stove 5.0.0 → 5.1.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: 6a5b3636377d2a72d01138c74bc0d1a02c4019b5
4
- data.tar.gz: f2252e862624ad4862bec9da34fc2160d0aa6995
3
+ metadata.gz: 86092b84ffa5f03569b57944b56f09c82c0b24a9
4
+ data.tar.gz: b42a43be5248d0ab029a93abf3a54e906521a88b
5
5
  SHA512:
6
- metadata.gz: 86a17cf2099b2771ea197c6c0614fbf494ee3f8304ed143281ef127efaf27dc27376fb860e4598d79e7f267251a9cf9ca438c7fb6ccbd346dcb0deb734497184
7
- data.tar.gz: c40bf883da00c1b1dc2c7a6fab8355f625320f438989a284b1ef4e43f4720364883cda41e22d30b2a7ff3287a1bbc65f9d10a8e45b08c80a1404efdce4e216f0
6
+ metadata.gz: 7f694c9b7f8921db5683cfdc2fd326e2458545a54ba5ac9eb9ff17c5ed6e463343404a7f57ba45a55d29b8da43b429d35ca1f3037b79ff7a44ad0436d019807a
7
+ data.tar.gz: a79d23a0c76f6917ef065a3a8b09afc5e78bcc2218326efb8eef091ee35bc69e300579038818d5e9a8a1e74a0d6d2d0ab7dc46580ad3b8d33145e5795846f0fd
data/.travis.yml CHANGED
@@ -4,8 +4,8 @@ sudo: false
4
4
 
5
5
  rvm:
6
6
  - 2.1.9
7
- - 2.2.5
8
- - 2.3.1
7
+ - 2.2.6
8
+ - 2.3.3
9
9
 
10
10
  branches:
11
11
  only:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  This is the Changelog for the Stove gem.
4
4
 
5
+ ## v5.1.0 (2017-03-31)
6
+
7
+ - Match Chef's metadata behavior with chef_version and ohai_version to allow version constraints like '>= 12.5', '< 14'
8
+ - Allow having gem version in cookbook metadata.json
9
+ - Better align gem version logic with how Chef handles it
10
+
5
11
  ## v5.0.0 (2017-03-22)
6
12
 
7
13
  - Enable pushing extended metadata for Chef 12 by default
