knife-spork 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzVhYmQyOTBlMDQzMWNkNWY0ZDUwNTk4Njg3YjYyNDJjZDA0NjU1NA==
4
+ NzAyZmY2MjljNzA5ZDRkOWQ4MTE4MWNiZGNmZjE1NjQ5MzA4MDg4Zg==
5
5
  data.tar.gz: !binary |-
6
- OWM2M2VjYzg2MTUwNzM0YTkxN2M1ZGUzYjlmNTI4N2VlODk4N2Y0Nw==
6
+ ZGU1NWM1NDgxMjFiODRjYTM4NmY0ZjkwZDUyZGI3Mzk4M2NkMDdjMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmNmYTkwODJhYmRkZjJiOTM0MmZkNmJhNzI1OWY4YTUwMGNkZDQxM2NjM2Y4
10
- ZjVjNGYwMjliZjFkMjdmYjZiNWI0NjhhY2M5ZjllZTIzNjNjNDYzZTJmODNj
11
- ZDYwMzQ1OGEzZTc1MWQ1N2YyZjhmZWY3MTA5NDg1MGI1ZjMwZjM=
9
+ MzY1ZDU4NDRmMzgzNmY2NzEzOTI0YjIzYTNkYmUxNTY1MDYyY2Y0Mjc5ZTY1
10
+ ZmJiYjcyZTU2NDJkMTk0YTdkOWIxZTdlNmVjNWU3Yjg3ZWRlMzU1ZWZkYzk1
11
+ NTI4MTdiYTZiZmY1OTg4M2QzMTMxOTQ0YTY4NjU2Y2VhMjg4NTg=
12
12
  data.tar.gz: !binary |-
