class TapDance::Definition

Attributes

brews[RW]
taps[RW]

Public Class Methods

new(taps=[], brews=[]) click to toggle source
# File lib/tap_dance/definition.rb, line 11
def initialize(taps=[], brews=[])
  @taps = taps
  @brews = brews
end

Public Instance Methods

brew(*args) click to toggle source
# File lib/tap_dance/definition.rb, line 24
def brew(*args)
  if args.last.is_a? Hash
    args.last.merge!(:definition => self)
  end
  @brews << Brew.new(*args)
  @brews.last
end
execute(upgrade=false) click to toggle source
# File lib/tap_dance/definition.rb, line 36
def execute(upgrade=false)
  for tap in @taps do
    TapDance.ui.confirm "Tapping \"#{tap}\""
    TapDance.ui.detail tap.entap
  end

  for brew in @brews do
    unless upgrade
      TapDance.ui.confirm "Installing \"#{brew}\""
      TapDance.ui.detail brew.install
    else
      TapDance.ui.confirm "Upgrading \"#{brew}\""
      TapDance.ui.detail brew.upgrade
    end
  end
end
tap(*args) click to toggle source
# File lib/tap_dance/definition.rb, line 16
def tap(*args)
  if args.last.is_a? Hash
    args.last.merge!(:definition => self)
  end
  @taps << Tap.new(*args)
  @taps.last
end
tap_named(name) click to toggle source
# File lib/tap_dance/definition.rb, line 32
def tap_named(name)
  @taps.find { |t| t.name.to_s == name.to_s }
end