knife-spork 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 1.0.3 (10th September, 2012)
2
+ Bugfixes:
3
+
4
+ - Fix spork upload when using Chef 10.14.0
5
+ - Optional config override for chef environment location (not documented in README until 1.0.4)
6
+
7
+ ## 1.0.2 (28th August, 2012)
8
+ Bugfixes:
9
+
10
+ - Fix bug which caused plugin errors when no spork config file could be found
11
+
12
+ ## 1.0.1 (27th August, 2012)
13
+ Bugfixes:
14
+
15
+ - Fix require error which broke spork on CentOS 5.6
16
+
1
17
  ## 1.0.0 (27th August, 2012)
2
18
  Features:
3
19
 
data/knife-spork.gemspec CHANGED
@@ -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.0.2'
5
+ gem.version = '1.0.3'
6
6
  gem.authors = ["Jon Cowie"]
7
7
  gem.email = 'jonlives@gmail.com'
8
8
  gem.homepage = 'https://github.com/jonlives/knife-spork'
@@ -11,6 +11,13 @@ module KnifeSpork
11
11
 
12
12
  def run
13
13
  self.config = Chef::Config.merge!(config)
14
+
15
+ if @name_args.empty?
16
+ show_usage
17
+ ui.error("You must specify at least a cookbook name")
18
+ exit 1
19
+ end
20
+
14
21
  @cookbook = load_cookbook(name_args.first)
15
22
 
16
23
  run_plugins(:before_bump)
@@ -62,11 +62,20 @@ module KnifeSpork
62
62
  @cookbooks.reverse.each do |cookbook|
63
63
  begin
64
64
  check_dependencies(cookbook)
65
- Chef::CookbookUploader.new(cookbook, ::Chef::Config.cookbook_path).upload_cookbook
66
- if name_args.include?(cookbook.name.to_s)
67
- ui.info "Freezing #{cookbook.name} at #{cookbook.version}..."
68
- cookbook.freeze_version
69
- Chef::CookbookUploader.new(cookbook, ::Chef::Config.cookbook_path).upload_cookbook
65
+ if Gem.loaded_specs['chef'].version == Gem::Version.create('10.14.0')
66
+ uploader = Chef::CookbookUploader.new([cookbook], ::Chef::Config.cookbook_path).upload_cookbooks
67
+ if name_args.include?(cookbook.name.to_s)
68
+ ui.info "Freezing #{cookbook.name} at #{cookbook.version}..."
69
+ cookbook.freeze_version
70
+ Chef::CookbookUploader.new(cookbook, ::Chef::Config.cookbook_path).upload_cookbooks
71
+ end
72
+ else
73
+ uploader = Chef::CookbookUploader.new(cookbook, ::Chef::Config.cookbook_path).upload_cookbook
74
+ if name_args.include?(cookbook.name.to_s)
75
+ ui.info "Freezing #{cookbook.name} at #{cookbook.version}..."
76
+ cookbook.freeze_version
77
+ Chef::CookbookUploader.new(cookbook, ::Chef::Config.cookbook_path).upload_cookbook
78
+ end
70
79
  end
71
80
  rescue Net::HTTPServerException => e
72
81
  if e.response.code == '409'
@@ -14,7 +14,7 @@ module KnifeSpork
14
14
  return @spork_config unless @spork_config.nil?
15
15
 
16
16
  @spork_config = AppConf.new
17
- load_paths = [ File.expand_path('config/spork-config.yml'), '/etc/spork-config.yml', File.expand_path('~/.chef/spork-config.yml') ]
17
+ load_paths = [ File.expand_path("#{cookbook_path.gsub('cookbooks','')}/config/spork-config.yml"), File.expand_path('config/spork-config.yml'), '/etc/spork-config.yml', File.expand_path('~/.chef/spork-config.yml') ]
18
18
  load_paths.each do |load_path|
19
19
  if File.exists?(load_path)
20
20
  @spork_config.load(load_path)
@@ -87,6 +87,10 @@ module KnifeSpork
87
87
  ensure_cookbook_path!
88
88
  [config[:cookbook_path] ||= ::Chef::Config.cookbook_path].flatten[0]
89
89
  end
90
+
91
+ def environment_path
92
+ spork_config[:environment_path] || cookbook_path.gsub("/cookbooks","/environments")
93
+ end
90
94
 
91
95
  def all_cookbooks
92
96
  ::Chef::CookbookLoader.new(::Chef::Config.cookbook_path)
@@ -104,7 +108,7 @@ module KnifeSpork
104
108
  end
105
109
 
106
110
  def load_environment(environment_name)
107
- loader.load_from('environments', "#{environment_name}.json")
111
+ loader.object_from_file("#{environment_path}/#{environment_name}.json")
108
112
  end
109
113
 
110
114
  def load_remote_environment(environment_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
12
+ date: 2012-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
16
- requirement: &70247898469200 !ruby/object:Gem::Requirement
16
+ requirement: &70124426250060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.10.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70247898469200
24
+ version_requirements: *70124426250060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: git
27
- requirement: &70247898468460 !ruby/object:Gem::Requirement
27
+ requirement: &70124426249560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.5
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70247898468460
35
+ version_requirements: *70124426249560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: app_conf
38
- requirement: &70247898467620 !ruby/object:Gem::Requirement
38
+ requirement: &70124426249100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.4.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70247898467620
46
+ version_requirements: *70124426249100
47
47
  description: A workflow plugin to help many devs work with the same chef repo/server
48
48
  email: jonlives@gmail.com
49
49
  executables: []