halite 1.2.0 → 1.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a42a9b842d21763abf144daa10997a8f37c8ffda
4
- data.tar.gz: a1751ed26b28b813aa1b05c03ad1d82aac86ee09
3
+ metadata.gz: 3d1bc19ae8a72bb862340afa0214c5be90974d73
4
+ data.tar.gz: cd89d974c5481647c360edfaef147a4fef596d17
5
5
  SHA512:
6
- metadata.gz: f7eabc21a9a311c068d7b6c58cc9c203f47a10e1fcc2c97bb0ff49b41aea2a19fb6e91418710cc8ab6c447524940d23251d0140c7b30437a35619046afed2385
7
- data.tar.gz: ebaeb2cfe08d6c2997d39828ca1f0efb3dcfd4f8b8c085f76a25a3386a041694955962bb5430b9e917a9c08da3ff489c3c499ef6dff6b4cf3d2499bc2244223c
6
+ metadata.gz: 9d12f3883c3fda75bb249bf9e67248720767db6721950b74f4e6d7325da1af4152226b056682b2bc2e20391c76b222432a5f2f36c77ec26f75e808c9e67564cd
7
+ data.tar.gz: b2aecb6a9a796d8777c2029b033715044025488da843089e0bdae363d3d02c65d45e5b3edf2e3595ec1277f2eba2bccfbccc36a116e68ac30f40407ef3af453a
data/.travis.yml CHANGED
@@ -1,10 +1,6 @@
1
1
  sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
- addons:
5
- apt:
6
- packages:
7
- - libgecode-dev
8
4
  rvm:
9
5
  - "2.0"
10
6
  - "2.1"
@@ -18,6 +14,7 @@ gemfile:
18
14
  - gemfiles/chef-12.4.gemfile
19
15
  - gemfiles/chef-12.5.gemfile
20
16
  - gemfiles/chef-12.6.gemfile
17
+ - gemfiles/chef-12.7.gemfile
21
18
  - gemfiles/chef-12.gemfile
22
19
  - gemfiles/master.gemfile
23
20
  env:
@@ -25,4 +22,6 @@ env:
25
22
  - USE_SYSTEM_GECODE=true
26
23
  - secure: bNxYOvi85lnPIPO1qR6NnhfqlREfMXSjmd+xCH01e/gg3x00D+3uyQIotQtglgHRItVIR36GqX70q2g/reudxBsCjfUhH2vDgbtmrWe1ow78rt1xZRlFMQs7JfBpfWKkox5i9mrdzZDekZACA0HUMI1pRM0MYQmkuol/oZw5H4A=
27
24
  - secure: ecX52GLF7IHCiaPEDzPtztiEmu2mNPfyyPrM7aaNsufat7DdsZqPP9LKpCTOoJC+Jgz9sdbQ6Hf61CeZAsrqZ8sKKdiXUoBUXdcBhvuPdpIbfwq97hjOoqQV7rLSD4EW58fipJU8Rl5P1ijFJizHIyxNB+VWBow3niIMGjIEUSE=
25
+ before_install:
26
+ - if [[ $BUNDLE_GEMFILE == *master.gemfile ]]; then gem update --system && gem install bundler; fi
28
27
  script: bundle exec rake integration
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Halite Changelog
2
2
 
3
+ ## v1.2.1
4
+
5
+ * Compatibility with Foodcritic 6.0. `issues_url` will be added to the generated
6
+ `metadata.rb`. This can be set via `metadata['issues_url']` or auto-detected
7
+ if the spec's `homepage` is set to a GitHub project.
8
+ * Compatibility with RubyGems 2.2.
9
+
3
10
  ## v1.2.0
4
11
 
5
12
  * Allow passing a `Halite::Gem` object to `Halite.convert`.
@@ -16,4 +16,4 @@
16
16
 
17
17
  eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
18
 
19
- gem 'chef', '~> 12.0.0'
19
+ gem 'chef', '~> 12.0.3'
@@ -16,4 +16,4 @@
16
16
 
17
17
  eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
18
 
19
- gem 'chef', '~> 12.1.0'
19
+ gem 'chef', '~> 12.1.2'
@@ -16,4 +16,4 @@
16
16
 
17
17
  eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
18
 
19
- gem 'chef', '~> 12.2.0'
19
+ gem 'chef', '~> 12.2.1'
@@ -16,4 +16,4 @@
16
16
 
17
17
  eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
18
 
19
- gem 'chef', '~> 12.4.0'
19
+ gem 'chef', '~> 12.4.3'
@@ -16,4 +16,4 @@
16
16
 
17
17
  eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
18
 
19
- gem 'chef', '~> 12.5.0'
19
+ gem 'chef', '~> 12.5.1'
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
+
19
+ gem 'chef', '~> 12.7.2'
@@ -19,3 +19,4 @@ eval_gemfile File.expand_path('../../Gemfile', __FILE__)
19
19
  gem 'chef', github: 'chef/chef'
20
20
  gem 'poise', github: 'poise/poise'
21
21
  gem 'poise-boiler', github: 'poise/poise-boiler'
