bundler 1.1.pre.8 → 1.1.pre.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- data/.travis.yml +29 -5
- data/CHANGELOG.md +58 -3
- data/Rakefile +25 -2
- data/UPGRADING.md +2 -2
- data/bin/bundle +10 -10
- data/bundler.gemspec +2 -1
- data/lib/bundler.rb +8 -6
- data/lib/bundler/cli.rb +45 -14
- data/lib/bundler/definition.rb +4 -4
- data/lib/bundler/dependency.rb +1 -8
- data/lib/bundler/deployment.rb +8 -3
- data/lib/bundler/dsl.rb +3 -18
- data/lib/bundler/fetcher.rb +15 -3
- data/lib/bundler/gem_helper.rb +1 -1
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/installer.rb +33 -18
- data/lib/bundler/resolver.rb +19 -7
- data/lib/bundler/rubygems_ext.rb +3 -1
- data/lib/bundler/rubygems_integration.rb +37 -4
- data/lib/bundler/runtime.rb +47 -15
- data/lib/bundler/settings.rb +1 -3
- data/lib/bundler/source.rb +23 -23
- data/lib/bundler/ui.rb +9 -9
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-install.ronn +3 -3
- data/man/bundle.ronn +0 -6
- data/man/gemfile.5.ronn +2 -2
- data/spec/bundler/dsl_spec.rb +22 -0
- data/spec/{other → bundler}/gem_helper_spec.rb +7 -0
- data/spec/install/deprecated_spec.rb +2 -3
- data/spec/install/gems/dependency_api_spec.rb +13 -2
- data/spec/install/gems/groups_spec.rb +14 -0
- data/spec/install/gems/simple_case_spec.rb +34 -1
- data/spec/install/gems/standalone_spec.rb +24 -10
- data/spec/lock/lockfile_spec.rb +48 -15
- data/spec/other/clean_spec.rb +236 -37
- data/spec/other/exec_spec.rb +6 -0
- data/spec/other/help_spec.rb +2 -1
- data/spec/other/newgem_spec.rb +18 -0
- data/spec/other/outdated_spec.rb +19 -2
- data/spec/other/show_spec.rb +6 -0
- data/spec/runtime/setup_spec.rb +19 -0
- data/spec/support/builders.rb +10 -1
- data/spec/update/gems_spec.rb +3 -2
- metadata +90 -17
data/lib/bundler/settings.rb
CHANGED
data/lib/bundler/source.rb
CHANGED
@@ -78,18 +78,16 @@ module Bundler
|
|
78
78
|
|
79
79
|
Bundler.ui.info "Installing #{spec.name} (#{spec.version}) "
|
80
80
|
path = cached_gem(spec)
|
81
|
+
install_path = Bundler.requires_sudo? ? Bundler.tmp : Bundler.rubygems.gem_dir
|
81
82
|
|
82
83
|
Bundler.rubygems.preserve_paths do
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
installer = Gem::Installer.new path, options
|
92
|
-
installer.install
|
84
|
+
Bundler::GemInstaller.new(path,
|
85
|
+
:install_dir => install_path,
|
86
|
+
:ignore_dependencies => true,
|
87
|
+
:wrappers => true,
|
88
|
+
:env_shebang => true,
|
89
|
+
:bin_dir => "#{install_path}/bin"
|
90
|
+
).install
|
93
91
|
end
|
94
92
|
|
95
93
|
if spec.post_install_message
|
@@ -237,7 +235,9 @@ module Bundler
|
|
237
235
|
if api_fetchers.any? && modern_index_fetchers.all? {|fetcher| sources[fetcher] < FORCE_MODERN_INDEX_LIMIT }
|
238
236
|
# this will fetch all the specifications on the rubygems repo
|
239
237
|
unmet_dependency_names = idx.unmet_dependency_names
|
238
|
+
unmet_dependency_names -= ['bundler'] # bundler will always be unmet
|
240
239
|
|
240
|
+
Bundler.ui.debug "Unmet Dependencies: #{unmet_dependency_names}"
|
241
241
|
if unmet_dependency_names.any?
|
242
242
|
api_fetchers.each do |fetcher|
|
243
243
|
idx.use fetcher.specs(unmet_dependency_names, self)
|
@@ -361,7 +361,7 @@ module Bundler
|
|
361
361
|
@local_specs ||= load_spec_files
|
362
362
|
end
|
363
363
|
|
364
|
-
class Installer <
|
364
|
+
class Installer < Bundler::GemInstaller
|
365
365
|
def initialize(spec, options = {})
|
366
366
|
@spec = spec
|
367
367
|
@bin_dir = Bundler.requires_sudo? ? "#{Bundler.tmp}/bin" : "#{Bundler.rubygems.gem_dir}/bin"
|
@@ -481,6 +481,7 @@ module Bundler
|
|
481
481
|
@revision = options["revision"]
|
482
482
|
@submodules = options["submodules"]
|
483
483
|
@update = false
|
484
|
+
@installed = nil
|
484
485
|
end
|
485
486
|
|
486
487
|
def self.from_lock(options)
|
@@ -562,6 +563,17 @@ module Bundler
|
|
562
563
|
raise GitError, "#{to_s} is not checked out. Please run `bundle install`"
|
563
564
|
end
|
564
565
|
|
566
|
+
def cache_path
|
567
|
+
@cache_path ||= begin
|
568
|
+
git_scope = "#{base_name}-#{uri_hash}"
|
569
|
+
|
570
|
+
if Bundler.requires_sudo?
|
571
|
+
Bundler.user_bundle_path.join("cache/git", git_scope)
|
572
|
+
else
|
573
|
+
Bundler.cache.join("git", git_scope)
|
574
|
+
end
|
575
|
+
end
|
576
|
+
end
|
565
577
|
private
|
566
578
|
|
567
579
|
def git(command)
|
@@ -618,18 +630,6 @@ module Bundler
|
|
618
630
|
end
|
619
631
|
end
|
620
632
|
|
621
|
-
def cache_path
|
622
|
-
@cache_path ||= begin
|
623
|
-
git_scope = "#{base_name}-#{uri_hash}"
|
624
|
-
|
625
|
-
if Bundler.requires_sudo?
|
626
|
-
Bundler.user_bundle_path.join("cache/git", git_scope)
|
627
|
-
else
|
628
|
-
Bundler.cache.join("git", git_scope)
|
629
|
-
end
|
630
|
-
end
|
631
|
-
end
|
632
|
-
|
633
633
|
def cache
|
634
634
|
if cached?
|
635
635
|
return if has_revision_cached?
|
data/lib/bundler/ui.rb
CHANGED
@@ -30,14 +30,6 @@ module Bundler
|
|
30
30
|
@debug = ENV['DEBUG']
|
31
31
|
end
|
32
32
|
|
33
|
-
def debug(msg, newline = nil)
|
34
|
-
tell_me(msg, nil, newline) if debugging?
|
35
|
-
end
|
36
|
-
|
37
|
-
def debugging?
|
38
|
-
@debug && !@quiet
|
39
|
-
end
|
40
|
-
|
41
33
|
def info(msg, newline = nil)
|
42
34
|
tell_me(msg, nil, newline) if !@quiet
|
43
35
|
end
|
@@ -58,14 +50,22 @@ module Bundler
|
|
58
50
|
@quiet = true
|
59
51
|
end
|
60
52
|
|
53
|
+
def debugging?
|
54
|
+
@debug && !@quiet
|
55
|
+
end
|
56
|
+
|
61
57
|
def debug!
|
62
58
|
@debug = true
|
63
59
|
end
|
64
60
|
|
61
|
+
def debug(msg, newline = nil)
|
62
|
+
tell_me(msg, nil, newline) if debugging?
|
63
|
+
end
|
64
|
+
|
65
65
|
private
|
66
66
|
# valimism
|
67
67
|
def tell_me(msg, color = nil, newline = nil)
|
68
|
-
newline.nil? ? @shell.say(msg) : @shell.say(msg,
|
68
|
+
newline.nil? ? @shell.say(msg, color) : @shell.say(msg, color, newline)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/lib/bundler/version.rb
CHANGED
@@ -2,5 +2,5 @@ module Bundler
|
|
2
2
|
# We're doing this because we might write tests that deal
|
3
3
|
# with other versions of bundler and we are unsure how to
|
4
4
|
# handle this better.
|
5
|
-
VERSION = "1.1.pre.
|
5
|
+
VERSION = "1.1.pre.9" unless defined?(::Bundler::VERSION)
|
6
6
|
end
|
data/man/bundle-install.ronn
CHANGED
@@ -55,9 +55,9 @@ update process below under [CONSERVATIVE UPDATING][].
|
|
55
55
|
|
56
56
|
* `--local`:
|
57
57
|
Do not attempt to connect to `rubygems.org`, instead using just
|
58
|
-
the gems
|
59
|
-
appropriate platform-specific gem exists on
|
60
|
-
|
58
|
+
the gems already present in Rubygems' cache or in `vendor/cache`.
|
59
|
+
Note that if a more appropriate platform-specific gem exists on
|
60
|
+
`rubygems.org`, it will not be found.
|
61
61
|
|
62
62
|
* `--deployment`:
|
63
63
|
Switches bundler's defaults into [deployment mode][DEPLOYMENT MODE].
|
data/man/bundle.ronn
CHANGED
@@ -66,12 +66,6 @@ We divide `bundle` subcommands into primary commands and utilities.
|
|
66
66
|
|
67
67
|
* `bundle viz(1)`:
|
68
68
|
Generate a visual representation of your dependencies
|
69
|
-
<<<<<<< HEAD
|
70
|
-
|
71
|
-
* `bundle benchmark(1)`:
|
72
|
-
Display the time taken for each each gem to be loaded into the environment
|
73
|
-
=======
|
74
|
-
>>>>>>> parent of e547c86... Add documentation for the benchmark CLI utility
|
75
69
|
|
76
70
|
* `bundle init(1)`:
|
77
71
|
Generate a simple `Gemfile`, placed in the current directory
|
data/man/gemfile.5.ronn
CHANGED
@@ -280,5 +280,5 @@ bundler uses the following priority order:
|
|
280
280
|
repository otherwise declared. This results in bundler prioritizing the
|
281
281
|
ActiveSupport gem from the Rails git repository over ones from
|
282
282
|
`rubygems.org`
|
283
|
-
3. The sources specified via `source`,
|
284
|
-
|
283
|
+
3. The sources specified via `source`, searching each source in your `Gemfile`
|
284
|
+
from last added to first added.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bundler::Dsl do
|
4
|
+
describe '#_normalize_options' do
|
5
|
+
before do
|
6
|
+
@rubygems = mock("rubygems")
|
7
|
+
Bundler::Source::Rubygems.stub(:new){ @rubygems }
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should convert :github to :git" do
|
11
|
+
subject.gem("sparks", :github => "indirect/sparks")
|
12
|
+
github_uri = "git://github.com/indirect/sparks.git"
|
13
|
+
subject.dependencies.first.source.uri.should == github_uri
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should convert 'rails' to 'rails/rails'" do
|
17
|
+
subject.gem("rails", :github => "rails")
|
18
|
+
github_uri = "git://github.com/rails/rails.git"
|
19
|
+
subject.dependencies.first.source.uri.should == github_uri
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -31,6 +31,13 @@ describe "Bundler::GemHelper tasks" do
|
|
31
31
|
File.open(File.join(app.to_s, 'test2.gemspec'), 'w') {|f| f << ''}
|
32
32
|
proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/)
|
33
33
|
end
|
34
|
+
|
35
|
+
it "handles namespaces and converting to CamelCase" do
|
36
|
+
bundle 'gem test-foo_bar'
|
37
|
+
lib = bundled_app('test-foo_bar').join('lib/test-foo_bar.rb').read
|
38
|
+
lib.should include("module Test")
|
39
|
+
lib.should include("module FooBar")
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
36
43
|
context "gem management" do
|
@@ -5,8 +5,7 @@ describe "bundle install with deprecated features" do
|
|
5
5
|
in_app_root
|
6
6
|
end
|
7
7
|
|
8
|
-
%w(
|
9
|
-
clear_sources bundle_path bin_path ).each do |deprecated|
|
8
|
+
%w().each do |deprecated|
|
10
9
|
|
11
10
|
it "reports that #{deprecated} is deprecated" do
|
12
11
|
gemfile <<-G
|
@@ -21,7 +20,7 @@ describe "bundle install with deprecated features" do
|
|
21
20
|
end
|
22
21
|
|
23
22
|
|
24
|
-
%w(
|
23
|
+
%w().each do |deprecated|
|
25
24
|
|
26
25
|
it "reports that :#{deprecated} is deprecated" do
|
27
26
|
gemfile <<-G
|
@@ -247,13 +247,24 @@ describe "gemcutter's dependency API" do
|
|
247
247
|
should_be_installed "back_deps 1.0"
|
248
248
|
end
|
249
249
|
|
250
|
+
it "does not refetch if the only unmet dependency is bundler" do
|
251
|
+
gemfile <<-G
|
252
|
+
source "#{source_uri}"
|
253
|
+
|
254
|
+
gem "bundler_dep"
|
255
|
+
G
|
256
|
+
|
257
|
+
bundle :install, :artifice => "endpoint"
|
258
|
+
out.scan(/Fetching dependency information from the API/).size.should == 1
|
259
|
+
end
|
260
|
+
|
250
261
|
it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
|
251
262
|
sys_exec "mkdir -p #{system_gem_path("bin")}"
|
252
263
|
sudo "chown -R root #{system_gem_path("bin")}"
|
253
264
|
|
254
265
|
gemfile <<-G
|
255
|
-
|
256
|
-
|
266
|
+
source "#{source_uri}"
|
267
|
+
gem "rails"
|
257
268
|
G
|
258
269
|
bundle :install, :artifice => "endpoint"
|
259
270
|
should_be_installed "rails 2.3.2"
|
@@ -136,6 +136,20 @@ describe "bundle install with gem sources" do
|
|
136
136
|
|
137
137
|
ENV["BUNDLE_WITHOUT"] = nil
|
138
138
|
end
|
139
|
+
|
140
|
+
it "clears without when passed an empty list" do
|
141
|
+
bundle :install, :without => "emo"
|
142
|
+
|
143
|
+
bundle 'install --without ""'
|
144
|
+
should_be_installed "activesupport 2.3.5"
|
145
|
+
end
|
146
|
+
|
147
|
+
it "doesn't clear without when nothing is passed" do
|
148
|
+
bundle :install, :without => "emo"
|
149
|
+
|
150
|
+
bundle :install
|
151
|
+
should_not_be_installed "activesupport 2.3.5"
|
152
|
+
end
|
139
153
|
end
|
140
154
|
|
141
155
|
describe "with gems assigned to multiple groups" do
|
@@ -300,6 +300,19 @@ describe "bundle install with gem sources" do
|
|
300
300
|
|
301
301
|
File.exists?(bundled_app("Gemfile.lock")).should be_true
|
302
302
|
end
|
303
|
+
|
304
|
+
it "gracefully handles error when rubygems server is unavailable" do
|
305
|
+
install_gemfile <<-G
|
306
|
+
source "file://#{gem_repo1}"
|
307
|
+
source "http://localhost:9384"
|
308
|
+
|
309
|
+
gem 'foo'
|
310
|
+
G
|
311
|
+
|
312
|
+
bundle :install
|
313
|
+
out.should include("Could not reach http://localhost:9384/")
|
314
|
+
out.should_not include("file://")
|
315
|
+
end
|
303
316
|
end
|
304
317
|
|
305
318
|
describe "when prerelease gems are available" do
|
@@ -593,7 +606,7 @@ describe "bundle install with gem sources" do
|
|
593
606
|
Current Bundler version:
|
594
607
|
bundler (#{Bundler::VERSION})
|
595
608
|
E
|
596
|
-
out.should
|
609
|
+
out.should include(nice_error)
|
597
610
|
end
|
598
611
|
|
599
612
|
it "works for gems with multiple versions in its dependencies" do
|
@@ -719,4 +732,24 @@ describe "bundle install with gem sources" do
|
|
719
732
|
err.should be_empty
|
720
733
|
end
|
721
734
|
end
|
735
|
+
|
736
|
+
describe "when Gem.bindir is hardcoded to a root-owned directory" do
|
737
|
+
# On OS X, Gem.bindir is hardcoded to /usr/bin. :(
|
738
|
+
it "installs binstubs into Gem.dir+'/bin' instead" do
|
739
|
+
Pathname.new("/usr/bin").should_not be_writable
|
740
|
+
|
741
|
+
gemfile <<-G
|
742
|
+
require 'rubygems'
|
743
|
+
def Gem.bindir(dir=Gem.dir); "/usr/bin"; end
|
744
|
+
|
745
|
+
source "file://#{gem_repo1}"
|
746
|
+
gem "rack"
|
747
|
+
G
|
748
|
+
|
749
|
+
bundle :install
|
750
|
+
should_be_installed "rack 1.0.0"
|
751
|
+
system_gem_path("bin/rackup").should exist
|
752
|
+
end
|
753
|
+
end
|
754
|
+
|
722
755
|
end
|
@@ -26,7 +26,7 @@ describe "bundle install --standalone" do
|
|
26
26
|
puts ACTIONPACK
|
27
27
|
RUBY
|
28
28
|
|
29
|
-
out.should == "2.3.2"
|
29
|
+
out.should be == "2.3.2"
|
30
30
|
end
|
31
31
|
|
32
32
|
it "works on a different system" do
|
@@ -41,7 +41,7 @@ describe "bundle install --standalone" do
|
|
41
41
|
puts ACTIONPACK
|
42
42
|
RUBY
|
43
43
|
|
44
|
-
out.should == "2.3.2"
|
44
|
+
out.should be == "2.3.2"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -75,7 +75,7 @@ describe "bundle install --standalone" do
|
|
75
75
|
puts ACTIONPACK
|
76
76
|
RUBY
|
77
77
|
|
78
|
-
out.should == "1.0\n2.3.2"
|
78
|
+
out.should be == "1.0\n2.3.2"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -107,7 +107,7 @@ describe "bundle install --standalone" do
|
|
107
107
|
puts RACK_TEST
|
108
108
|
RUBY
|
109
109
|
|
110
|
-
out.should == "2.3.2\n1.2.7\n1.0"
|
110
|
+
out.should be == "2.3.2\n1.2.7\n1.0"
|
111
111
|
end
|
112
112
|
|
113
113
|
it "allows creating a standalone file with limited groups" do
|
@@ -122,7 +122,7 @@ describe "bundle install --standalone" do
|
|
122
122
|
require "spec"
|
123
123
|
RUBY
|
124
124
|
|
125
|
-
out.should == "2.3.2"
|
125
|
+
out.should be == "2.3.2"
|
126
126
|
err.should =~ /no such file to load.*spec/
|
127
127
|
end
|
128
128
|
|
@@ -138,10 +138,24 @@ describe "bundle install --standalone" do
|
|
138
138
|
require "spec"
|
139
139
|
RUBY
|
140
140
|
|
141
|
-
out.should == "2.3.2"
|
141
|
+
out.should be == "2.3.2"
|
142
142
|
err.should =~ /no such file to load.*spec/
|
143
143
|
end
|
144
144
|
|
145
|
+
it "allows --path to change the location of the standalone bundle" do
|
146
|
+
bundle "install --standalone --path path/to/bundle"
|
147
|
+
|
148
|
+
ruby <<-RUBY, :no_lib => true, :expect_err => false
|
149
|
+
$:.unshift File.expand_path("path/to/bundle")
|
150
|
+
require "bundler/setup"
|
151
|
+
|
152
|
+
require "actionpack"
|
153
|
+
puts ACTIONPACK
|
154
|
+
RUBY
|
155
|
+
|
156
|
+
out.should == "2.3.2"
|
157
|
+
end
|
158
|
+
|
145
159
|
it "allows remembered --without to limit the groups used in a standalone" do
|
146
160
|
bundle "install --without test"
|
147
161
|
bundle "install --standalone"
|
@@ -155,7 +169,7 @@ describe "bundle install --standalone" do
|
|
155
169
|
require "spec"
|
156
170
|
RUBY
|
157
171
|
|
158
|
-
out.should == "2.3.2"
|
172
|
+
out.should be == "2.3.2"
|
159
173
|
err.should =~ /no such file to load.*spec/
|
160
174
|
end
|
161
175
|
end
|
@@ -174,7 +188,7 @@ describe "bundle install --standalone" do
|
|
174
188
|
it "should run without errors" do
|
175
189
|
bundle "install --standalone", :artifice => "endpoint", :exitstatus => true
|
176
190
|
|
177
|
-
@exitstatus.should == 0
|
191
|
+
@exitstatus.should be == 0
|
178
192
|
end
|
179
193
|
|
180
194
|
it "still makes the gems available to normal bundler" do
|
@@ -200,7 +214,7 @@ describe "bundle install --standalone" do
|
|
200
214
|
puts ACTIONPACK
|
201
215
|
RUBY
|
202
216
|
|
203
|
-
out.should == "2.3.2"
|
217
|
+
out.should be == "2.3.2"
|
204
218
|
end
|
205
219
|
|
206
220
|
it "works on a different system" do
|
@@ -217,7 +231,7 @@ describe "bundle install --standalone" do
|
|
217
231
|
puts ACTIONPACK
|
218
232
|
RUBY
|
219
233
|
|
220
|
-
out.should == "2.3.2"
|
234
|
+
out.should be == "2.3.2"
|
221
235
|
end
|
222
236
|
end
|
223
237
|
end
|