data/README.md CHANGED
@@ -1,35 +1,32 @@
1
- Stove
2
- =====
3
- [![Gem Version](http://img.shields.io/gem/v/stove.svg?style=flat-square)][gem]
4
- [![Build Status](http://img.shields.io/travis/sethvargo/stove.svg?style=flat-square)][travis]
1
+ # Stove
5
2
 
6
- [gem]: https://rubygems.org/gems/stove
7
- [travis]: http://travis-ci.org/sethvargo/stove
3
+ [![Gem Version](http://img.shields.io/gem/v/stove.svg?style=flat-square)][gem] [![Build Status](http://img.shields.io/travis/sethvargo/stove.svg?style=flat-square)][travis]
8
4
 
9
5
  A utility for releasing and managing Chef Cookbooks. It will:
10
6
 
11
7
  - Tag and push a new release to git
12
- - Upload the cookbook to a cookbook share (such as Supermarket)
8
+ - Upload the cookbook to a private or public Supermarket
13
9
 
10
+ ## Why?
14
11
 
15
- Why?
16
- ----
17
- Existing tools to package cookbooks (such as [Knife Community](https://github.com/miketheman/knife-community) and `knife cookbook site share`) require a dependency on Chef. Because of thier dependency on Chef, they enforce the use of a "cookbook repo". Especially with the evolution of [Berkshelf](https://github.com/RiotGames/berkshelf), cookbooks are individualized artifacts and are often contained in their own repositories. [stove](https://github.com/sethvargo/stove) is **cookbook-centric, rather than Chef-centric**.
12
+ Existing tools to package cookbooks (such as [Knife Community](https://github.com/miketheman/knife-community) and `knife cookbook site share`) require a dependency on Chef. Because of their dependency on Chef, they enforce the use of a "cookbook repo". Especially with the evolution of [Berkshelf](https://github.com/RiotGames/berkshelf), cookbooks are individualized artifacts and are often contained in their own repositories. [stove](https://github.com/sethvargo/stove) is **cookbook-centric, rather than Chef-centric**.
18
13
 
14
+ ## Installation
19
15
 
20
- Installation
21
- ------------
22
16
  1. Add Stove to your project's Gemfile:
23
17
 
24
- gem 'stove'
18
+ ```
19
+ gem 'stove'
20
+ ```
25
21
 
26
22
  2. Run the `bundle` command to install:
27
23
 
28
- $ bundle install --binstubs
24
+ ```
25
+ $ bundle install --binstubs
26
+ ```
29
27
 
28
+ ## Configuration
30
29
 
31
- Configuration
32
- -------------
33
30
  Stove requires your username and private key to upload a cookbook. You can pass these to each command call, or you can set them Stove:
34
31
 
35
32
  ```bash
@@ -38,29 +35,24 @@ $ stove login --username sethvargo --key ~/.chef/sethvargo.pem
38
35
 
39
36
  These values will be saved in Stove's configuration file (`~/.stove`) and persisted across your workstation.
40
37
 
41
- The default publishing endpoint is the [Chef Supermarket](https://supermarket.chef.io), but this is configurable. If you want to publish to an internal community site, you can specify the `--endpoint` value:
38
+ The default publishing endpoint is the [Chef Supermarket](https://supermarket.chef.io), but this is configurable. If you want to publish to an internal Supermarket, you can specify the `--endpoint` value:
42
39
 
43
40
  ```bash
44
- $ stove --endpoint https://internal-cookbook-store.example.com
41
+ $ stove --endpoint https://internal-supermarket.example.com/api/v1
45
42
  ```
46
43
 
47
- or for a private supermarket using the [supermarket](https://supermarket.chef.io/cookbooks/supermarket) cookbook:
44
+ Please note: depending on which version of Chef and which version of Supermarket you are running, you may support the new "extended" metadata fields. By default, Stove writes these new fields when uploading cookbooks, which require Chef 12 or later. If you would like to retain compatibility with Chef 11 you can disable extended metadata with `--no-extended-metadata`:
48
45
 
49
46
  ```bash
50
- $ stove --endpoint https://internal-cookbook-store.example.com/api/v1
47
+ $ stove --no-extended-metadata
51
48
  ```
52
49
 
53
- Please note: depending on which version of Chef and which version of Supermarket you are running, you may support the new "extended" metadata fields. By default, Stove reads but does not write these new fields when uploading cookbooks because it is not backwards compatible. If you are running Chef 12+ and have the latest version of Supermarket installed, you can specify the `--extended-metadata` flag to include these values in the generated metadata:
54
-
55
- ```bash
56
- $ stove --extended-metadata
57
- ```
50
+ ## Usage
58
51
 
59
- Usage
60
- -----
61
52
  There are two ways to use Stove. You can either use the `stove` command directly or use the embedded rake task.
62
53
 
63
54
  ### Command
55
+
64
56
  Execute the `stove` command from inside the root of a cookbook:
65
57
 
66
58
  ```bash
@@ -70,6 +62,7 @@ $ bin/stove
70
62
  This will package (as a tarball) the cookbook in the current working directory, tag a new version, push to git, and publish to a cookbook share.
71
63
 
72
64
  ### Rake task
65
+
73
66
  If you are familiar with the Bundler approach to publishing Ruby gems, this approach will feel very familiar. Simply add the following to your `Rakefile`:
74
67
 
75
68
  ```ruby
@@ -83,24 +76,21 @@ And then use rake to publish the cookbook:
83
76
  $ bin/rake publish
84
77
  ```
85
78
 
79
+ ## Contributing
86
80
 
87
- Contributing
88
- ------------
89
81
  1. Fork it
90
82
  2. Create your feature branch (`git checkout -b my-new-feature`)
91
83
  3. Commit your changes (`git commit -am 'Add some feature'`)
92
84
  4. Push to the branch (`git push origin my-new-feature`)
93
85
  5. Create new Pull Request
94
86
 
87
+ ## See Also
95
88
 
96
- See Also
97
- --------
98
89
  - [Knife Community](https://github.com/miketheman/knife-community)
99
90
  - [Emeril](https://github.com/fnichol/emeril)
100
91
 
92
+ ## License & Authors
101
93
 
102
- License & Authors
103
- -----------------
104
94
  - Author: Seth Vargo (sethvargo@gmail.com)
105
95
 
106
96
  ```text
@@ -119,3 +109,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
109
  See the License for the specific language governing permissions and
120
110
  limitations under the License.
121
111
  ```
112
+
113
+ [gem]: https://rubygems.org/gems/stove
114
+ [travis]: http://travis-ci.org/sethvargo/stove
@@ -57,8 +57,18 @@ module Stove
57
57
 
58
58
  def def_meta_gems(field, instance_variable)
59
59
  class_eval <<-EOM, __FILE__, __LINE__ + 1
60
- def #{field}(thing)
61
- @#{instance_variable} << thing
60
+ def #{field}(*args)
61
+ @#{instance_variable} << args unless args.empty?
62
+ @#{instance_variable}
63
+ end
64
+ EOM
65
+ end
66
+
67
+ def def_meta_version(field)
68
+ class_eval <<-EOM, __FILE__, __LINE__ + 1
69
+ def #{field}(*args)
70
+ @#{field} << args unless args.empty?
71
+ @#{field}
62
72
  end
63
73
  EOM
64
74
  end
@@ -85,9 +95,8 @@ module Stove
85
95
  # these attributes are here.
86
96
  def_attribute :source_url
87
97
  def_attribute :issues_url
88
- def_attribute :chef_version
89
- def_attribute :ohai_version
90
- def_attribute :gem
98
+ def_meta_version :chef_version
99
+ def_meta_version :ohai_version
91
100
 
92
101
  def_meta_cookbook :supports, :platforms
93
102
  def_meta_cookbook :depends, :dependencies
@@ -123,8 +132,8 @@ module Stove
123
132
  @source_url = Stove::Mash.new
124
133
  @issues_url = Stove::Mash.new
125
134
  @gems = []
126
- @chef_version = Stove::Mash.new
127
- @ohai_version = Stove::Mash.new
135
+ @chef_version = []
136
+ @ohai_version = []
128
137
  @platforms = Stove::Mash.new
129
138
  @dependencies = Stove::Mash.new
130
139
  @recommendations = Stove::Mash.new
@@ -205,8 +214,8 @@ module Stove
205
214
  hash['source_url'] = self.source_url unless self.source_url.empty?
206
215
  hash['issues_url'] = self.issues_url unless self.issues_url.empty?
207
216
  hash['gems'] = self.gems unless self.gems.empty?
208
- hash['chef_version'] = self.chef_version
209
- hash['ohai_version'] = self.ohai_version
217
+ hash['chef_version'] = self.chef_version.map(&:sort)
218
+ hash['ohai_version'] = self.ohai_version.map(&:sort)
210
219
  end
211
220
 
212
221
  return hash
data/lib/stove/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stove
2
- VERSION = '5.0.0'
2
+ VERSION = '5.1.0'
3
3
  end
@@ -23,7 +23,7 @@ class Stove::Cookbook
23
23
  expect(hash).to include('source_url')
24
24
  expect(hash['issues_url']).to eq 'http://bar.example.com'
25
25
  expect(hash).to include('gems')
26
- expect(hash['gems']).to eq(['rspec'])
26
+ expect(hash['gems']).to eq([['rspec']])
27
27
  end
28
28
  end
29
29
 
@@ -57,11 +57,120 @@ class Stove::Cookbook
57
57
  subject.gem('rspec')
58
58
  hash = subject.to_hash(true)
59
59
  expect(hash).to include('gems')
60
- expect(hash['gems']).to eq(['rspec'])
60
+ expect(hash['gems']).to eq([['rspec']])
61
61
  expect(hash).not_to include('source_url')
62
62
  expect(hash).not_to include('issues_url')
63
63
  end
64
64
  end
65
65
  end
66
+
67
+ describe '#chef_version' do
68
+ let(:hash_version) { subject.to_hash(true)['chef_version'] }
69
+
70
+ context 'with no chef_version line' do
71
+ it 'returns []' do
72
+ expect(subject.chef_version).to eq []
73
+ expect(hash_version).to eq []
74
+ end
75
+ end
76
+
77
+ context 'with a single chef_version requirement' do
78
+ it 'returns [[req]]' do
79
+ subject.chef_version('>= 12.0')
80
+ expect(subject.chef_version).to eq [['>= 12.0']]
81
+ expect(hash_version).to eq [['>= 12.0']]
82
+ end
83
+ end
84
+
85
+ context 'with a multi-part chef_version requirement' do
86
+ it 'returns [[req1, req2]]' do
87
+ subject.chef_version('>= 12.0', '< 14.0')
88
+ expect(subject.chef_version).to eq [['>= 12.0', '< 14.0']]
89
+ expect(hash_version).to eq [['< 14.0', '>= 12.0',]]
90
+ end
91
+ end
92
+
93
+ context 'with multiple chef_version requirements' do
94
+ it 'returns [[req1], [req2]]' do
95
+ subject.chef_version('< 12')
96
+ subject.chef_version('> 14')
97
+ expect(subject.chef_version).to eq [['< 12'], ['> 14']]
98
+ expect(hash_version).to eq [['< 12'], ['> 14']]
99
+ end
100
+ end
101
+ end
102
+
103
+ describe '#ohai_version' do
104
+ let(:hash_version) { subject.to_hash(true)['ohai_version'] }
105
+
106
+ context 'with no ohai_version line' do
107
+ it 'returns []' do
108
+ expect(subject.ohai_version).to eq []
109
+ expect(hash_version).to eq []
110
+ end
111
+ end
112
+
113
+ context 'with a single ohai_version requirement' do
114
+ it 'returns [[req]]' do
115
+ subject.ohai_version('>= 12.0')
116
+ expect(subject.ohai_version).to eq [['>= 12.0']]
117
+ expect(hash_version).to eq [['>= 12.0']]
118
+ end
119
+ end
120
+
121
+ context 'with a multi-part ohai_version requirement' do
122
+ it 'returns [[req1, req2]]' do
123
+ subject.ohai_version('>= 12.0', '< 14.0')
124
+ expect(subject.ohai_version).to eq [['>= 12.0', '< 14.0']]
125
+ expect(hash_version).to eq [['< 14.0', '>= 12.0',]]
126
+ end
127
+ end
128
+
129
+ context 'with multiple ohai_version requirements' do
130
+ it 'returns [[req1], [req2]]' do
131
+ subject.ohai_version('< 12')
132
+ subject.ohai_version('> 14')
133
+ expect(subject.ohai_version).to eq [['< 12'], ['> 14']]
134
+ expect(hash_version).to eq [['< 12'], ['> 14']]
135
+ end
136
+ end
137
+ end
138
+
139
+ describe '#gem' do
140
+ let(:hash_gems) { subject.to_hash(true)['gems'] }
141
+
142
+ context 'with no gem line' do
143
+ it 'returns []' do
144
+ expect(subject.gems).to eq []
145
+ expect(hash_gems).to be_nil
146
+ end
147
+ end
148
+
149
+ context 'with a single gem dependency' do
150
+ it 'returns [[gem]]' do
151
+ subject.gem('nokogiri')
152
+ expect(subject.gems).to eq [['nokogiri']]
153
+ expect(hash_gems).to eq [['nokogiri']]
154
+ end
155
+ end
156
+
157
+ context 'with a gem dependency with a version specifier' do
158
+ it 'returns [[gem, ver]]' do
159
+ subject.gem('nokogiri', '>= 1.2.3')
160
+ expect(subject.gems).to eq [['nokogiri', '>= 1.2.3']]
161
+ expect(hash_gems).to eq [['nokogiri', '>= 1.2.3']]
162
+ end
163
+ end
164
+
165
+ context 'with multiple gem dependencies' do
166
+ it 'returns [[gem1], [gem2]]' do
167
+ subject.gem('nokogiri')
168
+ subject.gem('rack')
169
+ expect(subject.gems).to eq [['nokogiri'], ['rack']]
170
+ expect(hash_gems).to eq [['nokogiri'], ['rack']]
171
+ end
172
+ end
173
+ end
174
+
66
175
  end
67
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stove
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-api
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubyforge_project:
197
- rubygems_version: 2.6.10
197
+ rubygems_version: 2.6.11
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: A command-line utility for releasing Chef community cookbooks