22
+ gem 'poise-profiler', github: 'poise/poise-profiler'
data/halite.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.email = %w{noah@coderanger.net}
26
26
  spec.description = 'A set of helpers to write Chef cookbooks as Ruby gems.'
27
27
  spec.summary = spec.description
28
- spec.homepage = 'https://github.com/coderanger/halite'
28
+ spec.homepage = 'https://github.com/poise/halite'
29
29
  spec.license = 'Apache 2.0'
30
30
 
31
31
  spec.files = `git ls-files`.split($/)
@@ -40,6 +40,7 @@ module Halite
40
40
  buf << "maintainer #{gem_data.spec.authors.join(', ').inspect}\n" unless gem_data.spec.authors.empty?
41
41
  buf << "maintainer_email #{Array(gem_data.spec.email).join(',').inspect}\n" if gem_data.spec.email
42
42
  buf << "source_url #{gem_data.spec.homepage.inspect} if defined?(source_url)\n" if gem_data.spec.homepage
43
+ buf << "issues_url #{gem_data.issues_url.inspect} if defined?(issues_url)\n" if gem_data.issues_url
43
44
  buf << "license #{gem_data.spec.licenses.join(', ').inspect}\n" unless gem_data.spec.licenses.empty?
44
45
  gem_data.cookbook_dependencies.each do |dep|
45
46
  buf << "depends #{dep.name.inspect}"
data/lib/halite/gem.rb CHANGED
@@ -96,10 +96,25 @@ module Halite
96
96
  File.join(spec.full_gem_path, spec.name + '.gemspec')
97
97
  end
98
98
 
99
+ # License header extacted from the gemspec. Suitable for inclusion in other
100
+ # Ruby source files.
101
+ #
102
+ # @return [String]
99
103
  def license_header
100
104
  IO.readlines(spec_file).take_while { |line| line.strip.empty? || line.strip.start_with?('#') }.join('')
101
105
  end
102
106
 
107
+ # URL to the issue tracker for this project.
108
+ #
109
+ # @return [String, nil]
110
+ def issues_url
111
+ if spec.metadata['issues_url']
112
+ spec.metadata['issues_url']
113
+ elsif spec.homepage =~ /^http(s)?:\/\/(www\.)?github\.com/
114
+ spec.homepage.chomp('/') + '/issues'
115
+ end
116
+ end
117
+
103
118
  # Iterate over all the files in the gem, with an optional prefix. Each
104
119
  # element in the iterable will be [full_path, relative_path], where
105
120
  # relative_path is relative to the prefix or gem path.
@@ -17,5 +17,5 @@
17
17
 
18
18
  module Halite
19
19
  # Halite version.
20
- VERSION = '1.2.0'
20
+ VERSION = '1.2.1'
21
21
  end
@@ -22,6 +22,7 @@ describe Halite::Converter::Metadata do
22
22
  let(:cookbook_name) { gem_name }
23
23
  let(:version) { '1.0.0' }
24
24
  let(:cookbook_version) { version }
25
+ let(:issues_url) { nil }
25
26
  let(:cookbook_dependencies) { [] }
26
27
  let(:gem_metadata) { {} }
27
28
  let(:spec) do
@@ -46,6 +47,7 @@ describe Halite::Converter::Metadata do
46
47
  spec: spec,
47
48
  version: version,
48
49
  cookbook_version: cookbook_version,
50
+ issues_url: issues_url,
49
51
  )
50
52
  end
51
53
  subject { described_class.generate(gem_data) }
@@ -127,6 +129,17 @@ version "1.0.0"
127
129
  chef_version ">= 0" if defined?(chef_version)
128
130
  EOH
129
131
  end # /context with a chef_version
132
+
133
+ context 'with an issues_url' do
134
+ let(:issues_url) { 'http://issues' }
135
+
136
+ it { is_expected.to eq <<-EOH }
137
+ name "mygem"
138
+ version "1.0.0"
139
+ issues_url "http://issues" if defined?(issues_url)
140
+ chef_version "~> 12" if defined?(chef_version)
141
+ EOH
142
+ end # /context with an issues_url
130
143
  end # /describe #generate
131
144
 
132
145
  describe '#write' do
@@ -36,6 +36,9 @@ describe Halite::Dependencies do
36
36
 
37
37
  before do
38
38
  allow(Gem::Specification).to receive(:stubs).and_return(gem_stubs)
39
+ allow(Gem::Specification).to receive(:stubs_for) do |name|
40
+ gem_stubs.select {|stub| stub.name == name }
41
+ end
39
42
  end
40
43
 
41
44
  describe '#extract_from_requirements' do
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q||
13
13
  spec.homepage = 'http://example.com/'
14
14
  spec.license = 'Apache 2.0'
15
+ spec.metadata['issues_url'] = 'http://issues'
15
16
 
16
17
  spec.files = `cd #{File.expand_path('..', __FILE__)} && git ls-files`.split($/)
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
data/spec/gem_spec.rb CHANGED
@@ -28,6 +28,7 @@ describe Halite::Gem do
28
28
  its(:cookbook_name) { is_expected.to eq 'halite' }
29
29
  its(:version) { is_expected.to eq Halite::VERSION }
