librarianp 0.1.2 → 0.2.0
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 +4 -4
- data/.travis.yml +7 -6
- data/Gemfile.lock +3 -5
- data/VERSION +1 -1
- data/lib/librarian/action/install.rb +5 -1
- data/lib/librarian/dependency.rb +41 -3
- data/lib/librarian/logger.rb +6 -0
- data/lib/librarian/manifest.rb +101 -4
- data/lib/librarian/manifest_set.rb +1 -0
- data/lib/librarian/mock/source/mock.rb +6 -0
- data/lib/librarian/source/git.rb +6 -0
- data/lib/librarian/source/path.rb +6 -0
- data/librarian.gemspec +3 -6
- data/spec/unit/action/install_spec.rb +1 -0
- data/spec/unit/algorithms_spec.rb +10 -0
- data/spec/unit/dependency/requirement_spec.rb +24 -0
- data/spec/unit/manifest/version_spec.rb +90 -0
- data/spec/unit/manifest_set_spec.rb +4 -0
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32e59b1fc3a6aaa7e1f6affb7bc95ac940151489
|
4
|
+
data.tar.gz: 183d10a379c2e3d925c9e1e7f45483f9f43b24bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ede0dafff66900070bf14ea10d9a206c9081fbbeca8114982e1eb6bdf99a129135107cf0bda02d1490d15cd99dd80e790ec7b6939077c1489b7b20ea9726d84
|
7
|
+
data.tar.gz: b99e91e02d4f3ae3acc4f74b30bbc2a01cf5149ff36f12c6c8c45790e43ac97c509029c38a47f31aa633d9952063dde58cd1d049316186f8b576d79a50bc654e
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
librarianp (0.
|
5
|
-
highline
|
4
|
+
librarianp (0.2.0)
|
6
5
|
thor (~> 0.15)
|
7
6
|
|
8
7
|
GEM
|
@@ -11,9 +10,8 @@ GEM
|
|
11
10
|
diff-lcs (1.2.5)
|
12
11
|
fakefs (0.4.2)
|
13
12
|
ffi2-generators (0.1.1)
|
14
|
-
|
15
|
-
|
16
|
-
rake (10.0.4)
|
13
|
+
json (1.8.2)
|
14
|
+
rake (10.4.2)
|
17
15
|
rspec (2.99.0)
|
18
16
|
rspec-core (~> 2.99.0)
|
19
17
|
rspec-expectations (~> 2.99.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -40,7 +40,7 @@ module Librarian
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def create_install_path
|
43
|
-
install_path.rmtree if install_path.exist?
|
43
|
+
install_path.rmtree if install_path.exist? && destructive?
|
44
44
|
install_path.mkpath
|
45
45
|
end
|
46
46
|
|
@@ -54,6 +54,10 @@ module Librarian
|
|
54
54
|
ManifestSet.sort(lock.manifests)
|
55
55
|
end
|
56
56
|
|
57
|
+
def destructive?
|
58
|
+
environment.config_db.local['destructive'] == 'true'
|
59
|
+
end
|
60
|
+
|
57
61
|
def specfile_name
|
58
62
|
environment.specfile_name
|
59
63
|
end
|
data/lib/librarian/dependency.rb
CHANGED
@@ -7,7 +7,7 @@ module Librarian
|
|
7
7
|
def initialize(*args)
|
8
8
|
args = initialize_normalize_args(args)
|
9
9
|
|
10
|
-
self.backing = Gem::Requirement.create(
|
10
|
+
self.backing = Gem::Requirement.create(args)
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_gem_requirement
|
@@ -22,6 +22,12 @@ module Librarian
|
|
22
22
|
to_gem_requirement == other.to_gem_requirement
|
23
23
|
end
|
24
24
|
|
25
|
+
alias :eql? :==
|
26
|
+
|
27
|
+
def hash
|
28
|
+
self.to_s.hash
|
29
|
+
end
|
30
|
+
|
25
31
|
def to_s
|
26
32
|
to_gem_requirement.to_s
|
27
33
|
end
|
@@ -84,8 +90,30 @@ module Librarian
|
|
84
90
|
def initialize_normalize_args(args)
|
85
91
|
args.map do |arg|
|
86
92
|
arg = arg.backing if self.class === arg
|
87
|
-
arg
|
88
|
-
|
93
|
+
case arg
|
94
|
+
when nil
|
95
|
+
nil
|
96
|
+
when Array
|
97
|
+
arg.map { |item| parse(item) }
|
98
|
+
when String
|
99
|
+
parse(arg)
|
100
|
+
else
|
101
|
+
# Gem::Requirement, convert to string (ie. =1.0) so we can concat later
|
102
|
+
# Gem::Requirements can not be concatenated
|
103
|
+
arg.requirements.map{|x,y| "#{x}#{y}"}
|
104
|
+
end
|
105
|
+
end.flatten
|
106
|
+
end
|
107
|
+
|
108
|
+
# build an array if the argument is a string defining a range
|
109
|
+
# or a ~> 1.0 type version if string is 1.x
|
110
|
+
def parse(arg)
|
111
|
+
return nil if arg.nil?
|
112
|
+
match = range_requirement(arg)
|
113
|
+
return [match[1], match[2]] if match
|
114
|
+
match = pessimistic_requirement(arg)
|
115
|
+
return "~> #{match[1]}.0" if match
|
116
|
+
arg
|
89
117
|
end
|
90
118
|
|
91
119
|
def compatible?(a, b)
|
@@ -94,6 +122,16 @@ module Librarian
|
|
94
122
|
r = r.call(a.last, b.last) if r.respond_to?(:call)
|
95
123
|
r
|
96
124
|
end
|
125
|
+
|
126
|
+
# A version range: >=1.0 <2.0
|
127
|
+
def range_requirement(arg)
|
128
|
+
arg.match(/(>=? ?\d+(?:\.\d+){0,2}) (<=? ?\d+(?:\.\d+){0,2})/)
|
129
|
+
end
|
130
|
+
|
131
|
+
# A string with .x: 1.x, 2.1.x
|
132
|
+
def pessimistic_requirement(arg)
|
133
|
+
arg.match(/(\d+(?:\.\d+)?)\.x/)
|
134
|
+
end
|
97
135
|
end
|
98
136
|
|
99
137
|
attr_accessor :name, :requirement, :source
|
data/lib/librarian/logger.rb
CHANGED
data/lib/librarian/manifest.rb
CHANGED
@@ -6,10 +6,21 @@ module Librarian
|
|
6
6
|
class Version
|
7
7
|
include Comparable
|
8
8
|
|
9
|
+
@@SEMANTIC_VERSION_PATTERN = /^([0-9]+\.[0-9]+(?:\.[0-9]+)?)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
|
10
|
+
|
11
|
+
attr_reader :prerelease
|
12
|
+
|
9
13
|
def initialize(*args)
|
10
14
|
args = initialize_normalize_args(args)
|
11
|
-
|
12
|
-
|
15
|
+
semver = Version.parse_semver(*args)
|
16
|
+
if semver
|
17
|
+
self.backing = Gem::Version.new(semver[:version])
|
18
|
+
@prerelease = semver[:prerelease]
|
19
|
+
@full_version = semver[:full_version]
|
20
|
+
else
|
21
|
+
self.backing = Gem::Version.new(*args)
|
22
|
+
@full_version = to_gem_version.to_s
|
23
|
+
end
|
13
24
|
end
|
14
25
|
|
15
26
|
def to_gem_version
|
@@ -17,17 +28,43 @@ module Librarian
|
|
17
28
|
end
|
18
29
|
|
19
30
|
def <=>(other)
|
20
|
-
to_gem_version <=> other.to_gem_version
|
31
|
+
cmp = to_gem_version <=> other.to_gem_version
|
32
|
+
|
33
|
+
# Should compare pre-release versions?
|
34
|
+
if cmp == 0 and not (prerelease.nil? and other.prerelease.nil?)
|
35
|
+
case # Versions without prerelease take precedence
|
36
|
+
when (prerelease.nil? and not other.prerelease.nil?)
|
37
|
+
1
|
38
|
+
when (not prerelease.nil? and other.prerelease.nil?)
|
39
|
+
-1
|
40
|
+
else
|
41
|
+
prerelease <=> other.prerelease
|
42
|
+
end
|
43
|
+
else
|
44
|
+
cmp
|
45
|
+
end
|
21
46
|
end
|
22
47
|
|
23
48
|
def to_s
|
24
|
-
|
49
|
+
@full_version
|
25
50
|
end
|
26
51
|
|
27
52
|
def inspect
|
28
53
|
"#<#{self.class} #{to_s}>"
|
29
54
|
end
|
30
55
|
|
56
|
+
def self.parse_semver(version_string)
|
57
|
+
parsed = @@SEMANTIC_VERSION_PATTERN.match(version_string.strip)
|
58
|
+
if parsed
|
59
|
+
{
|
60
|
+
:full_version => parsed[0],
|
61
|
+
:version => parsed[1],
|
62
|
+
:prerelease => (PreReleaseVersion.new(parsed[2]) if parsed[2]),
|
63
|
+
:build => parsed[3]
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
31
68
|
private
|
32
69
|
|
33
70
|
def initialize_normalize_args(args)
|
@@ -40,6 +77,66 @@ module Librarian
|
|
40
77
|
attr_accessor :backing
|
41
78
|
end
|
42
79
|
|
80
|
+
class PreReleaseVersion
|
81
|
+
|
82
|
+
# Compares pre-release component ids using Semver 2.0.0 spec
|
83
|
+
def self.compare_components(this_id,other_id)
|
84
|
+
case # Strings have higher precedence than numbers
|
85
|
+
when (this_id.is_a?(Integer) and other_id.is_a?(String))
|
86
|
+
-1
|
87
|
+
when (this_id.is_a?(String) and other_id.is_a?(Integer))
|
88
|
+
1
|
89
|
+
else
|
90
|
+
this_id <=> other_id
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Parses pre-release components `a.b.c` into an array ``[a,b,c]`
|
95
|
+
# Converts numeric components into +Integer+
|
96
|
+
def self.parse(prerelease)
|
97
|
+
if prerelease.nil?
|
98
|
+
[]
|
99
|
+
else
|
100
|
+
prerelease.split('.').collect do |id|
|
101
|
+
id = Integer(id) if /^[0-9]+$/ =~ id
|
102
|
+
id
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
include Comparable
|
108
|
+
|
109
|
+
attr_reader :components
|
110
|
+
|
111
|
+
def initialize(prerelease)
|
112
|
+
@prerelease = prerelease
|
113
|
+
@components = PreReleaseVersion.parse(prerelease)
|
114
|
+
end
|
115
|
+
|
116
|
+
def to_s
|
117
|
+
@prerelease
|
118
|
+
end
|
119
|
+
|
120
|
+
def <=>(other)
|
121
|
+
# null-fill zip array to prevent loss of components
|
122
|
+
z = Array.new([components.length,other.components.length])
|
123
|
+
|
124
|
+
# Compare each component against the other
|
125
|
+
comp = z.zip(components,other.components).collect do |ids|
|
126
|
+
case # All components being equal, the version with more of them takes precedence
|
127
|
+
when ids[1].nil? # Self has less elements, other wins
|
128
|
+
-1
|
129
|
+
when ids[2].nil? # Other has less elements, self wins
|
130
|
+
1
|
131
|
+
else
|
132
|
+
PreReleaseVersion.compare_components(ids[1],ids[2])
|
133
|
+
end
|
134
|
+
end
|
135
|
+
# Chose the first non-zero comparison or return 0
|
136
|
+
comp.delete_if {|c| c == 0}[0] || 0
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
43
140
|
attr_accessor :source, :name, :extra
|
44
141
|
private :source=, :name=, :extra=
|
45
142
|
|
@@ -137,6 +137,7 @@ module Librarian
|
|
137
137
|
next if deps.include?(name)
|
138
138
|
|
139
139
|
deps << name
|
140
|
+
raise(Error, "Unable to find module #{name}. The dependency descriptor may be out of sync with the lock, try running 'install' first") if index[name].nil?
|
140
141
|
names.concat index[name].dependencies.map(&:name)
|
141
142
|
end
|
142
143
|
deps.to_a
|
data/lib/librarian/source/git.rb
CHANGED
data/librarian.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: librarianp 0.
|
2
|
+
# stub: librarianp 0.2.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "librarianp"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.2.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Jay Feldblum", "Carlos Sanchez"]
|
11
|
-
s.date = "2015-02-
|
11
|
+
s.date = "2015-02-25"
|
12
12
|
s.description = "A Framework for Bundlers, used by librarian-puppet."
|
13
13
|
s.email = ["y_feldblum@yahoo.com", "carlos@apache.org"]
|
14
14
|
s.files = [".gitignore", ".rspec", ".travis.yml", "CHANGELOG.md", "Gemfile", "Gemfile.lock", "LICENSE.txt", "README.md", "Rakefile", "VERSION", "lib/librarian.rb", "lib/librarian/action.rb", "lib/librarian/action/base.rb", "lib/librarian/action/clean.rb", "lib/librarian/action/ensure.rb", "lib/librarian/action/install.rb", "lib/librarian/action/persist_resolution_mixin.rb", "lib/librarian/action/resolve.rb", "lib/librarian/action/update.rb", "lib/librarian/algorithms.rb", "lib/librarian/cli.rb", "lib/librarian/cli/manifest_presenter.rb", "lib/librarian/config.rb", "lib/librarian/config/database.rb", "lib/librarian/config/file_source.rb", "lib/librarian/config/hash_source.rb", "lib/librarian/config/source.rb", "lib/librarian/dependency.rb", "lib/librarian/dsl.rb", "lib/librarian/dsl/receiver.rb", "lib/librarian/dsl/target.rb", "lib/librarian/environment.rb", "lib/librarian/environment/runtime_cache.rb", "lib/librarian/error.rb", "lib/librarian/helpers.rb", "lib/librarian/linter/source_linter.rb", "lib/librarian/lockfile.rb", "lib/librarian/lockfile/compiler.rb", "lib/librarian/lockfile/parser.rb", "lib/librarian/logger.rb", "lib/librarian/manifest.rb", "lib/librarian/manifest_set.rb", "lib/librarian/mock.rb", "lib/librarian/mock/cli.rb", "lib/librarian/mock/dsl.rb", "lib/librarian/mock/environment.rb", "lib/librarian/mock/extension.rb", "lib/librarian/mock/source.rb", "lib/librarian/mock/source/mock.rb", "lib/librarian/mock/source/mock/registry.rb", "lib/librarian/mock/version.rb", "lib/librarian/posix.rb", "lib/librarian/resolution.rb", "lib/librarian/resolver.rb", "lib/librarian/resolver/implementation.rb", "lib/librarian/rspec/support/cli_macro.rb", "lib/librarian/source.rb", "lib/librarian/source/basic_api.rb", "lib/librarian/source/git.rb", "lib/librarian/source/git/repository.rb", "lib/librarian/source/local.rb", "lib/librarian/source/path.rb", "lib/librarian/spec.rb", "lib/librarian/spec_change_set.rb", "lib/librarian/specfile.rb", "lib/librarian/support/abstract_method.rb", "lib/librarian/ui.rb", "lib/librarian/version.rb", "librarian.gemspec", "spec/functional/cli_spec.rb", "spec/functional/posix_spec.rb", "spec/functional/source/git/repository_spec.rb", "spec/functional/source/git_spec.rb", "spec/support/fakefs.rb", "spec/support/method_patch_macro.rb", "spec/support/project_path_macro.rb", "spec/support/with_env_macro.rb", "spec/unit/action/base_spec.rb", "spec/unit/action/clean_spec.rb", "spec/unit/action/ensure_spec.rb", "spec/unit/action/install_spec.rb", "spec/unit/algorithms_spec.rb", "spec/unit/config/database_spec.rb", "spec/unit/dependency/requirement_spec.rb", "spec/unit/dependency_spec.rb", "spec/unit/dsl_spec.rb", "spec/unit/environment/runtime_cache_spec.rb", "spec/unit/environment_spec.rb", "spec/unit/lockfile/parser_spec.rb", "spec/unit/lockfile_spec.rb", "spec/unit/manifest/version_spec.rb", "spec/unit/manifest_set_spec.rb", "spec/unit/manifest_spec.rb", "spec/unit/mock/environment_spec.rb", "spec/unit/mock/source/mock_spec.rb", "spec/unit/resolver_spec.rb", "spec/unit/source/git_spec.rb", "spec/unit/spec_change_set_spec.rb"]
|
@@ -23,14 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
25
|
s.add_runtime_dependency(%q<thor>, ["~> 0.15"])
|
26
|
-
s.add_runtime_dependency(%q<highline>, [">= 0"])
|
27
26
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
28
27
|
s.add_development_dependency(%q<rspec>, ["~> 2.14"])
|
29
28
|
s.add_development_dependency(%q<json>, [">= 0"])
|
30
29
|
s.add_development_dependency(%q<fakefs>, ["~> 0.4.2"])
|
31
30
|
else
|
32
31
|
s.add_dependency(%q<thor>, ["~> 0.15"])
|
33
|
-
s.add_dependency(%q<highline>, [">= 0"])
|
34
32
|
s.add_dependency(%q<rake>, [">= 0"])
|
35
33
|
s.add_dependency(%q<rspec>, ["~> 2.14"])
|
36
34
|
s.add_dependency(%q<json>, [">= 0"])
|
@@ -38,7 +36,6 @@ Gem::Specification.new do |s|
|
|
38
36
|
end
|
39
37
|
else
|
40
38
|
s.add_dependency(%q<thor>, ["~> 0.15"])
|
41
|
-
s.add_dependency(%q<highline>, [">= 0"])
|
42
39
|
s.add_dependency(%q<rake>, [">= 0"])
|
43
40
|
s.add_dependency(%q<rspec>, ["~> 2.14"])
|
44
41
|
s.add_dependency(%q<json>, [">= 0"])
|
@@ -123,6 +123,16 @@ module Librarian
|
|
123
123
|
it { should be == [?a, ?b, ?c, ?d] }
|
124
124
|
end
|
125
125
|
|
126
|
+
# Dependencies are sorted alphabetically. Should they?
|
127
|
+
context "should be deterministic" do
|
128
|
+
let(:graph) { { ?a => [], ?b => [?c], ?c => [] } }
|
129
|
+
it { should be == [?a, ?c, ?b] }
|
130
|
+
end
|
131
|
+
|
132
|
+
context "should be deterministic" do
|
133
|
+
let(:graph) { { ?c => [], ?b => [?a], ?a => [] } }
|
134
|
+
it { should be == [?a, ?b, ?c] }
|
135
|
+
end
|
126
136
|
end
|
127
137
|
|
128
138
|
end
|
@@ -9,4 +9,28 @@ describe Librarian::Dependency::Requirement do
|
|
9
9
|
to eq "#<Librarian::Dependency::Requirement >= 3.2.1>" }
|
10
10
|
end
|
11
11
|
|
12
|
+
it 'should handle nil versions' do
|
13
|
+
described_class.new(nil).to_gem_requirement.should eq(Gem::Requirement.new)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should handle nil versions in arrays' do
|
17
|
+
described_class.new([nil]).to_gem_requirement.should eq(Gem::Requirement.new)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should handle .x versions' do
|
21
|
+
described_class.new('1.x').to_gem_requirement.should eq(Gem::Requirement.new('~> 1.0'))
|
22
|
+
described_class.new('1.0.x').to_gem_requirement.should eq(Gem::Requirement.new('~> 1.0.0'))
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should handle version ranges' do
|
26
|
+
described_class.new('>=1.1.0 <2.0.0').to_gem_requirement.should eq(Gem::Requirement.new(['>=1.1.0', '<2.0.0']))
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should print to_s' do
|
30
|
+
described_class.new('1.x').to_s.should eq('~> 1.0')
|
31
|
+
s = described_class.new('>=1.1.0 <2.0.0').to_s
|
32
|
+
s.should include(">= 1.1.0")
|
33
|
+
s.should include("< 2.0.0")
|
34
|
+
end
|
35
|
+
|
12
36
|
end
|
@@ -8,4 +8,94 @@ describe Librarian::Manifest::Version do
|
|
8
8
|
specify { expect(version.inspect).to eq "#<Librarian::Manifest::Version 3.2.1>" }
|
9
9
|
end
|
10
10
|
|
11
|
+
describe "version comparison" do
|
12
|
+
|
13
|
+
context "when version has only two components" do
|
14
|
+
it "creates a new version with only 2 version components" do
|
15
|
+
v1 = described_class.new("1.0")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when neither version has pre-release items" do
|
20
|
+
it "compares 1.0.0 < 2.0.0" do
|
21
|
+
v1 = described_class.new("1.0.0")
|
22
|
+
v2 = described_class.new("2.0.0")
|
23
|
+
expect(v1 <=> v2).to eq(-1)
|
24
|
+
end
|
25
|
+
it "compares 2.0.0 < 2.1.0" do
|
26
|
+
v1 = described_class.new("2.0.0")
|
27
|
+
v2 = described_class.new("2.1.0")
|
28
|
+
expect(v1 <=> v2).to eq(-1)
|
29
|
+
end
|
30
|
+
it "compares 2.1.0 < 2.1.1" do
|
31
|
+
v1 = described_class.new("2.1.0")
|
32
|
+
v2 = described_class.new("2.1.1")
|
33
|
+
expect(v1 <=> v2).to eq(-1)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when versions have pre-release information" do
|
38
|
+
it "compares 1.0.0-alpha < 1.0.0-alpha1" do
|
39
|
+
v1 = described_class.new("1.0.0-alpha")
|
40
|
+
v2 = described_class.new("1.0.0-alpha.1")
|
41
|
+
expect(v1 <=> v2).to eq(-1)
|
42
|
+
end
|
43
|
+
it "compares 1.0.0-alpha.1 < 1.0.0-alpha.beta" do
|
44
|
+
v1 = described_class.new("1.0.0-alpha.1")
|
45
|
+
v2 = described_class.new("1.0.0-alpha.beta")
|
46
|
+
expect(v1 <=> v2).to eq(-1)
|
47
|
+
end
|
48
|
+
it "compares 1.0.0-alpha.beta < 1.0.0-beta" do
|
49
|
+
v1 = described_class.new("1.0.0-alpha.beta")
|
50
|
+
v2 = described_class.new("1.0.0-beta")
|
51
|
+
expect(v1 <=> v2).to eq(-1)
|
52
|
+
end
|
53
|
+
it "compares 1.0.0-beta < 1.0.0-beta.2" do
|
54
|
+
v1 = described_class.new("1.0.0-beta")
|
55
|
+
v2 = described_class.new("1.0.0-beta.2")
|
56
|
+
expect(v1 <=> v2).to eq(-1)
|
57
|
+
end
|
58
|
+
it "compares 1.0.0-beta.2 < 1.0.0-beta.11" do
|
59
|
+
v1 = described_class.new("1.0.0-beta.2")
|
60
|
+
v2 = described_class.new("1.0.0-beta.11")
|
61
|
+
expect(v1 <=> v2).to eq(-1)
|
62
|
+
end
|
63
|
+
it "compares 1.0.0-beta.11 < 1.0.0-rc.1" do
|
64
|
+
v1 = described_class.new("1.0.0-beta.11")
|
65
|
+
v2 = described_class.new("1.0.0-rc.1")
|
66
|
+
expect(v1 <=> v2).to eq(-1)
|
67
|
+
end
|
68
|
+
it "compares 1.0.0-rc.1 < 1.0.0" do
|
69
|
+
v1 = described_class.new("1.0.0-rc.1")
|
70
|
+
v2 = described_class.new("1.0.0")
|
71
|
+
expect(v1 <=> v2).to eq(-1)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "when an invalid version number is provided" do
|
76
|
+
it "raises" do
|
77
|
+
expect { described_class.new("invalidversion") }.
|
78
|
+
to raise_error(ArgumentError)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "when a version is converted to string" do
|
83
|
+
it "should be the full semver" do
|
84
|
+
version = "1.0.0-beta.11+200.1.2"
|
85
|
+
v1 = described_class.new(version)
|
86
|
+
expect(v1.to_s).to eq(version)
|
87
|
+
end
|
88
|
+
it "should be the full gem version" do
|
89
|
+
version = "1.0.0.a"
|
90
|
+
v1 = described_class.new(version)
|
91
|
+
expect(v1.to_s).to eq(version)
|
92
|
+
end
|
93
|
+
it "should be the two-component version" do
|
94
|
+
version = "1.0"
|
95
|
+
v1 = described_class.new(version)
|
96
|
+
expect(v1.to_s).to eq(version)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
11
101
|
end
|
@@ -143,6 +143,10 @@ module Librarian
|
|
143
143
|
|
144
144
|
expect(set.to_a).to match_array( [] )
|
145
145
|
end
|
146
|
+
|
147
|
+
it "should fail if index does not contain manifest" do
|
148
|
+
expect { set.deep_strip!(["a", "z"]) }.to raise_error(Librarian::Error, /^Unable to find module z/)
|
149
|
+
end
|
146
150
|
end
|
147
151
|
|
148
152
|
describe "#deep_keep!" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librarianp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Feldblum
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
12
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0.15'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: highline
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: rake
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|