bundler-prehistoric 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +100 -0
- data/CHANGELOG.md +1640 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +117 -0
- data/Gemfile +3 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +46 -0
- data/Rakefile +256 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bin/bundle_ruby +56 -0
- data/bin/bundler +21 -0
- data/bundler.gemspec +33 -0
- data/lib/bundler.rb +442 -0
- data/lib/bundler/backports/time.rb +7 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +395 -0
- data/lib/bundler/cli/binstubs.rb +38 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +35 -0
- data/lib/bundler/cli/clean.rb +19 -0
- data/lib/bundler/cli/common.rb +54 -0
- data/lib/bundler/cli/config.rb +84 -0
- data/lib/bundler/cli/console.rb +39 -0
- data/lib/bundler/cli/exec.rb +37 -0
- data/lib/bundler/cli/gem.rb +101 -0
- data/lib/bundler/cli/init.rb +33 -0
- data/lib/bundler/cli/inject.rb +33 -0
- data/lib/bundler/cli/install.rb +133 -0
- data/lib/bundler/cli/open.rb +23 -0
- data/lib/bundler/cli/outdated.rb +80 -0
- data/lib/bundler/cli/package.rb +36 -0
- data/lib/bundler/cli/platform.rb +43 -0
- data/lib/bundler/cli/show.rb +48 -0
- data/lib/bundler/cli/update.rb +73 -0
- data/lib/bundler/cli/viz.rb +27 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +155 -0
- data/lib/bundler/definition.rb +604 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +106 -0
- data/lib/bundler/deployment.rb +59 -0
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +305 -0
- data/lib/bundler/endpoint_specification.rb +76 -0
- data/lib/bundler/env.rb +56 -0
- data/lib/bundler/environment.rb +42 -0
- data/lib/bundler/fetcher.rb +396 -0
- data/lib/bundler/friendly_errors.rb +42 -0
- data/lib/bundler/gem_helper.rb +169 -0
- data/lib/bundler/gem_helpers.rb +25 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +169 -0
- data/lib/bundler/index.rb +184 -0
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +332 -0
- data/lib/bundler/lazy_specification.rb +83 -0
- data/lib/bundler/lockfile_parser.rb +146 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/parallel_workers.rb +18 -0
- data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
- data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
- data/lib/bundler/parallel_workers/worker.rb +69 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +534 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +117 -0
- data/lib/bundler/rubygems_ext.rb +171 -0
- data/lib/bundler/rubygems_integration.rb +578 -0
- data/lib/bundler/runtime.rb +310 -0
- data/lib/bundler/settings.rb +176 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +110 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +29 -0
- data/lib/bundler/source/git.rb +289 -0
- data/lib/bundler/source/git/git_proxy.rb +158 -0
- data/lib/bundler/source/path.rb +225 -0
- data/lib/bundler/source/path/installer.rb +38 -0
- data/lib/bundler/source/rubygems.rb +334 -0
- data/lib/bundler/source/svn.rb +260 -0
- data/lib/bundler/source/svn/svn_proxy.rb +110 -0
- data/lib/bundler/spec_set.rb +154 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +31 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/consolerc.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +21 -0
- data/lib/bundler/ui/shell.rb +98 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor.rb +480 -0
- data/lib/bundler/vendor/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/invocation.rb +173 -0
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/parser/option.rb +121 -0
- data/lib/bundler/vendor/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
- data/lib/bundler/vendor/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_persistent.rb +3 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +155 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-install.ronn +372 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +179 -0
- data/man/bundle.ronn +92 -0
- data/man/gemfile.5.ronn +369 -0
- data/man/index.txt +7 -0
- data/spec/bundler/bundler_spec.rb +74 -0
- data/spec/bundler/cli_spec.rb +16 -0
- data/spec/bundler/definition_spec.rb +21 -0
- data/spec/bundler/dsl_spec.rb +108 -0
- data/spec/bundler/friendly_errors_spec.rb +13 -0
- data/spec/bundler/gem_helper_spec.rb +225 -0
- data/spec/bundler/psyched_yaml_spec.rb +8 -0
- data/spec/bundler/retry_spec.rb +59 -0
- data/spec/bundler/settings_spec.rb +13 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +316 -0
- data/spec/cache/git_spec.rb +188 -0
- data/spec/cache/path_spec.rb +121 -0
- data/spec/cache/platform_spec.rb +53 -0
- data/spec/cache/svn_spec.rb +82 -0
- data/spec/commands/binstubs_spec.rb +246 -0
- data/spec/commands/check_spec.rb +278 -0
- data/spec/commands/clean_spec.rb +652 -0
- data/spec/commands/config_spec.rb +227 -0
- data/spec/commands/console_spec.rb +102 -0
- data/spec/commands/exec_spec.rb +367 -0
- data/spec/commands/help_spec.rb +39 -0
- data/spec/commands/init_spec.rb +39 -0
- data/spec/commands/inject_spec.rb +78 -0
- data/spec/commands/licenses_spec.rb +31 -0
- data/spec/commands/newgem_spec.rb +451 -0
- data/spec/commands/open_spec.rb +80 -0
- data/spec/commands/outdated_spec.rb +168 -0
- data/spec/commands/package_spec.rb +128 -0
- data/spec/commands/show_spec.rb +152 -0
- data/spec/install/binstubs_spec.rb +24 -0
- data/spec/install/bundler_spec.rb +146 -0
- data/spec/install/deploy_spec.rb +237 -0
- data/spec/install/gemfile/gemspec_spec.rb +170 -0
- data/spec/install/gemfile/git_spec.rb +967 -0
- data/spec/install/gemfile/path_spec.rb +480 -0
- data/spec/install/gemfile/svn_spec.rb +582 -0
- data/spec/install/gemfile_spec.rb +44 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +580 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +314 -0
- data/spec/install/gems/groups_spec.rb +308 -0
- data/spec/install/gems/mirror_spec.rb +39 -0
- data/spec/install/gems/platform_spec.rb +221 -0
- data/spec/install/gems/post_install_spec.rb +121 -0
- data/spec/install/gems/resolving_spec.rb +124 -0
- data/spec/install/gems/simple_case_spec.rb +386 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +136 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspecs_spec.rb +50 -0
- data/spec/install/path_spec.rb +150 -0
- data/spec/install/post_bundle_message_spec.rb +142 -0
- data/spec/install/prereleases_spec.rb +43 -0
- data/spec/install/security_policy_spec.rb +77 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +34 -0
- data/spec/lock/lockfile_spec.rb +912 -0
- data/spec/lock/svn_spec.rb +35 -0
- data/spec/other/bundle_ruby_spec.rb +142 -0
- data/spec/other/cli_dispatch_spec.rb +21 -0
- data/spec/other/ext_spec.rb +60 -0
- data/spec/other/platform_spec.rb +1285 -0
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/quality_spec.rb +88 -0
- data/spec/realworld/dependency_api_spec.rb +60 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/resolver/basic_spec.rb +66 -0
- data/spec/resolver/platform_spec.rb +88 -0
- data/spec/runtime/executable_spec.rb +149 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +332 -0
- data/spec/runtime/setup_spec.rb +856 -0
- data/spec/runtime/with_clean_env_spec.rb +91 -0
- data/spec/spec_helper.rb +114 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +71 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_creds_diff_host.rb +38 -0
- data/spec/support/artifice/endpoint_extra.rb +31 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +17 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
- data/spec/support/artifice/endpoint_timeout.rb +13 -0
- data/spec/support/builders.rb +748 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/hax.rb +22 -0
- data/spec/support/helpers.rb +348 -0
- data/spec/support/indexes.rb +280 -0
- data/spec/support/less_than_proc.rb +14 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +81 -0
- data/spec/support/permissions.rb +10 -0
- data/spec/support/platforms.rb +94 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +39 -0
- data/spec/support/streams.rb +13 -0
- data/spec/support/sudo.rb +16 -0
- data/spec/update/gems_spec.rb +201 -0
- data/spec/update/git_spec.rb +236 -0
- data/spec/update/source_spec.rb +63 -0
- data/spec/update/svn_spec.rb +100 -0
- metadata +486 -0
@@ -0,0 +1,59 @@
|
|
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
|
@@ -0,0 +1,13 @@
|
|
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
|
@@ -0,0 +1,25 @@
|
|
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
|
@@ -0,0 +1,316 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle cache" do
|
4
|
+
|
5
|
+
describe "when there are only gemsources" do
|
6
|
+
before :each do
|
7
|
+
gemfile <<-G
|
8
|
+
gem 'rack'
|
9
|
+
G
|
10
|
+
|
11
|
+
system_gems "rack-1.0.0"
|
12
|
+
bundle :cache
|
13
|
+
end
|
14
|
+
|
15
|
+
it "copies the .gem file to vendor/cache" do
|
16
|
+
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
|
17
|
+
end
|
18
|
+
|
19
|
+
it "uses the cache as a source when installing gems" do
|
20
|
+
build_gem "omg", :path => bundled_app('vendor/cache')
|
21
|
+
|
22
|
+
install_gemfile <<-G
|
23
|
+
source "file://#{gem_repo1}"
|
24
|
+
gem "omg"
|
25
|
+
G
|
26
|
+
|
27
|
+
should_be_installed "omg 1.0.0"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "uses the cache as a source when installing gems with --local" do
|
31
|
+
system_gems []
|
32
|
+
bundle "install --local"
|
33
|
+
|
34
|
+
should_be_installed("rack 1.0.0")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "does not reinstall gems from the cache if they exist on the system" do
|
38
|
+
build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
|
39
|
+
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
40
|
+
end
|
41
|
+
|
42
|
+
install_gemfile <<-G
|
43
|
+
gem "rack"
|
44
|
+
G
|
45
|
+
|
46
|
+
should_be_installed("rack 1.0.0")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "does not reinstall gems from the cache if they exist in the bundle" do
|
50
|
+
system_gems "rack-1.0.0"
|
51
|
+
|
52
|
+
gemfile <<-G
|
53
|
+
gem "rack"
|
54
|
+
G
|
55
|
+
|
56
|
+
build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
|
57
|
+
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
58
|
+
end
|
59
|
+
|
60
|
+
bundle "install --local"
|
61
|
+
should_be_installed("rack 1.0.0")
|
62
|
+
end
|
63
|
+
|
64
|
+
it "creates a lockfile" do
|
65
|
+
cache_gems "rack-1.0.0"
|
66
|
+
|
67
|
+
gemfile <<-G
|
68
|
+
gem "rack"
|
69
|
+
G
|
70
|
+
|
71
|
+
bundle "cache"
|
72
|
+
|
73
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "when there is a built-in gem", :ruby => "2.0" do
|
78
|
+
before :each do
|
79
|
+
build_repo2 do
|
80
|
+
build_gem "builtin_gem", "1.0.2"
|
81
|
+
end
|
82
|
+
|
83
|
+
build_gem "builtin_gem", "1.0.2", :to_system => true do |s|
|
84
|
+
s.summary = "This builtin_gem is bundled with Ruby"
|
85
|
+
end
|
86
|
+
|
87
|
+
FileUtils.rm("#{system_gem_path}/cache/builtin_gem-1.0.2.gem")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "uses builtin gems" do
|
91
|
+
install_gemfile %|gem 'builtin_gem', '1.0.2'|
|
92
|
+
should_be_installed("builtin_gem 1.0.2")
|
93
|
+
end
|
94
|
+
|
95
|
+
it "caches remote and builtin gems" do
|
96
|
+
install_gemfile <<-G
|
97
|
+
source "file://#{gem_repo2}"
|
98
|
+
gem 'builtin_gem', '1.0.2'
|
99
|
+
gem 'rack', '1.0.0'
|
100
|
+
G
|
101
|
+
|
102
|
+
bundle :cache
|
103
|
+
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
|
104
|
+
expect(bundled_app("vendor/cache/builtin_gem-1.0.2.gem")).to exist
|
105
|
+
end
|
106
|
+
|
107
|
+
it "doesn't make remote request after caching the gem" do
|
108
|
+
build_gem "builtin_gem_2", "1.0.2", :path => bundled_app('vendor/cache') do |s|
|
109
|
+
s.summary = "This builtin_gem is bundled with Ruby"
|
110
|
+
end
|
111
|
+
|
112
|
+
install_gemfile <<-G
|
113
|
+
source "file://#{gem_repo2}"
|
114
|
+
gem 'builtin_gem_2', '1.0.2'
|
115
|
+
G
|
116
|
+
|
117
|
+
bundle "install --local"
|
118
|
+
should_be_installed("builtin_gem_2 1.0.2")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "when there are also git sources" do
|
123
|
+
before do
|
124
|
+
build_git "foo"
|
125
|
+
system_gems "rack-1.0.0"
|
126
|
+
|
127
|
+
install_gemfile <<-G
|
128
|
+
source "file://#{gem_repo1}"
|
129
|
+
git "#{lib_path("foo-1.0")}" do
|
130
|
+
gem 'foo'
|
131
|
+
end
|
132
|
+
gem 'rack'
|
133
|
+
G
|
134
|
+
end
|
135
|
+
|
136
|
+
it "still works" do
|
137
|
+
bundle :cache
|
138
|
+
|
139
|
+
system_gems []
|
140
|
+
bundle "install --local"
|
141
|
+
|
142
|
+
should_be_installed("rack 1.0.0", "foo 1.0")
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should not explode if the lockfile is not present" do
|
146
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
147
|
+
|
148
|
+
bundle :cache
|
149
|
+
|
150
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe "when there are also svn sources" do
|
155
|
+
before do
|
156
|
+
build_svn "foo"
|
157
|
+
system_gems "rack-1.0.0"
|
158
|
+
|
159
|
+
install_gemfile <<-G
|
160
|
+
source "file://#{gem_repo1}"
|
161
|
+
svn "file://#{lib_path("foo-1.0")}" do
|
162
|
+
gem 'foo'
|
163
|
+
end
|
164
|
+
gem 'rack'
|
165
|
+
G
|
166
|
+
end
|
167
|
+
|
168
|
+
it "still works" do
|
169
|
+
bundle :cache
|
170
|
+
|
171
|
+
system_gems []
|
172
|
+
bundle "install --local"
|
173
|
+
|
174
|
+
should_be_installed("rack 1.0.0", "foo 1.0")
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should not explode if the lockfile is not present" do
|
178
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
179
|
+
|
180
|
+
bundle :cache
|
181
|
+
|
182
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "when previously cached" do
|
187
|
+
before :each do
|
188
|
+
build_repo2
|
189
|
+
install_gemfile <<-G
|
190
|
+
source "file://#{gem_repo2}"
|
191
|
+
gem "rack"
|
192
|
+
gem "actionpack"
|
193
|
+
G
|
194
|
+
bundle :cache
|
195
|
+
expect(cached_gem("rack-1.0.0")).to exist
|
196
|
+
expect(cached_gem("actionpack-2.3.2")).to exist
|
197
|
+
expect(cached_gem("activesupport-2.3.2")).to exist
|
198
|
+
end
|
199
|
+
|
200
|
+
it "re-caches during install" do
|
201
|
+
cached_gem("rack-1.0.0").rmtree
|
202
|
+
bundle :install
|
203
|
+
expect(out).to include("Updating files in vendor/cache")
|
204
|
+
expect(cached_gem("rack-1.0.0")).to exist
|
205
|
+
end
|
206
|
+
|
207
|
+
it "adds and removes when gems are updated" do
|
208
|
+
update_repo2
|
209
|
+
bundle 'update'
|
210
|
+
expect(cached_gem("rack-1.2")).to exist
|
211
|
+
expect(cached_gem("rack-1.0.0")).not_to exist
|
212
|
+
end
|
213
|
+
|
214
|
+
it "adds new gems and dependencies" do
|
215
|
+
install_gemfile <<-G
|
216
|
+
source "file://#{gem_repo2}"
|
217
|
+
gem "rails"
|
218
|
+
G
|
219
|
+
expect(cached_gem("rails-2.3.2")).to exist
|
220
|
+
expect(cached_gem("activerecord-2.3.2")).to exist
|
221
|
+
end
|
222
|
+
|
223
|
+
it "removes .gems for removed gems and dependencies" do
|
224
|
+
install_gemfile <<-G
|
225
|
+
source "file://#{gem_repo2}"
|
226
|
+
gem "rack"
|
227
|
+
G
|
228
|
+
expect(cached_gem("rack-1.0.0")).to exist
|
229
|
+
expect(cached_gem("actionpack-2.3.2")).not_to exist
|
230
|
+
expect(cached_gem("activesupport-2.3.2")).not_to exist
|
231
|
+
end
|
232
|
+
|
233
|
+
it "removes .gems when gem changes to git source" do
|
234
|
+
build_git "rack"
|
235
|
+
|
236
|
+
install_gemfile <<-G
|
237
|
+
source "file://#{gem_repo2}"
|
238
|
+
gem "rack", :git => "#{lib_path("rack-1.0")}"
|
239
|
+
gem "actionpack"
|
240
|
+
G
|
241
|
+
expect(cached_gem("rack-1.0.0")).not_to exist
|
242
|
+
expect(cached_gem("actionpack-2.3.2")).to exist
|
243
|
+
expect(cached_gem("activesupport-2.3.2")).to exist
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
it "doesn't remove gems that are for another platform" do
|
248
|
+
simulate_platform "java" do
|
249
|
+
install_gemfile <<-G
|
250
|
+
source "file://#{gem_repo1}"
|
251
|
+
gem "platform_specific"
|
252
|
+
G
|
253
|
+
|
254
|
+
bundle :cache
|
255
|
+
expect(cached_gem("platform_specific-1.0-java")).to exist
|
256
|
+
end
|
257
|
+
|
258
|
+
simulate_new_machine
|
259
|
+
install_gemfile <<-G
|
260
|
+
source "file://#{gem_repo1}"
|
261
|
+
gem "platform_specific"
|
262
|
+
G
|
263
|
+
|
264
|
+
expect(cached_gem("platform_specific-1.0-#{Gem::Platform.local}")).to exist
|
265
|
+
expect(cached_gem("platform_specific-1.0-java")).to exist
|
266
|
+
end
|
267
|
+
|
268
|
+
it "doesn't remove gems with mismatched :rubygems_version or :date" do
|
269
|
+
cached_gem("rack-1.0.0").rmtree
|
270
|
+
build_gem "rack", "1.0.0",
|
271
|
+
:path => bundled_app('vendor/cache'),
|
272
|
+
:rubygems_version => "1.3.2"
|
273
|
+
simulate_new_machine
|
274
|
+
|
275
|
+
bundle :install
|
276
|
+
expect(cached_gem("rack-1.0.0")).to exist
|
277
|
+
end
|
278
|
+
|
279
|
+
it "handles directories and non .gem files in the cache" do
|
280
|
+
bundled_app("vendor/cache/foo").mkdir
|
281
|
+
File.open(bundled_app("vendor/cache/bar"), 'w'){|f| f.write("not a gem") }
|
282
|
+
bundle :cache
|
283
|
+
end
|
284
|
+
|
285
|
+
it "does not say that it is removing gems when it isn't actually doing so" do
|
286
|
+
install_gemfile <<-G
|
287
|
+
source "file://#{gem_repo1}"
|
288
|
+
gem "rack"
|
289
|
+
G
|
290
|
+
bundle "cache"
|
291
|
+
bundle "install"
|
292
|
+
expect(out).not_to match(/removing/i)
|
293
|
+
end
|
294
|
+
|
295
|
+
it "does not warn about all if it doesn't have any git/path dependency" do
|
296
|
+
install_gemfile <<-G
|
297
|
+
source "file://#{gem_repo1}"
|
298
|
+
gem "rack"
|
299
|
+
G
|
300
|
+
bundle "cache"
|
301
|
+
expect(out).not_to match(/\-\-all/)
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should install gems with the name bundler in them (that aren't bundler)" do
|
305
|
+
build_gem "foo-bundler", "1.0",
|
306
|
+
:path => bundled_app('vendor/cache')
|
307
|
+
|
308
|
+
install_gemfile <<-G
|
309
|
+
gem "foo-bundler"
|
310
|
+
G
|
311
|
+
|
312
|
+
should_be_installed "foo-bundler 1.0"
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "git base name" do
|
4
|
+
it "base_name should strip private repo uris" do
|
5
|
+
source = Bundler::Source::Git.new("uri" => "git@github.com:bundler.git")
|
6
|
+
expect(source.send(:base_name)).to eq("bundler")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "base_name should strip network share paths" do
|
10
|
+
source = Bundler::Source::Git.new("uri" => "//MachineName/ShareFolder")
|
11
|
+
expect(source.send(:base_name)).to eq("ShareFolder")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
%w(cache package).each do |cmd|
|
16
|
+
describe "bundle #{cmd} with git" do
|
17
|
+
it "copies repository to vendor cache and uses it" do
|
18
|
+
git = build_git "foo"
|
19
|
+
ref = git.ref_for("master", 11)
|
20
|
+
|
21
|
+
install_gemfile <<-G
|
22
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
23
|
+
G
|
24
|
+
|
25
|
+
bundle "#{cmd} --all"
|
26
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
|
27
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
|
28
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file
|
29
|
+
|
30
|
+
FileUtils.rm_rf lib_path("foo-1.0")
|
31
|
+
should_be_installed "foo 1.0"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "copies repository to vendor cache and uses it even when installed with bundle --path" do
|
35
|
+
git = build_git "foo"
|
36
|
+
ref = git.ref_for("master", 11)
|
37
|
+
|
38
|
+
install_gemfile <<-G
|
39
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
40
|
+
G
|
41
|
+
|
42
|
+
bundle "install --path vendor/bundle"
|
43
|
+
bundle "#{cmd} --all"
|
44
|
+
|
45
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
|
46
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
|
47
|
+
|
48
|
+
FileUtils.rm_rf lib_path("foo-1.0")
|
49
|
+
should_be_installed "foo 1.0"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "runs twice without exploding" do
|
53
|
+
build_git "foo"
|
54
|
+
|
55
|
+
install_gemfile <<-G
|
56
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
57
|
+
G
|
58
|
+
|
59
|
+
bundle "#{cmd} --all"
|
60
|
+
bundle "#{cmd} --all"
|
61
|
+
|
62
|
+
expect(err).to eq("")
|
63
|
+
FileUtils.rm_rf lib_path("foo-1.0")
|
64
|
+
should_be_installed "foo 1.0"
|
65
|
+
end
|
66
|
+
|
67
|
+
it "tracks updates" do
|
68
|
+
git = build_git "foo"
|
69
|
+
old_ref = git.ref_for("master", 11)
|
70
|
+
|
71
|
+
install_gemfile <<-G
|
72
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
73
|
+
G
|
74
|
+
|
75
|
+
bundle "#{cmd} --all"
|
76
|
+
|
77
|
+
update_git "foo" do |s|
|
78
|
+
s.write "lib/foo.rb", "puts :CACHE"
|
79
|
+
end
|
80
|
+
|
81
|
+
ref = git.ref_for("master", 11)
|
82
|
+
expect(ref).not_to eq(old_ref)
|
83
|
+
|
84
|
+
bundle "update"
|
85
|
+
bundle "#{cmd} --all"
|
86
|
+
|
87
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
|
88
|
+
expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
|
89
|
+
|
90
|
+
FileUtils.rm_rf lib_path("foo-1.0")
|
91
|
+
run "require 'foo'"
|
92
|
+
expect(out).to eq("CACHE")
|
93
|
+
end
|
94
|
+
|
95
|
+
it "uses the local repository to generate the cache" do
|
96
|
+
git = build_git "foo"
|
97
|
+
ref = git.ref_for("master", 11)
|
98
|
+
|
99
|
+
gemfile <<-G
|
100
|
+
gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
|
101
|
+
G
|
102
|
+
|
103
|
+
bundle %|config local.foo #{lib_path('foo-1.0')}|
|
104
|
+
bundle "install"
|
105
|
+
bundle "#{cmd} --all"
|
106
|
+
|
107
|
+
expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist
|
108
|
+
|
109
|
+
# Updating the local still uses the local.
|
110
|
+
update_git "foo" do |s|
|
111
|
+
s.write "lib/foo.rb", "puts :LOCAL"
|
112
|
+
end
|
113
|
+
|
114
|
+
run "require 'foo'"
|
115
|
+
expect(out).to eq("LOCAL")
|
116
|
+
end
|
117
|
+
|
118
|
+
it "copies repository to vendor cache, including submodules" do
|
119
|
+
build_git "submodule", "1.0"
|
120
|
+
|
121
|
+
git = build_git "has_submodule", "1.0" do |s|
|
122
|
+
s.add_dependency "submodule"
|
123
|
+
end
|
124
|
+
|
125
|
+
Dir.chdir(lib_path('has_submodule-1.0')) do
|
126
|
+
`git submodule add #{lib_path('submodule-1.0')} submodule-1.0`
|
127
|
+
`git commit -m "submodulator"`
|
128
|
+
end
|
129
|
+
|
130
|
+
install_gemfile <<-G
|
131
|
+
git "#{lib_path('has_submodule-1.0')}", :submodules => true do
|
132
|
+
gem "has_submodule"
|
133
|
+
end
|
134
|
+
G
|
135
|
+
|
136
|
+
ref = git.ref_for("master", 11)
|
137
|
+
bundle "#{cmd} --all"
|
138
|
+
|
139
|
+
expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist
|
140
|
+
expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist
|
141
|
+
should_be_installed "has_submodule 1.0"
|
142
|
+
end
|
143
|
+
|
144
|
+
it "displays warning message when detecting git repo in Gemfile" do
|
145
|
+
build_git "foo"
|
146
|
+
|
147
|
+
install_gemfile <<-G
|
148
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
149
|
+
G
|
150
|
+
|
151
|
+
bundle "#{cmd}"
|
152
|
+
|
153
|
+
expect(out).to include("Your Gemfile contains path and git dependencies.")
|
154
|
+
end
|
155
|
+
|
156
|
+
it "does not display warning message if cache_all is set in bundle config" do
|
157
|
+
build_git "foo"
|
158
|
+
|
159
|
+
install_gemfile <<-G
|
160
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
161
|
+
G
|
162
|
+
|
163
|
+
bundle "#{cmd} --all"
|
164
|
+
bundle "#{cmd}"
|
165
|
+
|
166
|
+
expect(out).not_to include("Your Gemfile contains path and git dependencies.")
|
167
|
+
end
|
168
|
+
|
169
|
+
it "caches pre-evaluated gemspecs" do
|
170
|
+
git = build_git "foo"
|
171
|
+
|
172
|
+
# Insert a gemspec method that shells out
|
173
|
+
spec_lines = lib_path("foo-1.0/foo.gemspec").read.split("\n")
|
174
|
+
spec_lines.insert(-2, "s.description = `echo bob`")
|
175
|
+
update_git("foo"){ |s| s.write "foo.gemspec", spec_lines.join("\n") }
|
176
|
+
|
177
|
+
install_gemfile <<-G
|
178
|
+
gem "foo", :git => '#{lib_path("foo-1.0")}'
|
179
|
+
G
|
180
|
+
bundle "#{cmd} --all"
|
181
|
+
|
182
|
+
ref = git.ref_for("master", 11)
|
183
|
+
gemspec = bundled_app("vendor/cache/foo-1.0-#{ref}/foo.gemspec").read
|
184
|
+
expect(gemspec).to_not match("`echo bob`")
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
end
|