halite 1.0.1 → 1.0.2

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: 5249265d5c7c72220587865b41b064803b947f6a
4
- data.tar.gz: 7c9793d015ef7a1bcdac708ffeb8f97abeff9ce1
3
+ metadata.gz: bce33914c9ed0fcf28bc4739ef04bf41b5528b9a
4
+ data.tar.gz: d5af9a38530b3b346deb1b49315266e47996670c
5
5
  SHA512:
6
- metadata.gz: 8a1e2e4de4f7bd411cf491cb4c8032803d24d74606f42b339c243cf40b721e17743e6e4705f328f67bee7b0ee643c3aeeb77bf61e3bd7465d1c6b44f28d4c452
7
- data.tar.gz: ac647c3327ada3bfefa57f1b96bd1181da4c03fb1583f786d437183aca9245f0f0bf8d1ecc4fb98f1cd6a0a6f3f166c3f702d87d3f6b2816b42067dbf9b675e5
6
+ metadata.gz: ec86cb776cc8eb7850c9b6e84506486dff8180df57ffb6c1b41e87d60e6a1a98c08c989e4ef8d21502def4d8432da422db805f3ca78bd022372d3d38023696bc
7
+ data.tar.gz: ad00a903f3a5d7af87334fff1d7a083e047fde44aa69de1217bcc74022250a25f5b96f8e70af3c237b995c04da72a8c1180b8049ac29592d2a34ee55da105c6a
@@ -1,6 +1,10 @@
1
1
  sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
+ addons:
5
+ apt:
6
+ packages:
7
+ - libgecode-dev
4
8
  rvm:
5
9
  - "2.0"
6
10
  - "2.1"
@@ -8,10 +12,6 @@ rvm:
8
12
  gemfile:
9
13
  - gemfiles/default.gemfile
10
14
  - gemfiles/master.gemfile
11
- addons:
12
- apt:
13
- packages:
14
- - libgecode-dev
15
15
  env:
16
16
  global:
17
17
  - USE_SYSTEM_GECODE=true
@@ -1,9 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.2
4
+
5
+ * Handle converting cookbooks with pre-release version numbers and other
6
+ non-Chef compatible components.
7
+ * Include a cookbook's changelog file in converted output.
8
+ * Handle OS X's case-insensitivity when converting misc. type files (README, etc).
9
+
3
10
  ## v1.0.1
4
11
 
5
- Fix issues with pre-release version numbers.
12
+ * Fix issues with pre-release version numbers.
6
13
 
7
14
  ## v1.0.0
8
15
 
9
- Initial release!
16
+ * Initial release!
data/Gemfile CHANGED
@@ -18,13 +18,10 @@ source 'https://rubygems.org/'
18
18
 
19
19
  gemspec path: File.expand_path('..', __FILE__)
20
20
 
21
- def dev_gem(name, path: File.join('..', name), github: "poise/#{name}")
22
- github = "#{github}/#{name}" unless github.include?('/')
21
+ def dev_gem(name, path: File.join('..', name))
23
22
  path = File.expand_path(File.join('..', path), __FILE__)
24
23
  if File.exist?(path)
25
24
  gem name, path: path
26
- else
27
- gem name, github: github
28
25
  end
29
26
  end
30
27
 
@@ -17,5 +17,5 @@
17
17
  eval_gemfile File.expand_path('../../Gemfile', __FILE__)
18
18
 
19
19
  gem 'chef', github: 'chef/chef'
20
- # gem 'poise', github: 'poise/poise'
21
- # gem 'poise-boiler', github: 'poise/poise-boiler'
20
+ gem 'poise', github: 'poise/poise'
21
+ gem 'poise-boiler', github: 'poise/poise-boiler'
@@ -43,7 +43,7 @@ module Halite
43
43
  # Build a fake "remote" cookbook
