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,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "bundle install" do
|
4
|
+
|
5
|
+
describe "when prerelease gems are available" do
|
6
|
+
it "finds prereleases" do
|
7
|
+
install_gemfile <<-G
|
8
|
+
source "file://#{gem_repo1}"
|
9
|
+
gem "not_released"
|
10
|
+
G
|
11
|
+
should_be_installed "not_released 1.0.pre"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "uses regular releases if available" do
|
15
|
+
install_gemfile <<-G
|
16
|
+
source "file://#{gem_repo1}"
|
17
|
+
gem "has_prerelease"
|
18
|
+
G
|
19
|
+
should_be_installed "has_prerelease 1.0"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "uses prereleases if requested" do
|
23
|
+
install_gemfile <<-G
|
24
|
+
source "file://#{gem_repo1}"
|
25
|
+
gem "has_prerelease", "1.1.pre"
|
26
|
+
G
|
27
|
+
should_be_installed "has_prerelease 1.1.pre"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "when prerelease gems are not available" do
|
32
|
+
it "still works" do
|
33
|
+
build_repo3
|
34
|
+
install_gemfile <<-G
|
35
|
+
source "file://#{gem_repo3}"
|
36
|
+
gem "rack"
|
37
|
+
G
|
38
|
+
|
39
|
+
should_be_installed "rack 1.0"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rubygems/security"
|
3
|
+
|
4
|
+
# unfortunately, testing signed gems with a provided CA is extremely difficult
|
5
|
+
# as 'gem cert' is currently the only way to add CAs to the system.
|
6
|
+
|
7
|
+
describe "policies with unsigned gems" do
|
8
|
+
before do
|
9
|
+
build_security_repo
|
10
|
+
gemfile <<-G
|
11
|
+
source "file://#{security_repo}"
|
12
|
+
gem "rack"
|
13
|
+
gem "signed_gem"
|
14
|
+
G
|
15
|
+
end
|
16
|
+
|
17
|
+
it "will work after you try to deploy without a lock" do
|
18
|
+
bundle "install --deployment"
|
19
|
+
bundle :install, :exitstatus => true
|
20
|
+
expect(exitstatus).to eq(0)
|
21
|
+
should_be_installed "rack 1.0", "signed_gem 1.0"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "will fail when given invalid security policy" do
|
25
|
+
bundle "install --trust-policy=InvalidPolicyName"
|
26
|
+
expect(out).to include("Rubygems doesn't know about trust policy")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "will fail with High Security setting due to presence of unsigned gem" do
|
30
|
+
bundle "install --trust-policy=HighSecurity"
|
31
|
+
expect(out).to include("security policy didn't allow")
|
32
|
+
end
|
33
|
+
|
34
|
+
# This spec will fail on Rubygems 2 rc1 due to a bug in policy.rb. the bug is fixed in rc3.
|
35
|
+
it "will fail with Medium Security setting due to presence of unsigned gem", :unless => ENV['RGV'] == "v2.0.0.rc.1" do
|
36
|
+
bundle "install --trust-policy=MediumSecurity"
|
37
|
+
expect(out).to include("security policy didn't allow")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "will succeed with no policy" do
|
41
|
+
bundle "install", :exitstatus => true
|
42
|
+
expect(exitstatus).to eq(0)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "policies with signed gems and no CA" do
|
48
|
+
before do
|
49
|
+
build_security_repo
|
50
|
+
gemfile <<-G
|
51
|
+
source "file://#{security_repo}"
|
52
|
+
gem "signed_gem"
|
53
|
+
G
|
54
|
+
end
|
55
|
+
|
56
|
+
it "will fail with High Security setting, gem is self-signed" do
|
57
|
+
bundle "install --trust-policy=HighSecurity"
|
58
|
+
expect(out).to include("security policy didn't allow")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "will fail with Medium Security setting, gem is self-signed" do
|
62
|
+
bundle "install --trust-policy=MediumSecurity"
|
63
|
+
expect(out).to include("security policy didn't allow")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "will succeed with Low Security setting, low security accepts self signed gem" do
|
67
|
+
bundle "install --trust-policy=LowSecurity", :exitstatus => true
|
68
|
+
expect(exitstatus).to eq(0)
|
69
|
+
should_be_installed "signed_gem 1.0"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "will succeed with no policy" do
|
73
|
+
bundle "install", :exitstatus => true
|
74
|
+
expect(exitstatus).to eq(0)
|
75
|
+
should_be_installed "signed_gem 1.0"
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install for the first time with v1.0" do
|
4
|
+
before :each do
|
5
|
+
in_app_root
|
6
|
+
|
7
|
+
gemfile <<-G
|
8
|
+
source "file://#{gem_repo1}"
|
9
|
+
gem "rack"
|
10
|
+
G
|
11
|
+
end
|
12
|
+
|
13
|
+
it "removes lockfiles in 0.9 YAML format" do
|
14
|
+
File.open("Gemfile.lock", "w"){|f| YAML.dump({}, f) }
|
15
|
+
bundle :install
|
16
|
+
expect(File.read("Gemfile.lock")).not_to match(/^---/)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "removes env.rb if it exists" do
|
20
|
+
bundled_app.join(".bundle").mkdir
|
21
|
+
bundled_app.join(".bundle/environment.rb").open("w"){|f| f.write("raise 'nooo'") }
|
22
|
+
bundle :install
|
23
|
+
expect(bundled_app.join(".bundle/environment.rb")).not_to exist
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle lock with git gems" do
|
4
|
+
before :each do
|
5
|
+
build_git "foo"
|
6
|
+
|
7
|
+
install_gemfile <<-G
|
8
|
+
gem 'foo', :git => "#{lib_path('foo-1.0')}"
|
9
|
+
G
|
10
|
+
end
|
11
|
+
|
12
|
+
it "doesn't break right after running lock" do
|
13
|
+
should_be_installed "foo 1.0.0"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "locks a git source to the current ref" do
|
17
|
+
update_git "foo"
|
18
|
+
bundle :install
|
19
|
+
|
20
|
+
run <<-RUBY
|
21
|
+
require 'foo'
|
22
|
+
puts "WIN" unless defined?(FOO_PREV_REF)
|
23
|
+
RUBY
|
24
|
+
|
25
|
+
expect(out).to eq("WIN")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "provides correct #full_gem_path" do
|
29
|
+
run <<-RUBY
|
30
|
+
puts Bundler.rubygems.find_name('foo').first.full_gem_path
|
31
|
+
RUBY
|
32
|
+
expect(out).to eq(bundle("show foo"))
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,912 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "the lockfile format" do
|
4
|
+
include Bundler::GemHelpers
|
5
|
+
|
6
|
+
it "generates a simple lockfile for a single source, gem" do
|
7
|
+
install_gemfile <<-G
|
8
|
+
source "file://#{gem_repo1}"
|
9
|
+
|
10
|
+
gem "rack"
|
11
|
+
G
|
12
|
+
|
13
|
+
lockfile_should_be <<-G
|
14
|
+
GEM
|
15
|
+
remote: file:#{gem_repo1}/
|
16
|
+
specs:
|
17
|
+
rack (1.0.0)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
#{generic(Gem::Platform.local)}
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
rack
|
24
|
+
G
|
25
|
+
end
|
26
|
+
|
27
|
+
it "generates a simple lockfile for a single source, gem with dependencies" do
|
28
|
+
install_gemfile <<-G
|
29
|
+
source "file://#{gem_repo1}"
|
30
|
+
|
31
|
+
gem "rack-obama"
|
32
|
+
G
|
33
|
+
|
34
|
+
lockfile_should_be <<-G
|
35
|
+
GEM
|
36
|
+
remote: file:#{gem_repo1}/
|
37
|
+
specs:
|
38
|
+
rack (1.0.0)
|
39
|
+
rack-obama (1.0)
|
40
|
+
rack
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
#{generic(Gem::Platform.local)}
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
rack-obama
|
47
|
+
G
|
48
|
+
end
|
49
|
+
|
50
|
+
it "generates a simple lockfile for a single source, gem with a version requirement" do
|
51
|
+
install_gemfile <<-G
|
52
|
+
source "file://#{gem_repo1}"
|
53
|
+
|
54
|
+
gem "rack-obama", ">= 1.0"
|
55
|
+
G
|
56
|
+
|
57
|
+
lockfile_should_be <<-G
|
58
|
+
GEM
|
59
|
+
remote: file:#{gem_repo1}/
|
60
|
+
specs:
|
61
|
+
rack (1.0.0)
|
62
|
+
rack-obama (1.0)
|
63
|
+
rack
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
#{generic(Gem::Platform.local)}
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
rack-obama (>= 1.0)
|
70
|
+
G
|
71
|
+
end
|
72
|
+
|
73
|
+
it "generates a lockfile wihout credentials for a configured source" do
|
74
|
+
bundle "config http://localgemserver.test/ user:pass"
|
75
|
+
|
76
|
+
install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
|
77
|
+
source "http://localgemserver.test/"
|
78
|
+
|
79
|
+
gem "rack-obama", ">= 1.0"
|
80
|
+
G
|
81
|
+
|
82
|
+
lockfile_should_be <<-G
|
83
|
+
GEM
|
84
|
+
remote: http://localgemserver.test/
|
85
|
+
specs:
|
86
|
+
rack (1.0.0)
|
87
|
+
rack-obama (1.0)
|
88
|
+
rack
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
#{generic(Gem::Platform.local)}
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
rack-obama (>= 1.0)
|
95
|
+
G
|
96
|
+
end
|
97
|
+
|
98
|
+
it "generates lockfiles with multiple requirements" do
|
99
|
+
install_gemfile <<-G
|
100
|
+
source "file://#{gem_repo1}"
|
101
|
+
gem "net-sftp"
|
102
|
+
G
|
103
|
+
|
104
|
+
lockfile_should_be <<-G
|
105
|
+
GEM
|
106
|
+
remote: file:#{gem_repo1}/
|
107
|
+
specs:
|
108
|
+
net-sftp (1.1.1)
|
109
|
+
net-ssh (>= 1.0.0, < 1.99.0)
|
110
|
+
net-ssh (1.0)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
ruby
|
114
|
+
|
115
|
+
DEPENDENCIES
|
116
|
+
net-sftp
|
117
|
+
G
|
118
|
+
|
119
|
+
should_be_installed "net-sftp 1.1.1", "net-ssh 1.0.0"
|
120
|
+
end
|
121
|
+
|
122
|
+
it "generates a simple lockfile for a single pinned source, gem with a version requirement" do
|
123
|
+
git = build_git "foo"
|
124
|
+
|
125
|
+
install_gemfile <<-G
|
126
|
+
gem "foo", :git => "#{lib_path("foo-1.0")}"
|
127
|
+
G
|
128
|
+
|
129
|
+
lockfile_should_be <<-G
|
130
|
+
GIT
|
131
|
+
remote: #{lib_path("foo-1.0")}
|
132
|
+
revision: #{git.ref_for('master')}
|
133
|
+
specs:
|
134
|
+
foo (1.0)
|
135
|
+
|
136
|
+
GEM
|
137
|
+
specs:
|
138
|
+
|
139
|
+
PLATFORMS
|
140
|
+
#{generic(Gem::Platform.local)}
|
141
|
+
|
142
|
+
DEPENDENCIES
|
143
|
+
foo!
|
144
|
+
G
|
145
|
+
end
|
146
|
+
|
147
|
+
it "does not assplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do
|
148
|
+
build_lib "omg", :path => lib_path('omg')
|
149
|
+
|
150
|
+
gemfile <<-G
|
151
|
+
source "file://#{gem_repo1}"
|
152
|
+
|
153
|
+
platforms :#{not_local_tag} do
|
154
|
+
gem "omg", :path => "#{lib_path('omg')}"
|
155
|
+
end
|
156
|
+
|
157
|
+
gem "rack"
|
158
|
+
G
|
159
|
+
|
160
|
+
lockfile <<-L
|
161
|
+
GIT
|
162
|
+
remote: git://github.com/nex3/haml.git
|
163
|
+
revision: 8a2271f
|
164
|
+
specs:
|
165
|
+
|
166
|
+
GEM
|
167
|
+
remote: file://#{gem_repo1}/
|
168
|
+
specs:
|
169
|
+
rack (1.0.0)
|
170
|
+
|
171
|
+
PLATFORMS
|
172
|
+
#{not_local}
|
173
|
+
|
174
|
+
DEPENDENCIES
|
175
|
+
omg!
|
176
|
+
rack
|
177
|
+
L
|
178
|
+
|
179
|
+
bundle "install"
|
180
|
+
should_be_installed "rack 1.0.0"
|
181
|
+
end
|
182
|
+
|
183
|
+
it "serializes global git sources" do
|
184
|
+
git = build_git "foo"
|
185
|
+
|
186
|
+
install_gemfile <<-G
|
187
|
+
git "#{lib_path('foo-1.0')}" do
|
188
|
+
gem "foo"
|
189
|
+
end
|
190
|
+
G
|
191
|
+
|
192
|
+
lockfile_should_be <<-G
|
193
|
+
GIT
|
194
|
+
remote: #{lib_path('foo-1.0')}
|
195
|
+
revision: #{git.ref_for('master')}
|
196
|
+
specs:
|
197
|
+
foo (1.0)
|
198
|
+
|
199
|
+
GEM
|
200
|
+
specs:
|
201
|
+
|
202
|
+
PLATFORMS
|
203
|
+
#{generic(Gem::Platform.local)}
|
204
|
+
|
205
|
+
DEPENDENCIES
|
206
|
+
foo!
|
207
|
+
G
|
208
|
+
end
|
209
|
+
|
210
|
+
it "serializes global svn sources" do
|
211
|
+
build_svn "foo"
|
212
|
+
|
213
|
+
install_gemfile <<-G
|
214
|
+
svn "file://#{lib_path('foo-1.0')}" do
|
215
|
+
gem "foo"
|
216
|
+
end
|
217
|
+
G
|
218
|
+
|
219
|
+
lockfile_should_be <<-G
|
220
|
+
SVN
|
221
|
+
remote: file://#{lib_path('foo-1.0')}
|
222
|
+
revision: 1
|
223
|
+
specs:
|
224
|
+
foo (1.0)
|
225
|
+
|
226
|
+
GEM
|
227
|
+
specs:
|
228
|
+
|
229
|
+
PLATFORMS
|
230
|
+
#{generic(Gem::Platform.local)}
|
231
|
+
|
232
|
+
DEPENDENCIES
|
233
|
+
foo!
|
234
|
+
G
|
235
|
+
end
|
236
|
+
|
237
|
+
it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do
|
238
|
+
git = build_git "foo"
|
239
|
+
update_git "foo", :branch => "omg"
|
240
|
+
|
241
|
+
install_gemfile <<-G
|
242
|
+
gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
|
243
|
+
G
|
244
|
+
|
245
|
+
lockfile_should_be <<-G
|
246
|
+
GIT
|
247
|
+
remote: #{lib_path("foo-1.0")}
|
248
|
+
revision: #{git.ref_for('omg')}
|
249
|
+
branch: omg
|
250
|
+
specs:
|
251
|
+
foo (1.0)
|
252
|
+
|
253
|
+
GEM
|
254
|
+
specs:
|
255
|
+
|
256
|
+
PLATFORMS
|
257
|
+
#{generic(Gem::Platform.local)}
|
258
|
+
|
259
|
+
DEPENDENCIES
|
260
|
+
foo!
|
261
|
+
G
|
262
|
+
end
|
263
|
+
|
264
|
+
it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do
|
265
|
+
git = build_git "foo"
|
266
|
+
update_git "foo", :tag => "omg"
|
267
|
+
|
268
|
+
install_gemfile <<-G
|
269
|
+
gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"
|
270
|
+
G
|
271
|
+
|
272
|
+
lockfile_should_be <<-G
|
273
|
+
GIT
|
274
|
+
remote: #{lib_path("foo-1.0")}
|
275
|
+
revision: #{git.ref_for('omg')}
|
276
|
+
tag: omg
|
277
|
+
specs:
|
278
|
+
foo (1.0)
|
279
|
+
|
280
|
+
GEM
|
281
|
+
specs:
|
282
|
+
|
283
|
+
PLATFORMS
|
284
|
+
#{generic(Gem::Platform.local)}
|
285
|
+
|
286
|
+
DEPENDENCIES
|
287
|
+
foo!
|
288
|
+
G
|
289
|
+
end
|
290
|
+
|
291
|
+
it "serializes pinned path sources to the lockfile" do
|
292
|
+
build_lib "foo"
|
293
|
+
|
294
|
+
install_gemfile <<-G
|
295
|
+
gem "foo", :path => "#{lib_path("foo-1.0")}"
|
296
|
+
G
|
297
|
+
|
298
|
+
lockfile_should_be <<-G
|
299
|
+
PATH
|
300
|
+
remote: #{lib_path("foo-1.0")}
|
301
|
+
specs:
|
302
|
+
foo (1.0)
|
303
|
+
|
304
|
+
GEM
|
305
|
+
specs:
|
306
|
+
|
307
|
+
PLATFORMS
|
308
|
+
#{generic(Gem::Platform.local)}
|
309
|
+
|
310
|
+
DEPENDENCIES
|
311
|
+
foo!
|
312
|
+
G
|
313
|
+
end
|
314
|
+
|
315
|
+
it "lists gems alphabetically" do
|
316
|
+
install_gemfile <<-G
|
317
|
+
source "file://#{gem_repo1}"
|
318
|
+
|
319
|
+
gem "thin"
|
320
|
+
gem "actionpack"
|
321
|
+
gem "rack-obama"
|
322
|
+
G
|
323
|
+
|
324
|
+
lockfile_should_be <<-G
|
325
|
+
GEM
|
326
|
+
remote: file:#{gem_repo1}/
|
327
|
+
specs:
|
328
|
+
actionpack (2.3.2)
|
329
|
+
activesupport (= 2.3.2)
|
330
|
+
activesupport (2.3.2)
|
331
|
+
rack (1.0.0)
|
332
|
+
rack-obama (1.0)
|
333
|
+
rack
|
334
|
+
thin (1.0)
|
335
|
+
rack
|
336
|
+
|
337
|
+
PLATFORMS
|
338
|
+
#{generic(Gem::Platform.local)}
|
339
|
+
|
340
|
+
DEPENDENCIES
|
341
|
+
actionpack
|
342
|
+
rack-obama
|
343
|
+
thin
|
344
|
+
G
|
345
|
+
end
|
346
|
+
|
347
|
+
it "orders dependencies' dependencies in alphabetical order" do
|
348
|
+
install_gemfile <<-G
|
349
|
+
source "file://#{gem_repo1}"
|
350
|
+
|
351
|
+
gem "rails"
|
352
|
+
G
|
353
|
+
|
354
|
+
lockfile_should_be <<-G
|
355
|
+
GEM
|
356
|
+
remote: file:#{gem_repo1}/
|
357
|
+
specs:
|
358
|
+
actionmailer (2.3.2)
|
359
|
+
activesupport (= 2.3.2)
|
360
|
+
actionpack (2.3.2)
|
361
|
+
activesupport (= 2.3.2)
|
362
|
+
activerecord (2.3.2)
|
363
|
+
activesupport (= 2.3.2)
|
364
|
+
activeresource (2.3.2)
|
365
|
+
activesupport (= 2.3.2)
|
366
|
+
activesupport (2.3.2)
|
367
|
+
rails (2.3.2)
|
368
|
+
actionmailer (= 2.3.2)
|
369
|
+
actionpack (= 2.3.2)
|
370
|
+
activerecord (= 2.3.2)
|
371
|
+
activeresource (= 2.3.2)
|
372
|
+
rake (= 10.0.2)
|
373
|
+
rake (10.0.2)
|
374
|
+
|
375
|
+
PLATFORMS
|
376
|
+
#{generic(Gem::Platform.local)}
|
377
|
+
|
378
|
+
DEPENDENCIES
|
379
|
+
rails
|
380
|
+
G
|
381
|
+
end
|
382
|
+
|
383
|
+
it "orders dependencies by version" do
|
384
|
+
install_gemfile <<-G
|
385
|
+
source "file://#{gem_repo1}"
|
386
|
+
gem 'double_deps'
|
387
|
+
G
|
388
|
+
|
389
|
+
lockfile_should_be <<-G
|
390
|
+
GEM
|
391
|
+
remote: file:#{gem_repo1}/
|
392
|
+
specs:
|
393
|
+
double_deps (1.0)
|
394
|
+
net-ssh
|
395
|
+
net-ssh (>= 1.0.0)
|
396
|
+
net-ssh (1.0)
|
397
|
+
|
398
|
+
PLATFORMS
|
399
|
+
#{generic(Gem::Platform.local)}
|
400
|
+
|
401
|
+
DEPENDENCIES
|
402
|
+
double_deps
|
403
|
+
G
|
404
|
+
end
|
405
|
+
|
406
|
+
it "does not add the :require option to the lockfile" do
|
407
|
+
install_gemfile <<-G
|
408
|
+
source "file://#{gem_repo1}"
|
409
|
+
|
410
|
+
gem "rack-obama", ">= 1.0", :require => "rack/obama"
|
411
|
+
G
|
412
|
+
|
413
|
+
lockfile_should_be <<-G
|
414
|
+
GEM
|
415
|
+
remote: file:#{gem_repo1}/
|
416
|
+
specs:
|
417
|
+
rack (1.0.0)
|
418
|
+
rack-obama (1.0)
|
419
|
+
rack
|
420
|
+
|
421
|
+
PLATFORMS
|
422
|
+
#{generic(Gem::Platform.local)}
|
423
|
+
|
424
|
+
DEPENDENCIES
|
425
|
+
rack-obama (>= 1.0)
|
426
|
+
G
|
427
|
+
end
|
428
|
+
|
429
|
+
it "does not add the :group option to the lockfile" do
|
430
|
+
install_gemfile <<-G
|
431
|
+
source "file://#{gem_repo1}"
|
432
|
+
|
433
|
+
gem "rack-obama", ">= 1.0", :group => :test
|
434
|
+
G
|
435
|
+
|
436
|
+
lockfile_should_be <<-G
|
437
|
+
GEM
|
438
|
+
remote: file:#{gem_repo1}/
|
439
|
+
specs:
|
440
|
+
rack (1.0.0)
|
441
|
+
rack-obama (1.0)
|
442
|
+
rack
|
443
|
+
|
444
|
+
PLATFORMS
|
445
|
+
#{generic(Gem::Platform.local)}
|
446
|
+
|
447
|
+
DEPENDENCIES
|
448
|
+
rack-obama (>= 1.0)
|
449
|
+
G
|
450
|
+
end
|
451
|
+
|
452
|
+
it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do
|
453
|
+
build_lib "foo", :path => bundled_app('foo')
|
454
|
+
|
455
|
+
install_gemfile <<-G
|
456
|
+
path "foo"
|
457
|
+
gem "foo"
|
458
|
+
G
|
459
|
+
|
460
|
+
lockfile_should_be <<-G
|
461
|
+
PATH
|
462
|
+
remote: foo
|
463
|
+
specs:
|
464
|
+
foo (1.0)
|
465
|
+
|
466
|
+
GEM
|
467
|
+
specs:
|
468
|
+
|
469
|
+
PLATFORMS
|
470
|
+
#{generic(Gem::Platform.local)}
|
471
|
+
|
472
|
+
DEPENDENCIES
|
473
|
+
foo
|
474
|
+
G
|
475
|
+
end
|
476
|
+
|
477
|
+
it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do
|
478
|
+
build_lib "foo", :path => bundled_app(File.join('..', 'foo'))
|
479
|
+
|
480
|
+
install_gemfile <<-G
|
481
|
+
path "../foo"
|
482
|
+
gem "foo"
|
483
|
+
G
|
484
|
+
|
485
|
+
lockfile_should_be <<-G
|
486
|
+
PATH
|
487
|
+
remote: ../foo
|
488
|
+
specs:
|
489
|
+
foo (1.0)
|
490
|
+
|
491
|
+
GEM
|
492
|
+
specs:
|
493
|
+
|
494
|
+
PLATFORMS
|
495
|
+
#{generic(Gem::Platform.local)}
|
496
|
+
|
497
|
+
DEPENDENCIES
|
498
|
+
foo
|
499
|
+
G
|
500
|
+
end
|
501
|
+
|
502
|
+
it "stores relative paths when the path is provided in an absolute fashion but is relative" do
|
503
|
+
build_lib "foo", :path => bundled_app('foo')
|
504
|
+
|
505
|
+
install_gemfile <<-G
|
506
|
+
path File.expand_path("../foo", __FILE__)
|
507
|
+
gem "foo"
|
508
|
+
G
|
509
|
+
|
510
|
+
lockfile_should_be <<-G
|
511
|
+
PATH
|
512
|
+
remote: foo
|
513
|
+
specs:
|
514
|
+
foo (1.0)
|
515
|
+
|
516
|
+
GEM
|
517
|
+
specs:
|
518
|
+
|
519
|
+
PLATFORMS
|
520
|
+
#{generic(Gem::Platform.local)}
|
521
|
+
|
522
|
+
DEPENDENCIES
|
523
|
+
foo
|
524
|
+
G
|
525
|
+
end
|
526
|
+
|
527
|
+
it "stores relative paths when the path is provided for gemspec" do
|
528
|
+
build_lib("foo", :path => tmp.join("foo"))
|
529
|
+
|
530
|
+
install_gemfile <<-G
|
531
|
+
gemspec :path => "../foo"
|
532
|
+
G
|
533
|
+
|
534
|
+
lockfile_should_be <<-G
|
535
|
+
PATH
|
536
|
+
remote: ../foo
|
537
|
+
specs:
|
538
|
+
foo (1.0)
|
539
|
+
|
540
|
+
GEM
|
541
|
+
specs:
|
542
|
+
|
543
|
+
PLATFORMS
|
544
|
+
#{generic(Gem::Platform.local)}
|
545
|
+
|
546
|
+
DEPENDENCIES
|
547
|
+
foo!
|
548
|
+
G
|
549
|
+
end
|
550
|
+
|
551
|
+
it "keeps existing platforms in the lockfile" do
|
552
|
+
lockfile <<-G
|
553
|
+
GEM
|
554
|
+
remote: file:#{gem_repo1}/
|
555
|
+
specs:
|
556
|
+
rack (1.0.0)
|
557
|
+
|
558
|
+
PLATFORMS
|
559
|
+
java
|
560
|
+
|
561
|
+
DEPENDENCIES
|
562
|
+
rack
|
563
|
+
G
|
564
|
+
|
565
|
+
install_gemfile <<-G
|
566
|
+
source "file://#{gem_repo1}"
|
567
|
+
|
568
|
+
gem "rack"
|
569
|
+
G
|
570
|
+
|
571
|
+
platforms = ['java', generic(Gem::Platform.local).to_s].sort
|
572
|
+
|
573
|
+
lockfile_should_be <<-G
|
574
|
+
GEM
|
575
|
+
remote: file:#{gem_repo1}/
|
576
|
+
specs:
|
577
|
+
rack (1.0.0)
|
578
|
+
|
579
|
+
PLATFORMS
|
580
|
+
#{platforms[0]}
|
581
|
+
#{platforms[1]}
|
582
|
+
|
583
|
+
DEPENDENCIES
|
584
|
+
rack
|
585
|
+
G
|
586
|
+
end
|
587
|
+
|
588
|
+
it "persists the spec's platform to the lockfile" do
|
589
|
+
build_gem "platform_specific", "1.0.0", :to_system => true do |s|
|
590
|
+
s.platform = Gem::Platform.new('universal-java-16')
|
591
|
+
end
|
592
|
+
|
593
|
+
simulate_platform "universal-java-16"
|
594
|
+
|
595
|
+
install_gemfile <<-G
|
596
|
+
source "file://#{gem_repo1}"
|
597
|
+
gem "platform_specific"
|
598
|
+
G
|
599
|
+
|
600
|
+
lockfile_should_be <<-G
|
601
|
+
GEM
|
602
|
+
remote: file:#{gem_repo1}/
|
603
|
+
specs:
|
604
|
+
platform_specific (1.0-java)
|
605
|
+
|
606
|
+
PLATFORMS
|
607
|
+
java
|
608
|
+
|
609
|
+
DEPENDENCIES
|
610
|
+
platform_specific
|
611
|
+
G
|
612
|
+
end
|
613
|
+
|
614
|
+
it "does not add duplicate gems" do
|
615
|
+
install_gemfile <<-G
|
616
|
+
source "file://#{gem_repo1}"
|
617
|
+
gem "rack"
|
618
|
+
G
|
619
|
+
|
620
|
+
install_gemfile <<-G
|
621
|
+
source "file://#{gem_repo1}"
|
622
|
+
gem "rack"
|
623
|
+
gem "activesupport"
|
624
|
+
G
|
625
|
+
|
626
|
+
lockfile_should_be <<-G
|
627
|
+
GEM
|
628
|
+
remote: file:#{gem_repo1}/
|
629
|
+
specs:
|
630
|
+
activesupport (2.3.5)
|
631
|
+
rack (1.0.0)
|
632
|
+
|
633
|
+
PLATFORMS
|
634
|
+
ruby
|
635
|
+
|
636
|
+
DEPENDENCIES
|
637
|
+
activesupport
|
638
|
+
rack
|
639
|
+
G
|
640
|
+
end
|
641
|
+
|
642
|
+
it "does not add duplicate dependencies" do
|
643
|
+
install_gemfile <<-G
|
644
|
+
source "file://#{gem_repo1}"
|
645
|
+
gem "rack"
|
646
|
+
gem "rack"
|
647
|
+
G
|
648
|
+
|
649
|
+
lockfile_should_be <<-G
|
650
|
+
GEM
|
651
|
+
remote: file:#{gem_repo1}/
|
652
|
+
specs:
|
653
|
+
rack (1.0.0)
|
654
|
+
|
655
|
+
PLATFORMS
|
656
|
+
ruby
|
657
|
+
|
658
|
+
DEPENDENCIES
|
659
|
+
rack
|
660
|
+
G
|
661
|
+
end
|
662
|
+
|
663
|
+
it "does not add duplicate dependencies with versions" do
|
664
|
+
install_gemfile <<-G
|
665
|
+
source "file://#{gem_repo1}"
|
666
|
+
gem "rack", "1.0"
|
667
|
+
gem "rack", "1.0"
|
668
|
+
G
|
669
|
+
|
670
|
+
lockfile_should_be <<-G
|
671
|
+
GEM
|
672
|
+
remote: file:#{gem_repo1}/
|
673
|
+
specs:
|
674
|
+
rack (1.0.0)
|
675
|
+
|
676
|
+
PLATFORMS
|
677
|
+
ruby
|
678
|
+
|
679
|
+
DEPENDENCIES
|
680
|
+
rack (= 1.0)
|
681
|
+
G
|
682
|
+
end
|
683
|
+
|
684
|
+
it "does not add duplicate dependencies in different groups" do
|
685
|
+
install_gemfile <<-G
|
686
|
+
source "file://#{gem_repo1}"
|
687
|
+
gem "rack", "1.0", :group => :one
|
688
|
+
gem "rack", "1.0", :group => :two
|
689
|
+
G
|
690
|
+
|
691
|
+
lockfile_should_be <<-G
|
692
|
+
GEM
|
693
|
+
remote: file:#{gem_repo1}/
|
694
|
+
specs:
|
695
|
+
rack (1.0.0)
|
696
|
+
|
697
|
+
PLATFORMS
|
698
|
+
ruby
|
699
|
+
|
700
|
+
DEPENDENCIES
|
701
|
+
rack (= 1.0)
|
702
|
+
G
|
703
|
+
end
|
704
|
+
|
705
|
+
it "raises if two different versions are used" do
|
706
|
+
install_gemfile <<-G
|
707
|
+
source "file://#{gem_repo1}"
|
708
|
+
gem "rack", "1.0"
|
709
|
+
gem "rack", "1.1"
|
710
|
+
G
|
711
|
+
|
712
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
713
|
+
expect(out).to include "rack (= 1.0) and rack (= 1.1)"
|
714
|
+
end
|
715
|
+
|
716
|
+
|
717
|
+
it "raises if two different sources are used" do
|
718
|
+
install_gemfile <<-G
|
719
|
+
source "file://#{gem_repo1}"
|
720
|
+
gem "rack"
|
721
|
+
gem "rack", :git => "git://hubz.com"
|
722
|
+
G
|
723
|
+
|
724
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
725
|
+
expect(out).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
|
726
|
+
end
|
727
|
+
|
728
|
+
it "works correctly with multiple version dependencies" do
|
729
|
+
install_gemfile <<-G
|
730
|
+
source "file://#{gem_repo1}"
|
731
|
+
gem "rack", "> 0.9", "< 1.0"
|
732
|
+
G
|
733
|
+
|
734
|
+
lockfile_should_be <<-G
|
735
|
+
GEM
|
736
|
+
remote: file:#{gem_repo1}/
|
737
|
+
specs:
|
738
|
+
rack (0.9.1)
|
739
|
+
|
740
|
+
PLATFORMS
|
741
|
+
ruby
|
742
|
+
|
743
|
+
DEPENDENCIES
|
744
|
+
rack (> 0.9, < 1.0)
|
745
|
+
G
|
746
|
+
|
747
|
+
end
|
748
|
+
|
749
|
+
# Some versions of the Bundler 1.1 RC series introduced corrupted
|
750
|
+
# lockfiles. There were two major problems:
|
751
|
+
#
|
752
|
+
# * multiple copies of the same GIT section appeared in the lockfile
|
753
|
+
# * when this happened, those sections got multiple copies of gems
|
754
|
+
# in those sections.
|
755
|
+
it "fixes corrupted lockfiles" do
|
756
|
+
build_git "omg", :path => lib_path('omg')
|
757
|
+
revision = revision_for(lib_path('omg'))
|
758
|
+
|
759
|
+
gemfile <<-G
|
760
|
+
source "file://#{gem_repo1}"
|
761
|
+
gem "omg", :git => "#{lib_path('omg')}", :branch => 'master'
|
762
|
+
G
|
763
|
+
|
764
|
+
bundle "install --path vendor"
|
765
|
+
should_be_installed "omg 1.0"
|
766
|
+
|
767
|
+
# Create a Gemfile.lock that has duplicate GIT sections
|
768
|
+
lockfile <<-L
|
769
|
+
GIT
|
770
|
+
remote: #{lib_path('omg')}
|
771
|
+
revision: #{revision}
|
772
|
+
branch: master
|
773
|
+
specs:
|
774
|
+
omg (1.0)
|
775
|
+
|
776
|
+
GIT
|
777
|
+
remote: #{lib_path('omg')}
|
778
|
+
revision: #{revision}
|
779
|
+
branch: master
|
780
|
+
specs:
|
781
|
+
omg (1.0)
|
782
|
+
|
783
|
+
GEM
|
784
|
+
remote: file:#{gem_repo1}/
|
785
|
+
specs:
|
786
|
+
|
787
|
+
PLATFORMS
|
788
|
+
#{local}
|
789
|
+
|
790
|
+
DEPENDENCIES
|
791
|
+
omg!
|
792
|
+
L
|
793
|
+
|
794
|
+
FileUtils.rm_rf(bundled_app('vendor'))
|
795
|
+
bundle "install"
|
796
|
+
should_be_installed "omg 1.0"
|
797
|
+
|
798
|
+
# Confirm that duplicate specs do not appear
|
799
|
+
expect(File.read(bundled_app('Gemfile.lock'))).to eq(strip_whitespace(<<-L))
|
800
|
+
GIT
|
801
|
+
remote: #{lib_path('omg')}
|
802
|
+
revision: #{revision}
|
803
|
+
branch: master
|
804
|
+
specs:
|
805
|
+
omg (1.0)
|
806
|
+
|
807
|
+
GEM
|
808
|
+
remote: file:#{gem_repo1}/
|
809
|
+
specs:
|
810
|
+
|
811
|
+
PLATFORMS
|
812
|
+
#{local}
|
813
|
+
|
814
|
+
DEPENDENCIES
|
815
|
+
omg!
|
816
|
+
L
|
817
|
+
end
|
818
|
+
|
819
|
+
describe "a line ending" do
|
820
|
+
def set_lockfile_mtime_to_known_value
|
821
|
+
time = Time.local(2000, 1, 1, 0, 0, 0)
|
822
|
+
File.utime(time, time, bundled_app('Gemfile.lock'))
|
823
|
+
end
|
824
|
+
before(:each) do
|
825
|
+
build_repo2
|
826
|
+
install_gemfile <<-G
|
827
|
+
source "file://#{gem_repo2}"
|
828
|
+
gem "rack"
|
829
|
+
G
|
830
|
+
set_lockfile_mtime_to_known_value
|
831
|
+
end
|
832
|
+
|
833
|
+
it "generates Gemfile.lock with \\n line endings" do
|
834
|
+
expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
|
835
|
+
should_be_installed "rack 1.0"
|
836
|
+
end
|
837
|
+
|
838
|
+
context "during updates" do
|
839
|
+
|
840
|
+
it "preserves Gemfile.lock \\n line endings" do
|
841
|
+
update_repo2
|
842
|
+
|
843
|
+
expect { bundle "update" }.to change { File.mtime(bundled_app('Gemfile.lock')) }
|
844
|
+
expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
|
845
|
+
should_be_installed "rack 1.2"
|
846
|
+
end
|
847
|
+
|
848
|
+
it "preserves Gemfile.lock \\n\\r line endings" do
|
849
|
+
update_repo2
|
850
|
+
win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
|
851
|
+
File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
|
852
|
+
set_lockfile_mtime_to_known_value
|
853
|
+
|
854
|
+
expect { bundle "update" }.to change { File.mtime(bundled_app('Gemfile.lock')) }
|
855
|
+
expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n")
|
856
|
+
should_be_installed "rack 1.2"
|
857
|
+
end
|
858
|
+
end
|
859
|
+
|
860
|
+
context "when nothing changes" do
|
861
|
+
|
862
|
+
it "preserves Gemfile.lock \\n line endings" do
|
863
|
+
expect { ruby <<-RUBY
|
864
|
+
require 'rubygems'
|
865
|
+
require 'bundler'
|
866
|
+
Bundler.setup
|
867
|
+
RUBY
|
868
|
+
}.not_to change { File.mtime(bundled_app('Gemfile.lock')) }
|
869
|
+
end
|
870
|
+
|
871
|
+
it "preserves Gemfile.lock \\n\\r line endings" do
|
872
|
+
win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
|
873
|
+
File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
|
874
|
+
set_lockfile_mtime_to_known_value
|
875
|
+
|
876
|
+
expect { ruby <<-RUBY
|
877
|
+
require 'rubygems'
|
878
|
+
require 'bundler'
|
879
|
+
Bundler.setup
|
880
|
+
RUBY
|
881
|
+
}.not_to change { File.mtime(bundled_app('Gemfile.lock')) }
|
882
|
+
end
|
883
|
+
end
|
884
|
+
end
|
885
|
+
|
886
|
+
it "refuses to install if Gemfile.lock contains conflict markers" do
|
887
|
+
lockfile <<-L
|
888
|
+
GEM
|
889
|
+
remote: file://#{gem_repo1}/
|
890
|
+
specs:
|
891
|
+
<<<<<<<
|
892
|
+
rack (1.0.0)
|
893
|
+
=======
|
894
|
+
rack (1.0.1)
|
895
|
+
>>>>>>>
|
896
|
+
|
897
|
+
PLATFORMS
|
898
|
+
ruby
|
899
|
+
|
900
|
+
DEPENDENCIES
|
901
|
+
rack
|
902
|
+
L
|
903
|
+
|
904
|
+
error = install_gemfile(<<-G, :expect_err => true)
|
905
|
+
source "file://#{gem_repo1}"
|
906
|
+
gem "rack"
|
907
|
+
G
|
908
|
+
|
909
|
+
expect(error).to match(/your Gemfile.lock contains merge conflicts/i)
|
910
|
+
expect(error).to match(/git checkout HEAD -- Gemfile.lock/i)
|
911
|
+
end
|
912
|
+
end
|