class Pandan::Targets

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/pandan/command/targets.rb, line 21
def initialize(argv)
  @xcworkspace = argv.option('xcworkspace')
  @xcworkspace ||= XCWorkspace.find_workspace
  @comma_separated = argv.flag?('comma-separated')
  @filter = argv.option('filter')
  super
end
options() click to toggle source
Calls superclass method
# File lib/pandan/command/targets.rb, line 9
def self.options
  [
    ['--xcworkspace=path/to/workspace', 'If not set, Pandan will try to find a workspace'],
    ['--comma-separated', 'If set, Pandan outputs a comma-separated list instead of multiple lines'],
    ['--filter=expression', 'If set, pandan will select all targets whose name match the regular expression']
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/pandan/command/targets.rb, line 35
def run
  parser = Parser.new(@xcworkspace, @filter)
  targets = parser.all_targets

  if @comma_separated
    puts targets.join ','
  else
    puts targets
  end
end
validate!() click to toggle source
Calls superclass method
# File lib/pandan/command/targets.rb, line 29
def validate!
  super

  help! 'Could not find the workspace. Try setting it manually using the --xcworkspace option.' unless @xcworkspace
end