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 +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +14 -0
- data/README.md +1 -0
- data/knife-spork.gemspec +3 -1
- data/lib/chef/knife/spork-info.rb +2 -1
- data/lib/chef/knife/spork-upload.rb +11 -4
- data/lib/chef/knife/spork-version.rb +12 -0
- data/lib/knife-spork/plugins/rubocop.rb +5 -1
- data/lib/knife-spork/runner.rb +4 -2
- data/lib/knife-spork/version.rb +5 -0
- data/plugins/Rubocop.md +9 -1
- data/spec/unit/spork_upload_spec.rb +4 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed2d90462c49f6dd058ff7d5df3c8e15fb0ce541
|
4
|
+
data.tar.gz: 9a34114efd252e64ec1c0260e23ef415dae06139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12082e66af466bd59956dda2bdf13312fc2f785e2fb74be2d11531c30583a30fb290f5f76d01d1cf619a16f3e85ff63498d1297d4788ca49bc6ea1b57a90526f
|
7
|
+
data.tar.gz: 8e217c599c8bf546a12e647dbe311d2600c7175f0eee1c078c3ab51bb6a468d3b1de542d0d1139a66477e5995b90d4e8806a224a0647e0b6fc35b9faaae22663
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.4.0
|
data/CHANGELOG.md
CHANGED
@@ -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
data/knife-spork.gemspec
CHANGED
@@ -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 =
|
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
|
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
|
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
|
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
|
-
|
141
|
-
|
147
|
+
def negotiate_protocol_version
|
148
|
+
server_side_cookbooks
|
142
149
|
end
|
143
150
|
end
|
144
151
|
end
|
@@ -7,7 +7,11 @@ module KnifeSpork
|
|
7
7
|
hooks :after_check, :before_upload
|
8
8
|
|
9
9
|
def perform
|
10
|
-
|
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
|
|
data/lib/knife-spork/runner.rb
CHANGED
@@ -110,7 +110,9 @@ module KnifeSpork
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def save_environment_changes(environment, json)
|
113
|
-
if
|
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
|
|
data/plugins/Rubocop.md
CHANGED
@@ -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.
|
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:
|
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.
|
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
|