13
- NTYzZWJiYjBjYmM0M2JmYzA3OGYxNmE5MTcxMGI3NDZhYzE4NDZkMjNmM2Ri
14
- NDg1MzE4NWY1NGM1OWZlZjRhODhjNzEwOTQ5ZTAxNjlmOWYxNmNmODk5MjNj
15
- ZTAzNTM1NWIzM2NjZGU3OGRjZWZjMjU1MDEzYzcxN2RkMDVjNmY=
13
+ YTIyMDQwODRmN2QzMGQ1ODFiYWIzNTZhMWRkZjU5MGVmNGQ1MGYwZDhkZWI4
14
+ ZmRmZDc5OGI0ZGE1YmI2YTM3ZjRkYjVjNjJiNjA3ODY3OTRkMDVjMjM3OGEw
15
+ ZGQ0ZTg2NDViZTA4MTQ1ZGM0ZmY1Nzg0Y2EzZDY2MGZiZTM2YTk=
@@ -1,3 +1,10 @@
1
+ ## 1.3.2 (5th Feb, 2014)
2
+
3
+ Features:
4
+
5
+ - Add spork environment commands (Thanks to @jperry https://github.com/jonlives/knife-spork/pull/102)
6
+ - Berkshelf support for bump and check commands (Thanks to @poliva83 https://github.com/jonlives/knife-spork/pull/104)
7
+
1
8
  ## 1.3.1 (31st Dec, 2013)
2
9
 
3
10
  Features:
data/README.md CHANGED
@@ -368,7 +368,7 @@ Promotion complete. Don't forget to upload your changed development.json to Chef
368
368
  Spork Node / Role / Databag Commands
369
369
  -------------
370
370
 
371
- Knife spork contains "wrappers" around several stock knife commands for changing nodes, roles, and databags. These commands work exactly as in the original knife, with the addition of being wrapped in Spork's plugin API. This means that for example, when you upload a role using spork you will see an IRC message containing details, and a gist of the role change.
371
+ Knife spork contains "wrappers" around several stock knife commands for changing nodes, roles, environments and databags. These commands work exactly as in the original knife, with the addition of being wrapped in Spork's plugin API. This means that for example, when you upload a role using spork you will see an IRC message containing details, and a gist of the role change.
372
372
 
373
373
  The following ```data bag``` commands are provided in knife-spork:
374
374
  ```
@@ -395,4 +395,12 @@ knife spork role create
395
395
  knife spork role delete
396
396
  knife spork role edit
397
397
  knife spork role from file
398
- ```
398
+ ```
399
+
400
+ The following ```environment``` commands are provided in knife-spork:
401
+ ```
402
+ knife spork environment create
403
+ knife spork environment delete
404
+ knife spork environment edit
405
+ knife spork environment from file
406
+ ```
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'knife-spork'
5
- gem.version = '1.3.1'
5
+ gem.version = '1.3.2'
6
6
  gem.authors = ["Jon Cowie"]
7
7
  gem.email = 'jonlives@gmail.com'
8
8
  gem.homepage = 'https://github.com/jonlives/knife-spork'
@@ -13,6 +13,20 @@ module KnifeSpork
13
13
  :description => 'A colon-separated path to look for cookbooks in',
14
14
  :proc => lambda { |o| o.split(':') }
15
15
 
16
+ if defined?(::Berkshelf)
17
+ option :berksfile,
18
+ :short => '-b',
19
+ :long => 'berksfile',
20
+ :description => 'Path to a Berksfile to operate off of',
21
+ :default => File.join(Dir.pwd, ::Berkshelf::DEFAULT_FILENAME)
22
+
23
+ option :skip_dependencies,
24
+ :short => '-s',
25
+ :long => '--skip-dependencies',
26
+ :description => 'Berksfile skips resolving source cookbook dependencies',
27
+ :default => true
28
+ end
29
+
16
30
  banner 'knife spork bump COOKBOOK [major|minor|patch|manual]'
17
31
 
18
32
  def run
@@ -16,6 +16,26 @@ module KnifeSpork
16
16
  :long => "--fail",
17
17
  :description => "If the check fails exit with non-zero exit code"
18
18
 
19
+ option :cookbook_path,
20
+ :short => '-o PATH:PATH',
21
+ :long => '--cookbook-path PATH:PATH',
22
+ :description => 'A colon-separated path to look for cookbooks in',
23
+ :proc => lambda { |o| o.split(':') }
24
+
25
+ if defined?(::Berkshelf)
26
+ option :berksfile,
27
+ :short => '-b',
28
+ :long => 'berksfile',
29
+ :description => 'Path to a Berksfile to operate off of',
30
+ :default => File.join(Dir.pwd, ::Berkshelf::DEFAULT_FILENAME)
31
+
32
+ option :skip_dependencies,
33
+ :short => '-s',
34
+ :long => '--skip-dependencies',
35
+ :description => 'Berksfile skips resolving source cookbook dependencies',
36
+ :default => true
37
+ end
38
+
19
39
  def run
20
40
  self.config = Chef::Config.merge!(config)
21
41
 
@@ -0,0 +1,43 @@
1
+ require 'chef/knife'
2
+ require 'knife-spork/runner'
3
+
4
+ module KnifeSpork
5
+ class SporkEnvironmentCreate < Chef::Knife
6
+ include KnifeSpork::Runner
7
+
8
+ banner 'knife spork environment create ENVIRONMENT (options)'
9
+
10
+ option :description,
11
+ :short => "-d DESC",
12
+ :long => "--description DESC",
13
+ :description => "The environment description"
14
+
15
+ def run
16
+ self.config = Chef::Config.merge!(config)
17
+
18
+ if @name_args.empty?
19
+ show_usage
20
+ ui.error("You must specify a environment name")
21
+ exit 1
22
+ end
23
+
24
+ @object_name = @name_args.first
25
+
26
+ run_plugins(:before_environmentcreate)
27
+ pre_environment = {}
28
+ environment_create
29
+ post_environment = load_environment(@object_name)
30
+ @object_difference = json_diff(pre_environment,post_environment).to_s
31
+ run_plugins(:after_environmentcreate)
32
+ end
33
+
34
+ private
35
+ def environment_create
36
+ rc = Chef::Knife::EnvironmentCreate.new
37
+ rc.name_args = @name_args
38
+ rc.config[:editor] = config[:editor]
39
+ rc.config[:description] = config[:description]
40
+ rc.run
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,36 @@
1
+ require 'chef/knife'
2
+ require 'knife-spork/runner'
3
+
4
+ module KnifeSpork
5
+ class SporkEnvironmentDelete < Chef::Knife
6
+ include KnifeSpork::Runner
7
+
8
+ banner 'knife spork environment delete ENVIRONMENT (options)'
9
+
10
+ def run
11
+ self.config = Chef::Config.merge!(config)
12
+
13
+ if @name_args.empty?
14
+ show_usage
15
+ ui.error("You must specify a environment name")
16
+ exit 1
17
+ end
18
+
19
+ @object_name = @name_args.first
20
+
21
+ run_plugins(:before_environmentdelete)
22
+ pre_environment = load_environment(@object_name)
23
+ environment_delete
24
+ post_environment = {}
25
+ @object_difference = json_diff(pre_environment,post_environment).to_s
26
+ run_plugins(:after_environmentdelete)
27
+ end
28
+
29
+ private
30
+ def environment_delete
31
+ rd = Chef::Knife::EnvironmentDelete.new
32
+ rd.name_args = @name_args
33
+ rd.run
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,37 @@
1
+ require 'chef/knife'
2
+ require 'knife-spork/runner'
3
+
4
+ module KnifeSpork
5
+ class SporkEnvironmentEdit < Chef::Knife
6
+ include KnifeSpork::Runner
7
+
8
+ banner 'knife spork environment edit ENVIRONMENT (options)'
9
+
10
+ def run
11
+ self.config = Chef::Config.merge!(config)
12
+
13
+ if @name_args.empty?
14
+ show_usage
15
+ ui.error("You must specify a environment name")
16
+ exit 1
17
+ end
18
+
19
+ @object_name = @name_args.first
20
+
21
+ run_plugins(:before_environmentedit)
22
+ pre_environment = load_environment(@object_name)
23
+ environment_edit
24
+ post_environment = load_environment(@object_name)
25
+ @object_difference = json_diff(pre_environment,post_environment).to_s
26
+ run_plugins(:after_environmentedit)
27
+ end
28
+
29
+ private
30
+ def environment_edit
31
+ re = Chef::Knife::EnvironmentEdit.new
32
+ re.name_args = @name_args
33
+ re.config[:editor] = config[:editor]
34
+ re.run
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,42 @@
1
+ require 'chef/knife'
2
+ require 'knife-spork/runner'
3
+ require 'json'
4
+
5
+ module KnifeSpork
6
+ class SporkEnvironmentFromFile < Chef::Knife
7
+ include KnifeSpork::Runner
8
+
9
+ deps do
10
+ require 'chef/knife/environment_from_file'
11
+ end
12
+
13
+ banner 'knife spork environment from file FILENAME (options)'
14
+
15
+ def run
16
+ self.config = Chef::Config.merge!(config)
17
+
18
+ if @name_args.empty?
19
+ show_usage
20
+ ui.error("You must specify a environment name")
21
+ exit 1
22
+ end
23
+
24
+ @name_args.each do |arg|
25
+ @object_name = arg.split("/").last
26
+ run_plugins(:before_environmentfromfile)
27
+ pre_environment = load_environment(@object_name.gsub(".json","").gsub(".rb",""))
28
+ environment_from_file
29
+ post_environment = load_environment(@object_name.gsub(".json","").gsub(".rb",""))
30
+ @object_difference = json_diff(pre_environment,post_environment).to_s
31
+ run_plugins(:after_environmentfromfile)
32
+ end
33
+ end
34
+
35
+ private
36
+ def environment_from_file
37
+ rff = Chef::Knife::EnvironmentFromFile.new
38
+ rff.name_args = @name_args
39
+ rff.run
40
+ end
41
+ end
42
+ end
@@ -51,7 +51,7 @@ module KnifeSpork
51
51
  check_cookbook_uploaded(@cookbook)
52
52
 
53
53
  @environments.each do |e|
54
- environment = load_environment(e)
54
+ environment = load_environment_from_file(e)
55
55
 
56
56
 
57
57
  promote(environment, @cookbook)
@@ -81,7 +81,7 @@ module KnifeSpork
81
81
  end
82
82
 
83
83
  def save_environment_changes_remote(environment)
84
- local_environment = load_environment(environment)
84
+ local_environment = load_environment_from_file(environment)
85
85
  remote_environment = load_remote_environment(environment)
86
86
  @environment_diffs ||= Hash.new
87
87
  @environment_diffs["#{environment}"] = environment_diff(local_environment, remote_environment)
@@ -5,7 +5,7 @@ module KnifeSpork
5
5
  class SporkRoleDelete < Chef::Knife
6
6
  include KnifeSpork::Runner
7
7
 
8
- banner 'knife spork role delete ROLENAME'
8
+ banner 'knife spork role delete ROLENAME (options)'
9
9
 
10
10
  def run
11
11
  self.config = Chef::Config.merge!(config)
@@ -5,7 +5,7 @@ module KnifeSpork
5
5
  class SporkRoleEdit < Chef::Knife
6
6
  include KnifeSpork::Runner
7
7
 
8
- banner 'knife spork role edit ROLENAME'
8
+ banner 'knife spork role edit ROLENAME (options)'
9
9
 
10
10
  def run
11
11
  self.config = Chef::Config.merge!(config)
@@ -10,7 +10,7 @@ module KnifeSpork
10
10
  require 'chef/knife/role_from_file'
11
11
  end
12
12
 
13
- banner 'knife spork role from file FILENAME'
13
+ banner 'knife spork role from file FILENAME (options)'
14
14
 
15
15
  def run
16
16
  self.config = Chef::Config.merge!(config)
@@ -30,6 +30,14 @@ module KnifeSpork
30
30
  :long => '--include-dependencies',
31
31
  :description => 'Also upload cookbook dependencies'
32
32
 
33
+ if defined?(::Berkshelf)
34
+ option :berksfile,
35
+ :short => '-b',
36
+ :long => 'berksfile',
37
+ :description => 'Path to a Berksfile to operate off of',
38
+ :default => File.join(Dir.pwd, ::Berkshelf::DEFAULT_FILENAME)
39
+ end
40
+
33
41
  def run
34
42
  self.config = Chef::Config.merge!(config)
35
43
  config[:cookbook_path] ||= Chef::Config[:cookbook_path]
@@ -30,6 +30,38 @@ EOH
30
30
  end
31
31
  end
32
32
 
33
+ def after_environmentfromfile
34
+ campfire do |rooms|
35
+ rooms.paste <<-EOH
36
+ #{organization}#{current_user} uploaded environment #{object_name}
37
+ EOH
38
+ end
39
+ end
40
+
41
+ def after_environmentedit
42
+ campfire do |rooms|
43
+ rooms.paste <<-EOH
44
+ #{organization}#{current_user} edited environment #{object_name}
45
+ EOH
46
+ end
47
+ end
48
+
49
+ def after_environmentcreate
50
+ campfire do |rooms|
51
+ rooms.paste <<-EOH
52
+ #{organization}#{current_user} created environment #{object_name}
53
+ EOH
54
+ end
55
+ end
56
+
57
+ def after_environmentdelete
58
+ campfire do |rooms|
59
+ rooms.paste <<-EOH
60
+ #{organization}#{current_user} deleted environment #{object_name}
61
+ EOH
62
+ end
63
+ end
64
+
33
65
  def after_rolefromfile
34
66
  campfire do |rooms|
35
67
  rooms.paste <<-EOH
@@ -41,6 +41,53 @@ module KnifeSpork
41
41
  end
42
42
  end
43
43
 
44
+ def after_environmentfromfile
45
+ event_data = {
46
+ :tag => 'knife',
47
+ :username => current_user,
48
+ :status => "#{organization}#{current_user} uploaded environment #{object_name}",
49
+ :metadata => {
50
+ :environment_name => object_name,
51
+ }.to_json
52
+ }
53
+ eventinate(event_data)
54
+ end
55
+
56
+ def after_environmentedit
57
+ event_data = {
58
+ :tag => 'knife',
59
+ :username => current_user,
60
+ :status => "#{organization}#{current_user} edited environment #{object_name}",
61
+ :metadata => {
62
+ :environment_name => object_name,
63
+ }.to_json
64
+ }
65
+ eventinate(event_data)
66
+ end
67
+
68
+ def after_environmentcreate
69
+ event_data = {
70
+ :tag => 'knife',
71
+ :username => current_user,
72
+ :status => "#{organization}#{current_user} created environment #{object_name}",
73
+ :metadata => {
74
+ :environment_name => object_name,
75
+ }.to_json
76
+ }
77
+ eventinate(event_data)
78
+ end
79
+
80
+ def after_environmentdelete
81
+ event_data = {
82
+ :tag => 'knife',
83
+ :username => current_user,
84
+ :status => "#{organization}#{current_user} deleted environment #{object_name}",
85
+ :metadata => {
86
+ :environment_name => object_name,
87
+ }.to_json
88
+ }
89
+ eventinate(event_data)
90
+ end
44
91
 
45
92
  def after_rolefromfile
46
93
  event_data = {
@@ -19,6 +19,30 @@ module KnifeSpork
19
19
  EOH
20
20
  end
21
21
 
22
+ def after_environmentfromfile
23
+ grove <<-EOH
24
+ #{current_user} uploaded environment #{object_name}
25
+ EOH
26
+ end
27
+
28
+ def after_environmentedit
29
+ grove <<-EOH
30
+ #{current_user} edited environment #{object_name}
31
+ EOH
32
+ end
33
+
34
+ def after_environmentcreate
35
+ grove <<-EOH
36
+ #{current_user} created environment #{object_name}
37
+ EOH
38
+ end
39
+
40
+ def after_environmentdelete
41
+ grove <<-EOH
42
+ #{current_user} deleted environment #{object_name}
43
+ EOH
44
+ end
45
+
22
46
  def after_rolefromfile
23
47
  grove <<-EOH
24
48
  #{current_user} uploaded role #{object_name}
@@ -15,6 +15,22 @@ module KnifeSpork
15
15
  hipchat "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
16
16
  end
17
17
 
18
+ def after_environmentfromfile
19
+ hipchat "#{organization}#{current_user} uploaded environment #{object_name}"
20
+ end
21
+
22
+ def after_environmentedit
23
+ hipchat "#{organization}#{current_user} edited environment #{object_name}"
24
+ end
25
+
26
+ def after_environmentcreate
27
+ hipchat "#{organization}#{current_user} created environment #{object_name}"
28
+ end
29
+
30
+ def after_environmentdelete
31
+ hipchat "#{organization}#{current_user} deleted environment #{object_name}"
32
+ end
33
+
18
34
  def after_rolefromfile
19
35
  hipchat "#{organization}#{current_user} uploaded role #{object_name}"
20
36
  end
@@ -8,6 +8,10 @@ module KnifeSpork
8
8
  TEMPLATES = {
9
9
  :upload => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded #TEAL%{cookbooks}#NORMAL',
10
10
  :promote => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} promoted #TEAL%{cookbooks}#NORMAL to %{environment} %{gist}',
11
+ :environmentfromfile => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded environment #TEAL%{object_name}#NORMAL %{gist}',
12
+ :environmentedit => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} edited environment #TEAL%{object_name}#NORMAL %{gist}',
13
+ :environmentcreate => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} created environment #TEAL%{object_name}#NORMAL %{gist}',
14
+ :environmentdelete => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted environment #TEAL%{object_name}#NORMAL %{gist}',
11
15
  :rolefromfile => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded role #TEAL%{object_name}#NORMAL %{gist}',
12
16
  :roleedit => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} edited role #TEAL%{object_name}#NORMAL %{gist}',
13
17
  :rolecreate => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} created role #TEAL%{object_name}#NORMAL %{gist}',
@@ -50,6 +54,46 @@ module KnifeSpork
50
54
  end
51
55
  end
52
56
 
57
+ def after_environmentfromfile
58
+ environment_gist = object_gist("environment", object_name, object_difference) if config.gist and !object_difference.empty?
59
+ irccat(template(:environmentfromfile) % {
60
+ :organization => organization,
61
+ :current_user => current_user,
62
+ :object_name => object_name,
63
+ :gist => environment_gist
64
+ })
65
+ end
66
+
67
+ def after_environmentedit
68
+ environment_gist = object_gist("environment", object_name, object_difference) if config.gist and !object_difference.empty?
69
+ irccat(template(:environmentedit) % {
70
+ :organization => organization,
71
+ :current_user => current_user,
72
+ :object_name => object_name,
73
+ :gist => environment_gist
74
+ })
75
+ end
76
+
77
+ def after_environmentcreate
78
+ environment_gist = object_gist("environment", object_name, object_difference) if config.gist and !object_difference.empty?
79
+ irccat(template(:environmentcreate) % {
80
+ :organization => organization,
81
+ :current_user => current_user,
82
+ :object_name => object_name,
83
+ :gist => environment_gist
84
+ })
85
+ end
86
+
87
+ def after_environmentdelete
88
+ environment_gist = object_gist("environment", object_name, object_difference) if config.gist and !object_difference.empty?
89
+ irccat(template(:environmentdelete) % {
90
+ :organization => organization,
91
+ :current_user => current_user,
92
+ :object_name => object_name,
93
+ :gist => environment_gist
94
+ })
95
+ end
96
+
53
97
  def after_rolefromfile
54
98
  role_gist = object_gist("role", object_name, object_difference) if config.gist and !object_difference.empty?
55
99
  irccat(template(:rolefromfile) % {
@@ -15,6 +15,22 @@ module KnifeSpork
15
15
  jabber "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
16
16
  end
17
17
 
18
+ def after_environmentfromfile
19
+ jabber "#{organization}#{current_user} uploaded environment #{object_name}"
20
+ end
21
+
22
+ def after_environmentedit
23
+ jabber "#{organization}#{current_user} edited environment #{object_name}"
24
+ end
25
+
26
+ def after_environmentcreate
27
+ jabber "#{organization}#{current_user} created environment #{object_name}"
28
+ end
29
+
30
+ def after_environmentdelete
31
+ jabber "#{organization}#{current_user} deleted environment #{object_name}"
32
+ end
33
+
18
34
  def after_rolefromfile
19
35
  jabber "#{organization}#{current_user} uploaded role #{object_name}"
20
36
  end
@@ -15,6 +15,22 @@ module KnifeSpork
15
15
  statusnet "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
16
16
  end
17
17
 
18
+ def after_environmentfromfile
19
+ statusnet "#{organization}#{current_user} uploaded environment #{object_name}"
20
+ end
21
+
22
+ def after_environmentedit
23
+ statusnet "#{organization}#{current_user} edited environment #{object_name}"
24
+ end
25
+
26
+ def after_environmentcreate
27
+ statusnet "#{organization}#{current_user} created environment #{object_name}"
28
+ end
29
+
30
+ def after_environmentdelete
31
+ statusnet "#{organization}#{current_user} deleted environment #{object_name}"
32
+ end
33
+
18
34
  def after_rolefromfile
19
35
  statusnet "#{organization}#{current_user} uploaded role #{object_name}"
20
36
  end
@@ -34,7 +34,7 @@ module KnifeSpork
34
34
  # We know cookbooks will only contain one cookbook in the case of promote.
35
35
  cookbooks.map{|c|c.version = config[:version]} if config[:version]
36
36
 
37
- environments = [ @environments || @environment ].flatten.compact.collect{|environment| environment.is_a?(::Chef::Environment) ? environment : load_environment(environment)}.sort{|a,b| a.name.to_s <=> b.name.to_s}
37
+ environments = [ @environments || @environment ].flatten.compact.collect{|environment| environment.is_a?(::Chef::Environment) ? environment : load_environment_from_file(environment)}.sort{|a,b| a.name.to_s <=> b.name.to_s}
38
38
  environment_diffs = @environment_diffs
39
39
 
40
40
  KnifeSpork::Plugins.run(
@@ -150,7 +150,8 @@ module KnifeSpork
150
150
  raise Berkshelf::BerkshelfError, "LockFileNotFound" unless File.exists?(lockfile.filepath)
151
151
 
152
152
  cookbook = Berkshelf.ui.mute {
153
- berksfile.resolve(lockfile.find(name))[:solution].first
153
+ self.config[:skip_dependencies] ||= false
154
+ berksfile.resolve(lockfile.find(name), {skip_dependencies: self.config[:skip_dependencies]})[:solution].first
154
155
  }
155
156
 
156
157
  #convert Berkshelf::CachedCookbook to Chef::CookbookVersion
@@ -169,6 +170,7 @@ module KnifeSpork
169
170
  cookbook_names.collect{ |cookbook_name| load_cookbook(cookbook_name) }
170
171
  end
171
172
 
173
+
172
174
  def load_role_from_file(role_name)
173
175
  role_loader.object_from_file("#{role_path}/#{role_name}.json")
174
176
  end
@@ -190,6 +192,10 @@ module KnifeSpork
190
192
  end
191
193
 
192
194
  def load_environment(environment_name)
195
+ Chef::Environment.load(environment_name)
196
+ end
197
+
198
+ def load_environment_from_file(environment_name)
193
199
  environment_loader.object_from_file("#{environment_path}/#{environment_name}.json")
194
200
  end
195
201
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Cowie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-31 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -87,6 +87,10 @@ files:
87
87
  - lib/chef/knife/spork-databag-delete.rb
88
88
  - lib/chef/knife/spork-databag-edit.rb
89
89
  - lib/chef/knife/spork-databag-fromfile.rb
90
+ - lib/chef/knife/spork-environment-create.rb
91
+ - lib/chef/knife/spork-environment-delete.rb
92
+ - lib/chef/knife/spork-environment-edit.rb
93
+ - lib/chef/knife/spork-environment-fromfile.rb
90
94
  - lib/chef/knife/spork-info.rb
91
95
  - lib/chef/knife/spork-node-create.rb
92
96
  - lib/chef/knife/spork-node-delete.rb
@@ -147,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
151
  version: '0'
148
152
  requirements: []
149
153
  rubyforge_project:
150
- rubygems_version: 2.1.10
154
+ rubygems_version: 2.2.1
151
155
  signing_key:
152
156
  specification_version: 4
153
157
  summary: A workflow plugin to help many devs work with the same chef repo/server