class Xcodeproj::Command::Sort

Public Class Methods

new(argv) click to toggle source
Calls superclass method Xcodeproj::Command::new
# File lib/xcodeproj/command/sort.rb, line 22
def initialize(argv)
  self.xcodeproj_path = argv.shift_argument
  @group_option = argv.option('group-option')
  @group_option &&= @group_option.to_sym
  super
end
options() click to toggle source
Calls superclass method
# File lib/xcodeproj/command/sort.rb, line 12
def self.options
  [
    ['--group-option=[above|below]', 'The position of the groups when sorting. If no option is specified, sorting will interleave groups and files.'],
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/xcodeproj/command/sort.rb, line 37
def run
  xcodeproj.sort(:groups_position => @group_option)
  xcodeproj.save
  puts "The `#{File.basename(xcodeproj_path)}` project was sorted"
end
validate!() click to toggle source
Calls superclass method
# File lib/xcodeproj/command/sort.rb, line 29
def validate!
  super
  unless [nil, :above, :below].include?(@group_option)
    help! "Unknown format `#{@group_option}`"
  end
  open_project!
end