Class: Pandan::Targets
- Defined in:
- lib/pandan/command/targets.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Targets
constructor
A new instance of Targets.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Targets
Returns a new instance of Targets.
21 22 23 24 25 26 27 |
# 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 |
Class Method Details
.options ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/pandan/command/targets.rb', line 9 def self. [ ['--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 |
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# 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! ⇒ Object
29 30 31 32 33 |
# 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 |