halite 1.0.2 → 1.0.3

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: bce33914c9ed0fcf28bc4739ef04bf41b5528b9a
4
- data.tar.gz: d5af9a38530b3b346deb1b49315266e47996670c
3
+ metadata.gz: 577aff0788b35c31b43e31a40d5fe5eddc9018a1
4
+ data.tar.gz: 7c967c99985629798dc8dacb7c5a92bb5d3f43cd
5
5
  SHA512:
6
- metadata.gz: ec86cb776cc8eb7850c9b6e84506486dff8180df57ffb6c1b41e87d60e6a1a98c08c989e4ef8d21502def4d8432da422db805f3ca78bd022372d3d38023696bc
7
- data.tar.gz: ad00a903f3a5d7af87334fff1d7a083e047fde44aa69de1217bcc74022250a25f5b96f8e70af3c237b995c04da72a8c1180b8049ac29592d2a34ee55da105c6a
6
+ metadata.gz: 18a8ae4db88b1bf4a08cf8b365bee9317e21080879447d925ddbd0262ffc0236ee02b8886b8fbe920e002133db551f36317d6a4b399b9ea07952a709a5dca2ac
7
+ data.tar.gz: 2429414aade1578d376d5dee34bf8df98c141ba4276512121ca40855b1ef5bbfa3ff99bdf0dab1b476bf3bc18c3608e2e368737b52facb889fb0ef78b93dc00c
@@ -38,7 +38,8 @@ module Halite
38
38
  ::Gem::Specification.stubs.map do |spec|
39
39
  Gem.new(spec)
40
40
  end.select do |cook|
41
- cook.is_halite_cookbook?
41
+ # Make sure this is a cookbook, and that it isn't a pre-release.
42
+ cook.is_halite_cookbook? && cook.version == cook.cookbook_version
42
43
  end.map do |cook|
43
44
  # Build a fake "remote" cookbook
44
45
  ::Berkshelf::APIClient::RemoteCookbook.new(
@@ -100,11 +100,15 @@ module Halite
100
100
  end
101
101
 
102
102
  def self.clean_version(ver)
103
- segments = ver.segments
104
- # Various ways Chef differs from Rubygems
103
+ segments = ver.segments.dup
104
+ # Various ways Chef differs from Rubygems.
105
+ # Strip any pre-release tags in the version.
106
+ segments = segments.take_while {|s| s.to_s =~ /^\d+$/ }
107
+ # Must be x or x.y or x.y.z.
105
108
  raise InvalidDependencyError.new("Chef only supports two or three version segments: #{ver}") if segments.length < 1 || segments.length > 3
106
- segments.each {|s| raise InvalidDependencyError.new("Chef does not support pre-release version numbers: #{ver}") unless s.is_a?(Integer) }
109
+ # If x, convert to x.0 because Chef requires two segments.
107
110
  segments << 0 if segments.length == 1
111
+ # Convert 0.0 or 0.0.0 to just 0.
108
112
  segments = [0] if segments.all? {|s| s == 0 }
109
113
  ::Gem::Version.new(segments.join('.'))
110
114
  end
@@ -17,5 +17,5 @@
17
17
 
18
18
  module Halite
19
19
  # Halite version.
20
- VERSION = '1.0.2'
20
+ VERSION = '1.0.3'
21
21
  end
@@ -205,7 +205,12 @@ describe Halite::Dependencies do
205
205
 
206
206
  context 'with 1.0.a' do
207
207
  let(:version) { '1.0.a' }
208
- it { expect { subject }.to raise_error Halite::InvalidDependencyError }
208
+ it { is_expected.to eq '1.0' }
209
+ end
210
+
211
+ context 'with 2.3.rc.0' do
212
+ let(:version) { '2.3.rc.0' }
213
+ it { is_expected.to eq '2.3' }
209
214
  end
210
215
 
211
216
  context 'with 1.2.3.4' do
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.2
4
+ version: 1.0.3
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-23 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef