Class: TapDance::CLI
- Inherits:
-
Thor
- Object
- Thor
- TapDance::CLI
- Defined in:
- lib/tap_dance/cli.rb
Instance Attribute Summary collapse
-
#brewfile ⇒ Object
Returns the value of attribute brewfile.
-
#definition ⇒ Object
Returns the value of attribute definition.
Instance Method Summary collapse
-
#initialize(*args, &block) ⇒ CLI
constructor
A new instance of CLI.
- #install ⇒ Object
- #update(name = nil) ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ CLI
Returns a new instance of CLI.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/tap_dance/cli.rb', line 28 def initialize(*args, &block) super(*args, &block) # Activate shell output TapDance.ui = UI::Shell.new() TapDance.ui.level = "debug" if ["verbose"] # Make sure homebrew is installed unless command?(:brew) TapDance.ui.error "You haven't installed homebrew, or it isn't in your path." exit 1 end @definition = nil # Activate dry-run mode TapDance::BrewCLI.dry_run = ["dry-run"] if ["dry-run"] # Find brewfile @brewfile = ["brewfile"] @brewfile ||= "./Brewfile" @brewfile = File. @brewfile TapDance.ui.info "Brewing from #{@brewfile}" unless File.exist? @brewfile TapDance.ui.error "Nothing to brew! No Brewfile found." else TapDance.ui.info "Running `brew update` for good measure." BrewCLI.update end end |
Instance Attribute Details
#brewfile ⇒ Object
Returns the value of attribute brewfile.
25 26 27 |
# File 'lib/tap_dance/cli.rb', line 25 def brewfile @brewfile end |
#definition ⇒ Object
Returns the value of attribute definition.
26 27 28 |
# File 'lib/tap_dance/cli.rb', line 26 def definition @definition end |
Instance Method Details
#install ⇒ Object
62 63 64 65 66 |
# File 'lib/tap_dance/cli.rb', line 62 def install return unless File.exist? @brewfile @definition = TapDance::DSL.evaluate @brewfile @definition.execute end |
#update(name = nil) ⇒ Object
69 70 71 72 73 |
# File 'lib/tap_dance/cli.rb', line 69 def update(name=nil) return unless File.exist? @brewfile @definition = TapDance::DSL.evaluate @brewfile @definition.execute true end |