honkster-bundler 1.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/CHANGELOG.md +547 -0
- data/ISSUES.md +32 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +150 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +268 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +515 -0
- data/lib/bundler/definition.rb +427 -0
- data/lib/bundler/dependency.rb +114 -0
- data/lib/bundler/deployment.rb +37 -0
- data/lib/bundler/dsl.rb +245 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/gem_helper.rb +145 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +114 -0
- data/lib/bundler/installer.rb +84 -0
- data/lib/bundler/lazy_specification.rb +71 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +59 -0
- data/lib/bundler/resolver.rb +454 -0
- data/lib/bundler/rubygems_ext.rb +203 -0
- data/lib/bundler/runtime.rb +148 -0
- data/lib/bundler/settings.rb +117 -0
- data/lib/bundler/setup.rb +15 -0
- data/lib/bundler/shared_helpers.rb +151 -0
- data/lib/bundler/source.rb +662 -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 +3 -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 +60 -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 +98 -0
- data/man/bundle-install.ronn +310 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +77 -0
- data/man/gemfile.5.ronn +273 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +205 -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 +43 -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 +272 -0
- data/spec/install/gems/groups_spec.rb +228 -0
- data/spec/install/gems/packed_spec.rb +72 -0
- data/spec/install/gems/platform_spec.rb +195 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +749 -0
- data/spec/install/gems/sudo_spec.rb +77 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +96 -0
- data/spec/install/git_spec.rb +553 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +329 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/flex_spec.rb +650 -0
- data/spec/lock/git_spec.rb +35 -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 +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +126 -0
- data/spec/other/help_spec.rb +36 -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 +22 -0
- data/spec/quality_spec.rb +55 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +57 -0
- data/spec/runtime/environment_rb_spec.rb +162 -0
- data/spec/runtime/executable_spec.rb +110 -0
- data/spec/runtime/load_spec.rb +102 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +231 -0
- data/spec/runtime/setup_spec.rb +412 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +82 -0
- data/spec/support/builders.rb +566 -0
- data/spec/support/helpers.rb +243 -0
- data/spec/support/indexes.rb +113 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +71 -0
- data/spec/support/platforms.rb +49 -0
- data/spec/support/ruby_ext.rb +19 -0
- data/spec/support/rubygems_ext.rb +30 -0
- data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +112 -0
- data/spec/update/git_spec.rb +159 -0
- data/spec/update/source_spec.rb +50 -0
- metadata +251 -0
@@ -0,0 +1,35 @@
|
|
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
|
+
out.should == "WIN"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "provides correct #full_gem_path" do
|
29
|
+
run <<-RUBY
|
30
|
+
puts Gem.source_index.find_name('foo').first.full_gem_path
|
31
|
+
RUBY
|
32
|
+
out.should == bundle("show foo")
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle check" do
|
4
|
+
it "returns success when the Gemfile is satisfied" do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
G
|
9
|
+
|
10
|
+
bundle :check, :exitstatus => true
|
11
|
+
check @exitstatus.should == 0
|
12
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "works with the --gemfile flag when not in the directory" do
|
16
|
+
install_gemfile <<-G
|
17
|
+
source "file://#{gem_repo1}"
|
18
|
+
gem "rails"
|
19
|
+
G
|
20
|
+
|
21
|
+
Dir.chdir tmp
|
22
|
+
bundle "check --gemfile bundled_app/Gemfile"
|
23
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "creates a Gemfile.lock if one did not exist" do
|
27
|
+
install_gemfile <<-G
|
28
|
+
source "file://#{gem_repo1}"
|
29
|
+
gem "rails"
|
30
|
+
G
|
31
|
+
|
32
|
+
FileUtils.rm("Gemfile.lock")
|
33
|
+
|
34
|
+
bundle "check"
|
35
|
+
|
36
|
+
bundled_app("Gemfile.lock").should exist
|
37
|
+
end
|
38
|
+
|
39
|
+
it "prints a generic error if the missing gems are unresolvable" do
|
40
|
+
system_gems ["rails-2.3.2"]
|
41
|
+
|
42
|
+
gemfile <<-G
|
43
|
+
source "file://#{gem_repo1}"
|
44
|
+
gem "rails"
|
45
|
+
G
|
46
|
+
|
47
|
+
bundle :check
|
48
|
+
out.should include("Your Gemfile's dependencies could not be satisfied")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do
|
52
|
+
gemfile <<-G
|
53
|
+
source "file://#{gem_repo1}"
|
54
|
+
gem "rails"
|
55
|
+
G
|
56
|
+
|
57
|
+
bundle :check, :exitstatus => true
|
58
|
+
check @exitstatus.should > 0
|
59
|
+
out.should include("could not be satisfied")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "prints a generic message if you changed your lockfile" do
|
63
|
+
install_gemfile <<-G
|
64
|
+
source "file://#{gem_repo1}"
|
65
|
+
gem 'rails'
|
66
|
+
G
|
67
|
+
install_gemfile <<-G
|
68
|
+
source "file://#{gem_repo1}"
|
69
|
+
gem 'rails_fail'
|
70
|
+
G
|
71
|
+
|
72
|
+
gemfile <<-G
|
73
|
+
source "file://#{gem_repo1}"
|
74
|
+
gem "rails"
|
75
|
+
gem "rails_fail"
|
76
|
+
G
|
77
|
+
|
78
|
+
bundle :check
|
79
|
+
out.should include("Your Gemfile's dependencies could not be satisfied")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "remembers --without option from install" do
|
83
|
+
gemfile <<-G
|
84
|
+
source "file://#{gem_repo1}"
|
85
|
+
group :foo do
|
86
|
+
gem "rack"
|
87
|
+
end
|
88
|
+
G
|
89
|
+
|
90
|
+
bundle "install --without foo"
|
91
|
+
bundle "check", :exitstatus => true
|
92
|
+
check @exitstatus.should == 0
|
93
|
+
out.should include("The Gemfile's dependencies are satisfied")
|
94
|
+
end
|
95
|
+
|
96
|
+
it "ensures that gems are actually installed and not just cached" do
|
97
|
+
gemfile <<-G
|
98
|
+
source "file://#{gem_repo1}"
|
99
|
+
gem "rack", :group => :foo
|
100
|
+
G
|
101
|
+
|
102
|
+
bundle "install --without foo"
|
103
|
+
|
104
|
+
gemfile <<-G
|
105
|
+
source "file://#{gem_repo1}"
|
106
|
+
gem "rack"
|
107
|
+
G
|
108
|
+
|
109
|
+
bundle "check", :exitstatus => true
|
110
|
+
out.should include("* rack (1.0.0)")
|
111
|
+
@exitstatus.should == 1
|
112
|
+
end
|
113
|
+
|
114
|
+
it "ignores missing gems restricted to other platforms" do
|
115
|
+
system_gems "rack-1.0.0"
|
116
|
+
|
117
|
+
gemfile <<-G
|
118
|
+
source "file://#{gem_repo1}"
|
119
|
+
gem "rack"
|
120
|
+
platforms :#{not_local_tag} do
|
121
|
+
gem "activesupport"
|
122
|
+
end
|
123
|
+
G
|
124
|
+
|
125
|
+
lockfile <<-G
|
126
|
+
GEM
|
127
|
+
remote: file:#{gem_repo1}/
|
128
|
+
specs:
|
129
|
+
activesupport (2.3.5)
|
130
|
+
rack (1.0.0)
|
131
|
+
|
132
|
+
PLATFORMS
|
133
|
+
#{local}
|
134
|
+
#{not_local}
|
135
|
+
|
136
|
+
DEPENDENCIES
|
137
|
+
rack
|
138
|
+
activesupport
|
139
|
+
G
|
140
|
+
|
141
|
+
bundle :check
|
142
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
143
|
+
end
|
144
|
+
|
145
|
+
it "works with env conditionals" do
|
146
|
+
system_gems "rack-1.0.0"
|
147
|
+
|
148
|
+
gemfile <<-G
|
149
|
+
source "file://#{gem_repo1}"
|
150
|
+
gem "rack"
|
151
|
+
env :NOT_GOING_TO_BE_SET do
|
152
|
+
gem "activesupport"
|
153
|
+
end
|
154
|
+
G
|
155
|
+
|
156
|
+
lockfile <<-G
|
157
|
+
GEM
|
158
|
+
remote: file:#{gem_repo1}/
|
159
|
+
specs:
|
160
|
+
activesupport (2.3.5)
|
161
|
+
rack (1.0.0)
|
162
|
+
|
163
|
+
PLATFORMS
|
164
|
+
#{local}
|
165
|
+
#{not_local}
|
166
|
+
|
167
|
+
DEPENDENCIES
|
168
|
+
rack
|
169
|
+
activesupport
|
170
|
+
G
|
171
|
+
|
172
|
+
bundle :check
|
173
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
174
|
+
end
|
175
|
+
|
176
|
+
it "outputs an error when the default Gemfile is not found" do
|
177
|
+
bundle :check, :exitstatus => true
|
178
|
+
check @exitstatus.should == 10
|
179
|
+
out.should include("Could not locate Gemfile")
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should not crash when called multiple times on a new machine" do
|
183
|
+
gemfile <<-G
|
184
|
+
gem 'rails', '3.0.0.beta3'
|
185
|
+
gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
|
186
|
+
G
|
187
|
+
|
188
|
+
simulate_new_machine
|
189
|
+
bundle "check"
|
190
|
+
last_out = out
|
191
|
+
3.times do |i|
|
192
|
+
bundle :check
|
193
|
+
out.should == last_out
|
194
|
+
err.should be_empty
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe "when locked" do
|
199
|
+
before :each do
|
200
|
+
system_gems "rack-1.0.0"
|
201
|
+
install_gemfile <<-G
|
202
|
+
source "file://#{gem_repo1}"
|
203
|
+
gem "rack", "1.0"
|
204
|
+
G
|
205
|
+
end
|
206
|
+
|
207
|
+
it "returns success when the Gemfile is satisfied" do
|
208
|
+
bundle :install
|
209
|
+
bundle :check, :exitstatus => true
|
210
|
+
check @exitstatus.should == 0
|
211
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
212
|
+
end
|
213
|
+
|
214
|
+
it "shows what is missing with the current Gemfile if it is not satisfied" do
|
215
|
+
simulate_new_machine
|
216
|
+
bundle :check
|
217
|
+
out.should match(/The following gems are missing/)
|
218
|
+
out.should include("* rack (1.0")
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe ".bundle/config" do
|
4
|
+
before :each do
|
5
|
+
gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rack", "1.0.0"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
it "can be moved with an environment variable" do
|
12
|
+
ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
|
13
|
+
bundle "install vendor"
|
14
|
+
|
15
|
+
bundled_app('.bundle').should_not exist
|
16
|
+
tmp('foo/bar/config').should exist
|
17
|
+
should_be_installed "rack 1.0.0"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "can provide a relative path with the environment variable" do
|
21
|
+
FileUtils.mkdir_p bundled_app('omg')
|
22
|
+
Dir.chdir bundled_app('omg')
|
23
|
+
|
24
|
+
ENV['BUNDLE_APP_CONFIG'] = "../foo"
|
25
|
+
bundle "install vendor"
|
26
|
+
|
27
|
+
bundled_app(".bundle").should_not exist
|
28
|
+
bundled_app("../foo/config").should exist
|
29
|
+
should_be_installed "rack 1.0.0"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "removes environment.rb from BUNDLE_APP_CONFIG's path" do
|
33
|
+
FileUtils.mkdir_p(tmp('foo/bar'))
|
34
|
+
ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
|
35
|
+
bundle "install"
|
36
|
+
FileUtils.touch tmp('foo/bar/environment.rb')
|
37
|
+
should_be_installed "rack 1.0.0"
|
38
|
+
tmp('foo/bar/environment.rb').should_not exist
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle console" do
|
4
|
+
before :each do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rack"
|
8
|
+
gem "activesupport", :group => :test
|
9
|
+
gem "rack_middleware", :group => :development
|
10
|
+
G
|
11
|
+
end
|
12
|
+
|
13
|
+
it "starts IRB with the default group loaded" do
|
14
|
+
bundle "console" do |input|
|
15
|
+
input.puts("puts RACK")
|
16
|
+
input.puts("exit")
|
17
|
+
end
|
18
|
+
out.should include("0.9.1")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "doesn't load any other groups" do
|
22
|
+
bundle "console" do |input|
|
23
|
+
input.puts("puts ACTIVESUPPORT")
|
24
|
+
input.puts("exit")
|
25
|
+
end
|
26
|
+
out.should include("NameError")
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "when given a group" do
|
30
|
+
it "loads the given group" do
|
31
|
+
bundle "console test" do |input|
|
32
|
+
input.puts("puts ACTIVESUPPORT")
|
33
|
+
input.puts("exit")
|
34
|
+
end
|
35
|
+
out.should include("2.3.5")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "loads the default group" do
|
39
|
+
bundle "console test" do |input|
|
40
|
+
input.puts("puts RACK")
|
41
|
+
input.puts("exit")
|
42
|
+
end
|
43
|
+
out.should include("0.9.1")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "doesn't load other groups" do
|
47
|
+
bundle "console test" do |input|
|
48
|
+
input.puts("puts RACK_MIDDLEWARE")
|
49
|
+
input.puts("exit")
|
50
|
+
end
|
51
|
+
out.should include("NameError")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,241 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle exec" do
|
4
|
+
before :each do
|
5
|
+
system_gems "rack-1.0.0", "rack-0.9.1"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "activates the correct gem" do
|
9
|
+
gemfile <<-G
|
10
|
+
gem "rack", "0.9.1"
|
11
|
+
G
|
12
|
+
|
13
|
+
bundle "exec rackup"
|
14
|
+
out.should == "0.9.1"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "works when the bins are in ~/.bundle" do
|
18
|
+
install_gemfile <<-G
|
19
|
+
gem "rack"
|
20
|
+
G
|
21
|
+
|
22
|
+
bundle "exec rackup"
|
23
|
+
out.should == "1.0.0"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "works when running from a random directory" do
|
27
|
+
install_gemfile <<-G
|
28
|
+
gem "rack"
|
29
|
+
G
|
30
|
+
|
31
|
+
bundle "exec 'cd #{tmp('gems')} && rackup'"
|
32
|
+
|
33
|
+
out.should == "1.0.0"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "handles different versions in different bundles" do
|
37
|
+
build_repo2 do
|
38
|
+
build_gem "rack_two", "1.0.0" do |s|
|
39
|
+
s.executables = "rackup"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
install_gemfile <<-G
|
44
|
+
source "file://#{gem_repo1}"
|
45
|
+
gem "rack", "0.9.1"
|
46
|
+
G
|
47
|
+
|
48
|
+
Dir.chdir bundled_app2 do
|
49
|
+
install_gemfile bundled_app2('Gemfile'), <<-G
|
50
|
+
source "file://#{gem_repo2}"
|
51
|
+
gem "rack_two", "1.0.0"
|
52
|
+
G
|
53
|
+
end
|
54
|
+
|
55
|
+
bundle "exec rackup"
|
56
|
+
|
57
|
+
check out.should == "0.9.1"
|
58
|
+
|
59
|
+
Dir.chdir bundled_app2 do
|
60
|
+
bundle "exec rackup"
|
61
|
+
out.should == "1.0.0"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "handles gems installed with --without" do
|
66
|
+
install_gemfile <<-G, :without => :middleware
|
67
|
+
source "file://#{gem_repo1}"
|
68
|
+
gem "rack" # rack 0.9.1 and 1.0 exist
|
69
|
+
|
70
|
+
group :middleware do
|
71
|
+
gem "rack_middleware" # rack_middleware depends on rack 0.9.1
|
72
|
+
end
|
73
|
+
G
|
74
|
+
|
75
|
+
bundle "exec rackup"
|
76
|
+
|
77
|
+
check out.should == "0.9.1"
|
78
|
+
should_not_be_installed "rack_middleware 1.0"
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should not duplicate already exec'ed RUBYOPT or PATH" do
|
82
|
+
install_gemfile <<-G
|
83
|
+
gem "rack"
|
84
|
+
G
|
85
|
+
|
86
|
+
rubyopt = "-I#{bundler_path} -rbundler/setup"
|
87
|
+
|
88
|
+
bundle "exec 'echo $RUBYOPT'"
|
89
|
+
out.should have_rubyopts(rubyopt)
|
90
|
+
|
91
|
+
bundle "exec 'echo $RUBYOPT'", :env => {"RUBYOPT" => rubyopt}
|
92
|
+
out.should have_rubyopts(rubyopt)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "errors nicely when the argument doesn't exist" do
|
96
|
+
install_gemfile <<-G
|
97
|
+
gem "rack"
|
98
|
+
G
|
99
|
+
|
100
|
+
bundle "exec foobarbaz", :exitstatus => true
|
101
|
+
@exitstatus.should == 127
|
102
|
+
out.should include("bundler: command not found: foobarbaz")
|
103
|
+
out.should include("Install missing gem binaries with `bundle install`")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "errors nicely when the argument is not executable" do
|
107
|
+
install_gemfile <<-G
|
108
|
+
gem "rack"
|
109
|
+
G
|
110
|
+
|
111
|
+
bundle "exec touch foo"
|
112
|
+
bundle "exec ./foo", :exitstatus => true
|
113
|
+
@exitstatus.should == 126
|
114
|
+
out.should include("bundler: not executable: ./foo")
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "with gem binaries" do
|
118
|
+
describe "run from a random directory" do
|
119
|
+
before(:each) do
|
120
|
+
install_gemfile <<-G
|
121
|
+
gem "rack"
|
122
|
+
G
|
123
|
+
end
|
124
|
+
|
125
|
+
it "works when unlocked" do
|
126
|
+
bundle "exec 'cd #{tmp('gems')} && rackup'"
|
127
|
+
out.should == "1.0.0"
|
128
|
+
end
|
129
|
+
|
130
|
+
it "works when locked" do
|
131
|
+
bundle "lock"
|
132
|
+
should_be_locked
|
133
|
+
bundle "exec 'cd #{tmp('gems')} && rackup'"
|
134
|
+
out.should == "1.0.0"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "from gems bundled via :path" do
|
139
|
+
before(:each) do
|
140
|
+
build_lib "fizz", :path => home("fizz") do |s|
|
141
|
+
s.executables = "fizz"
|
142
|
+
end
|
143
|
+
|
144
|
+
install_gemfile <<-G
|
145
|
+
gem "fizz", :path => "#{File.expand_path(home("fizz"))}"
|
146
|
+
G
|
147
|
+
end
|
148
|
+
|
149
|
+
it "works when unlocked" do
|
150
|
+
bundle "exec fizz"
|
151
|
+
out.should == "1.0"
|
152
|
+
end
|
153
|
+
|
154
|
+
it "works when locked" do
|
155
|
+
bundle "lock"
|
156
|
+
should_be_locked
|
157
|
+
|
158
|
+
bundle "exec fizz"
|
159
|
+
out.should == "1.0"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "from gems bundled via :git" do
|
164
|
+
before(:each) do
|
165
|
+
build_git "fizz_git" do |s|
|
166
|
+
s.executables = "fizz_git"
|
167
|
+
end
|
168
|
+
|
169
|
+
install_gemfile <<-G
|
170
|
+
gem "fizz_git", :git => "#{lib_path('fizz_git-1.0')}"
|
171
|
+
G
|
172
|
+
end
|
173
|
+
|
174
|
+
it "works when unlocked" do
|
175
|
+
bundle "exec fizz_git"
|
176
|
+
out.should == "1.0"
|
177
|
+
end
|
178
|
+
|
179
|
+
it "works when locked" do
|
180
|
+
bundle "lock"
|
181
|
+
should_be_locked
|
182
|
+
bundle "exec fizz_git"
|
183
|
+
out.should == "1.0"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe "from gems bundled via :git with no gemspec" do
|
188
|
+
before(:each) do
|
189
|
+
build_git "fizz_no_gemspec", :gemspec => false do |s|
|
190
|
+
s.executables = "fizz_no_gemspec"
|
191
|
+
end
|
192
|
+
|
193
|
+
install_gemfile <<-G
|
194
|
+
gem "fizz_no_gemspec", "1.0", :git => "#{lib_path('fizz_no_gemspec-1.0')}"
|
195
|
+
G
|
196
|
+
end
|
197
|
+
|
198
|
+
it "works when unlocked" do
|
199
|
+
bundle "exec fizz_no_gemspec"
|
200
|
+
out.should == "1.0"
|
201
|
+
end
|
202
|
+
|
203
|
+
it "works when locked" do
|
204
|
+
bundle "lock"
|
205
|
+
should_be_locked
|
206
|
+
bundle "exec fizz_no_gemspec"
|
207
|
+
out.should == "1.0"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
describe "bundling bundler" do
|
214
|
+
before(:each) do
|
215
|
+
gemfile <<-G
|
216
|
+
source "file://#{gem_repo1}"
|
217
|
+
gem "rack"
|
218
|
+
G
|
219
|
+
|
220
|
+
bundle "install vendor --disable-shared-gems"
|
221
|
+
end
|
222
|
+
|
223
|
+
it "does not explode with --disable-shared-gems" do
|
224
|
+
bundle "exec bundle check", :exitstatus => true
|
225
|
+
exitstatus.should == 0
|
226
|
+
end
|
227
|
+
|
228
|
+
it "does not explode when starting with Bundler.setup" do
|
229
|
+
ruby <<-R
|
230
|
+
require "rubygems"
|
231
|
+
require "bundler"
|
232
|
+
Bundler.setup
|
233
|
+
puts `bundle check`
|
234
|
+
puts $?.exitstatus
|
235
|
+
R
|
236
|
+
|
237
|
+
out.should include("satisfied")
|
238
|
+
out.should include("\n0")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|