stove 3.2.6 → 3.2.7

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: 14e6b97b12766451d286f30909803c1c5a7bf56f
4
- data.tar.gz: 20fdbce7e94c7bb0e2a53ce63b193751e351c9e1
3
+ metadata.gz: e408d2205fca9b0b14a446ae29746f36b39b9411
4
+ data.tar.gz: 4c3f9baa7f8de64aa63b484264db3aed57cdf7b4
5
5
  SHA512:
6
- metadata.gz: 05df808d14a6d6b31bc1b1898963b20a88174e3ec09bb7315607ee17eeeb1329688c0aa81d39378859e2b6e015340a0fc22ea9f5f55a9745277b082de28183d7
7
- data.tar.gz: 16765a9d38f934e7f8d97f80c097d1ae9d85b5c0c506e9f4eccf262e394c7ba138955739581efa875a56165e881c0d84b602fb8627dade640f2237f40ddb3a2e
6
+ metadata.gz: 108c86f18357afa93cdcb735f8dbc2a8fa688a4d2fe44aff21132469862e667b424eb4a7586b89d22d47602853d52b9ebbf616743e4e116df0e75ce8a58a3a3b
7
+ data.tar.gz: db000dddde6faf57a6073c23d3322c6c800565bbab6a60ac4166c13b56453fb95a708096f50992a34734b66e3a11be3a355ce4da2878a8ecd51413c54d0981c9
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .rspec
19
+ vendor/
data/.travis.yml CHANGED
@@ -2,6 +2,11 @@ rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
4
  - 2.1
5
+ - 2.2
6
+
7
+ branches:
8
+ only:
9
+ - master
5
10
 
6
11
  bundler_args: --jobs 7
7
12
 
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@ Stove CHANGELOG
2
2
  ===============
3
3
  This is the Changelog for the Stove gem.
4
4
 
5
+ v3.2.7 (2015-04-16)
6
+ -------------------
7
+ - Use chef.io instead of getchef.com
8
+ - Ignore `vendor/` directory
9
+ - Do not publish extended metadata fields like `issues_url` and `source_url` by
10
+ default (GH-64, GH-72). These fields can be optionally added using the
11
+ new `--extended-metadata` flag.
12
+ - Add support for Ruby 2.2
13
+ - Use binmode when reading and writing the tgz (GH-64)
14
+
5
15
  v3.2.6 (2015-03-18)
6
16
  -------------------
7
17
  - Include new metadata methods for Supermarket
data/README.md CHANGED
@@ -38,18 +38,24 @@ $ stove login --username sethvargo --key ~/.chef/sethvargo.pem
38
38
 
39
39
  These values will be saved in Stove's configuration file (`~/.stove`) and persisted across your workstation.
40
40
 