30
30
  its(:spec) { is_expected.to be_a Gem::Specification }
31
+ its(:issues_url) { is_expected.to eq 'https://github.com/poise/halite/issues' }
31
32
  end
32
33
 
33
34
  context 'when loading halite with a version' do
@@ -58,6 +59,7 @@ describe Halite::Gem do
58
59
  ] }
59
60
  its(:cookbook_dependencies) { is_expected.to eq [] }
60
61
  its(:is_halite_cookbook?) { is_expected.to be_truthy }
62
+ its(:issues_url) { is_expected.to be_nil }
61
63
 
62
64
  describe '#each_file' do
63
65
  context 'with no prefixes' do
@@ -95,6 +97,7 @@ describe Halite::Gem do
95
97
  ] }
96
98
  its(:cookbook_dependencies) { is_expected.to eq [Halite::Dependencies::Dependency.new('testdep', '>= 0', :requirements)] }
97
99
  its(:is_halite_cookbook?) { is_expected.to be_truthy }
100
+ its(:issues_url) { is_expected.to be_nil }
98
101
 
99
102
  describe '#each_file' do
100
103
  context 'with no prefixes' do
@@ -129,6 +132,7 @@ describe Halite::Gem do
129
132
  its(:cookbook_name) { is_expected.to eq 'test3' }
130
133
  its(:cookbook_dependencies) { is_expected.to eq [Halite::Dependencies::Dependency.new('test2', '~> 4.5.6', :dependencies)] }
131
134
  its(:is_halite_cookbook?) { is_expected.to be_truthy }
135
+ its(:issues_url) { is_expected.to be_nil }
132
136
  end # /context when loading test3
133
137
 
134
138
  context 'when loading test4' do
@@ -136,6 +140,7 @@ describe Halite::Gem do
136
140
  its(:cookbook_name) { is_expected.to eq 'test4' }
137
141
  its(:version) { is_expected.to eq '2.3.1.rc.1' }
138
142
  its(:cookbook_version) { is_expected.to eq '2.3.1' }
143
+ its(:issues_url) { is_expected.to eq 'http://issues' }
139
144
  end # /context when loading test4
140
145
 
141
146
  context 'when loading a Gem::Dependency' do
@@ -0,0 +1,46 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe Halite do
20
+ describe '#convert' do
21
+ let(:fake_gem) do
22
+ double('Halite::Gem').tap do |g|
23
+ allow(g).to receive(:is_a?).and_return(false)
24
+ allow(g).to receive(:is_a?).with(Halite::Gem).and_return(true)
25
+ end
26
+ end
27
+
28
+ context 'with a gem name' do
29
+ before do
30
+ allow(Halite::Gem).to receive(:new).with('mygem').and_return(fake_gem)
31
+ end
32
+
33
+ it do
34
+ expect(Halite::Converter).to receive(:write).with(fake_gem, '/path')
35
+ described_class.convert('mygem', '/path')
36
+ end
37
+ end # /context with a gem name
38
+
39
+ context 'with a Gem object' do
40
+ it do
41
+ expect(Halite::Converter).to receive(:write).with(fake_gem, '/path')
42
+ described_class.convert(fake_gem, '/path')
43
+ end
44
+ end # /context with a Gem object
45
+ end # /describe #convert
46
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -138,6 +138,7 @@ files:
138
138
  - gemfiles/chef-12.4.gemfile
139
139
  - gemfiles/chef-12.5.gemfile
140
140
  - gemfiles/chef-12.6.gemfile
141
+ - gemfiles/chef-12.7.gemfile
141
142
  - gemfiles/chef-12.gemfile
142
143
  - gemfiles/master.gemfile
143
144
  - halite.gemspec
@@ -211,11 +212,12 @@ files:
211
212
  - spec/fixtures/gems/test4/lib/test4/version.rb
212
213
  - spec/fixtures/gems/test4/test4.gemspec
213
214
  - spec/gem_spec.rb
215
+ - spec/halite_spec.rb
214
216
  - spec/integration_spec.rb
215
217
  - spec/runner_spec.rb
216
218
  - spec/spec_helper.rb
217
219
  - spec/spec_helper_spec.rb
218
- homepage: https://github.com/coderanger/halite
220
+ homepage: https://github.com/poise/halite
219
221
  licenses:
220
222
  - Apache 2.0
221
223
  metadata: {}
@@ -235,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
237
  version: '0'
236
238
  requirements: []
237
239
  rubyforge_project:
238
- rubygems_version: 2.4.8
240
+ rubygems_version: 2.5.2
239
241
  signing_key:
240
242
  specification_version: 4
241
243
  summary: A set of helpers to write Chef cookbooks as Ruby gems.
@@ -289,6 +291,7 @@ test_files:
289
291
  - spec/fixtures/gems/test4/lib/test4/version.rb
290
292
  - spec/fixtures/gems/test4/test4.gemspec
291
293
  - spec/gem_spec.rb
294
+ - spec/halite_spec.rb
292
295
  - spec/integration_spec.rb
293
296
  - spec/runner_spec.rb
294
297
  - spec/spec_helper.rb