44
44
  ::Berkshelf::APIClient::RemoteCookbook.new(
45
45
  cook.cookbook_name,
46
- cook.version,
46
+ cook.cookbook_version,
47
47
  {
48
48
  location_type: 'halite',
49
49
  location_path: cook.name,
@@ -30,7 +30,7 @@ module Halite
30
30
  ''.tap do |buf|
31
31
  buf << gem_data.license_header
32
32
  buf << "name #{gem_data.cookbook_name.inspect}\n"
33
- buf << "version #{gem_data.version.inspect}\n"
33
+ buf << "version #{gem_data.cookbook_version.inspect}\n"
34
34
  if gem_data.spec.description && !gem_data.spec.description.empty?
35
35
  buf << "description #{gem_data.spec.description.inspect}\n"
36
36
  end
@@ -31,7 +31,7 @@ module Halite
31
31
  # @param output_path [String] Output path for the cookbook.
32
32
  # @return [void]
33
33
  def self.write(gem_data, output_path)
34
- %w{Readme License Copying Contributing}.each do |name|
34
+ %w{Readme License Copying Contributing Changelog}.each do |name|
35
35
  if path = gem_data.find_misc_path(name) # rubocop:disable Lint/AssignmentInCondition
36
36
  FileUtils.copy(path, File.join(output_path, File.basename(path)), preserve: true)
37
37
  end
@@ -62,6 +62,18 @@ module Halite
62
62
  end
63
63
  end
64
64
 
65
+ # Version of the gem sanitized for Chef. This means no non-numeric tags and
66
+ # only three numeric components.
67
+ #
68
+ # @return [String]
69
+ def cookbook_version
70
+ if match = version.match(/^(\d+\.\d+\.(\d+)?)/)
71
+ match[1]
72
+ else
73
+ raise Halite::Error.new("Unable to parse #{version.inspect} as a Chef cookbook version")
74
+ end
75
+ end
76
+
65
77
  # Path to the .gemspec for this gem. This is different from
66
78
  # Gem::Specification#spec_file because the Rubygems API is shit and just
67
79
  # assumes the file layout matches normal, which is not the case with Bundler
@@ -159,7 +171,7 @@ module Halite
159
171
  [name, name.upcase, name.downcase].each do |base|
160
172
  ['.md', '', '.txt', '.html'].each do |suffix|
161
173
  path = File.join(spec.full_gem_path, base+suffix)
162
- return path if File.exist?(path)
174
+ return path if File.exist?(path) && Dir.entries(File.dirname(path)).include?(File.basename(path))
163
175
  end
164
176
  end
165
177
  # Didn't find anything
@@ -179,7 +191,7 @@ module Halite
179
191
  spec = dep.to_spec || dep.to_specs.last
180
192
  raise Error.new("Cannot find a gem to satisfy #{dep}") unless spec
181
193
  spec
182
- rescue Gem::LoadError => ex
194
+ rescue ::Gem::LoadError => ex
183
195
  raise Error.new("Cannot find a gem to satisfy #{dep}: #{ex}")
184
196
  end
185
197
  end
@@ -91,7 +91,7 @@ module Halite
91
91
  def install_kitchen
92
92
  desc 'Run all Test Kitchen tests'
93
93
  task 'chef:kitchen' do
94
- sh 'kitchen test -d always'
94
+ sh(*%w{kitchen test -d always})
95
95
  end
96
96
 
97
97
  add_test_task('chef:kitchen')
@@ -114,6 +114,7 @@ module Halite
114
114
  def release_cookbook
115
115
  Dir.chdir(pkg_path) do
116
116
  sh('stove --no-git')
117
+ shell.say("Pushed #{gemspec.name} #{gemspec.version} to supermarket.chef.io.", :green)
117
118
  end
118
119
  end
119
120
 
@@ -17,5 +17,5 @@
17
17
 
18
18
  module Halite
19
19
  # Halite version.
20
- VERSION = '1.0.1'
20
+ VERSION = '1.0.2'
21
21
  end
@@ -21,6 +21,7 @@ describe Halite::Converter::Metadata do
21
21
  let(:gem_name) { 'mygem' }
22
22
  let(:cookbook_name) { gem_name }
23
23
  let(:version) { '1.0.0' }
24
+ let(:cookbook_version) { version }
24
25
  let(:cookbook_dependencies) { [] }
25
26
  let(:spec) do
26
27
  instance_double('Gem::Specification', description: '')
@@ -34,6 +35,7 @@ describe Halite::Converter::Metadata do
34
35
  name: gem_name,
35
36
  spec: spec,
36
37
  version: version,
38
+ cookbook_version: cookbook_version,
37
39
  )
38
40
  end
39
41
  subject { described_class.generate(gem_data) }
@@ -25,6 +25,7 @@ describe Halite::Gem do
25
25
 
26
26
  context 'when loading halite' do
27
27
  its(:name) { is_expected.to eq 'halite' }
28
+ its(:cookbook_name) { is_expected.to eq 'halite' }
28
29
  its(:version) { is_expected.to eq Halite::VERSION }
29
30
  its(:spec) { is_expected.to be_a Gem::Specification }
30
31
  end
@@ -32,6 +33,7 @@ describe Halite::Gem do
32
33
  context 'when loading halite with a version' do
33
34
  let(:gem_version) { Halite::VERSION }
34
35
  its(:name) { is_expected.to eq 'halite' }
36
+ its(:cookbook_name) { is_expected.to eq 'halite' }
35
37
  its(:version) { is_expected.to eq Halite::VERSION }
36
38
  its(:spec) { is_expected.to be_a Gem::Specification }
37
39
  end
@@ -46,8 +48,9 @@ describe Halite::Gem do
46
48
  context 'when loading test1' do
47
49
  let(:gem_name) { 'test1' }
48
50
  its(:name) { is_expected.to eq 'test1' }
49
- its(:version) { is_expected.to eq '1.2.3' }
50
51
  its(:cookbook_name) { is_expected.to eq 'test1' }
52
+ its(:version) { is_expected.to eq '1.2.3' }
53
+ its(:cookbook_version) { is_expected.to eq '1.2.3' }
51
54
  its(:license_header) { is_expected.to eq "# coding: utf-8\n# Awesome license\n" }
52
55
  its(:each_library_file) { is_expected.to eq [
53
56
  [File.expand_path('../fixtures/gems/test1/lib/test1.rb', __FILE__), 'test1.rb'],
@@ -81,8 +84,9 @@ describe Halite::Gem do
81
84
  context 'when loading test2' do
82
85
  let(:gem_name) { 'test2' }
83
86
  its(:name) { is_expected.to eq 'test2' }
84
- its(:version) { is_expected.to eq '4.5.6' }
85
87
  its(:cookbook_name) { is_expected.to eq 'test2' }
88
+ its(:version) { is_expected.to eq '4.5.6' }
89
+ its(:cookbook_version) { is_expected.to eq '4.5.6' }
86
90
  its(:license_header) { is_expected.to eq "# coding: utf-8\n" }
87
91
  its(:each_library_file) { is_expected.to eq [
88
92
  [File.expand_path('../fixtures/gems/test2/lib/test2.rb', __FILE__), 'test2.rb'],
@@ -127,6 +131,13 @@ describe Halite::Gem do
127
131
  its(:is_halite_cookbook?) { is_expected.to be_truthy }
128
132
  end # /context when loading test3
129
133
 
134
+ context 'when loading test4' do
135
+ let(:gem_name) { 'test4' }
136
+ its(:cookbook_name) { is_expected.to eq 'test4' }
137
+ its(:version) { is_expected.to eq '2.3.1.rc.1' }
138
+ its(:cookbook_version) { is_expected.to eq '2.3.1' }
139
+ end # /context when loading test4
140
+
130
141
  context 'when loading a Gem::Dependency' do
131
142
  let(:dependency) do
132
143
  reqs = []
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.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef