bundler_package_git 1.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +659 -0
- data/ISSUES.md +47 -0
- data/LICENSE +23 -0
- data/README.md +29 -0
- data/Rakefile +167 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +22 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +283 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +490 -0
- data/lib/bundler/definition.rb +429 -0
- data/lib/bundler/dependency.rb +130 -0
- data/lib/bundler/deployment.rb +53 -0
- data/lib/bundler/dsl.rb +243 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/fetcher.rb +101 -0
- data/lib/bundler/gem_helper.rb +146 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +131 -0
- data/lib/bundler/installer.rb +117 -0
- data/lib/bundler/lazy_specification.rb +71 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +470 -0
- data/lib/bundler/rubygems_ext.rb +226 -0
- data/lib/bundler/runtime.rb +201 -0
- data/lib/bundler/settings.rb +117 -0
- data/lib/bundler/setup.rb +16 -0
- data/lib/bundler/shared_helpers.rb +167 -0
- data/lib/bundler/source.rb +675 -0
- data/lib/bundler/spec_set.rb +134 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +4 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -0
- data/lib/bundler/ui.rb +73 -0
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +464 -0
- data/lib/bundler/vendor/thor.rb +319 -0
- data/lib/bundler/vendor/thor/actions.rb +297 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +229 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +104 -0
- data/lib/bundler/vendor/thor/base.rb +556 -0
- data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
- data/lib/bundler/vendor/thor/error.rb +30 -0
- data/lib/bundler/vendor/thor/invocation.rb +168 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
- data/lib/bundler/vendor/thor/parser/option.rb +120 -0
- data/lib/bundler/vendor/thor/parser/options.rb +174 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +275 -0
- data/lib/bundler/vendor/thor/shell/color.rb +108 -0
- data/lib/bundler/vendor/thor/shell/html.rb +121 -0
- data/lib/bundler/vendor/thor/task.rb +114 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +9 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +314 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +80 -0
- data/man/gemfile.5.ronn +279 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +219 -0
- data/spec/cache/git_spec.rb +9 -0
- data/spec/cache/path_spec.rb +27 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +197 -0
- data/spec/install/deprecated_spec.rb +37 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +85 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +313 -0
- data/spec/install/gems/groups_spec.rb +245 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +208 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +715 -0
- data/spec/install/gems/standalone_spec.rb +162 -0
- data/spec/install/gems/sudo_spec.rb +73 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +108 -0
- data/spec/install/git_spec.rb +571 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +353 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +683 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/clean_spec.rb +202 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +128 -0
- data/spec/other/help_spec.rb +38 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +24 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/show_spec.rb +82 -0
- data/spec/pack/gems_spec.rb +54 -0
- data/spec/quality_spec.rb +58 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +82 -0
- data/spec/runtime/executable_spec.rb +110 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +231 -0
- data/spec/runtime/setup_spec.rb +688 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/artifice/endpoint.rb +50 -0
- data/spec/support/artifice/endpoint_fallback.rb +22 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +11 -0
- data/spec/support/builders.rb +574 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +246 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +73 -0
- data/spec/support/platforms.rb +53 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +35 -0
- data/spec/support/rubygems_hax/platform.rb +11 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +121 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +294 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with deprecated features" do
|
4
|
+
before :each do
|
5
|
+
in_app_root
|
6
|
+
end
|
7
|
+
|
8
|
+
%w( only except disable_system_gems disable_rubygems
|
9
|
+
clear_sources bundle_path bin_path ).each do |deprecated|
|
10
|
+
|
11
|
+
it "reports that #{deprecated} is deprecated" do
|
12
|
+
gemfile <<-G
|
13
|
+
#{deprecated}
|
14
|
+
G
|
15
|
+
|
16
|
+
bundle :install
|
17
|
+
out.should =~ /'#{deprecated}' has been removed/
|
18
|
+
out.should =~ /See the README for more information/
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
%w( require_as vendored_at only except ).each do |deprecated|
|
25
|
+
|
26
|
+
it "reports that :#{deprecated} is deprecated" do
|
27
|
+
gemfile <<-G
|
28
|
+
gem "rack", :#{deprecated} => true
|
29
|
+
G
|
30
|
+
|
31
|
+
bundle :install
|
32
|
+
out.should =~ /Please replace :#{deprecated}|The :#{deprecated} option is no longer supported/
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "installing a gem with C extensions" do
|
4
|
+
it "installs" do
|
5
|
+
build_repo2 do
|
6
|
+
build_gem "c_extension" do |s|
|
7
|
+
s.extensions = ["ext/extconf.rb"]
|
8
|
+
s.write "ext/extconf.rb", <<-E
|
9
|
+
require "mkmf"
|
10
|
+
name = "c_extension_bundle"
|
11
|
+
dir_config(name)
|
12
|
+
raise "OMG" unless with_config("c_extension") == "hello"
|
13
|
+
create_makefile(name)
|
14
|
+
E
|
15
|
+
|
16
|
+
s.write "ext/c_extension.c", <<-C
|
17
|
+
#include "ruby.h"
|
18
|
+
|
19
|
+
VALUE c_extension_true(VALUE self) {
|
20
|
+
return Qtrue;
|
21
|
+
}
|
22
|
+
|
23
|
+
void Init_c_extension_bundle() {
|
24
|
+
VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
|
25
|
+
rb_define_method(c_Extension, "its_true", c_extension_true, 0);
|
26
|
+
}
|
27
|
+
C
|
28
|
+
|
29
|
+
s.write "lib/c_extension.rb", <<-C
|
30
|
+
require "c_extension_bundle"
|
31
|
+
C
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
gemfile <<-G
|
36
|
+
source "file://#{gem_repo2}"
|
37
|
+
gem "c_extension"
|
38
|
+
G
|
39
|
+
|
40
|
+
bundle "config build.c_extension --with-c_extension=hello"
|
41
|
+
bundle "install"
|
42
|
+
|
43
|
+
out.should_not include("extconf.rb failed")
|
44
|
+
|
45
|
+
run "Bundler.require; puts CExtension.new.its_true"
|
46
|
+
out.should == "true"
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "gemcutter's dependency API" do
|
4
|
+
it "should use the API" do
|
5
|
+
gemfile <<-G
|
6
|
+
source "http://localgemserver.test"
|
7
|
+
gem "rack"
|
8
|
+
G
|
9
|
+
|
10
|
+
bundle :install, :artifice => "endpoint"
|
11
|
+
should_be_installed "rack 1.0.0"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should handle nested dependencies" do
|
15
|
+
gemfile <<-G
|
16
|
+
source "http://localgemserver.test"
|
17
|
+
gem "rails"
|
18
|
+
G
|
19
|
+
|
20
|
+
bundle :install, :artifice => "endpoint"
|
21
|
+
should_be_installed(
|
22
|
+
"rails 2.3.2",
|
23
|
+
"actionpack 2.3.2",
|
24
|
+
"activerecord 2.3.2",
|
25
|
+
"actionmailer 2.3.2",
|
26
|
+
"activeresource 2.3.2",
|
27
|
+
"activesupport 2.3.2")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "falls back when the API errors out" do
|
31
|
+
simulate_platform mswin
|
32
|
+
|
33
|
+
gemfile <<-G
|
34
|
+
source "http://localgemserver.test/"
|
35
|
+
gem "rcov"
|
36
|
+
G
|
37
|
+
|
38
|
+
bundle :install, :fakeweb => "windows"
|
39
|
+
should_be_installed "rcov 1.0.0"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "falls back when hitting the Gemcutter Dependency Limit" do
|
43
|
+
gemfile <<-G
|
44
|
+
source "http://localgemserver.test"
|
45
|
+
gem "activesupport"
|
46
|
+
gem "actionpack"
|
47
|
+
gem "actionmailer"
|
48
|
+
gem "activeresource"
|
49
|
+
gem "thin"
|
50
|
+
gem "rack"
|
51
|
+
gem "rails"
|
52
|
+
G
|
53
|
+
bundle :install, :artifice => "endpoint_fallback"
|
54
|
+
|
55
|
+
should_be_installed(
|
56
|
+
"activesupport 2.3.2",
|
57
|
+
"actionpack 2.3.2",
|
58
|
+
"actionmailer 2.3.2",
|
59
|
+
"activeresource 2.3.2",
|
60
|
+
"activesupport 2.3.2",
|
61
|
+
"thin 1.0.0",
|
62
|
+
"rack 1.0.0",
|
63
|
+
"rails 2.3.2")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "falls back when Gemcutter API doesn't return proper Marshal format" do
|
67
|
+
gemfile <<-G
|
68
|
+
source "http://localgemserver.test"
|
69
|
+
gem "rack"
|
70
|
+
G
|
71
|
+
|
72
|
+
bundle :install, :artifice => "endpoint_marshal_fail"
|
73
|
+
should_be_installed "rack 1.0.0"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "timeouts when Bundler::Fetcher redirects to much" do
|
77
|
+
gemfile <<-G
|
78
|
+
source "http://localgemserver.test"
|
79
|
+
gem "rack"
|
80
|
+
G
|
81
|
+
|
82
|
+
bundle :install, :artifice => "endpoint_redirect"
|
83
|
+
out.should match(/Too many redirects/)
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with ENV conditionals" do
|
4
|
+
describe "when just setting an ENV key as a string" do
|
5
|
+
before :each do
|
6
|
+
gemfile <<-G
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
|
9
|
+
env "BUNDLER_TEST" do
|
10
|
+
gem "rack"
|
11
|
+
end
|
12
|
+
G
|
13
|
+
end
|
14
|
+
|
15
|
+
it "excludes the gems when the ENV variable is not set" do
|
16
|
+
bundle :install
|
17
|
+
should_not_be_installed "rack"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "includes the gems when the ENV variable is set" do
|
21
|
+
ENV['BUNDLER_TEST'] = '1'
|
22
|
+
bundle :install
|
23
|
+
should_be_installed "rack 1.0"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "when just setting an ENV key as a symbol" do
|
28
|
+
before :each do
|
29
|
+
gemfile <<-G
|
30
|
+
source "file://#{gem_repo1}"
|
31
|
+
|
32
|
+
env :BUNDLER_TEST do
|
33
|
+
gem "rack"
|
34
|
+
end
|
35
|
+
G
|
36
|
+
end
|
37
|
+
|
38
|
+
it "excludes the gems when the ENV variable is not set" do
|
39
|
+
bundle :install
|
40
|
+
should_not_be_installed "rack"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "includes the gems when the ENV variable is set" do
|
44
|
+
ENV['BUNDLER_TEST'] = '1'
|
45
|
+
bundle :install
|
46
|
+
should_be_installed "rack 1.0"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "when setting a string to match the env" do
|
51
|
+
before :each do
|
52
|
+
gemfile <<-G
|
53
|
+
source "file://#{gem_repo1}"
|
54
|
+
|
55
|
+
env "BUNDLER_TEST" => "foo" do
|
56
|
+
gem "rack"
|
57
|
+
end
|
58
|
+
G
|
59
|
+
end
|
60
|
+
|
61
|
+
it "excludes the gems when the ENV variable is not set" do
|
62
|
+
bundle :install
|
63
|
+
should_not_be_installed "rack"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "excludes the gems when the ENV variable is set but does not match the condition" do
|
67
|
+
ENV['BUNDLER_TEST'] = '1'
|
68
|
+
bundle :install
|
69
|
+
should_not_be_installed "rack"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "includes the gems when the ENV variable is set and matches the condition" do
|
73
|
+
ENV['BUNDLER_TEST'] = 'foo'
|
74
|
+
bundle :install
|
75
|
+
should_be_installed "rack 1.0"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "when setting a regex to match the env" do
|
80
|
+
before :each do
|
81
|
+
gemfile <<-G
|
82
|
+
source "file://#{gem_repo1}"
|
83
|
+
|
84
|
+
env "BUNDLER_TEST" => /foo/ do
|
85
|
+
gem "rack"
|
86
|
+
end
|
87
|
+
G
|
88
|
+
end
|
89
|
+
|
90
|
+
it "excludes the gems when the ENV variable is not set" do
|
91
|
+
bundle :install
|
92
|
+
should_not_be_installed "rack"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "excludes the gems when the ENV variable is set but does not match the condition" do
|
96
|
+
ENV['BUNDLER_TEST'] = 'fo'
|
97
|
+
bundle :install
|
98
|
+
should_not_be_installed "rack"
|
99
|
+
end
|
100
|
+
|
101
|
+
it "includes the gems when the ENV variable is set and matches the condition" do
|
102
|
+
ENV['BUNDLER_TEST'] = 'foobar'
|
103
|
+
bundle :install
|
104
|
+
should_be_installed "rack 1.0"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,313 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle flex_install" do
|
4
|
+
it "installs the gems as expected" do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem 'rack'
|
8
|
+
G
|
9
|
+
|
10
|
+
should_be_installed "rack 1.0.0"
|
11
|
+
should_be_locked
|
12
|
+
end
|
13
|
+
|
14
|
+
it "installs even when the lockfile is invalid" do
|
15
|
+
install_gemfile <<-G
|
16
|
+
source "file://#{gem_repo1}"
|
17
|
+
gem 'rack'
|
18
|
+
G
|
19
|
+
|
20
|
+
should_be_installed "rack 1.0.0"
|
21
|
+
should_be_locked
|
22
|
+
|
23
|
+
gemfile <<-G
|
24
|
+
source "file://#{gem_repo1}"
|
25
|
+
gem 'rack', '1.0'
|
26
|
+
G
|
27
|
+
|
28
|
+
bundle :install
|
29
|
+
should_be_installed "rack 1.0.0"
|
30
|
+
should_be_locked
|
31
|
+
end
|
32
|
+
|
33
|
+
it "keeps child dependencies at the same version" do
|
34
|
+
build_repo2
|
35
|
+
|
36
|
+
install_gemfile <<-G
|
37
|
+
source "file://#{gem_repo2}"
|
38
|
+
gem "rack-obama"
|
39
|
+
G
|
40
|
+
|
41
|
+
should_be_installed "rack 1.0.0", "rack-obama 1.0.0"
|
42
|
+
|
43
|
+
update_repo2
|
44
|
+
install_gemfile <<-G
|
45
|
+
source "file://#{gem_repo2}"
|
46
|
+
gem "rack-obama", "1.0"
|
47
|
+
G
|
48
|
+
|
49
|
+
should_be_installed "rack 1.0.0", "rack-obama 1.0.0"
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "adding new gems" do
|
53
|
+
it "installs added gems without updating previously installed gems" do
|
54
|
+
build_repo2
|
55
|
+
|
56
|
+
install_gemfile <<-G
|
57
|
+
source "file://#{gem_repo2}"
|
58
|
+
gem 'rack'
|
59
|
+
G
|
60
|
+
|
61
|
+
update_repo2
|
62
|
+
|
63
|
+
install_gemfile <<-G
|
64
|
+
source "file://#{gem_repo2}"
|
65
|
+
gem 'rack'
|
66
|
+
gem 'activesupport', '2.3.5'
|
67
|
+
G
|
68
|
+
|
69
|
+
should_be_installed "rack 1.0.0", 'activesupport 2.3.5'
|
70
|
+
end
|
71
|
+
|
72
|
+
it "keeps child dependencies pinned" do
|
73
|
+
build_repo2
|
74
|
+
|
75
|
+
install_gemfile <<-G
|
76
|
+
source "file://#{gem_repo2}"
|
77
|
+
gem "rack-obama"
|
78
|
+
G
|
79
|
+
|
80
|
+
update_repo2
|
81
|
+
|
82
|
+
install_gemfile <<-G
|
83
|
+
source "file://#{gem_repo2}"
|
84
|
+
gem "rack-obama"
|
85
|
+
gem "thin"
|
86
|
+
G
|
87
|
+
|
88
|
+
should_be_installed "rack 1.0.0", 'rack-obama 1.0', 'thin 1.0'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "removing gems" do
|
93
|
+
it "removes gems without changing the versions of remaining gems" do
|
94
|
+
build_repo2
|
95
|
+
install_gemfile <<-G
|
96
|
+
source "file://#{gem_repo2}"
|
97
|
+
gem 'rack'
|
98
|
+
gem 'activesupport', '2.3.5'
|
99
|
+
G
|
100
|
+
|
101
|
+
update_repo2
|
102
|
+
|
103
|
+
install_gemfile <<-G
|
104
|
+
source "file://#{gem_repo2}"
|
105
|
+
gem 'rack'
|
106
|
+
G
|
107
|
+
|
108
|
+
should_be_installed "rack 1.0.0"
|
109
|
+
should_not_be_installed "activesupport 2.3.5"
|
110
|
+
|
111
|
+
install_gemfile <<-G
|
112
|
+
source "file://#{gem_repo2}"
|
113
|
+
gem 'rack'
|
114
|
+
gem 'activesupport', '2.3.2'
|
115
|
+
G
|
116
|
+
|
117
|
+
should_be_installed "rack 1.0.0", 'activesupport 2.3.2'
|
118
|
+
end
|
119
|
+
|
120
|
+
it "removes top level dependencies when removed from the Gemfile while leaving other dependencies intact" do
|
121
|
+
build_repo2
|
122
|
+
install_gemfile <<-G
|
123
|
+
source "file://#{gem_repo2}"
|
124
|
+
gem 'rack'
|
125
|
+
gem 'activesupport', '2.3.5'
|
126
|
+
G
|
127
|
+
|
128
|
+
update_repo2
|
129
|
+
|
130
|
+
install_gemfile <<-G
|
131
|
+
source "file://#{gem_repo2}"
|
132
|
+
gem 'rack'
|
133
|
+
G
|
134
|
+
|
135
|
+
should_not_be_installed "activesupport 2.3.5"
|
136
|
+
end
|
137
|
+
|
138
|
+
it "removes child dependencies" do
|
139
|
+
build_repo2
|
140
|
+
install_gemfile <<-G
|
141
|
+
source "file://#{gem_repo2}"
|
142
|
+
gem 'rack-obama'
|
143
|
+
gem 'activesupport'
|
144
|
+
G
|
145
|
+
|
146
|
+
should_be_installed "rack 1.0.0", "rack-obama 1.0.0", "activesupport 2.3.5"
|
147
|
+
|
148
|
+
update_repo2
|
149
|
+
install_gemfile <<-G
|
150
|
+
source "file://#{gem_repo2}"
|
151
|
+
gem 'activesupport'
|
152
|
+
G
|
153
|
+
|
154
|
+
should_be_installed 'activesupport 2.3.5'
|
155
|
+
should_not_be_installed "rack-obama", "rack"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "when Gemfile conflicts with lockfile" do
|
160
|
+
before(:each) do
|
161
|
+
build_repo2
|
162
|
+
install_gemfile <<-G
|
163
|
+
source "file://#{gem_repo2}"
|
164
|
+
gem "rack_middleware"
|
165
|
+
G
|
166
|
+
|
167
|
+
should_be_installed "rack_middleware 1.0", "rack 0.9.1"
|
168
|
+
|
169
|
+
build_repo2
|
170
|
+
update_repo2 do
|
171
|
+
build_gem "rack-obama", "2.0" do |s|
|
172
|
+
s.add_dependency "rack", "=1.2"
|
173
|
+
end
|
174
|
+
build_gem "rack_middleware", "2.0" do |s|
|
175
|
+
s.add_dependency "rack", ">=1.0"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
gemfile <<-G
|
180
|
+
source "file://#{gem_repo2}"
|
181
|
+
gem "rack-obama", "2.0"
|
182
|
+
gem "rack_middleware"
|
183
|
+
G
|
184
|
+
end
|
185
|
+
|
186
|
+
it "does not install gems whose dependencies are not met" do
|
187
|
+
bundle :install
|
188
|
+
ruby <<-RUBY
|
189
|
+
require 'bundler/setup'
|
190
|
+
RUBY
|
191
|
+
out.should =~ /could not find gem 'rack-obama/i
|
192
|
+
end
|
193
|
+
|
194
|
+
it "suggests bundle update when the Gemfile requires different versions than the lock" do
|
195
|
+
nice_error = <<-E.strip.gsub(/^ {8}/, '')
|
196
|
+
Fetching source index for file:#{gem_repo2}/
|
197
|
+
Bundler could not find compatible versions for gem "rack":
|
198
|
+
In snapshot (Gemfile.lock):
|
199
|
+
rack (0.9.1)
|
200
|
+
|
201
|
+
In Gemfile:
|
202
|
+
rack-obama (= 2.0) depends on
|
203
|
+
rack (= 1.2)
|
204
|
+
|
205
|
+
Running `bundle update` will rebuild your snapshot from scratch, using only
|
206
|
+
the gems in your Gemfile, which may resolve the conflict.
|
207
|
+
E
|
208
|
+
|
209
|
+
bundle :install
|
210
|
+
out.should == nice_error
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe "subtler cases" do
|
215
|
+
before :each do
|
216
|
+
install_gemfile <<-G
|
217
|
+
source "file://#{gem_repo1}"
|
218
|
+
gem "rack"
|
219
|
+
gem "rack-obama"
|
220
|
+
G
|
221
|
+
|
222
|
+
gemfile <<-G
|
223
|
+
source "file://#{gem_repo1}"
|
224
|
+
gem "rack", "0.9.1"
|
225
|
+
gem "rack-obama"
|
226
|
+
G
|
227
|
+
end
|
228
|
+
|
229
|
+
it "does something" do
|
230
|
+
lambda {
|
231
|
+
bundle "install"
|
232
|
+
}.should_not change { File.read(bundled_app('Gemfile.lock')) }
|
233
|
+
|
234
|
+
out.should include('rack = 0.9.1')
|
235
|
+
out.should include('locked at 1.0.0')
|
236
|
+
out.should include('bundle update rack')
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should work when you update" do
|
240
|
+
bundle "update rack"
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
describe "when adding a new source" do
|
245
|
+
it "updates the lockfile" do
|
246
|
+
build_repo2
|
247
|
+
install_gemfile <<-G
|
248
|
+
source "file://#{gem_repo1}"
|
249
|
+
gem "rack"
|
250
|
+
G
|
251
|
+
install_gemfile <<-G
|
252
|
+
source "file://#{gem_repo1}"
|
253
|
+
source "file://#{gem_repo2}"
|
254
|
+
gem "rack"
|
255
|
+
G
|
256
|
+
|
257
|
+
lockfile_should_be <<-L
|
258
|
+
GEM
|
259
|
+
remote: file:#{gem_repo1}/
|
260
|
+
remote: file:#{gem_repo2}/
|
261
|
+
specs:
|
262
|
+
rack (1.0.0)
|
263
|
+
|
264
|
+
PLATFORMS
|
265
|
+
ruby
|
266
|
+
|
267
|
+
DEPENDENCIES
|
268
|
+
rack
|
269
|
+
L
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
# This was written to test github issue #636, but it passed.
|
274
|
+
# It's insanoly slow (3.36s) so I'm not going to run it
|
275
|
+
# describe "when a locked child dependency conflicts" do
|
276
|
+
# before(:each) do
|
277
|
+
# build_repo2 do
|
278
|
+
# build_gem "capybara", "0.3.9" do |s|
|
279
|
+
# s.add_dependency "rack", ">= 1.0.0"
|
280
|
+
# end
|
281
|
+
#
|
282
|
+
# build_gem "rack", "1.1.0"
|
283
|
+
# build_gem "rails", "3.0.0.rc4" do |s|
|
284
|
+
# s.add_dependency "rack", "~> 1.1.0"
|
285
|
+
# end
|
286
|
+
#
|
287
|
+
# build_gem "rack", "1.2.1"
|
288
|
+
# build_gem "rails", "3.0.0" do |s|
|
289
|
+
# s.add_dependency "rack", "~> 1.2.1"
|
290
|
+
# end
|
291
|
+
# end
|
292
|
+
# end
|
293
|
+
#
|
294
|
+
# it "prints the correct error message" do
|
295
|
+
# # install Rails 3.0.0.rc
|
296
|
+
# install_gemfile <<-G
|
297
|
+
# source "file://#{gem_repo2}"
|
298
|
+
# gem "rails", "3.0.0.rc4"
|
299
|
+
# gem "capybara", "0.3.9"
|
300
|
+
# G
|
301
|
+
#
|
302
|
+
# # upgrade Rails to 3.0.0 and then install again
|
303
|
+
# install_gemfile <<-G
|
304
|
+
# source "file://#{gem_repo2}"
|
305
|
+
# gem "rails", "3.0.0"
|
306
|
+
# gem "capybara", "0.3.9"
|
307
|
+
# G
|
308
|
+
#
|
309
|
+
# out.should match(/Gemfile.lock/)
|
310
|
+
# end
|
311
|
+
# end
|
312
|
+
|
313
|
+
end
|