Class: BatCave::Action::Add

Inherits:
Object
  • Object
show all
Includes:
Support::Git
Defined in:
lib/batcave/action/add.rb

Instance Method Summary collapse

Methods included from Support::Git

#project_root

Constructor Details

#initialize(thing, args) ⇒ Add

Add a new thing with some arguments.

Arguments for each thing are defined in the ‘THING’ file for each … thing.



12
13
14
15
16
# File 'lib/batcave/action/add.rb', line 12

def initialize(thing, args)
  @logger = Cabin::Channel.get("batcave")
  @thing = thing
  @args = args
end

Instance Method Details

#executeObject

def find_thing



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/batcave/action/add.rb', line 30

def execute
  config = find_thing(@thing)
  return 1 if config == false
  dsl = BatCave::DSL.new(config, @thing, @args)
  dsl.execute

  # TODO(sissel): Record that we've added this thing.
  puts "Adding #{dsl.environment}/#{@thing}"
  store = BatCave::Store.new
  store.store(dsl)
end