knife-spork 1.6.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f41664f90da0809a4d75a015883b920cbcbf9a0
4
- data.tar.gz: cd5d2629b7a32ead1d32d6b11649c478f91bef21
3
+ metadata.gz: ed2d90462c49f6dd058ff7d5df3c8e15fb0ce541
4
+ data.tar.gz: 9a34114efd252e64ec1c0260e23ef415dae06139
5
5
  SHA512:
6
- metadata.gz: 8b5fd7c94fe33abeef46f3a00f6d0403a450c5f5c9206b3aae4cc6042e77112ff2690ddbcf781d4148966cb917ecc00ccd7fbbb5fa694f61ed7aeda2db6c7b25
7
- data.tar.gz: 73d8bedaac9e18b72fd72fb878b6566c5392b77a87894226288262ae284d7d0eab826708cea9f496fe155f6cc6cf4bea19c9e0339721492c6e1d3b01cce61e8c
6
+ metadata.gz: 12082e66af466bd59956dda2bdf13312fc2f785e2fb74be2d11531c30583a30fb290f5f76d01d1cf619a16f3e85ff63498d1297d4788ca49bc6ea1b57a90526f
7
+ data.tar.gz: 8e217c599c8bf546a12e647dbe311d2600c7175f0eee1c078c3ab51bb6a468d3b1de542d0d1139a66477e5995b90d4e8806a224a0647e0b6fc35b9faaae22663
@@ -1 +1 @@
1
- ruby-2.1.4
1
+ ruby-2.4.0
@@ -1,3 +1,17 @@
1
+ ## 1.7.0 (12th October 2017)
2
+
3
+ Features:
4
+
5
+ - Rubocop plugin now supports cookstyle (thanks to timurb https://github.com/jonlives/knife-spork/pull/211)
6
+ - Spork info will now dump config as yml (Thanks to jeunito https://github.com/jonlives/knife-spork/pull/215)
7
+ - Spork promote will now prefer the environment path passed in on the command line (Thanks to shoekstra https://github.com/jonlives/knife-spork/pull/216)
8
+ - Add knife spork version command (Thanks to jeunito https://github.com/jonlives/knife-spork/pull/217)
9
+
10
+ Bugfixes:
11
+
12
+ - Fix error with Chef server when uploading cookbook with no deps (Thanks to timurb https://github.com/jonlives/knife-spork/pull/210)
13
+ - Fix unclear error when trying to promote a non-existant cookbook (Thanks to timurb https://github.com/jonlives/knife-spork/pull/213)
14
+
1
15
  ## 1.6.3(12th December, 2016)
2
16
 
3
17
  Features:
data/README.md CHANGED
@@ -118,6 +118,7 @@ plugins:
118
118
  out_file: <file>
119
119
  sev_level: <C|W|E>
120
120
  lint: false
121
+ use_cookstyle: true
121
122
  ```
122
123
 
123
124
  #### Default Environments
@@ -1,8 +1,10 @@
1
1
  $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
+ require "knife-spork/version"
4
+
3
5
  Gem::Specification.new do |gem|
4
6
  gem.name = 'knife-spork'
5
- gem.version = '1.6.3'
7
+ gem.version = KnifeSpork::Version::VERSION
6
8
  gem.authors = ["Jon Cowie", "Katherine Daniels"]
7
9
  gem.email = ['jonlives@gmail.com', 'kdaniels@etsy.com']
8
10
  gem.homepage = 'https://github.com/jonlives/knife-spork'
@@ -1,4 +1,5 @@
1
1
  require 'chef/knife'
2
+ require 'yaml'
2
3
 
3
4
  module KnifeSpork
4
5
  class SporkInfo < Chef::Knife
@@ -21,7 +22,7 @@ module KnifeSpork
21
22
  private
22
23
  def info
23
24
  ui.msg "Config Hash:"
24
- ui.msg "#{spork_config.to_hash}"
25
+ ui.msg spork_config.to_yaml
25
26
  ui.msg ""
26
27
  ui.msg "Plugins:"
27
28
  KnifeSpork::Plugins.klasses.each do |klass|
@@ -122,23 +122,30 @@ module KnifeSpork
122
122
 
123
123
  # Ensures that all the cookbooks dependencies are either already on the server or being uploaded in this pass
124
124
  def check_dependencies(cookbook)
125
+ negotiate_protocol_version
125
126
  cookbook.metadata.dependencies.each do |cookbook_name, version|
126
- unless server_side_cookbooks(cookbook_name, version)
127
+ unless server_has_version(cookbook_name, version)
127
128
  ui.error "#{cookbook.name} depends on #{cookbook_name} (#{version}), which is not currently being uploaded and cannot be found on the server!"
128
129
  exit(1)
129
130
  end
130
131
  end
131
132
  end
132
133
 
133
- def server_side_cookbooks(cookbook_name, version)
134
+ def server_has_version(cookbook_name, version)
135
+ hash = server_side_cookbooks[cookbook_name]
136
+ hash && hash['versions'] && hash['versions'].any?{ |v| Chef::VersionConstraint.new(version).include?(v['version']) }
137
+ end
138
+
139
+ def server_side_cookbooks
134
140
  if Chef::CookbookVersion.respond_to?(:list_all_versions)
135
141
  @server_side_cookbooks ||= Chef::CookbookVersion.list_all_versions
136
142
  else
137
143
  @server_side_cookbooks ||= Chef::CookbookVersion.list
138
144
  end
145
+ end
139
146
 
140
- hash = @server_side_cookbooks[cookbook_name]
141
- hash && hash['versions'] && hash['versions'].any?{ |v| Chef::VersionConstraint.new(version).include?(v['version']) }
147
+ def negotiate_protocol_version
148
+ server_side_cookbooks
142
149
  end
143
150
  end
144
151
  end
@@ -0,0 +1,12 @@
1
+ require 'chef/knife'
2
+ require 'knife-spork/version'
3
+
4
+ module KnifeSpork
5
+ class SporkVersion < Chef::Knife
6
+ banner 'knife spork version'
7
+
8
+ def run
9
+ ui.info KnifeSpork::Version::VERSION
10
+ end
11
+ end
12
+ end
@@ -7,7 +7,11 @@ module KnifeSpork
7
7
  hooks :after_check, :before_upload
8
8
 
9
9
  def perform
10
- safe_require 'rubocop'
10
+ if config.use_cookstyle
11
+ safe_require 'cookstyle'
12
+ else
13
+ safe_require 'rubocop'
14
+ end
11
15
  safe_require 'rubocop/cli'
12
16
  safe_require 'rubocop/config_store'
13
17
 
@@ -110,7 +110,9 @@ module KnifeSpork
110
110
  end
111
111
 
112
112
  def save_environment_changes(environment, json)
113
- if spork_config[:environment_path]
113
+ if @config[:environment_path]
114
+ environments_path = @config[:environment_path]
115
+ elsif spork_config[:environment_path]
114
116
  environments_path = spork_config[:environment_path]
115
117
  else
116
118
  split_cb_path = cookbook_path.split("/")
@@ -192,7 +194,7 @@ module KnifeSpork
192
194
 
193
195
  def load_from_berkshelf(name)
194
196
  return unless defined?(::Berkshelf)
195
- return unless ::File.exist?(self.config[:berksfile])
197
+ return unless self.config[:berksfile] && ::File.exist?(self.config[:berksfile])
196
198
  berksfile = ::Berkshelf::Berksfile.from_file(self.config[:berksfile])
197
199
  lockfile = ::Berkshelf::Lockfile.new(berksfile)
198
200
 
@@ -0,0 +1,5 @@
1
+ module KnifeSpork
2
+ module Version
3
+ VERSION = "1.7.0"
4
+ end
5
+ end
@@ -1,6 +1,6 @@
1
1
  Rubocop
2
2
  ==========
3
- Automatically runs rubocop against your cookbooks on check and upload.
3
+ Automatically runs rubocop (or [cookstyle](https://github.com/chef/cookstyle) - its chef-focused brother) against your cookbooks on check and upload.
4
4
  This is entirely based off of the Foodcritic plugin.
5
5
 
6
6
  Gem Requirements
@@ -9,6 +9,7 @@ This plugin requires the following gems:
9
9
 
10
10
  ```ruby
11
11
  gem 'rubocop'
12
+ gem 'cookstyle' # if you wish to use cookstyle behaviour
12
13
  ```
13
14
 
14
15
  Hooks
@@ -27,6 +28,7 @@ plugins:
27
28
  out_file: <file>
28
29
  sev_level: <C|W|E>
29
30
  lint: false
31
+ use_cookstyle: true
30
32
  ```
31
33
 
32
34
  #### epic_fail:
@@ -65,6 +67,12 @@ Set the severity level at which Rubocop will fail (see rubocop --help for more).
65
67
  - Rubocop command line equivilant: "--lint"
66
68
  Only run linting rules.
67
69
 
70
+ #### use_cookstyle:
71
+ - Type: `Boolean`
72
+ - Default: `false`
73
+ - Rubocop command line equivilant: none, use `cookstyle` command instead of `rubocop` command
74
+ Cookstyle is a set of rubocop configurations that are specific to cookbooks.
75
+
68
76
  #### Example
69
77
  ``` ruby
70
78
  chef_workstation01$ knife spork check chef-client
@@ -35,10 +35,12 @@ module KnifeSpork
35
35
 
36
36
  describe '#upload' do
37
37
  before(:each) { set_chef_config }
38
- it 'uploads cookbook' do
38
+ it 'uploads cookbook' do # and negotiates protocol version
39
39
  knife.instance_variable_set(:@cookbooks, knife.load_cookbooks(argv))
40
40
  knife.send(:upload)
41
+ ### for some reason could not make this expectation pass
42
+ # expect(Chef::CookbookVersion).to receive(:list_all_version)
41
43
  end
42
44
  end
43
45
  end
44
- end
46
+ end
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.6.3
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Cowie
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-12 00:00:00.000000000 Z
12
+ date: 2017-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -157,6 +157,7 @@ files:
157
157
  - lib/chef/knife/spork-role-edit.rb
158
158
  - lib/chef/knife/spork-role-fromfile.rb
159
159
  - lib/chef/knife/spork-upload.rb
160
+ - lib/chef/knife/spork-version.rb
160
161
  - lib/knife-spork.rb
161
162
  - lib/knife-spork/plugins.rb
162
163
  - lib/knife-spork/plugins/campfire.rb
@@ -174,6 +175,7 @@ files:
174
175
  - lib/knife-spork/plugins/slack.rb
175
176
  - lib/knife-spork/plugins/statusnet.rb
176
177
  - lib/knife-spork/runner.rb
178
+ - lib/knife-spork/version.rb
177
179
  - plugins/Campfire.md
178
180
  - plugins/Eventinator.md
179
181
  - plugins/Foodcritic.md
@@ -220,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
222
  version: '0'
221
223
  requirements: []
222
224
  rubyforge_project:
223
- rubygems_version: 2.5.1
225
+ rubygems_version: 2.6.12
224
226
  signing_key:
225
227
  specification_version: 4
226
228
  summary: A workflow plugin to help many devs work with the same chef repo/server