Class: KnifeSpork::SporkEnvironmentCreate

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/chef/knife/spork-environment-create.rb

Instance Method Summary collapse

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/chef/knife/spork-environment-create.rb', line 17

def run
  self.class.send(:include, KnifeSpork::Runner)
  self.config = Chef::Config.merge!(config)

  if @name_args.empty?
    show_usage
    ui.error("You must specify a environment name")
    exit 1
  end

  @object_name = @name_args.first

  run_plugins(:before_environmentcreate)
  pre_environment = {}
  environment_create
  post_environment = load_environment(@object_name)
  @object_difference = json_diff(pre_environment,post_environment).to_s
  run_plugins(:after_environmentcreate)
end