41
- The default publishing endpoint is the [Chef Supermarket](https://supermarket.getchef.com), but this is configurable. If you want to publish to an internal community site, you can specify the `--endpoint` value:
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:
42
42
 
43
43
  ```bash
44
44
  $ stove --endpoint https://internal-cookbook-store.example.com
45
45
  ```
46
46
 
47
- or for a private supermarket using the [supermarket](https://supermarket.getchef.com/cookbooks/supermarket) cookbook:
47
+ or for a private supermarket using the [supermarket](https://supermarket.chef.io/cookbooks/supermarket) cookbook:
48
48
 
49
49
  ```bash
50
50
  $ stove --endpoint https://internal-cookbook-store.example.com/api/v1
51
51
  ```
52
52
 
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
+ ```
58
+
53
59
  Usage
54
60
  -----
55
61
  There are two ways to use Stove. You can either use the `stove` command directly or use the embedded rake task.
data/lib/stove/cli.rb CHANGED
@@ -116,6 +116,10 @@ module Stove
116
116
  options[:key] = v
117
117
  end
118
118
 
119
+ opts.on('--extended-metadata', 'Include non-backwards compatible metadata keys such as `issues_url`') do
120
+ options[:extended_metadata] = true
121
+ end
122
+
119
123
  opts.separator ''
120
124
  opts.separator 'Git Options:'
121
125
 
@@ -161,9 +165,10 @@ module Stove
161
165
  def options
162
166
  @options ||= {
163
167
  # Upload options
164
- :endpoint => nil,
165
- :username => Config.username,
166
- :key => Config.key,
168
+ :endpoint => nil,
169
+ :username => Config.username,
170
+ :key => Config.key,
171
+ :extended_metadata => false,
167
172
 
168
173
  # Git options
169
174
  :remote => 'origin',
@@ -10,7 +10,7 @@ module Stove
10
10
  #
11
11
  # @return [String]
12
12
  #
13
- DEFAULT_ENDPOINT = 'https://supermarket.getchef.com/api/v1'
13
+ DEFAULT_ENDPOINT = 'https://supermarket.chef.io/api/v1'
14
14
 
15
15
  #
16
16
  # Get and cache a community cookbook's JSON response from the given name
@@ -50,15 +50,15 @@ module Stove
50
50
  # @param [Cookbook] cookbook
51
51
  # the cookbook to upload
52
52
  #
53
- def upload(cookbook)
53
+ def upload(cookbook, extended_metadata = false)
54
54
  connection.post('cookbooks', {
55
- 'tarball' => cookbook.tarball,
55
+ 'tarball' => cookbook.tarball(extended_metadata),
56
56
 
57
57
  # This is for legacy, backwards-compatability reasons. The new
58
58
  # Supermarket site does not require a category, but many of the testing
59
59
  # tools still assume a cookbook category is present. We just hardcode
60
60
  # "Other" here.
61
- 'cookbook' => { 'category' => 'Other' }.to_json,
61
+ 'cookbook' => JSON.fast_generate(category: 'Other'),
62
62
  })
63
63
  end
64
64
 
@@ -94,8 +94,8 @@ module Stove
94
94
  #
95
95
  # @return [File]
96
96
  #
97
- def tarball
98
- @tarball ||= Packager.new(self).tarball
97
+ def tarball(extended_metadata = false)
98
+ @tarball ||= Packager.new(self, extended_metadata).tarball
99
99
  end
100
100
 
101
101
  private
@@ -72,6 +72,9 @@ module Stove
72
72
  def_attribute :description
73
73
  def_attribute :long_description
74
74
 
75
+ # These attributes are available for reading, but are not written by
76
+ # default. In order to maintain backwards and forwards compatability,
77
+ # these attributes are here.
75
78
  def_attribute :source_url
76
79
  def_attribute :issues_url
77
80
 
@@ -158,14 +161,12 @@ module Stove
158
161
  end
159
162
  end
160
163
 
161
- def to_hash
162
- {
164
+ def to_hash(extended_metadata = false)
165
+ hash = {
163
166
  'name' => self.name,
164
167
  'version' => self.version,
165
168
  'description' => self.description,
166
169
  'long_description' => self.long_description,
167
- 'source_url' => self.source_url,
168
- 'issues_url' => self.issues_url,
169
170
  'maintainer' => self.maintainer,
170
171
  'maintainer_email' => self.maintainer_email,
171
172
  'license' => self.license,
@@ -180,10 +181,13 @@ module Stove
180
181
  'groupings' => self.groupings,
181
182
  'recipes' => self.recipes,
182
183
  }
183
- end
184
184
 
185
- def to_json(*args)
186
- JSON.pretty_generate(self.to_hash)
185
+ if extended_metadata
186
+ hash['source_url'] = self.source_url
187
+ hash['issues_url'] = self.issues_url
188
+ end
189
+
190
+ return hash
187
191
  end
188
192
 
189
193
  private
@@ -33,12 +33,20 @@ module Stove
33
33
  # @erturn [Stove::Cookbook]
34
34
  attr_reader :cookbook
35
35
 
36
+ # Whether to include the new extended metadata attributes.
37
+ #
38
+ # @return [true, false]
39
+ attr_reader :extended_metadata
40
+
36
41
  # Create a new packager instance.
37
42
  #
38
43
  # @param [Stove::Cookbook]
39
44
  # the cookbook to package
40
- def initialize(cookbook)
45
+ # @param [true, false] extended_metadata
46
+ # include new extended metadata attributes
47
+ def initialize(cookbook, extended_metadata = false)
41
48
  @cookbook = cookbook
49
+ @extended_metadata = extended_metadata
42
50
  end
43
51
 
44
52
  # A map from physical file path to tarball file path
@@ -70,14 +78,14 @@ module Stove
70
78
  def tarball
71
79
  # Generate the metadata.json on the fly
72
80
  metadata_json = File.join(cookbook.path, 'metadata.json')
73
- File.open(metadata_json, 'wb') do |file|
74
- file.write(cookbook.metadata.to_json)
75
- end
81
+ json = JSON.fast_generate(cookbook.metadata.to_hash(extended_metadata))
82
+ File.open(metadata_json, 'wb') { |f| f.write(json) }
76
83
 
77
84
  io = tar(File.dirname(cookbook.path), packaging_slip)
78
85
  tgz = gzip(io)
79
86
 
80
- tempfile = Tempfile.new([cookbook.name, '.tar.gz'], Dir.tmpdir, mode: File::RDWR|File::CREAT|File::EXCL|File::BINARY)
87
+ tempfile = Tempfile.new([cookbook.name, '.tar.gz'], Dir.tmpdir)
88
+ tempfile.binmode
81
89
 
82
90
  while buffer = tgz.read(1024)
83
91
  tempfile.write(buffer)
@@ -12,7 +12,7 @@ module Stove
12
12
  end
13
13
 
14
14
  run('Publishing the release to the Chef community site') do
15
- Community.upload(cookbook)
15
+ Community.upload(cookbook, options[:extended_metadata])
16
16
  end
17
17
  end
18
18
  end
data/lib/stove/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stove
2
- VERSION = '3.2.6'
2
+ VERSION = '3.2.7'
3
3
  end
@@ -38,7 +38,7 @@ module Stove
38
38
  end
39
39
  File.open(root.join('Berksfile'), 'wb') do |f|
40
40
  f.write <<-EOH.gsub(/^ {11}/, '')
41
- source 'https://supermarket.getchef.com'
41
+ source 'https://supermarket.chef.io'
42
42
  metadata
43
43
  EOH
44
44
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ class Stove::Cookbook
4
+ describe Metadata do
5
+ describe '#to_hash' do
6
+ context 'when the extra metadata is not included' do
7
+ it 'does not include the new metadata fields' do
8
+ hash = subject.to_hash(false)
9
+ expect(hash).to_not include('issues_url')
10
+ expect(hash).to_not include('source_url')
11
+ end
12
+ end
13
+
14
+ context 'when the extra metadata is included' do
15
+ it 'includes the new metadata fields' do
16
+ hash = subject.to_hash(true)
17
+ expect(hash).to include('issues_url')
18
+ expect(hash).to include('source_url')
19
+ end
20
+ end
21
+ end
22
+ end
23
+ 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: 3.2.6
4
+ version: 3.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-api
@@ -161,6 +161,7 @@ files:
161
161
  - spec/integration/cookbook_spec.rb
162
162
  - spec/spec_helper.rb
163
163
  - spec/support/generators.rb
164
+ - spec/unit/cookbook/metadata_spec.rb
164
165
  - spec/unit/error_spec.rb
165
166
  - stove.gemspec
166
167
  - templates/errors/abstract_method.erb
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  version: '0'
194
195
  requirements: []
195
196
  rubyforge_project:
196
- rubygems_version: 2.4.5
197
+ rubygems_version: 2.2.3
197
198
  signing_key:
198
199
  specification_version: 4
199
200
  summary: A command-line utility for releasing Chef community cookbooks
@@ -211,5 +212,5 @@ test_files:
211
212
  - spec/integration/cookbook_spec.rb
212
213
  - spec/spec_helper.rb
213
214
  - spec/support/generators.rb
215
+ - spec/unit/cookbook/metadata_spec.rb
214
216
  - spec/unit/error_spec.rb
215
- has_rdoc: