bundler 1.5.3 → 1.6.0.pre.1
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.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +14 -11
- data/CHANGELOG.md +10 -3
- data/CONTRIBUTING.md +21 -12
- data/DEVELOPMENT.md +2 -2
- data/README.md +3 -2
- data/Rakefile +19 -9
- data/bundler.gemspec +1 -1
- data/lib/bundler.rb +9 -5
- data/lib/bundler/cli.rb +51 -10
- data/lib/bundler/dsl.rb +10 -6
- data/lib/bundler/friendly_errors.rb +1 -1
- data/lib/bundler/installer.rb +28 -17
- data/lib/bundler/parallel_workers/worker.rb +1 -1
- data/lib/bundler/resolver.rb +191 -207
- data/lib/bundler/rubygems_ext.rb +2 -4
- data/lib/bundler/rubygems_integration.rb +5 -0
- data/lib/bundler/runtime.rb +15 -12
- data/lib/bundler/settings.rb +4 -2
- data/lib/bundler/source.rb +11 -1
- data/lib/bundler/source/git.rb +11 -7
- data/lib/bundler/source/git/git_proxy.rb +4 -7
- data/lib/bundler/source/path.rb +21 -12
- data/lib/bundler/source/path/installer.rb +1 -1
- data/lib/bundler/source/rubygems.rb +18 -8
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -2
- data/lib/bundler/ui.rb +4 -141
- 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/net/http/faster.rb +0 -1
- data/lib/bundler/vendor/net/http/persistent.rb +0 -1
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +0 -1
- data/lib/bundler/version.rb +1 -1
- data/spec/bundler/definition_spec.rb +2 -2
- data/spec/bundler/dsl_spec.rb +3 -3
- data/spec/bundler/gem_helper_spec.rb +5 -7
- data/spec/bundler/settings_spec.rb +15 -0
- data/spec/bundler/source_spec.rb +1 -1
- data/spec/commands/config_spec.rb +18 -0
- data/spec/commands/console_spec.rb +22 -0
- data/spec/commands/exec_spec.rb +1 -0
- data/spec/commands/newgem_spec.rb +2 -2
- data/spec/commands/open_spec.rb +13 -0
- data/spec/{install/gems/packed_spec.rb → commands/package_spec.rb} +30 -0
- data/spec/commands/show_spec.rb +87 -71
- data/spec/install/binstubs_spec.rb +1 -1
- data/spec/install/bundler_spec.rb +1 -1
- data/spec/install/gemfile/git_spec.rb +1 -1
- data/spec/install/gemfile/path_spec.rb +12 -0
- data/spec/install/gemfile_spec.rb +1 -1
- data/spec/install/gems/groups_spec.rb +1 -1
- data/spec/install/gems/platform_spec.rb +0 -1
- data/spec/install/gems/post_install_spec.rb +74 -0
- data/spec/install/gems/resolving_spec.rb +22 -26
- data/spec/install/gems/simple_case_spec.rb +17 -1
- data/spec/install/gemspecs_spec.rb +1 -1
- data/spec/install/path_spec.rb +1 -1
- data/spec/install/prereleases_spec.rb +1 -1
- data/spec/other/ext_spec.rb +1 -1
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/realworld/edgecases_spec.rb +1 -1
- data/spec/resolver/basic_spec.rb +29 -0
- data/spec/support/builders.rb +42 -43
- data/spec/support/indexes.rb +129 -1
- data/spec/support/permissions.rb +1 -0
- data/spec/update/gems_spec.rb +37 -0
- data/spec/update/git_spec.rb +24 -1
- data/spec/update/source_spec.rb +14 -1
- metadata +14 -9
- data/lib/bundler/safe_catch.rb +0 -101
- data/spec/bundler/safe_catch_spec.rb +0 -37
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler/ui'
|
2
|
+
require 'rubygems/user_interaction'
|
3
|
+
|
4
|
+
module Bundler
|
5
|
+
module UI
|
6
|
+
class RGProxy < ::Gem::SilentUI
|
7
|
+
def initialize(ui)
|
8
|
+
@ui = ui
|
9
|
+
super()
|
10
|
+
end
|
11
|
+
|
12
|
+
def say(message)
|
13
|
+
if message =~ /native extensions/
|
14
|
+
@ui.info "with native extensions "
|
15
|
+
else
|
16
|
+
@ui.debug(message)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Bundler
|
2
|
+
module UI
|
3
|
+
class Shell
|
4
|
+
LEVELS = %w(silent error warn confirm info debug)
|
5
|
+
|
6
|
+
attr_writer :shell
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
if options["no-color"] || !STDOUT.tty?
|
10
|
+
Thor::Base.shell = Thor::Shell::Basic
|
11
|
+
end
|
12
|
+
@shell = Thor::Base.shell.new
|
13
|
+
@level = ENV['DEBUG'] ? "debug" : "info"
|
14
|
+
end
|
15
|
+
|
16
|
+
def info(msg, newline = nil)
|
17
|
+
tell_me(msg, nil, newline) if level("info")
|
18
|
+
end
|
19
|
+
|
20
|
+
def confirm(msg, newline = nil)
|
21
|
+
tell_me(msg, :green, newline) if level("confirm")
|
22
|
+
end
|
23
|
+
|
24
|
+
def warn(msg, newline = nil)
|
25
|
+
tell_me(msg, :yellow, newline) if level("warn")
|
26
|
+
end
|
27
|
+
|
28
|
+
def error(msg, newline = nil)
|
29
|
+
tell_me(msg, :red, newline) if level("error")
|
30
|
+
end
|
31
|
+
|
32
|
+
def debug(msg, newline = nil)
|
33
|
+
tell_me(msg, nil, newline) if level("debug")
|
34
|
+
end
|
35
|
+
|
36
|
+
def debug?
|
37
|
+
# needs to be false instead of nil to be newline param to other methods
|
38
|
+
level("debug")
|
39
|
+
end
|
40
|
+
|
41
|
+
def quiet?
|
42
|
+
LEVELS.index(@level) <= LEVELS.index("warn")
|
43
|
+
end
|
44
|
+
|
45
|
+
def ask(msg)
|
46
|
+
@shell.ask(msg)
|
47
|
+
end
|
48
|
+
|
49
|
+
def level=(level)
|
50
|
+
raise ArgumentError unless LEVELS.include?(level.to_s)
|
51
|
+
@level = level
|
52
|
+
end
|
53
|
+
|
54
|
+
def level(name = nil)
|
55
|
+
name ? LEVELS.index(name) <= LEVELS.index(@level) : @level
|
56
|
+
end
|
57
|
+
|
58
|
+
def trace(e, newline = nil)
|
59
|
+
msg = ["#{e.class}: #{e.message}", *e.backtrace].join("\n")
|
60
|
+
if debug?
|
61
|
+
tell_me(msg, nil, newline)
|
62
|
+
elsif @trace
|
63
|
+
STDERR.puts "#{msg}#{newline}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def silence
|
68
|
+
old_level, @level = @level, "silent"
|
69
|
+
yield
|
70
|
+
ensure
|
71
|
+
@level = old_level
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
# valimism
|
77
|
+
def tell_me(msg, color = nil, newline = nil)
|
78
|
+
msg = word_wrap(msg) if newline.is_a?(Hash) && newline[:wrap]
|
79
|
+
if newline.nil?
|
80
|
+
@shell.say(msg, color)
|
81
|
+
else
|
82
|
+
@shell.say(msg, color, newline)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def strip_leading_spaces(text)
|
87
|
+
spaces = text[/\A\s+/, 0]
|
88
|
+
spaces ? text.gsub(/#{spaces}/, '') : text
|
89
|
+
end
|
90
|
+
|
91
|
+
def word_wrap(text, line_width = @shell.terminal_width)
|
92
|
+
strip_leading_spaces(text).split("\n").collect do |line|
|
93
|
+
line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line
|
94
|
+
end * "\n"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Bundler
|
2
|
+
module UI
|
3
|
+
class Silent
|
4
|
+
def info(message, newline = nil)
|
5
|
+
end
|
6
|
+
|
7
|
+
def confirm(message, newline = nil)
|
8
|
+
end
|
9
|
+
|
10
|
+
def warn(message, newline = nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
def error(message, newline = nil)
|
14
|
+
end
|
15
|
+
|
16
|
+
def debug(message, newline = nil)
|
17
|
+
end
|
18
|
+
|
19
|
+
def debug?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
|
23
|
+
def quiet?
|
24
|
+
false
|
25
|
+
end
|
26
|
+
|
27
|
+
def ask(message)
|
28
|
+
end
|
29
|
+
|
30
|
+
def level=(name)
|
31
|
+
end
|
32
|
+
|
33
|
+
def level(name = nil)
|
34
|
+
end
|
35
|
+
|
36
|
+
def trace(message, newline = nil)
|
37
|
+
end
|
38
|
+
|
39
|
+
def silence
|
40
|
+
yield
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
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.
|
5
|
+
VERSION = "1.6.0.pre.1" unless defined?(::Bundler::VERSION)
|
6
6
|
end
|
@@ -3,7 +3,7 @@ require 'bundler/definition'
|
|
3
3
|
|
4
4
|
describe Bundler::Definition do
|
5
5
|
before do
|
6
|
-
|
6
|
+
Bundler.stub(:settings){ Bundler::Settings.new(".") }
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#lock" do
|
@@ -11,7 +11,7 @@ describe Bundler::Definition do
|
|
11
11
|
subject{ Bundler::Definition.new(nil, [], [], []) }
|
12
12
|
|
13
13
|
before do
|
14
|
-
|
14
|
+
File.should_receive(:open).with("Gemfile.lock", "wb").
|
15
15
|
and_raise(Errno::EACCES)
|
16
16
|
end
|
17
17
|
|
data/spec/bundler/dsl_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Bundler::Dsl do
|
4
4
|
before do
|
5
5
|
@rubygems = double("rubygems")
|
6
|
-
|
6
|
+
Bundler::Source::Rubygems.stub(:new){ @rubygems }
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "#_normalize_options" do
|
@@ -34,7 +34,7 @@ describe Bundler::Dsl do
|
|
34
34
|
|
35
35
|
describe "#method_missing" do
|
36
36
|
it "raises an error for unknown DSL methods" do
|
37
|
-
|
37
|
+
Bundler.should_receive(:read_file).with("Gemfile").and_return("unknown")
|
38
38
|
error_msg = "Undefined local variable or method `unknown'" \
|
39
39
|
" for Gemfile\\s+from Gemfile:1"
|
40
40
|
expect { subject.eval_gemfile("Gemfile") }.
|
@@ -44,7 +44,7 @@ describe Bundler::Dsl do
|
|
44
44
|
|
45
45
|
describe "#eval_gemfile" do
|
46
46
|
it "handles syntax errors with a useful message" do
|
47
|
-
|
47
|
+
Bundler.should_receive(:read_file).with("Gemfile").and_return("}")
|
48
48
|
expect { subject.eval_gemfile("Gemfile") }.
|
49
49
|
to raise_error(Bundler::GemfileError, /Gemfile syntax error/)
|
50
50
|
end
|
@@ -43,7 +43,7 @@ describe "Bundler::GemHelper tasks" do
|
|
43
43
|
|
44
44
|
context "gem management" do
|
45
45
|
def mock_confirm_message(message)
|
46
|
-
|
46
|
+
Bundler.ui.should_receive(:confirm).with(message)
|
47
47
|
end
|
48
48
|
|
49
49
|
def mock_build_message
|
@@ -116,7 +116,7 @@ describe "Bundler::GemHelper tasks" do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it "raises an appropriate error when the install fails" do
|
119
|
-
|
119
|
+
@helper.should_receive(:build_gem) do
|
120
120
|
# write an invalid gem file, so we can simulate install failure...
|
121
121
|
FileUtils.mkdir_p(File.join(@app.to_s, 'pkg'))
|
122
122
|
path = "#{@app.to_s}/pkg/test-0.0.1.gem"
|
@@ -146,9 +146,7 @@ describe "Bundler::GemHelper tasks" do
|
|
146
146
|
end
|
147
147
|
|
148
148
|
it "raises an appropriate error if there is no git remote" do
|
149
|
-
# silence messages
|
150
|
-
allow(Bundler.ui).to receive(:confirm)
|
151
|
-
allow(Bundler.ui).to receive(:error)
|
149
|
+
Bundler.ui.stub(:confirm => nil, :error => nil) # silence messages
|
152
150
|
|
153
151
|
Dir.chdir(gem_repo1) { `git init --bare` }
|
154
152
|
Dir.chdir(@app) { `git commit -a -m "initial commit"` }
|
@@ -161,7 +159,7 @@ describe "Bundler::GemHelper tasks" do
|
|
161
159
|
mock_confirm_message(/Tagged v0.0.1/)
|
162
160
|
mock_confirm_message("Pushed git commits and tags.")
|
163
161
|
|
164
|
-
|
162
|
+
@helper.should_receive(:rubygem_push).with(bundled_app('test/pkg/test-0.0.1.gem').to_s)
|
165
163
|
|
166
164
|
Dir.chdir(gem_repo1) { `git init --bare` }
|
167
165
|
Dir.chdir(@app) do
|
@@ -177,7 +175,7 @@ describe "Bundler::GemHelper tasks" do
|
|
177
175
|
mock_build_message
|
178
176
|
mock_confirm_message("Tag v0.0.1 has already been created.")
|
179
177
|
|
180
|
-
|
178
|
+
@helper.should_receive(:rubygem_push).with(bundled_app('test/pkg/test-0.0.1.gem').to_s)
|
181
179
|
|
182
180
|
Dir.chdir(gem_repo1) {
|
183
181
|
`git init --bare`
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'bundler/settings'
|
3
|
+
|
4
|
+
describe Bundler::Settings do
|
5
|
+
|
6
|
+
describe "#set_local" do
|
7
|
+
context "when the local config file is not found" do
|
8
|
+
it "raises a GemfileNotFound error with explanation" do
|
9
|
+
expect{ subject.set_local("foo", "bar") }.
|
10
|
+
to raise_error(Bundler::GemfileNotFound, "Could not locate Gemfile")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/spec/bundler/source_spec.rb
CHANGED
@@ -192,4 +192,22 @@ E
|
|
192
192
|
expect(out).to eq("http://gems.example.org/ => http://gem-mirror.example.org/")
|
193
193
|
end
|
194
194
|
end
|
195
|
+
|
196
|
+
describe "quoting" do
|
197
|
+
before(:each) { bundle :install }
|
198
|
+
|
199
|
+
it "saves quotes" do
|
200
|
+
bundle "config foo something\\'"
|
201
|
+
run "puts Bundler.settings[:foo]"
|
202
|
+
expect(out).to eq("something'")
|
203
|
+
end
|
204
|
+
|
205
|
+
it "doesn't return quotes around values", :ruby => "1.9" do
|
206
|
+
bundle "config foo '1'"
|
207
|
+
run "puts Bundler.settings.send(:global_config_file).read"
|
208
|
+
expect(out).to include("'1'")
|
209
|
+
run "puts Bundler.settings[:foo]"
|
210
|
+
expect(out).to eq("1")
|
211
|
+
end
|
212
|
+
end
|
195
213
|
end
|
@@ -18,6 +18,28 @@ describe "bundle console" do
|
|
18
18
|
expect(out).to include("0.9.1")
|
19
19
|
end
|
20
20
|
|
21
|
+
it "starts another REPL if configured as such" do
|
22
|
+
bundle "config console pry"
|
23
|
+
|
24
|
+
bundle "console" do |input|
|
25
|
+
input.puts("__callee__")
|
26
|
+
input.puts("exit")
|
27
|
+
end
|
28
|
+
expect(out).to include("pry")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "falls back to IRB if the other REPL isn't available" do
|
32
|
+
bundle "config console pry"
|
33
|
+
# make sure pry isn't there
|
34
|
+
|
35
|
+
bundle "console" do |input|
|
36
|
+
input.puts("__callee__")
|
37
|
+
input.puts("exit")
|
38
|
+
end
|
39
|
+
expect(out).to include("irb")
|
40
|
+
end
|
41
|
+
|
42
|
+
|
21
43
|
it "doesn't load any other groups" do
|
22
44
|
bundle "console" do |input|
|
23
45
|
input.puts("puts ACTIVESUPPORT")
|
data/spec/commands/exec_spec.rb
CHANGED
@@ -154,7 +154,7 @@ describe "bundle gem" do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
it "creates a default test which fails" do
|
157
|
-
expect(bundled_app("test_gem/spec/test_gem_spec.rb").read).to
|
157
|
+
expect(bundled_app("test_gem/spec/test_gem_spec.rb").read).to include('expect(false).to be true')
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -330,7 +330,7 @@ describe "bundle gem" do
|
|
330
330
|
end
|
331
331
|
|
332
332
|
it "creates a default test which fails" do
|
333
|
-
expect(bundled_app("test-gem/spec/test/gem_spec.rb").read).to
|
333
|
+
expect(bundled_app("test-gem/spec/test/gem_spec.rb").read).to include('expect(false).to be true')
|
334
334
|
end
|
335
335
|
|
336
336
|
it "creates a default rake task to run the specs" do
|
data/spec/commands/open_spec.rb
CHANGED
@@ -33,6 +33,19 @@ describe "bundle open" do
|
|
33
33
|
expect(out).to match(/could not find gem 'missing'/i)
|
34
34
|
end
|
35
35
|
|
36
|
+
it "does not blow up if the gem to open does not have a Gemfile" do
|
37
|
+
git = build_git "foo"
|
38
|
+
ref = git.ref_for("master", 11)
|
39
|
+
|
40
|
+
install_gemfile <<-G
|
41
|
+
source "file://#{gem_repo1}"
|
42
|
+
gem 'foo', :git => "#{lib_path("foo-1.0")}"
|
43
|
+
G
|
44
|
+
|
45
|
+
bundle "open foo", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
46
|
+
expect(out).to match("editor #{default_bundle_path.join("bundler/gems/foo-1.0-#{ref}")}")
|
47
|
+
end
|
48
|
+
|
36
49
|
it "suggests alternatives for similar-sounding gems" do
|
37
50
|
bundle "open Rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
38
51
|
expect(out).to match(/did you mean rails\?/i)
|
@@ -1,5 +1,35 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
+
describe "bundle package" do
|
4
|
+
context "with --gemfile" do
|
5
|
+
it "finds the gemfile" do
|
6
|
+
gemfile bundled_app("NotGemfile"), <<-G
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
gem 'rack'
|
9
|
+
G
|
10
|
+
|
11
|
+
bundle "package --gemfile=NotGemfile"
|
12
|
+
|
13
|
+
ENV['BUNDLE_GEMFILE'] = "NotGemfile"
|
14
|
+
should_be_installed "rack 1.0.0"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with --path" do
|
19
|
+
it "sets root directory for gems" do
|
20
|
+
gemfile <<-D
|
21
|
+
source "file://#{gem_repo1}"
|
22
|
+
gem 'rack'
|
23
|
+
D
|
24
|
+
|
25
|
+
bundle "package --path=#{bundled_app('test')}"
|
26
|
+
|
27
|
+
should_be_installed "rack 1.0.0"
|
28
|
+
expect(bundled_app("test/vendor/cache/")).to exist
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
3
33
|
describe "bundle install with gem sources" do
|
4
34
|
describe "when cached and locked" do
|
5
35
|
it "does not hit the remote at all" do
|