bundler-maglev- 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +22 -0
- data/.travis.yml +32 -0
- data/CHANGELOG.md +805 -0
- data/ISSUES.md +62 -0
- data/LICENSE +23 -0
- data/README.md +29 -0
- data/Rakefile +212 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +22 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +286 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +520 -0
- data/lib/bundler/definition.rb +438 -0
- data/lib/bundler/dependency.rb +134 -0
- data/lib/bundler/deployment.rb +58 -0
- data/lib/bundler/dsl.rb +257 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/gem_helper.rb +151 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +138 -0
- data/lib/bundler/installer.rb +97 -0
- data/lib/bundler/lazy_specification.rb +74 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +59 -0
- data/lib/bundler/resolver.rb +464 -0
- data/lib/bundler/rubygems_ext.rb +237 -0
- data/lib/bundler/rubygems_integration.rb +349 -0
- data/lib/bundler/runtime.rb +152 -0
- data/lib/bundler/settings.rb +115 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +71 -0
- data/lib/bundler/source.rb +708 -0
- data/lib/bundler/spec_set.rb +135 -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 +1 -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 +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +24 -0
- data/lib/bundler/ui.rb +73 -0
- data/lib/bundler/vendor/thor.rb +358 -0
- data/lib/bundler/vendor/thor/actions.rb +314 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +57 -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 +270 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
- data/lib/bundler/vendor/thor/base.rb +576 -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/group.rb +273 -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 +175 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
- data/lib/bundler/vendor/thor/runner.rb +309 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +302 -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 +113 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_thor.rb +7 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +317 -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 +284 -0
- data/man/index.txt +6 -0
- data/spec/bundler/gem_helper_spec.rb +143 -0
- data/spec/cache/gems_spec.rb +230 -0
- data/spec/cache/git_spec.rb +12 -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/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +313 -0
- data/spec/install/gems/groups_spec.rb +259 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +192 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +770 -0
- data/spec/install/gems/sudo_spec.rb +74 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +125 -0
- data/spec/install/git_spec.rb +570 -0
- data/spec/install/invalid_spec.rb +35 -0
- data/spec/install/path_spec.rb +405 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +739 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +248 -0
- data/spec/other/ext_spec.rb +37 -0
- data/spec/other/help_spec.rb +39 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +46 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/show_spec.rb +82 -0
- data/spec/quality_spec.rb +62 -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 +730 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/builders.rb +597 -0
- data/spec/support/helpers.rb +239 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +71 -0
- data/spec/support/platforms.rb +53 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +37 -0
- data/spec/support/rubygems_hax/platform.rb +11 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +122 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +296 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "install with --deployment or --frozen" do
|
4
|
+
before do
|
5
|
+
gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rack"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
it "fails without a lockfile and says that --deployment requires a lock" do
|
12
|
+
bundle "install --deployment"
|
13
|
+
out.should include("The --deployment flag requires a Gemfile.lock")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "fails without a lockfile and says that --frozen requires a lock" do
|
17
|
+
bundle "install --frozen"
|
18
|
+
out.should include("The --frozen flag requires a Gemfile.lock")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "works after you try to deploy without a lock" do
|
22
|
+
bundle "install --deployment"
|
23
|
+
bundle :install, :exitstatus => true
|
24
|
+
exitstatus.should eq(0)
|
25
|
+
should_be_installed "rack 1.0"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "still works if you are not in the app directory and specify --gemfile" do
|
29
|
+
bundle "install"
|
30
|
+
Dir.chdir tmp
|
31
|
+
simulate_new_machine
|
32
|
+
bundle "install --gemfile #{tmp}/bundled_app/Gemfile --deployment"
|
33
|
+
Dir.chdir bundled_app
|
34
|
+
should_be_installed "rack 1.0"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "works if you exclude a group with a git gem" do
|
38
|
+
build_git "foo"
|
39
|
+
gemfile <<-G
|
40
|
+
group :test do
|
41
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
42
|
+
end
|
43
|
+
G
|
44
|
+
bundle :install
|
45
|
+
bundle "install --deployment --without test", :exitstatus => true
|
46
|
+
exitstatus.should == 0
|
47
|
+
end
|
48
|
+
|
49
|
+
it "works when you bundle exec bundle" do
|
50
|
+
bundle :install
|
51
|
+
bundle "install --deployment"
|
52
|
+
bundle "exec bundle check", :exitstatus => true
|
53
|
+
exitstatus.should == 0
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "with an existing lockfile" do
|
57
|
+
before do
|
58
|
+
bundle "install"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "works with the --deployment flag if you didn't change anything" do
|
62
|
+
bundle "install --deployment", :exitstatus => true
|
63
|
+
exitstatus.should == 0
|
64
|
+
end
|
65
|
+
|
66
|
+
it "works with the --frozen flag if you didn't change anything" do
|
67
|
+
bundle "install --frozen", :exitstatus => true
|
68
|
+
exitstatus.should == 0
|
69
|
+
end
|
70
|
+
|
71
|
+
it "explodes with the --deployment flag if you make a change and don't check in the lockfile" do
|
72
|
+
gemfile <<-G
|
73
|
+
source "file://#{gem_repo1}"
|
74
|
+
gem "rack"
|
75
|
+
gem "rack-obama"
|
76
|
+
G
|
77
|
+
|
78
|
+
bundle "install --deployment"
|
79
|
+
out.should include("deployment mode")
|
80
|
+
out.should include("You have added to the Gemfile")
|
81
|
+
out.should include("* rack-obama")
|
82
|
+
out.should_not include("You have deleted from the Gemfile")
|
83
|
+
out.should_not include("You have changed in the Gemfile")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "can have --frozen set via an environment variable" do
|
87
|
+
gemfile <<-G
|
88
|
+
source "file://#{gem_repo1}"
|
89
|
+
gem "rack"
|
90
|
+
gem "rack-obama"
|
91
|
+
G
|
92
|
+
|
93
|
+
ENV['BUNDLE_FROZEN'] = '1'
|
94
|
+
bundle "install"
|
95
|
+
out.should include("deployment mode")
|
96
|
+
out.should include("You have added to the Gemfile")
|
97
|
+
out.should include("* rack-obama")
|
98
|
+
out.should_not include("You have deleted from the Gemfile")
|
99
|
+
out.should_not include("You have changed in the Gemfile")
|
100
|
+
end
|
101
|
+
|
102
|
+
it "explodes with the --frozen flag if you make a change and don't check in the lockfile" do
|
103
|
+
gemfile <<-G
|
104
|
+
source "file://#{gem_repo1}"
|
105
|
+
gem "rack"
|
106
|
+
gem "rack-obama"
|
107
|
+
G
|
108
|
+
|
109
|
+
bundle "install --frozen"
|
110
|
+
out.should include("deployment mode")
|
111
|
+
out.should include("You have added to the Gemfile")
|
112
|
+
out.should include("* rack-obama")
|
113
|
+
out.should_not include("You have deleted from the Gemfile")
|
114
|
+
out.should_not include("You have changed in the Gemfile")
|
115
|
+
end
|
116
|
+
|
117
|
+
it "explodes if you remove a gem and don't check in the lockfile" do
|
118
|
+
gemfile <<-G
|
119
|
+
source "file://#{gem_repo1}"
|
120
|
+
gem "activesupport"
|
121
|
+
G
|
122
|
+
|
123
|
+
bundle "install --deployment"
|
124
|
+
out.should include("deployment mode")
|
125
|
+
out.should include("You have added to the Gemfile:\n* activesupport\n\n")
|
126
|
+
out.should include("You have deleted from the Gemfile:\n* rack")
|
127
|
+
out.should_not include("You have changed in the Gemfile")
|
128
|
+
end
|
129
|
+
|
130
|
+
it "explodes if you add a source" do
|
131
|
+
gemfile <<-G
|
132
|
+
source "file://#{gem_repo1}"
|
133
|
+
gem "rack", :git => "git://hubz.com"
|
134
|
+
G
|
135
|
+
|
136
|
+
bundle "install --deployment"
|
137
|
+
out.should include("deployment mode")
|
138
|
+
out.should include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
|
139
|
+
out.should_not include("You have changed in the Gemfile")
|
140
|
+
end
|
141
|
+
|
142
|
+
it "explodes if you unpin a source" do
|
143
|
+
build_git "rack"
|
144
|
+
|
145
|
+
install_gemfile <<-G
|
146
|
+
source "file://#{gem_repo1}"
|
147
|
+
gem "rack", :git => "#{lib_path("rack-1.0")}"
|
148
|
+
G
|
149
|
+
|
150
|
+
gemfile <<-G
|
151
|
+
source "file://#{gem_repo1}"
|
152
|
+
gem "rack"
|
153
|
+
G
|
154
|
+
|
155
|
+
bundle "install --deployment"
|
156
|
+
out.should include("deployment mode")
|
157
|
+
out.should include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master)")
|
158
|
+
out.should_not include("You have added to the Gemfile")
|
159
|
+
out.should_not include("You have changed in the Gemfile")
|
160
|
+
end
|
161
|
+
|
162
|
+
it "explodes if you unpin a source, leaving it pinned somewhere else" do
|
163
|
+
build_lib "foo", :path => lib_path("rack/foo")
|
164
|
+
build_git "rack", :path => lib_path("rack")
|
165
|
+
|
166
|
+
install_gemfile <<-G
|
167
|
+
source "file://#{gem_repo1}"
|
168
|
+
gem "rack", :git => "#{lib_path("rack")}"
|
169
|
+
gem "foo", :git => "#{lib_path("rack")}"
|
170
|
+
G
|
171
|
+
|
172
|
+
gemfile <<-G
|
173
|
+
source "file://#{gem_repo1}"
|
174
|
+
gem "rack"
|
175
|
+
gem "foo", :git => "#{lib_path("rack")}"
|
176
|
+
G
|
177
|
+
|
178
|
+
bundle "install --deployment"
|
179
|
+
out.should include("deployment mode")
|
180
|
+
out.should include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master)`")
|
181
|
+
out.should_not include("You have added to the Gemfile")
|
182
|
+
out.should_not include("You have deleted from the Gemfile")
|
183
|
+
end
|
184
|
+
|
185
|
+
it "remembers that the bundle is frozen at runtime" do
|
186
|
+
bundle "install --deployment"
|
187
|
+
|
188
|
+
gemfile <<-G
|
189
|
+
source "file://#{gem_repo1}"
|
190
|
+
gem "rack", "1.0.0"
|
191
|
+
gem "rack-obama"
|
192
|
+
G
|
193
|
+
|
194
|
+
should_be_installed "rack 1.0.0"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -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,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, :expect_err => true
|
189
|
+
require 'bundler/setup'
|
190
|
+
RUBY
|
191
|
+
err.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) ruby depends on
|
203
|
+
rack (= 1.2) ruby
|
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
|