bundler 1.6.9 → 1.7.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.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +6 -19
- data/Rakefile +2 -2
- data/bundler.gemspec +0 -1
- data/lib/bundler.rb +1 -0
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/install.rb +10 -1
- data/lib/bundler/cli/package.rb +1 -1
- data/lib/bundler/definition.rb +35 -42
- data/lib/bundler/dsl.rb +46 -46
- data/lib/bundler/fetcher.rb +4 -1
- data/lib/bundler/index.rb +16 -2
- data/lib/bundler/installer.rb +4 -5
- data/lib/bundler/lockfile_parser.rb +20 -7
- data/lib/bundler/runtime.rb +1 -1
- data/lib/bundler/source.rb +3 -0
- data/lib/bundler/source/rubygems.rb +23 -16
- data/lib/bundler/source_list.rb +79 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +5 -29
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-config.ronn +1 -16
- data/man/gemfile.5.ronn +44 -29
- data/spec/bundler/definition_spec.rb +2 -1
- data/spec/bundler/{source_spec.rb → source/rubygems_spec.rb} +0 -0
- data/spec/bundler/source_list_spec.rb +382 -0
- data/spec/install/gemfile_spec.rb +0 -25
- data/spec/install/gems/sources_spec.rb +247 -0
- data/spec/lock/lockfile_spec.rb +1 -42
- data/spec/other/ssl_cert_spec.rb +1 -14
- data/spec/quality_spec.rb +1 -1
- data/spec/realworld/parallel_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -6
- data/spec/update/git_spec.rb +47 -0
- data/spec/update/path_spec.rb +18 -0
- metadata +11 -22
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/spec/update/source_spec.rb +0 -63
@@ -4,11 +4,12 @@ require 'bundler/definition'
|
|
4
4
|
describe Bundler::Definition do
|
5
5
|
before do
|
6
6
|
allow(Bundler).to receive(:settings){ Bundler::Settings.new(".") }
|
7
|
+
allow(Bundler).to receive(:default_gemfile){ Pathname.new("Gemfile") }
|
7
8
|
end
|
8
9
|
|
9
10
|
describe "#lock" do
|
10
11
|
context "when it's not possible to write to the file" do
|
11
|
-
subject{ Bundler::Definition.new(nil, [],
|
12
|
+
subject{ Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
|
12
13
|
|
13
14
|
it "raises an InstallError with explanation" do
|
14
15
|
expect(File).to receive(:open).with("Gemfile.lock", "wb").
|
File without changes
|
@@ -0,0 +1,382 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bundler::SourceList do
|
4
|
+
before do
|
5
|
+
Bundler.stub(:root) { Pathname.new '/' }
|
6
|
+
end
|
7
|
+
|
8
|
+
subject(:source_list) { Bundler::SourceList.new }
|
9
|
+
|
10
|
+
let(:rubygems_aggregate) { Bundler::Source::Rubygems.new }
|
11
|
+
|
12
|
+
describe "adding sources" do
|
13
|
+
before do
|
14
|
+
source_list.add_path_source('path' => '/existing/path/to/gem')
|
15
|
+
source_list.add_git_source('uri' => 'git://existing-git.org/path.git')
|
16
|
+
source_list.add_rubygems_source('remotes' => ['https://existing-rubygems.org'])
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#add_path_source" do
|
20
|
+
before do
|
21
|
+
@duplicate = source_list.add_path_source('path' => '/path/to/gem')
|
22
|
+
@new_source = source_list.add_path_source('path' => '/path/to/gem')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns the new path source" do
|
26
|
+
expect(@new_source).to be_instance_of(Bundler::Source::Path)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "passes the provided options to the new source" do
|
30
|
+
expect(@new_source.options).to eq('path' => '/path/to/gem')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "adds the source to the beginning of path_sources" do
|
34
|
+
expect(source_list.path_sources.first).to equal(@new_source)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "removes existing duplicates" do
|
38
|
+
expect(source_list.path_sources).not_to include equal(@duplicate)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#add_git_source" do
|
43
|
+
before do
|
44
|
+
@duplicate = source_list.add_git_source('uri' => 'git://host/path.git')
|
45
|
+
@new_source = source_list.add_git_source('uri' => 'git://host/path.git')
|
46
|
+
end
|
47
|
+
|
48
|
+
it "returns the new git source" do
|
49
|
+
expect(@new_source).to be_instance_of(Bundler::Source::Git)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "passes the provided options to the new source" do
|
53
|
+
expect(@new_source.options).to eq('uri' => 'git://host/path.git')
|
54
|
+
end
|
55
|
+
|
56
|
+
it "adds the source to the beginning of git_sources" do
|
57
|
+
expect(source_list.git_sources.first).to equal(@new_source)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "removes existing duplicates" do
|
61
|
+
expect(source_list.git_sources).not_to include equal(@duplicate)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#add_rubygems_source" do
|
66
|
+
before do
|
67
|
+
@duplicate = source_list.add_rubygems_source('remotes' => ['https://rubygems.org/'])
|
68
|
+
@new_source = source_list.add_rubygems_source('remotes' => ['https://rubygems.org/'])
|
69
|
+
end
|
70
|
+
|
71
|
+
it "returns the new rubygems source" do
|
72
|
+
expect(@new_source).to be_instance_of(Bundler::Source::Rubygems)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "passes the provided options to the new source" do
|
76
|
+
expect(@new_source.options).to eq('remotes' => ['https://rubygems.org/'])
|
77
|
+
end
|
78
|
+
|
79
|
+
it "adds the source to the beginning of rubygems_sources" do
|
80
|
+
expect(source_list.rubygems_sources.first).to equal(@new_source)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "removes duplicates" do
|
84
|
+
expect(source_list.rubygems_sources).not_to include equal(@duplicate)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#add_rubygems_remote" do
|
89
|
+
before do
|
90
|
+
@returned_source = source_list.add_rubygems_remote('https://rubygems.org/')
|
91
|
+
end
|
92
|
+
|
93
|
+
it "returns the aggregate rubygems source" do
|
94
|
+
expect(@returned_source).to be_instance_of(Bundler::Source::Rubygems)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "adds the provided remote to the beginning of the aggregate source" do
|
98
|
+
source_list.add_rubygems_remote('https://othersource.org')
|
99
|
+
expect(@returned_source.remotes.first).to eq(URI('https://othersource.org/'))
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#all_sources" do
|
105
|
+
it "includes the aggregate rubygems source when rubygems sources have been added" do
|
106
|
+
source_list.add_git_source('uri' => 'git://host/path.git')
|
107
|
+
source_list.add_rubygems_source('remotes' => ['https://rubygems.org'])
|
108
|
+
source_list.add_path_source('path' => '/path/to/gem')
|
109
|
+
|
110
|
+
expect(source_list.all_sources).to include rubygems_aggregate
|
111
|
+
end
|
112
|
+
|
113
|
+
it "includes the aggregate rubygems source when no rubygems sources have been added" do
|
114
|
+
source_list.add_git_source('uri' => 'git://host/path.git')
|
115
|
+
source_list.add_path_source('path' => '/path/to/gem')
|
116
|
+
|
117
|
+
expect(source_list.all_sources).to include rubygems_aggregate
|
118
|
+
end
|
119
|
+
|
120
|
+
it "returns path sources before git sources before rubygems sources before the aggregate" do
|
121
|
+
source_list.add_git_source('uri' => 'git://host/path.git')
|
122
|
+
source_list.add_rubygems_source('remotes' => ['https://rubygems.org'])
|
123
|
+
source_list.add_path_source('path' => '/path/to/gem')
|
124
|
+
|
125
|
+
expect(source_list.all_sources).to eq [
|
126
|
+
Bundler::Source::Path.new('path' => '/path/to/gem'),
|
127
|
+
Bundler::Source::Git.new('uri' => 'git://host/path.git'),
|
128
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://rubygems.org']),
|
129
|
+
rubygems_aggregate,
|
130
|
+
]
|
131
|
+
end
|
132
|
+
|
133
|
+
it "returns sources of the same type in the reverse order that they were added" do
|
134
|
+
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
|
135
|
+
source_list.add_rubygems_source('remotes' => ['https://fifth-rubygems.org'])
|
136
|
+
source_list.add_path_source('path' => '/third/path/to/gem')
|
137
|
+
source_list.add_rubygems_source('remotes' => ['https://fourth-rubygems.org'])
|
138
|
+
source_list.add_path_source('path' => '/second/path/to/gem')
|
139
|
+
source_list.add_rubygems_source('remotes' => ['https://third-rubygems.org'])
|
140
|
+
source_list.add_git_source('uri' => 'git://second-git.org/path.git')
|
141
|
+
source_list.add_rubygems_source('remotes' => ['https://second-rubygems.org'])
|
142
|
+
source_list.add_path_source('path' => '/first/path/to/gem')
|
143
|
+
source_list.add_rubygems_source('remotes' => ['https://first-rubygems.org'])
|
144
|
+
source_list.add_git_source('uri' => 'git://first-git.org/path.git')
|
145
|
+
|
146
|
+
expect(source_list.all_sources).to eq [
|
147
|
+
Bundler::Source::Path.new('path' => '/first/path/to/gem'),
|
148
|
+
Bundler::Source::Path.new('path' => '/second/path/to/gem'),
|
149
|
+
Bundler::Source::Path.new('path' => '/third/path/to/gem'),
|
150
|
+
Bundler::Source::Git.new('uri' => 'git://first-git.org/path.git'),
|
151
|
+
Bundler::Source::Git.new('uri' => 'git://second-git.org/path.git'),
|
152
|
+
Bundler::Source::Git.new('uri' => 'git://third-git.org/path.git'),
|
153
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://first-rubygems.org']),
|
154
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://second-rubygems.org']),
|
155
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://third-rubygems.org']),
|
156
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://fourth-rubygems.org']),
|
157
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://fifth-rubygems.org']),
|
158
|
+
rubygems_aggregate,
|
159
|
+
]
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "#path_sources" do
|
164
|
+
it "returns an empty array when no path sources have been added" do
|
165
|
+
source_list.add_rubygems_remote('https://rubygems.org')
|
166
|
+
source_list.add_git_source('uri' => 'git://host/path.git')
|
167
|
+
expect(source_list.path_sources).to be_empty
|
168
|
+
end
|
169
|
+
|
170
|
+
it "returns path sources in the reverse order that they were added" do
|
171
|
+
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
|
172
|
+
source_list.add_rubygems_remote('https://fifth-rubygems.org')
|
173
|
+
source_list.add_path_source('path' => '/third/path/to/gem')
|
174
|
+
source_list.add_rubygems_remote('https://fourth-rubygems.org')
|
175
|
+
source_list.add_path_source('path' => '/second/path/to/gem')
|
176
|
+
source_list.add_rubygems_remote('https://third-rubygems.org')
|
177
|
+
source_list.add_git_source('uri' => 'git://second-git.org/path.git')
|
178
|
+
source_list.add_rubygems_remote('https://second-rubygems.org')
|
179
|
+
source_list.add_path_source('path' => '/first/path/to/gem')
|
180
|
+
source_list.add_rubygems_remote('https://first-rubygems.org')
|
181
|
+
source_list.add_git_source('uri' => 'git://first-git.org/path.git')
|
182
|
+
|
183
|
+
expect(source_list.path_sources).to eq [
|
184
|
+
Bundler::Source::Path.new('path' => '/first/path/to/gem'),
|
185
|
+
Bundler::Source::Path.new('path' => '/second/path/to/gem'),
|
186
|
+
Bundler::Source::Path.new('path' => '/third/path/to/gem'),
|
187
|
+
]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe "#git_sources" do
|
192
|
+
it "returns an empty array when no git sources have been added" do
|
193
|
+
source_list.add_rubygems_remote('https://rubygems.org')
|
194
|
+
source_list.add_path_source('path' => '/path/to/gem')
|
195
|
+
|
196
|
+
expect(source_list.git_sources).to be_empty
|
197
|
+
end
|
198
|
+
|
199
|
+
it "returns git sources in the reverse order that they were added" do
|
200
|
+
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
|
201
|
+
source_list.add_rubygems_remote('https://fifth-rubygems.org')
|
202
|
+
source_list.add_path_source('path' => '/third/path/to/gem')
|
203
|
+
source_list.add_rubygems_remote('https://fourth-rubygems.org')
|
204
|
+
source_list.add_path_source('path' => '/second/path/to/gem')
|
205
|
+
source_list.add_rubygems_remote('https://third-rubygems.org')
|
206
|
+
source_list.add_git_source('uri' => 'git://second-git.org/path.git')
|
207
|
+
source_list.add_rubygems_remote('https://second-rubygems.org')
|
208
|
+
source_list.add_path_source('path' => '/first/path/to/gem')
|
209
|
+
source_list.add_rubygems_remote('https://first-rubygems.org')
|
210
|
+
source_list.add_git_source('uri' => 'git://first-git.org/path.git')
|
211
|
+
|
212
|
+
expect(source_list.git_sources).to eq [
|
213
|
+
Bundler::Source::Git.new('uri' => 'git://first-git.org/path.git'),
|
214
|
+
Bundler::Source::Git.new('uri' => 'git://second-git.org/path.git'),
|
215
|
+
Bundler::Source::Git.new('uri' => 'git://third-git.org/path.git'),
|
216
|
+
]
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
describe "#rubygems_sources" do
|
221
|
+
it "includes the aggregate rubygems source when rubygems sources have been added" do
|
222
|
+
source_list.add_git_source('uri' => 'git://host/path.git')
|
223
|
+
source_list.add_rubygems_source('remotes' => ['https://rubygems.org'])
|
224
|
+
source_list.add_path_source('path' => '/path/to/gem')
|
225
|
+
|
226
|
+
expect(source_list.rubygems_sources).to include rubygems_aggregate
|
227
|
+
end
|
228
|
+
|
229
|
+
it "returns only the aggregate rubygems source when no rubygems sources have been added" do
|
230
|
+
source_list.add_git_source('uri' => 'git://host/path.git')
|
231
|
+
source_list.add_path_source('path' => '/path/to/gem')
|
232
|
+
|
233
|
+
expect(source_list.rubygems_sources).to eq [rubygems_aggregate]
|
234
|
+
end
|
235
|
+
|
236
|
+
it "returns rubygems sources in the reverse order that they were added" do
|
237
|
+
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
|
238
|
+
source_list.add_rubygems_source('remotes' => ['https://fifth-rubygems.org'])
|
239
|
+
source_list.add_path_source('path' => '/third/path/to/gem')
|
240
|
+
source_list.add_rubygems_source('remotes' => ['https://fourth-rubygems.org'])
|
241
|
+
source_list.add_path_source('path' => '/second/path/to/gem')
|
242
|
+
source_list.add_rubygems_source('remotes' => ['https://third-rubygems.org'])
|
243
|
+
source_list.add_git_source('uri' => 'git://second-git.org/path.git')
|
244
|
+
source_list.add_rubygems_source('remotes' => ['https://second-rubygems.org'])
|
245
|
+
source_list.add_path_source('path' => '/first/path/to/gem')
|
246
|
+
source_list.add_rubygems_source('remotes' => ['https://first-rubygems.org'])
|
247
|
+
source_list.add_git_source('uri' => 'git://first-git.org/path.git')
|
248
|
+
|
249
|
+
expect(source_list.rubygems_sources).to eq [
|
250
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://first-rubygems.org']),
|
251
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://second-rubygems.org']),
|
252
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://third-rubygems.org']),
|
253
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://fourth-rubygems.org']),
|
254
|
+
Bundler::Source::Rubygems.new('remotes' => ['https://fifth-rubygems.org']),
|
255
|
+
rubygems_aggregate,
|
256
|
+
]
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
describe "#get" do
|
261
|
+
context "when it includes an equal source" do
|
262
|
+
let(:rubygems_source) { Bundler::Source::Rubygems.new('remotes' => ['https://rubygems.org']) }
|
263
|
+
before { @equal_source = source_list.add_rubygems_remote('https://rubygems.org') }
|
264
|
+
|
265
|
+
it "returns the equal source" do
|
266
|
+
expect(source_list.get(rubygems_source)).to be @equal_source
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
context "when it does not include an equal source" do
|
271
|
+
let(:path_source) { Bundler::Source::Path.new('path' => '/path/to/gem') }
|
272
|
+
|
273
|
+
it "returns nil" do
|
274
|
+
expect(source_list.get(path_source)).to be_nil
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
describe "#lock_sources" do
|
280
|
+
it "combines the rubygems sources into a single instance, removing duplicate remotes from the front" do
|
281
|
+
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
|
282
|
+
source_list.add_rubygems_source('remotes' => ['https://fourth-rubygems.org']) # intentional duplicate
|
283
|
+
source_list.add_path_source('path' => '/third/path/to/gem')
|
284
|
+
source_list.add_rubygems_source('remotes' => ['https://first-rubygems.org'])
|
285
|
+
source_list.add_path_source('path' => '/second/path/to/gem')
|
286
|
+
source_list.add_rubygems_source('remotes' => ['https://second-rubygems.org'])
|
287
|
+
source_list.add_git_source('uri' => 'git://second-git.org/path.git')
|
288
|
+
source_list.add_rubygems_source('remotes' => ['https://third-rubygems.org'])
|
289
|
+
source_list.add_path_source('path' => '/first/path/to/gem')
|
290
|
+
source_list.add_rubygems_source('remotes' => ['https://fourth-rubygems.org'])
|
291
|
+
source_list.add_git_source('uri' => 'git://first-git.org/path.git')
|
292
|
+
|
293
|
+
expect(source_list.lock_sources).to eq [
|
294
|
+
Bundler::Source::Path.new('path' => '/first/path/to/gem'),
|
295
|
+
Bundler::Source::Path.new('path' => '/second/path/to/gem'),
|
296
|
+
Bundler::Source::Path.new('path' => '/third/path/to/gem'),
|
297
|
+
Bundler::Source::Git.new('uri' => 'git://first-git.org/path.git'),
|
298
|
+
Bundler::Source::Git.new('uri' => 'git://second-git.org/path.git'),
|
299
|
+
Bundler::Source::Git.new('uri' => 'git://third-git.org/path.git'),
|
300
|
+
Bundler::Source::Rubygems.new('remotes' => [
|
301
|
+
'https://first-rubygems.org',
|
302
|
+
'https://second-rubygems.org',
|
303
|
+
'https://third-rubygems.org',
|
304
|
+
'https://fourth-rubygems.org',
|
305
|
+
]),
|
306
|
+
]
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
describe "replace_sources!" do
|
311
|
+
let(:existing_locked_source) { Bundler::Source::Path.new('path' => '/existing/path') }
|
312
|
+
let(:removed_locked_source) { Bundler::Source::Path.new('path' => '/removed/path') }
|
313
|
+
|
314
|
+
let(:locked_sources) { [existing_locked_source, removed_locked_source] }
|
315
|
+
|
316
|
+
before do
|
317
|
+
@existing_source = source_list.add_path_source('path' => '/existing/path')
|
318
|
+
@new_source = source_list.add_path_source('path' => '/new/path')
|
319
|
+
source_list.replace_sources!(locked_sources)
|
320
|
+
end
|
321
|
+
|
322
|
+
it "maintains the order and number of sources" do
|
323
|
+
expect(source_list.path_sources).to eq [@new_source, @existing_source]
|
324
|
+
end
|
325
|
+
|
326
|
+
it "retains the same instance of the new source" do
|
327
|
+
expect(source_list.path_sources[0]).to be @new_source
|
328
|
+
end
|
329
|
+
|
330
|
+
it "replaces the instance of the existing source" do
|
331
|
+
expect(source_list.path_sources[1]).to be existing_locked_source
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
describe "#cached!" do
|
336
|
+
let(:rubygems_source) { source_list.add_rubygems_remote('https://rubygems.org') }
|
337
|
+
let(:git_source) { source_list.add_git_source('uri' => 'git://host/path.git') }
|
338
|
+
let(:path_source) { source_list.add_path_source('path' => '/path/to/gem') }
|
339
|
+
|
340
|
+
before do
|
341
|
+
rubygems_source.stub(:cached!)
|
342
|
+
git_source.stub(:cached!)
|
343
|
+
path_source.stub(:cached!)
|
344
|
+
source_list.cached!
|
345
|
+
end
|
346
|
+
|
347
|
+
it "calls #cached! on the included rubygems source" do
|
348
|
+
expect(rubygems_source).to have_received(:cached!)
|
349
|
+
end
|
350
|
+
|
351
|
+
it "calls #cached! on the included git source" do
|
352
|
+
expect(git_source).to have_received(:cached!)
|
353
|
+
end
|
354
|
+
it "calls #cached! on the included path source" do
|
355
|
+
expect(path_source).to have_received(:cached!)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
describe "#remote!" do
|
360
|
+
let(:rubygems_source) { source_list.add_rubygems_remote('https://rubygems.org') }
|
361
|
+
let(:git_source) { source_list.add_git_source('uri' => 'git://host/path.git') }
|
362
|
+
let(:path_source) { source_list.add_path_source('path' => '/path/to/gem') }
|
363
|
+
|
364
|
+
before do
|
365
|
+
rubygems_source.stub(:remote!)
|
366
|
+
git_source.stub(:remote!)
|
367
|
+
path_source.stub(:remote!)
|
368
|
+
source_list.remote!
|
369
|
+
end
|
370
|
+
|
371
|
+
it "calls #remote! on the included rubygems source" do
|
372
|
+
expect(rubygems_source).to have_received(:remote!)
|
373
|
+
end
|
374
|
+
|
375
|
+
it "calls #remote! on the included git source" do
|
376
|
+
expect(git_source).to have_received(:remote!)
|
377
|
+
end
|
378
|
+
it "calls #remote! on the included path source" do
|
379
|
+
expect(path_source).to have_received(:remote!)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
@@ -41,29 +41,4 @@ describe "bundle install" do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
context "with future features" do
|
45
|
-
context "when source is used with a block" do
|
46
|
-
it "reports that sources with a block is not supported" do
|
47
|
-
gemfile <<-G
|
48
|
-
source 'http://rubygems.example.org' do
|
49
|
-
gem 'rack'
|
50
|
-
end
|
51
|
-
G
|
52
|
-
|
53
|
-
bundle :install
|
54
|
-
expect(out).to match(/A block was passed to `source`/)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "when source is used without a block" do
|
59
|
-
it "prints no warnings" do
|
60
|
-
gemfile <<-G
|
61
|
-
source 'http://rubygems.example.org'
|
62
|
-
G
|
63
|
-
|
64
|
-
bundle :install
|
65
|
-
expect(out).not_to match(/A block was passed to `source`/)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
44
|
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with gems on multiple sources" do
|
4
|
+
# repo1 is built automatically before all of the specs run
|
5
|
+
# it contains rack-obama 1.0.0 and rack 0.9.1 & 1.0.0 amongst other gems
|
6
|
+
|
7
|
+
context "without source affinity" do
|
8
|
+
before do
|
9
|
+
# Oh no! Someone evil is trying to hijack rack :(
|
10
|
+
# need this to be broken to check for correct source ordering
|
11
|
+
build_repo gem_repo3 do
|
12
|
+
build_gem "rack", repo3_rack_version do |s|
|
13
|
+
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when the same version of the same gem is in multiple sources" do
|
19
|
+
let(:repo3_rack_version) { "1.0.0" }
|
20
|
+
|
21
|
+
before do
|
22
|
+
gemfile <<-G
|
23
|
+
source "file://#{gem_repo3}"
|
24
|
+
source "file://#{gem_repo1}"
|
25
|
+
gem "rack-obama"
|
26
|
+
gem "rack"
|
27
|
+
G
|
28
|
+
end
|
29
|
+
|
30
|
+
it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first" do
|
31
|
+
bundle :install
|
32
|
+
|
33
|
+
expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
|
34
|
+
expect(out).to include("Installed from: file:#{gem_repo1}")
|
35
|
+
should_be_installed("rack-obama 1.0.0", "rack 1.0.0")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when different versions of the same gem are in multiple sources" do
|
40
|
+
let(:repo3_rack_version) { "1.2" }
|
41
|
+
|
42
|
+
before do
|
43
|
+
gemfile <<-G
|
44
|
+
source "file://#{gem_repo3}"
|
45
|
+
source "file://#{gem_repo1}"
|
46
|
+
gem "rack-obama"
|
47
|
+
gem "rack", "1.0.0" # force it to install the working version in repo1
|
48
|
+
G
|
49
|
+
end
|
50
|
+
|
51
|
+
it "warns about ambiguous gems, but installs anyway" do
|
52
|
+
bundle :install
|
53
|
+
|
54
|
+
expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
|
55
|
+
expect(out).to include("Installed from: file:#{gem_repo1}")
|
56
|
+
should_be_installed("rack-obama 1.0.0", "rack 1.0.0")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "with source affinity" do
|
62
|
+
context "with sources given by a block" do
|
63
|
+
before do
|
64
|
+
# Oh no! Someone evil is trying to hijack rack :(
|
65
|
+
# need this to be broken to check for correct source ordering
|
66
|
+
build_repo gem_repo3 do
|
67
|
+
build_gem "rack", "1.0.0" do |s|
|
68
|
+
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
gemfile <<-G
|
73
|
+
source "file://#{gem_repo3}"
|
74
|
+
source "file://#{gem_repo1}" do
|
75
|
+
gem "rack"
|
76
|
+
end
|
77
|
+
gem "rack-obama" # shoud come from repo3!
|
78
|
+
G
|
79
|
+
end
|
80
|
+
|
81
|
+
it "installs the gems without any warning" do
|
82
|
+
bundle :install
|
83
|
+
expect(out).not_to include("Warning")
|
84
|
+
should_be_installed("rack-obama 1.0.0", "rack 1.0.0")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "with sources set by an option" do
|
89
|
+
before do
|
90
|
+
# Oh no! Someone evil is trying to hijack rack :(
|
91
|
+
# need this to be broken to check for correct source ordering
|
92
|
+
build_repo gem_repo3 do
|
93
|
+
build_gem "rack", "1.0.0" do |s|
|
94
|
+
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
gemfile <<-G
|
99
|
+
source "file://#{gem_repo3}"
|
100
|
+
gem "rack-obama" # should come from repo3!
|
101
|
+
gem "rack", :source => "file://#{gem_repo1}"
|
102
|
+
G
|
103
|
+
end
|
104
|
+
|
105
|
+
it "installs the gems without any warning" do
|
106
|
+
bundle :install
|
107
|
+
expect(out).not_to include("Warning")
|
108
|
+
should_be_installed("rack-obama 1.0.0", "rack 1.0.0")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context "with an indirect dependency" do
|
113
|
+
before do
|
114
|
+
build_repo gem_repo3 do
|
115
|
+
build_gem "depends_on_rack", "1.0.1" do |s|
|
116
|
+
s.add_dependency "rack"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "when the indirect dependency is in the pinned source" do
|
122
|
+
before do
|
123
|
+
# we need a working rack gem in repo3
|
124
|
+
update_repo gem_repo3 do
|
125
|
+
build_gem "rack", "1.0.0"
|
126
|
+
end
|
127
|
+
|
128
|
+
gemfile <<-G
|
129
|
+
source "file://#{gem_repo2}"
|
130
|
+
source "file://#{gem_repo3}" do
|
131
|
+
gem "depends_on_rack"
|
132
|
+
end
|
133
|
+
G
|
134
|
+
end
|
135
|
+
|
136
|
+
context "and not in any other sources" do
|
137
|
+
before do
|
138
|
+
build_repo(gem_repo2) {}
|
139
|
+
end
|
140
|
+
|
141
|
+
it "installs from the same source without any warning" do
|
142
|
+
bundle :install
|
143
|
+
expect(out).not_to include("Warning")
|
144
|
+
should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0")
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context "and in another source" do
|
149
|
+
before do
|
150
|
+
# need this to be broken to check for correct source ordering
|
151
|
+
build_repo gem_repo2 do
|
152
|
+
build_gem "rack", "1.0.0" do |s|
|
153
|
+
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
it "installs from the same source without any warning" do
|
159
|
+
bundle :install
|
160
|
+
expect(out).not_to include("Warning")
|
161
|
+
should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0")
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
context "when the indirect dependency is in a different source" do
|
167
|
+
before do
|
168
|
+
# In these tests, we need a working rack gem in repo2 and not repo3
|
169
|
+
build_repo gem_repo2 do
|
170
|
+
build_gem "rack", "1.0.0"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context "and not in any other sources" do
|
175
|
+
before do
|
176
|
+
gemfile <<-G
|
177
|
+
source "file://#{gem_repo2}"
|
178
|
+
source "file://#{gem_repo3}" do
|
179
|
+
gem "depends_on_rack"
|
180
|
+
end
|
181
|
+
G
|
182
|
+
end
|
183
|
+
|
184
|
+
it "installs from the other source without any warning" do
|
185
|
+
bundle :install
|
186
|
+
expect(out).not_to include("Warning")
|
187
|
+
should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0")
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "and in yet another source" do
|
192
|
+
before do
|
193
|
+
gemfile <<-G
|
194
|
+
source "file://#{gem_repo1}"
|
195
|
+
source "file://#{gem_repo2}"
|
196
|
+
source "file://#{gem_repo3}" do
|
197
|
+
gem "depends_on_rack"
|
198
|
+
end
|
199
|
+
G
|
200
|
+
end
|
201
|
+
|
202
|
+
it "installs from the other source and warns about ambiguous gems" do
|
203
|
+
bundle :install
|
204
|
+
expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
|
205
|
+
expect(out).to include("Installed from: file:#{gem_repo2}")
|
206
|
+
should_be_installed("depends_on_rack 1.0.1", "rack 1.0.0")
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context "with a gem that is only found in the wrong source" do
|
213
|
+
before do
|
214
|
+
build_repo gem_repo3 do
|
215
|
+
build_gem "not_in_repo1", "1.0.0"
|
216
|
+
end
|
217
|
+
|
218
|
+
gemfile <<-G
|
219
|
+
source "file://#{gem_repo3}"
|
220
|
+
gem "not_in_repo1", :source => "file://#{gem_repo1}"
|
221
|
+
G
|
222
|
+
end
|
223
|
+
|
224
|
+
it "does not install the gem" do
|
225
|
+
bundle :install
|
226
|
+
expect(out).to include("Could not find gem 'not_in_repo1 (>= 0) ruby'")
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
context "when an older version of the same gem also ships with Ruby" do
|
232
|
+
before do
|
233
|
+
system_gems "rack-0.9.1"
|
234
|
+
|
235
|
+
gemfile <<-G
|
236
|
+
source "file://#{gem_repo1}"
|
237
|
+
gem "rack" # shoud come from repo1!
|
238
|
+
G
|
239
|
+
end
|
240
|
+
|
241
|
+
it "installs the gems without any warning" do
|
242
|
+
bundle :install
|
243
|
+
expect(out).not_to include("Warning")
|
244
|
+
should_be_installed("rack 1.0.0")
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|