librarian-puppet 0.0.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/LICENSE +20 -0
- data/README.md +0 -0
- data/bin/librarian-puppet +9 -0
- data/lib/librarian/puppet.rb +7 -0
- data/lib/librarian/puppet/cli.rb +30 -0
- data/lib/librarian/puppet/dsl.rb +14 -0
- data/lib/librarian/puppet/environment.rb +18 -0
- data/lib/librarian/puppet/extension.rb +9 -0
- data/lib/librarian/puppet/source.rb +2 -0
- data/lib/librarian/puppet/source/git.rb +12 -0
- data/lib/librarian/puppet/source/local.rb +46 -0
- data/lib/librarian/puppet/source/path.rb +12 -0
- data/lib/librarian/puppet/templates/Puppetfile +6 -0
- data/librarian-puppet.gemspec +126 -0
- data/vendor/librarian/.rspec +1 -0
- data/vendor/librarian/.travis.yml +6 -0
- data/vendor/librarian/CHANGELOG.md +168 -0
- data/vendor/librarian/Gemfile +4 -0
- data/vendor/librarian/MIT-LICENSE +20 -0
- data/vendor/librarian/README.md +318 -0
- data/vendor/librarian/Rakefile +34 -0
- data/vendor/librarian/bin/librarian-chef +7 -0
- data/vendor/librarian/bin/librarian-mock +7 -0
- data/vendor/librarian/config/cucumber.yaml +1 -0
- data/vendor/librarian/features/chef/cli/init.feature +10 -0
- data/vendor/librarian/features/chef/cli/install.feature +64 -0
- data/vendor/librarian/features/chef/cli/show.feature +65 -0
- data/vendor/librarian/features/chef/cli/version.feature +11 -0
- data/vendor/librarian/features/support/env.rb +9 -0
- data/vendor/librarian/lib/librarian.rb +19 -0
- data/vendor/librarian/lib/librarian/action.rb +5 -0
- data/vendor/librarian/lib/librarian/action/base.rb +22 -0
- data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
- data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
- data/vendor/librarian/lib/librarian/action/install.rb +95 -0
- data/vendor/librarian/lib/librarian/action/resolve.rb +81 -0
- data/vendor/librarian/lib/librarian/action/update.rb +78 -0
- data/vendor/librarian/lib/librarian/chef.rb +1 -0
- data/vendor/librarian/lib/librarian/chef/cli.rb +27 -0
- data/vendor/librarian/lib/librarian/chef/dsl.rb +15 -0
- data/vendor/librarian/lib/librarian/chef/environment.rb +19 -0
- data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
- data/vendor/librarian/lib/librarian/chef/integration/knife.rb +42 -0
- data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +47 -0
- data/vendor/librarian/lib/librarian/chef/source.rb +3 -0
- data/vendor/librarian/lib/librarian/chef/source/git.rb +12 -0
- data/vendor/librarian/lib/librarian/chef/source/local.rb +63 -0
- data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
- data/vendor/librarian/lib/librarian/chef/source/site.rb +434 -0
- data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
- data/vendor/librarian/lib/librarian/cli.rb +175 -0
- data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +79 -0
- data/vendor/librarian/lib/librarian/dependency.rb +95 -0
- data/vendor/librarian/lib/librarian/dsl.rb +105 -0
- data/vendor/librarian/lib/librarian/dsl/receiver.rb +48 -0
- data/vendor/librarian/lib/librarian/dsl/target.rb +176 -0
- data/vendor/librarian/lib/librarian/environment.rb +129 -0
- data/vendor/librarian/lib/librarian/error.rb +4 -0
- data/vendor/librarian/lib/librarian/helpers.rb +13 -0
- data/vendor/librarian/lib/librarian/helpers/debug.rb +35 -0
- data/vendor/librarian/lib/librarian/lockfile.rb +33 -0
- data/vendor/librarian/lib/librarian/lockfile/compiler.rb +70 -0
- data/vendor/librarian/lib/librarian/lockfile/parser.rb +104 -0
- data/vendor/librarian/lib/librarian/manifest.rb +140 -0
- data/vendor/librarian/lib/librarian/manifest_set.rb +153 -0
- data/vendor/librarian/lib/librarian/mock.rb +1 -0
- data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
- data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
- data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
- data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
- data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
- data/vendor/librarian/lib/librarian/mock/source/mock.rb +97 -0
- data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
- data/vendor/librarian/lib/librarian/resolution.rb +44 -0
- data/vendor/librarian/lib/librarian/resolver.rb +73 -0
- data/vendor/librarian/lib/librarian/resolver/implementation.rb +122 -0
- data/vendor/librarian/lib/librarian/source.rb +2 -0
- data/vendor/librarian/lib/librarian/source/git.rb +150 -0
- data/vendor/librarian/lib/librarian/source/git/repository.rb +213 -0
- data/vendor/librarian/lib/librarian/source/local.rb +51 -0
- data/vendor/librarian/lib/librarian/source/path.rb +74 -0
- data/vendor/librarian/lib/librarian/spec.rb +13 -0
- data/vendor/librarian/lib/librarian/spec_change_set.rb +170 -0
- data/vendor/librarian/lib/librarian/specfile.rb +22 -0
- data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
- data/vendor/librarian/lib/librarian/ui.rb +64 -0
- data/vendor/librarian/lib/librarian/version.rb +3 -0
- data/vendor/librarian/librarian.gemspec +33 -0
- data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
- data/vendor/librarian/spec/functional/chef/source/site_spec.rb +215 -0
- data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
- data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
- data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
- data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
- data/vendor/librarian/spec/unit/dependency_spec.rb +30 -0
- data/vendor/librarian/spec/unit/dsl_spec.rb +194 -0
- data/vendor/librarian/spec/unit/environment_spec.rb +9 -0
- data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
- data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
- data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
- data/vendor/librarian/spec/unit/manifest_spec.rb +30 -0
- data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
- data/vendor/librarian/spec/unit/resolver_spec.rb +192 -0
- data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
- data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
- metadata +163 -0
@@ -0,0 +1,202 @@
|
|
1
|
+
require 'librarian'
|
2
|
+
|
3
|
+
module Librarian
|
4
|
+
describe ManifestSet do
|
5
|
+
|
6
|
+
describe ".new" do
|
7
|
+
let(:jelly) { double(:name => "jelly") }
|
8
|
+
let(:butter) { double(:name => "butter") }
|
9
|
+
let(:jam) { double(:name => "jam") }
|
10
|
+
|
11
|
+
let(:array) { [jelly, butter, jam] }
|
12
|
+
let(:hash) { {"jelly" => jelly, "butter" => butter, "jam" => jam} }
|
13
|
+
|
14
|
+
context "with an array" do
|
15
|
+
let(:set) { described_class.new(array) }
|
16
|
+
|
17
|
+
it "should give back the array" do
|
18
|
+
set.to_a.should =~ array
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should give back the hash" do
|
22
|
+
set.to_hash.should == hash
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with a hash" do
|
27
|
+
let(:set) { described_class.new(hash) }
|
28
|
+
|
29
|
+
it "should give back the array" do
|
30
|
+
set.to_a.should =~ array
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should give back the hash" do
|
34
|
+
set.to_hash.should == hash
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Does not trace dependencies.
|
40
|
+
# That's why it's "shallow".
|
41
|
+
describe "#shallow_strip!" do
|
42
|
+
let(:jelly) { double(:name => "jelly") }
|
43
|
+
let(:butter) { double(:name => "butter") }
|
44
|
+
let(:jam) { double(:name => "jam") }
|
45
|
+
|
46
|
+
let(:set) { described_class.new([jelly, butter, jam]) }
|
47
|
+
|
48
|
+
it "should not do anything when given no names" do
|
49
|
+
set.shallow_strip!([])
|
50
|
+
|
51
|
+
set.to_a.should =~ [jelly, butter, jam]
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should remove only the named elements" do
|
55
|
+
set.shallow_strip!(["butter", "jam"])
|
56
|
+
|
57
|
+
set.to_a.should =~ [jelly]
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should allow removing all the elements" do
|
61
|
+
set.shallow_strip!(["jelly", "butter", "jam"])
|
62
|
+
|
63
|
+
set.to_a.should =~ []
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Does not trace dependencies.
|
68
|
+
# That's why it's "shallow".
|
69
|
+
describe "#shallow_keep!" do
|
70
|
+
let(:jelly) { double(:name => "jelly") }
|
71
|
+
let(:butter) { double(:name => "butter") }
|
72
|
+
let(:jam) { double(:name => "jam") }
|
73
|
+
|
74
|
+
let(:set) { described_class.new([jelly, butter, jam]) }
|
75
|
+
|
76
|
+
it "should empty the set when given no names" do
|
77
|
+
set.shallow_keep!([])
|
78
|
+
|
79
|
+
set.to_a.should =~ []
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should keep only the named elements" do
|
83
|
+
set.shallow_keep!(["butter", "jam"])
|
84
|
+
|
85
|
+
set.to_a.should =~ [butter, jam]
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should allow keeping all the elements" do
|
89
|
+
set.shallow_keep!(["jelly", "butter", "jam"])
|
90
|
+
|
91
|
+
set.to_a.should =~ [jelly, butter, jam]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#deep_strip!" do
|
96
|
+
def man(o)
|
97
|
+
k, v = o.keys.first, o.values.first
|
98
|
+
double(k, :name => k, :dependencies => deps(v))
|
99
|
+
end
|
100
|
+
|
101
|
+
def deps(names)
|
102
|
+
names.map{|n| double(:name => n)}
|
103
|
+
end
|
104
|
+
|
105
|
+
let(:a) { man("a" => %w[b c]) }
|
106
|
+
let(:b) { man("b" => %w[c d]) }
|
107
|
+
let(:c) { man("c" => %w[ ]) }
|
108
|
+
let(:d) { man("d" => %w[ ]) }
|
109
|
+
|
110
|
+
let(:e) { man("e" => %w[f g]) }
|
111
|
+
let(:f) { man("f" => %w[g h]) }
|
112
|
+
let(:g) { man("g" => %w[ ]) }
|
113
|
+
let(:h) { man("h" => %w[ ]) }
|
114
|
+
|
115
|
+
let(:set) { described_class.new([a, b, c, d, e, f, g, h]) }
|
116
|
+
|
117
|
+
it "should not do anything when given no names" do
|
118
|
+
set.deep_strip!([])
|
119
|
+
|
120
|
+
set.to_a.should =~ [a, b, c, d, e, f, g, h]
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should remove just the named elements if they have no dependencies" do
|
124
|
+
set.deep_strip!(["c", "h"])
|
125
|
+
|
126
|
+
set.to_a.should =~ [a, b, d, e, f, g]
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should remove the named elements and all their dependencies" do
|
130
|
+
set.deep_strip!(["b"])
|
131
|
+
|
132
|
+
set.to_a.should =~ [a, e, f, g, h]
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should remove an entire tree of dependencies" do
|
136
|
+
set.deep_strip!(["e"])
|
137
|
+
|
138
|
+
set.to_a.should =~ [a, b, c, d]
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should allow removing all the elements" do
|
142
|
+
set.deep_strip!(["a", "e"])
|
143
|
+
|
144
|
+
set.to_a.should =~ []
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "#deep_keep!" do
|
149
|
+
def man(o)
|
150
|
+
k, v = o.keys.first, o.values.first
|
151
|
+
double(k, :name => k, :dependencies => deps(v))
|
152
|
+
end
|
153
|
+
|
154
|
+
def deps(names)
|
155
|
+
names.map{|n| double(:name => n)}
|
156
|
+
end
|
157
|
+
|
158
|
+
let(:a) { man("a" => %w[b c]) }
|
159
|
+
let(:b) { man("b" => %w[c d]) }
|
160
|
+
let(:c) { man("c" => %w[ ]) }
|
161
|
+
let(:d) { man("d" => %w[ ]) }
|
162
|
+
|
163
|
+
let(:e) { man("e" => %w[f g]) }
|
164
|
+
let(:f) { man("f" => %w[g h]) }
|
165
|
+
let(:g) { man("g" => %w[ ]) }
|
166
|
+
let(:h) { man("h" => %w[ ]) }
|
167
|
+
|
168
|
+
let(:set) { described_class.new([a, b, c, d, e, f, g, h]) }
|
169
|
+
|
170
|
+
it "should remove all the elements when given no names" do
|
171
|
+
set.deep_keep!([])
|
172
|
+
|
173
|
+
set.to_a.should =~ []
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should keep just the named elements if they have no dependencies" do
|
177
|
+
set.deep_keep!(["c", "h"])
|
178
|
+
|
179
|
+
set.to_a.should =~ [c, h]
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should keep the named elements and all their dependencies" do
|
183
|
+
set.deep_keep!(["b"])
|
184
|
+
|
185
|
+
set.to_a.should =~ [b, c, d]
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should keep an entire tree of dependencies" do
|
189
|
+
set.deep_keep!(["e"])
|
190
|
+
|
191
|
+
set.to_a.should =~ [e, f, g, h]
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should allow keeping all the elements" do
|
195
|
+
set.deep_keep!(["a", "e"])
|
196
|
+
|
197
|
+
set.to_a.should =~ [a, b, c, d, e, f, g, h]
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "librarian/manifest"
|
2
|
+
|
3
|
+
describe Librarian::Manifest do
|
4
|
+
|
5
|
+
describe "validations" do
|
6
|
+
|
7
|
+
context "when the name is blank" do
|
8
|
+
it "raises" do
|
9
|
+
expect { described_class.new(nil, "") }.
|
10
|
+
to raise_error(ArgumentError, %{name ("") must be sensible})
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when the name has leading whitespace" do
|
15
|
+
it "raises" do
|
16
|
+
expect { described_class.new(nil, " the-name") }.
|
17
|
+
to raise_error(ArgumentError, %{name (" the-name") must be sensible})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when the name has trailing whitespace" do
|
22
|
+
it "raises" do
|
23
|
+
expect { described_class.new(nil, "the-name ") }.
|
24
|
+
to raise_error(ArgumentError, %{name ("the-name ") must be sensible})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "librarian/mock"
|
2
|
+
|
3
|
+
module Librarian
|
4
|
+
module Mock
|
5
|
+
module Source
|
6
|
+
describe Mock do
|
7
|
+
|
8
|
+
let(:env) { Librarian::Mock::Environment.new }
|
9
|
+
|
10
|
+
describe ".new" do
|
11
|
+
|
12
|
+
let(:source) { described_class.new(env, "source-a", {}) }
|
13
|
+
subject { source }
|
14
|
+
|
15
|
+
its(:environment) { should_not be_nil }
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require 'librarian/resolver'
|
2
|
+
require 'librarian/spec_change_set'
|
3
|
+
require 'librarian/mock'
|
4
|
+
|
5
|
+
module Librarian
|
6
|
+
describe Resolver do
|
7
|
+
|
8
|
+
let(:env) { Mock::Environment.new }
|
9
|
+
let(:resolver) { env.resolver }
|
10
|
+
|
11
|
+
context "a simple specfile" do
|
12
|
+
|
13
|
+
before do
|
14
|
+
env.registry :clear => true do
|
15
|
+
source 'source-1' do
|
16
|
+
spec 'butter', '1.1'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:spec) do
|
22
|
+
env.dsl do
|
23
|
+
src 'source-1'
|
24
|
+
dep 'butter'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:resolution) { resolver.resolve(spec) }
|
29
|
+
|
30
|
+
specify { resolution.should be_correct }
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
context "a specfile with a dep from one src depending on a dep from another src" do
|
35
|
+
|
36
|
+
before do
|
37
|
+
env.registry :clear => true do
|
38
|
+
source 'source-1' do
|
39
|
+
spec 'butter', '1.1'
|
40
|
+
end
|
41
|
+
source 'source-2' do
|
42
|
+
spec 'jam', '1.2' do
|
43
|
+
dependency 'butter', '>= 1.0'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:spec) do
|
50
|
+
env.dsl do
|
51
|
+
src 'source-1'
|
52
|
+
src 'source-2' do
|
53
|
+
dep 'jam'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:resolution) { resolver.resolve(spec) }
|
59
|
+
|
60
|
+
specify { resolution.should be_correct }
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
context "a specfile with a dep depending on a nonexistent dep" do
|
65
|
+
|
66
|
+
before do
|
67
|
+
env.registry :clear => true do
|
68
|
+
source 'source-1' do
|
69
|
+
spec 'jam', '1.2' do
|
70
|
+
dependency 'butter', '>= 1.0'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
let(:spec) do
|
77
|
+
env.dsl do
|
78
|
+
src 'source-1'
|
79
|
+
dep 'jam'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
let(:resolution) { resolver.resolve(spec) }
|
84
|
+
|
85
|
+
specify { resolution.should_not be_correct }
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
context "a specfile with conflicting constraints" do
|
90
|
+
|
91
|
+
before do
|
92
|
+
env.registry :clear => true do
|
93
|
+
source 'source-1' do
|
94
|
+
spec 'butter', '1.0'
|
95
|
+
spec 'butter', '1.1'
|
96
|
+
spec 'jam', '1.2' do
|
97
|
+
dependency 'butter', '1.1'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
let(:spec) do
|
104
|
+
env.dsl do
|
105
|
+
src 'source-1'
|
106
|
+
dep 'butter', '1.0'
|
107
|
+
dep 'jam'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
let(:resolution) { resolver.resolve(spec) }
|
112
|
+
|
113
|
+
specify { resolution.should_not be_correct }
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
context "updating" do
|
118
|
+
|
119
|
+
it "should not work" do
|
120
|
+
env.registry :clear => true do
|
121
|
+
source 'source-1' do
|
122
|
+
spec 'butter', '1.0'
|
123
|
+
spec 'butter', '1.1'
|
124
|
+
spec 'jam', '1.2' do
|
125
|
+
dependency 'butter'
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
first_spec = env.dsl do
|
130
|
+
src 'source-1'
|
131
|
+
dep 'butter', '1.1'
|
132
|
+
dep 'jam'
|
133
|
+
end
|
134
|
+
first_resolution = resolver.resolve(first_spec)
|
135
|
+
first_resolution.should be_correct
|
136
|
+
first_manifests = first_resolution.manifests
|
137
|
+
first_manifests_index = Hash[first_manifests.map{|m| [m.name, m]}]
|
138
|
+
first_manifests_index['butter'].version.to_s.should == '1.1'
|
139
|
+
|
140
|
+
second_spec = env.dsl do
|
141
|
+
src 'source-1'
|
142
|
+
dep 'butter', '1.0'
|
143
|
+
dep 'jam'
|
144
|
+
end
|
145
|
+
locked_manifests = ManifestSet.deep_strip(first_manifests, ['butter'])
|
146
|
+
second_resolution =resolver.resolve(second_spec, locked_manifests)
|
147
|
+
second_resolution.should be_correct
|
148
|
+
second_manifests = second_resolution.manifests
|
149
|
+
second_manifests_index = Hash[second_manifests.map{|m| [m.name, m]}]
|
150
|
+
second_manifests_index['butter'].version.to_s.should == '1.0'
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
context "a change to the spec" do
|
156
|
+
|
157
|
+
it "should work" do
|
158
|
+
env.registry :clear => true do
|
159
|
+
source 'source-1' do
|
160
|
+
spec 'butter', '1.0'
|
161
|
+
end
|
162
|
+
source 'source-2' do
|
163
|
+
spec 'butter', '1.0'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
spec = env.dsl do
|
167
|
+
src 'source-1'
|
168
|
+
dep 'butter'
|
169
|
+
end
|
170
|
+
lock = resolver.resolve(spec)
|
171
|
+
lock.should be_correct
|
172
|
+
|
173
|
+
spec = env.dsl do
|
174
|
+
src 'source-1'
|
175
|
+
dep 'butter', :src => 'source-2'
|
176
|
+
end
|
177
|
+
changes = SpecChangeSet.new(env, spec, lock)
|
178
|
+
changes.should_not be_same
|
179
|
+
manifests = ManifestSet.new(changes.analyze).to_hash
|
180
|
+
manifests.should_not have_key('butter')
|
181
|
+
lock = resolver.resolve(spec, changes.analyze)
|
182
|
+
lock.should be_correct
|
183
|
+
lock.manifests.map{|m| m.name}.should include('butter')
|
184
|
+
manifest = lock.manifests.find{|m| m.name == 'butter'}
|
185
|
+
manifest.should_not be_nil
|
186
|
+
manifest.source.name.should == 'source-2'
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "librarian"
|
2
|
+
|
3
|
+
module Librarian
|
4
|
+
module Source
|
5
|
+
describe Git do
|
6
|
+
|
7
|
+
let(:env) { Environment.new }
|
8
|
+
|
9
|
+
describe "validating options for the specfile" do
|
10
|
+
|
11
|
+
context "with only known options" do
|
12
|
+
it "should not raise" do
|
13
|
+
expect { described_class.from_spec_args(env, "some://git/repo.git", :ref => "megapatches") }.
|
14
|
+
to_not raise_error
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with an unknown option" do
|
19
|
+
it "should raise" do
|
20
|
+
expect { described_class.from_spec_args(env, "some://git/repo.git", :branch => "megapatches") }.
|
21
|
+
to raise_error Error, "unrecognized options: branch"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|