Class: KnifeSpork::SporkEnvironmentFromFile

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

Instance Method Summary collapse

Methods included from Runner

included

Instance Method Details

#runObject



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

def run
  self.config = Chef::Config.merge!(config)

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

  @name_args.each do |arg|
      @object_name = arg.split("/").last
      run_plugins(:before_environmentfromfile)
      pre_environment = load_environment(@object_name.gsub(".json","").gsub(".rb",""))
      environment_from_file
      post_environment = load_environment(@object_name.gsub(".json","").gsub(".rb",""))
      @object_difference = json_diff(pre_environment,post_environment).to_s
      run_plugins(:after_environmentfromfile)
  end
end