Class: DotUsage::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/dot_usage.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Target

Returns a new instance of Target.



44
45
46
# File 'lib/dot_usage.rb', line 44

def initialize(name)
  @name = name
end

Instance Method Details

#recipe(options) ⇒ Object



48
49
50
51
52
# File 'lib/dot_usage.rb', line 48

def recipe(options)
  file = DotUsageFile.new(options.file)

  file.recipe @name
end

#run(options) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/dot_usage.rb', line 54

def run(options)
  recipe(options).each do |cmd|
    status = Command.new(cmd).run(options)

    unless status
      STDERR.puts '> Command failed.  Aborting!'
      return 1
    end
  end

  0
end