bundler 1.7.15 → 1.8.0.pre
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/.gitignore +5 -14
- data/.rspec +1 -0
- data/.travis.yml +22 -15
- data/CHANGELOG.md +43 -13
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +14 -12
- data/DEVELOPMENT.md +4 -2
- data/ISSUES.md +1 -1
- data/README.md +10 -14
- data/Rakefile +10 -10
- data/bin/bundle +1 -1
- data/bundler.gemspec +5 -4
- data/lib/bundler.rb +22 -3
- data/lib/bundler/anonymizable_uri.rb +24 -8
- data/lib/bundler/cli.rb +103 -66
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/clean.rb +11 -4
- data/lib/bundler/cli/common.rb +2 -0
- data/lib/bundler/cli/console.rb +22 -26
- data/lib/bundler/cli/exec.rb +29 -22
- data/lib/bundler/cli/gem.rb +125 -37
- data/lib/bundler/cli/install.rb +22 -9
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/package.rb +8 -1
- data/lib/bundler/cli/show.rb +29 -3
- data/lib/bundler/cli/update.rb +2 -2
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/definition.rb +14 -22
- data/lib/bundler/dependency.rb +8 -1
- data/lib/bundler/dsl.rb +17 -4
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +44 -25
- data/lib/bundler/fetcher.rb +33 -25
- data/lib/bundler/friendly_errors.rb +38 -5
- data/lib/bundler/gem_helper.rb +16 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/graph.rb +4 -1
- data/lib/bundler/index.rb +15 -25
- data/lib/bundler/installer.rb +6 -6
- data/lib/bundler/lockfile_parser.rb +7 -7
- data/lib/bundler/resolver.rb +2 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +1 -1
- data/lib/bundler/runtime.rb +22 -40
- data/lib/bundler/settings.rb +14 -5
- data/lib/bundler/setup.rb +2 -1
- data/lib/bundler/shared_helpers.rb +56 -4
- data/lib/bundler/source.rb +8 -9
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/git/git_proxy.rb +4 -0
- data/lib/bundler/source/path.rb +8 -11
- data/lib/bundler/source/path/installer.rb +0 -2
- data/lib/bundler/source/rubygems.rb +58 -72
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
- data/lib/bundler/templates/newgem/README.md.tt +9 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +73 -0
- data/man/bundle-config.ronn +17 -15
- data/man/bundle-install.ronn +102 -93
- data/man/bundle-update.ronn +39 -30
- data/man/bundle.ronn +6 -0
- data/man/gemfile.5.ronn +74 -13
- metadata +10 -231
- data/lib/bundler/parallel_workers.rb +0 -18
- data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
- data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
- data/lib/bundler/parallel_workers/worker.rb +0 -69
- data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
- data/spec/bundler/anonymizable_uri_spec.rb +0 -32
- data/spec/bundler/bundler_spec.rb +0 -72
- data/spec/bundler/cli_spec.rb +0 -16
- data/spec/bundler/definition_spec.rb +0 -22
- data/spec/bundler/dsl_spec.rb +0 -82
- data/spec/bundler/friendly_errors_spec.rb +0 -13
- data/spec/bundler/gem_helper_spec.rb +0 -226
- data/spec/bundler/psyched_yaml_spec.rb +0 -8
- data/spec/bundler/retry_spec.rb +0 -59
- data/spec/bundler/settings_spec.rb +0 -13
- data/spec/bundler/source/rubygems_spec.rb +0 -25
- data/spec/bundler/source_list_spec.rb +0 -361
- data/spec/cache/gems_spec.rb +0 -284
- data/spec/cache/git_spec.rb +0 -188
- data/spec/cache/path_spec.rb +0 -121
- data/spec/cache/platform_spec.rb +0 -57
- data/spec/commands/binstubs_spec.rb +0 -219
- data/spec/commands/check_spec.rb +0 -278
- data/spec/commands/clean_spec.rb +0 -592
- data/spec/commands/config_spec.rb +0 -263
- data/spec/commands/console_spec.rb +0 -76
- data/spec/commands/exec_spec.rb +0 -309
- data/spec/commands/help_spec.rb +0 -39
- data/spec/commands/init_spec.rb +0 -39
- data/spec/commands/inject_spec.rb +0 -78
- data/spec/commands/licenses_spec.rb +0 -18
- data/spec/commands/newgem_spec.rb +0 -428
- data/spec/commands/open_spec.rb +0 -68
- data/spec/commands/outdated_spec.rb +0 -156
- data/spec/commands/package_spec.rb +0 -114
- data/spec/commands/show_spec.rb +0 -125
- data/spec/install/binstubs_spec.rb +0 -24
- data/spec/install/bundler_spec.rb +0 -146
- data/spec/install/deploy_spec.rb +0 -250
- data/spec/install/gemfile/gemspec_spec.rb +0 -170
- data/spec/install/gemfile/git_spec.rb +0 -967
- data/spec/install/gemfile/path_spec.rb +0 -500
- data/spec/install/gemfile_spec.rb +0 -44
- data/spec/install/gems/c_ext_spec.rb +0 -48
- data/spec/install/gems/dependency_api_spec.rb +0 -652
- data/spec/install/gems/env_spec.rb +0 -107
- data/spec/install/gems/flex_spec.rb +0 -314
- data/spec/install/gems/groups_spec.rb +0 -308
- data/spec/install/gems/mirror_spec.rb +0 -39
- data/spec/install/gems/platform_spec.rb +0 -195
- data/spec/install/gems/post_install_spec.rb +0 -121
- data/spec/install/gems/resolving_spec.rb +0 -124
- data/spec/install/gems/simple_case_spec.rb +0 -377
- data/spec/install/gems/sources_spec.rb +0 -386
- data/spec/install/gems/standalone_spec.rb +0 -260
- data/spec/install/gems/sudo_spec.rb +0 -136
- data/spec/install/gems/win32_spec.rb +0 -26
- data/spec/install/gemspecs_spec.rb +0 -50
- data/spec/install/path_spec.rb +0 -150
- data/spec/install/post_bundle_message_spec.rb +0 -142
- data/spec/install/prereleases_spec.rb +0 -43
- data/spec/install/security_policy_spec.rb +0 -77
- data/spec/install/upgrade_spec.rb +0 -26
- data/spec/lock/git_spec.rb +0 -34
- data/spec/lock/lockfile_spec.rb +0 -924
- data/spec/other/bundle_ruby_spec.rb +0 -142
- data/spec/other/cli_dispatch_spec.rb +0 -21
- data/spec/other/ext_spec.rb +0 -60
- data/spec/other/platform_spec.rb +0 -1285
- data/spec/other/ssl_cert_spec.rb +0 -23
- data/spec/quality_spec.rb +0 -88
- data/spec/realworld/dependency_api_spec.rb +0 -60
- data/spec/realworld/edgecases_spec.rb +0 -212
- data/spec/realworld/parallel_spec.rb +0 -71
- data/spec/resolver/basic_spec.rb +0 -66
- data/spec/resolver/platform_spec.rb +0 -88
- data/spec/runtime/executable_spec.rb +0 -149
- data/spec/runtime/load_spec.rb +0 -107
- data/spec/runtime/platform_spec.rb +0 -90
- data/spec/runtime/require_spec.rb +0 -332
- data/spec/runtime/setup_spec.rb +0 -853
- data/spec/runtime/with_clean_env_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -123
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint.rb +0 -71
- data/spec/support/artifice/endpoint_500.rb +0 -37
- data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
- data/spec/support/artifice/endpoint_api_missing.rb +0 -16
- data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
- data/spec/support/artifice/endpoint_extra.rb +0 -31
- data/spec/support/artifice/endpoint_extra_api.rb +0 -32
- data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
- data/spec/support/artifice/endpoint_fallback.rb +0 -17
- data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
- data/spec/support/artifice/endpoint_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
- data/spec/support/artifice/endpoint_timeout.rb +0 -13
- data/spec/support/builders.rb +0 -693
- data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
- data/spec/support/fakeweb/windows.rb +0 -23
- data/spec/support/hax.rb +0 -22
- data/spec/support/helpers.rb +0 -361
- data/spec/support/indexes.rb +0 -280
- data/spec/support/matchers.rb +0 -77
- data/spec/support/path.rb +0 -85
- data/spec/support/permissions.rb +0 -10
- data/spec/support/platforms.rb +0 -94
- data/spec/support/ruby_ext.rb +0 -20
- data/spec/support/rubygems_ext.rb +0 -39
- data/spec/support/streams.rb +0 -13
- data/spec/support/sudo.rb +0 -16
- data/spec/update/gems_spec.rb +0 -201
- data/spec/update/git_spec.rb +0 -283
- data/spec/update/path_spec.rb +0 -18
@@ -1,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "bundler"
|
3
|
-
require "bundler/friendly_errors"
|
4
|
-
|
5
|
-
describe Bundler, "friendly errors" do
|
6
|
-
it "rescues Thor::AmbiguousTaskError and raises SystemExit" do
|
7
|
-
expect {
|
8
|
-
Bundler.with_friendly_errors do
|
9
|
-
raise Thor::AmbiguousTaskError.new("")
|
10
|
-
end
|
11
|
-
}.to raise_error(SystemExit)
|
12
|
-
end
|
13
|
-
end
|
@@ -1,226 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require 'rake'
|
3
|
-
require 'bundler/gem_helper'
|
4
|
-
|
5
|
-
describe Bundler::GemHelper do
|
6
|
-
let(:app_name) { "test" }
|
7
|
-
let(:app_path) { bundled_app app_name }
|
8
|
-
let(:app_gemspec_path) { app_path.join("#{app_name}.gemspec") }
|
9
|
-
|
10
|
-
before(:each) do
|
11
|
-
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
|
12
|
-
bundle "gem #{app_name}"
|
13
|
-
end
|
14
|
-
|
15
|
-
context "determining gemspec" do
|
16
|
-
subject { Bundler::GemHelper.new(app_path) }
|
17
|
-
|
18
|
-
context "fails" do
|
19
|
-
it "when there is no gemspec" do
|
20
|
-
FileUtils.rm app_gemspec_path
|
21
|
-
expect { subject }.to raise_error(/Unable to determine name/)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "when there are two gemspecs and the name isn't specified" do
|
25
|
-
FileUtils.touch app_path.join("#{app_name}-2.gemspec")
|
26
|
-
expect { subject }.to raise_error(/Unable to determine name/)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "interpolates the name" do
|
31
|
-
it "when there is only one gemspec" do
|
32
|
-
expect(subject.gemspec.name).to eq(app_name)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "for a hidden gemspec" do
|
36
|
-
FileUtils.mv app_gemspec_path, app_path.join(".gemspec")
|
37
|
-
expect(subject.gemspec.name).to eq(app_name)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it "handles namespaces and converts them to CamelCase" do
|
42
|
-
bundle "gem #{app_name}-foo_bar"
|
43
|
-
app_path = bundled_app "#{app_name}-foo_bar"
|
44
|
-
|
45
|
-
lib = app_path.join("lib/#{app_name}/foo_bar.rb").read
|
46
|
-
expect(lib).to include("module #{app_name.capitalize}")
|
47
|
-
expect(lib).to include("module FooBar")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "gem management" do
|
52
|
-
def mock_confirm_message(message)
|
53
|
-
expect(Bundler.ui).to receive(:confirm).with(message)
|
54
|
-
end
|
55
|
-
|
56
|
-
def mock_build_message(name, version)
|
57
|
-
message = "#{name} #{version} built to pkg/#{name}-#{version}.gem."
|
58
|
-
mock_confirm_message message
|
59
|
-
end
|
60
|
-
|
61
|
-
subject! { Bundler::GemHelper.new(app_path) }
|
62
|
-
let(:app_version) { "0.0.1" }
|
63
|
-
let(:app_gem_dir) { app_path.join("pkg") }
|
64
|
-
let(:app_gem_path) { app_gem_dir.join("#{app_name}-#{app_version}.gem") }
|
65
|
-
let(:app_gemspec_content) { File.read(app_gemspec_path) }
|
66
|
-
|
67
|
-
before(:each) do
|
68
|
-
content = app_gemspec_content.gsub("TODO: ", "")
|
69
|
-
File.open(app_gemspec_path, "w") { |file| file << content }
|
70
|
-
end
|
71
|
-
|
72
|
-
it "uses a shell UI for output" do
|
73
|
-
expect(Bundler.ui).to be_a(Bundler::UI::Shell)
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "#install" do
|
77
|
-
let!(:rake_application) { Rake.application }
|
78
|
-
|
79
|
-
before(:each) do
|
80
|
-
Rake.application = Rake::Application.new
|
81
|
-
end
|
82
|
-
|
83
|
-
after(:each) do
|
84
|
-
Rake.application = rake_application
|
85
|
-
end
|
86
|
-
|
87
|
-
context "defines Rake tasks" do
|
88
|
-
let(:task_names) { %w[build install release] }
|
89
|
-
|
90
|
-
context "before installation" do
|
91
|
-
it "raises an error with appropriate message" do
|
92
|
-
task_names.each do |name|
|
93
|
-
expect { Rake.application[name] }.
|
94
|
-
to raise_error("Don't know how to build task '#{name}'")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context "after installation" do
|
100
|
-
before do
|
101
|
-
subject.install
|
102
|
-
end
|
103
|
-
|
104
|
-
it "adds Rake tasks successfully" do
|
105
|
-
task_names.each do |name|
|
106
|
-
expect { Rake.application[name] }.not_to raise_error
|
107
|
-
expect(Rake.application[name]).to be_instance_of Rake::Task
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
it "provides a way to access the gemspec object" do
|
112
|
-
expect(subject.gemspec.name).to eq(app_name)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "#build_gem" do
|
119
|
-
context "when build failed" do
|
120
|
-
it "raises an error with appropriate message" do
|
121
|
-
# break the gemspec by adding back the TODOs
|
122
|
-
File.open(app_gemspec_path, "w"){ |file| file << app_gemspec_content }
|
123
|
-
expect { subject.build_gem }.to raise_error(/TODO/)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
context "when build was successful" do
|
128
|
-
it "creates .gem file" do
|
129
|
-
mock_build_message app_name, app_version
|
130
|
-
subject.build_gem
|
131
|
-
expect(app_gem_path).to exist
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe "#install_gem" do
|
137
|
-
context "when installation was successful" do
|
138
|
-
it "gem is installed" do
|
139
|
-
mock_build_message app_name, app_version
|
140
|
-
mock_confirm_message "#{app_name} (#{app_version}) installed."
|
141
|
-
subject.install_gem
|
142
|
-
expect(app_gem_path).to exist
|
143
|
-
expect(`gem list`).to include("#{app_name} (#{app_version})")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
context "when installation fails" do
|
148
|
-
it "raises an error with appropriate message" do
|
149
|
-
# create empty gem file in order to simulate install failure
|
150
|
-
allow(subject).to receive(:build_gem) do
|
151
|
-
FileUtils.mkdir_p(app_gem_dir)
|
152
|
-
FileUtils.touch app_gem_path
|
153
|
-
app_gem_path
|
154
|
-
end
|
155
|
-
expect { subject.install_gem }.to raise_error(/Couldn't install gem/)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
describe "#release_gem" do
|
161
|
-
before do
|
162
|
-
Dir.chdir(app_path) do
|
163
|
-
`git init`
|
164
|
-
`git config user.email "you@example.com"`
|
165
|
-
`git config user.name "name"`
|
166
|
-
`git config push.default simple`
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
context "fails" do
|
171
|
-
it "when there are unstaged files" do
|
172
|
-
expect { subject.release_gem }.
|
173
|
-
to raise_error("There are files that need to be committed first.")
|
174
|
-
end
|
175
|
-
|
176
|
-
it "when there are uncommitted files" do
|
177
|
-
Dir.chdir(app_path) { `git add .` }
|
178
|
-
expect { subject.release_gem }.
|
179
|
-
to raise_error("There are files that need to be committed first.")
|
180
|
-
end
|
181
|
-
|
182
|
-
it "when there is no git remote" do
|
183
|
-
# silence messages
|
184
|
-
allow(Bundler.ui).to receive(:confirm)
|
185
|
-
allow(Bundler.ui).to receive(:error)
|
186
|
-
|
187
|
-
Dir.chdir(app_path) { `git commit -a -m "initial commit"` }
|
188
|
-
expect { subject.release_gem }.to raise_error
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
context "succeeds" do
|
193
|
-
before do
|
194
|
-
Dir.chdir(gem_repo1) { `git init --bare` }
|
195
|
-
Dir.chdir(app_path) do
|
196
|
-
`git remote add origin file://#{gem_repo1}`
|
197
|
-
`git commit -a -m "initial commit"`
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
it "on releasing" do
|
202
|
-
mock_build_message app_name, app_version
|
203
|
-
mock_confirm_message "Tagged v#{app_version}."
|
204
|
-
mock_confirm_message "Pushed git commits and tags."
|
205
|
-
expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
|
206
|
-
|
207
|
-
Dir.chdir(app_path) { sys_exec("git push -u origin master", true) }
|
208
|
-
|
209
|
-
subject.release_gem
|
210
|
-
end
|
211
|
-
|
212
|
-
it "even if tag already exists" do
|
213
|
-
mock_build_message app_name, app_version
|
214
|
-
mock_confirm_message "Tag v#{app_version} has already been created."
|
215
|
-
expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
|
216
|
-
|
217
|
-
Dir.chdir(app_path) do
|
218
|
-
`git tag -a -m \"Version #{app_version}\" v#{app_version}`
|
219
|
-
end
|
220
|
-
|
221
|
-
subject.release_gem
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
data/spec/bundler/retry_spec.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bundler::Retry do
|
4
|
-
it "return successful result if no errors" do
|
5
|
-
attempts = 0
|
6
|
-
result = Bundler::Retry.new(nil, nil, 3).attempt do
|
7
|
-
attempts += 1
|
8
|
-
:success
|
9
|
-
end
|
10
|
-
expect(result).to eq(:success)
|
11
|
-
expect(attempts).to eq(1)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "defaults to retrying twice" do
|
15
|
-
attempts = 0
|
16
|
-
expect {
|
17
|
-
Bundler::Retry.new(nil).attempt do
|
18
|
-
attempts += 1
|
19
|
-
raise "nope"
|
20
|
-
end
|
21
|
-
}.to raise_error("nope")
|
22
|
-
expect(attempts).to eq(3)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns the first valid result" do
|
26
|
-
jobs = [Proc.new{ raise "foo" }, Proc.new{ :bar }, Proc.new{ raise "foo" }]
|
27
|
-
attempts = 0
|
28
|
-
result = Bundler::Retry.new(nil, nil, 3).attempt do
|
29
|
-
attempts += 1
|
30
|
-
jobs.shift.call
|
31
|
-
end
|
32
|
-
expect(result).to eq(:bar)
|
33
|
-
expect(attempts).to eq(2)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "raises the last error" do
|
37
|
-
errors = [StandardError, StandardError, StandardError, Bundler::GemfileNotFound]
|
38
|
-
attempts = 0
|
39
|
-
expect {
|
40
|
-
Bundler::Retry.new(nil, nil, 3).attempt do
|
41
|
-
attempts += 1
|
42
|
-
raise errors.shift
|
43
|
-
end
|
44
|
-
}.to raise_error(Bundler::GemfileNotFound)
|
45
|
-
expect(attempts).to eq(4)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "raises exceptions" do
|
49
|
-
error = Bundler::GemfileNotFound
|
50
|
-
attempts = 0
|
51
|
-
expect {
|
52
|
-
Bundler::Retry.new(nil, error).attempt do
|
53
|
-
attempts += 1
|
54
|
-
raise error
|
55
|
-
end
|
56
|
-
}.to raise_error(error)
|
57
|
-
expect(attempts).to eq(1)
|
58
|
-
end
|
59
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'bundler/settings'
|
3
|
-
|
4
|
-
describe Bundler::Settings do
|
5
|
-
describe "#set_local" do
|
6
|
-
context "when the local config file is not found" do
|
7
|
-
it "raises a GemfileNotFound error with explanation" do
|
8
|
-
expect{ subject.set_local("foo", "bar") }.
|
9
|
-
to raise_error(Bundler::GemfileNotFound, "Could not locate Gemfile")
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bundler::Source::Rubygems do
|
4
|
-
before do
|
5
|
-
allow(Bundler).to receive(:root){ Pathname.new("root") }
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "caches" do
|
9
|
-
it "includes Bundler.app_cache" do
|
10
|
-
expect(subject.caches).to include(Bundler.app_cache)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "includes GEM_PATH entries" do
|
14
|
-
Gem.path.each do |path|
|
15
|
-
expect(subject.caches).to include(File.expand_path("#{path}/cache"))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
it "is an array of strings or pathnames" do
|
20
|
-
subject.caches.each do |cache|
|
21
|
-
expect([String, Pathname]).to include(cache.class)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,361 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bundler::SourceList do
|
4
|
-
before do
|
5
|
-
allow(Bundler).to receive(: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 end" do
|
281
|
-
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
|
282
|
-
source_list.add_rubygems_source('remotes' => ['https://duplicate-rubygems.org'])
|
283
|
-
source_list.add_path_source('path' => '/third/path/to/gem')
|
284
|
-
source_list.add_rubygems_source('remotes' => ['https://third-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://first-rubygems.org'])
|
289
|
-
source_list.add_path_source('path' => '/first/path/to/gem')
|
290
|
-
source_list.add_rubygems_source('remotes' => ['https://duplicate-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::Git.new('uri' => 'git://first-git.org/path.git'),
|
295
|
-
Bundler::Source::Git.new('uri' => 'git://second-git.org/path.git'),
|
296
|
-
Bundler::Source::Git.new('uri' => 'git://third-git.org/path.git'),
|
297
|
-
Bundler::Source::Path.new('path' => '/first/path/to/gem'),
|
298
|
-
Bundler::Source::Path.new('path' => '/second/path/to/gem'),
|
299
|
-
Bundler::Source::Path.new('path' => '/third/path/to/gem'),
|
300
|
-
Bundler::Source::Rubygems.new('remotes' => [
|
301
|
-
'https://duplicate-rubygems.org',
|
302
|
-
'https://first-rubygems.org',
|
303
|
-
'https://second-rubygems.org',
|
304
|
-
'https://third-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
|
-
it "calls #cached! on all the sources" do
|
341
|
-
expect(rubygems_source).to receive(:cached!)
|
342
|
-
expect(git_source).to receive(:cached!)
|
343
|
-
expect(path_source).to receive(:cached!)
|
344
|
-
source_list.cached!
|
345
|
-
end
|
346
|
-
end
|
347
|
-
|
348
|
-
describe "#remote!" do
|
349
|
-
let(:rubygems_source) { source_list.add_rubygems_remote('https://rubygems.org') }
|
350
|
-
let(:git_source) { source_list.add_git_source('uri' => 'git://host/path.git') }
|
351
|
-
let(:path_source) { source_list.add_path_source('path' => '/path/to/gem') }
|
352
|
-
|
353
|
-
it "calls #remote! on all the sources" do
|
354
|
-
expect(rubygems_source).to receive(:remote!)
|
355
|
-
expect(git_source).to receive(:remote!)
|
356
|
-
expect(path_source).to receive(:remote!)
|
357
|
-
source_list.remote!
|
358
|
-
end
|
359
|
-
end
|
360
|
-
|
361
|
-
end
|