Class: CocoapodsTools::Command
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- CocoapodsTools::Command
- Defined in:
- lib/cocoapods-tools/command.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Command
Returns a new instance of Command.
23 24 25 26 27 28 |
# File 'lib/cocoapods-tools/command.rb', line 23 def initialize(argv) # @add_milk = argv.flag?('milk', true) # @sweetener = argv.option('sweetener') # puts 'cocoapods init' super end |
Class Method Details
.options ⇒ Object
16 17 18 19 20 21 |
# File 'lib/cocoapods-tools/command.rb', line 16 def self. [ # ['--no-milk', 'Don’t add milk to the beverage'], # ['--sweetener=[sugar|honey]', 'Use one of the available sweeteners'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cocoapods-tools/command.rb', line 38 def run # puts '* cocoapods-tools…run' # sleep 1 # if @add_milk # puts '* Adding milk…' # sleep 1 # end # if @sweetener # puts "* Adding #{@sweetener}…" # sleep 1 # end end |
#validate! ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/cocoapods-tools/command.rb', line 30 def validate! super # puts 'cocoapods validate!' # if @sweetener && !%w(sugar honey).include?(@sweetener) # help! "`#{@sweetener}' is not a valid sweetener." # end end |