bundler 1.5.1 → 1.5.2
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.
- data/CHANGELOG.md +26 -2
- data/bin/bundle +1 -3
- data/bundler.gemspec +1 -1
- data/lib/bundler/cli.rb +2 -4
- data/lib/bundler/fetcher.rb +13 -12
- data/lib/bundler/installer.rb +9 -36
- data/lib/bundler/parallel_workers/unix_worker.rb +12 -4
- data/lib/bundler/parallel_workers/worker.rb +1 -0
- data/lib/bundler/rubygems_ext.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +15 -8
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/lib/bundler/vendor/thor.rb +63 -56
- data/lib/bundler/vendor/thor/actions.rb +52 -51
- data/lib/bundler/vendor/thor/actions/create_file.rb +35 -37
- data/lib/bundler/vendor/thor/actions/create_link.rb +1 -2
- data/lib/bundler/vendor/thor/actions/directory.rb +36 -37
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +67 -69
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +11 -12
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +41 -43
- data/lib/bundler/vendor/thor/base.rb +180 -178
- data/lib/bundler/vendor/thor/command.rb +22 -25
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +21 -24
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +1 -3
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +8 -10
- data/lib/bundler/vendor/thor/error.rb +2 -2
- data/lib/bundler/vendor/thor/group.rb +59 -60
- data/lib/bundler/vendor/thor/invocation.rb +39 -38
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +29 -30
- data/lib/bundler/vendor/thor/parser/arguments.rb +102 -98
- data/lib/bundler/vendor/thor/parser/option.rb +25 -25
- data/lib/bundler/vendor/thor/parser/options.rb +85 -85
- data/lib/bundler/vendor/thor/rake_compat.rb +6 -7
- data/lib/bundler/vendor/thor/runner.rb +154 -154
- data/lib/bundler/vendor/thor/shell.rb +23 -30
- data/lib/bundler/vendor/thor/shell/basic.rb +66 -57
- data/lib/bundler/vendor/thor/shell/color.rb +44 -43
- data/lib/bundler/vendor/thor/shell/html.rb +43 -44
- data/lib/bundler/vendor/thor/util.rb +37 -40
- data/lib/bundler/vendor/thor/version.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-install.ronn +1 -1
- data/man/gemfile.5.ronn +1 -2
- data/spec/commands/binstubs_spec.rb +13 -0
- data/spec/install/gemfile/git_spec.rb +2 -2
- data/spec/install/gems/dependency_api_spec.rb +34 -0
- data/spec/install/gems/packed_spec.rb +2 -4
- data/spec/quality_spec.rb +2 -2
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/runtime/setup_spec.rb +3 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/permissions.rb +11 -0
- metadata +11 -6
- data/spec/realworld/parallel_install_spec.rb +0 -23
- data/spec/realworld/parallel_update_spec.rb +0 -31
@@ -7,7 +7,7 @@ class Thor
|
|
7
7
|
#
|
8
8
|
class HTML < Basic
|
9
9
|
# The start of an HTML bold sequence.
|
10
|
-
BOLD =
|
10
|
+
BOLD = 'font-weight: bold'
|
11
11
|
|
12
12
|
# Set the terminal's foreground HTML color to black.
|
13
13
|
BLACK = 'color: black'
|
@@ -67,61 +67,60 @@ class Thor
|
|
67
67
|
# ask("What is your name?")
|
68
68
|
#
|
69
69
|
# TODO: Implement #ask for Thor::Shell::HTML
|
70
|
-
def ask(statement, color=nil)
|
71
|
-
|
70
|
+
def ask(statement, color = nil)
|
71
|
+
fail NotImplementedError, 'Implement #ask for Thor::Shell::HTML'
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
protected
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
def can_display_colors?
|
77
|
+
true
|
78
|
+
end
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
80
|
+
# Overwrite show_diff to show diff with colors if Diff::LCS is
|
81
|
+
# available.
|
82
|
+
#
|
83
|
+
def show_diff(destination, content) #:nodoc:
|
84
|
+
if diff_lcs_loaded? && ENV['THOR_DIFF'].nil? && ENV['RAILS_DIFF'].nil?
|
85
|
+
actual = File.binread(destination).to_s.split("\n")
|
86
|
+
content = content.to_s.split("\n")
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
end
|
91
|
-
else
|
92
|
-
super
|
88
|
+
Diff::LCS.sdiff(actual, content).each do |diff|
|
89
|
+
output_diff_line(diff)
|
93
90
|
end
|
91
|
+
else
|
92
|
+
super
|
94
93
|
end
|
94
|
+
end
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
96
|
+
def output_diff_line(diff) #:nodoc:
|
97
|
+
case diff.action
|
98
|
+
when '-'
|
99
|
+
say "- #{diff.old_element.chomp}", :red, true
|
100
|
+
when '+'
|
101
|
+
say "+ #{diff.new_element.chomp}", :green, true
|
102
|
+
when '!'
|
103
|
+
say "- #{diff.old_element.chomp}", :red, true
|
104
|
+
say "+ #{diff.new_element.chomp}", :green, true
|
105
|
+
else
|
106
|
+
say " #{diff.old_element.chomp}", nil, true
|
108
107
|
end
|
108
|
+
end
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
# Check if Diff::LCS is loaded. If it is, use it to create pretty output
|
111
|
+
# for diff.
|
112
|
+
#
|
113
|
+
def diff_lcs_loaded? #:nodoc:
|
114
|
+
return true if defined?(Diff::LCS)
|
115
|
+
return @diff_lcs_loaded unless @diff_lcs_loaded.nil?
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
117
|
+
@diff_lcs_loaded = begin
|
118
|
+
require 'diff/lcs'
|
119
|
+
true
|
120
|
+
rescue LoadError
|
121
|
+
false
|
123
122
|
end
|
124
|
-
|
123
|
+
end
|
125
124
|
end
|
126
125
|
end
|
127
126
|
end
|
@@ -15,9 +15,7 @@ class Thor
|
|
15
15
|
# Thor::Util.load_thorfile("~/.thor/foo")
|
16
16
|
#
|
17
17
|
module Util
|
18
|
-
|
19
18
|
class << self
|
20
|
-
|
21
19
|
# Receives a namespace and search for it in the Thor::Base subclasses.
|
22
20
|
#
|
23
21
|
# ==== Parameters
|
@@ -25,7 +23,7 @@ class Thor
|
|
25
23
|
#
|
26
24
|
def find_by_namespace(namespace)
|
27
25
|
namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/
|
28
|
-
Thor::Base.subclasses.
|
26
|
+
Thor::Base.subclasses.detect { |klass| klass.namespace == namespace }
|
29
27
|
end
|
30
28
|
|
31
29
|
# Receives a constant and converts it to a Thor namespace. Since Thor
|
@@ -43,8 +41,8 @@ class Thor
|
|
43
41
|
# String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz"
|
44
42
|
#
|
45
43
|
def namespace_from_thor_class(constant)
|
46
|
-
constant = constant.to_s.gsub(/^Thor::Sandbox::/,
|
47
|
-
constant = snake_case(constant).squeeze(
|
44
|
+
constant = constant.to_s.gsub(/^Thor::Sandbox::/, '')
|
45
|
+
constant = snake_case(constant).squeeze(':')
|
48
46
|
constant
|
49
47
|
end
|
50
48
|
|
@@ -57,7 +55,7 @@ class Thor
|
|
57
55
|
# ==== Returns
|
58
56
|
# Array[Object]
|
59
57
|
#
|
60
|
-
def namespaces_in_content(contents, file=__FILE__)
|
58
|
+
def namespaces_in_content(contents, file = __FILE__)
|
61
59
|
old_constants = Thor::Base.subclasses.dup
|
62
60
|
Thor::Base.subclasses.clear
|
63
61
|
|
@@ -66,7 +64,7 @@ class Thor
|
|
66
64
|
new_constants = Thor::Base.subclasses.dup
|
67
65
|
Thor::Base.subclasses.replace(old_constants)
|
68
66
|
|
69
|
-
new_constants.map!{ |c| c.namespace }
|
67
|
+
new_constants.map! { |c| c.namespace }
|
70
68
|
new_constants.compact!
|
71
69
|
new_constants
|
72
70
|
end
|
@@ -92,7 +90,7 @@ class Thor
|
|
92
90
|
def snake_case(str)
|
93
91
|
return str.downcase if str =~ /^[A-Z_]+$/
|
94
92
|
str.gsub(/\B[A-Z]/, '_\&').squeeze('_') =~ /_*(.*)/
|
95
|
-
|
93
|
+
$+.downcase
|
96
94
|
end
|
97
95
|
|
98
96
|
# Receives a string and convert it to camel case. camel_case returns CamelCase.
|
@@ -131,10 +129,10 @@ class Thor
|
|
131
129
|
# namespace<String>
|
132
130
|
#
|
133
131
|
def find_class_and_command_by_namespace(namespace, fallback = true)
|
134
|
-
if namespace.include?(
|
135
|
-
pieces = namespace.split(
|
132
|
+
if namespace.include?(':') # look for a namespaced command
|
133
|
+
pieces = namespace.split(':')
|
136
134
|
command = pieces.pop
|
137
|
-
klass = Thor::Util.find_by_namespace(pieces.join(
|
135
|
+
klass = Thor::Util.find_by_namespace(pieces.join(':'))
|
138
136
|
end
|
139
137
|
unless klass # look for a Thor::Group with the right name
|
140
138
|
klass, command = Thor::Util.find_by_namespace(namespace), nil
|
@@ -143,19 +141,19 @@ class Thor
|
|
143
141
|
command = namespace
|
144
142
|
klass = Thor::Util.find_by_namespace('')
|
145
143
|
end
|
146
|
-
|
144
|
+
[klass, command]
|
147
145
|
end
|
148
|
-
|
146
|
+
alias_method :find_class_and_task_by_namespace, :find_class_and_command_by_namespace
|
149
147
|
|
150
148
|
# Receives a path and load the thor file in the path. The file is evaluated
|
151
149
|
# inside the sandbox to avoid namespacing conflicts.
|
152
150
|
#
|
153
|
-
def load_thorfile(path, content=nil, debug=false)
|
151
|
+
def load_thorfile(path, content = nil, debug = false)
|
154
152
|
content ||= File.binread(path)
|
155
153
|
|
156
154
|
begin
|
157
155
|
Thor::Sandbox.class_eval(content, path)
|
158
|
-
rescue
|
156
|
+
rescue StandardError => e
|
159
157
|
$stderr.puts("WARNING: unable to load thorfile #{path.inspect}: #{e.message}")
|
160
158
|
if debug
|
161
159
|
$stderr.puts(*e.backtrace)
|
@@ -165,32 +163,32 @@ class Thor
|
|
165
163
|
end
|
166
164
|
end
|
167
165
|
|
168
|
-
def user_home
|
169
|
-
@@user_home ||= if ENV[
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
166
|
+
def user_home # rubocop:disable MethodLength
|
167
|
+
@@user_home ||= if ENV['HOME']
|
168
|
+
ENV['HOME']
|
169
|
+
elsif ENV['USERPROFILE']
|
170
|
+
ENV['USERPROFILE']
|
171
|
+
elsif ENV['HOMEDRIVE'] && ENV['HOMEPATH']
|
172
|
+
File.join(ENV['HOMEDRIVE'], ENV['HOMEPATH'])
|
173
|
+
elsif ENV['APPDATA']
|
174
|
+
ENV['APPDATA']
|
175
|
+
else
|
176
|
+
begin
|
177
|
+
File.expand_path('~')
|
178
|
+
rescue
|
179
|
+
if File::ALT_SEPARATOR
|
180
|
+
'C:/'
|
181
|
+
else
|
182
|
+
'/'
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
188
186
|
end
|
189
187
|
|
190
188
|
# Returns the root where thor files are located, depending on the OS.
|
191
189
|
#
|
192
190
|
def thor_root
|
193
|
-
File.join(user_home,
|
191
|
+
File.join(user_home, '.thor').gsub(/\\/, '/')
|
194
192
|
end
|
195
193
|
|
196
194
|
# Returns the files in the thor root. On Windows thor_root will be something
|
@@ -204,7 +202,7 @@ class Thor
|
|
204
202
|
files = Dir["#{escape_globs(thor_root)}/*"]
|
205
203
|
|
206
204
|
files.map! do |file|
|
207
|
-
File.directory?(file) ? File.join(file,
|
205
|
+
File.directory?(file) ? File.join(file, 'main.thor') : file
|
208
206
|
end
|
209
207
|
end
|
210
208
|
|
@@ -218,7 +216,7 @@ class Thor
|
|
218
216
|
# Return the path to the ruby interpreter taking into account multiple
|
219
217
|
# installations and windows extensions.
|
220
218
|
#
|
221
|
-
def ruby_command
|
219
|
+
def ruby_command # rubocop:disable MethodLength
|
222
220
|
@ruby_command ||= begin
|
223
221
|
ruby_name = RbConfig::CONFIG['ruby_install_name']
|
224
222
|
ruby = File.join(RbConfig::CONFIG['bindir'], ruby_name)
|
@@ -237,7 +235,7 @@ class Thor
|
|
237
235
|
# symlink points to 'ruby_install_name'
|
238
236
|
ruby = alternate_ruby if linked_ruby == ruby_name || linked_ruby == ruby
|
239
237
|
end
|
240
|
-
rescue NotImplementedError
|
238
|
+
rescue NotImplementedError # rubocop:disable HandleExceptions
|
241
239
|
# just ignore on windows
|
242
240
|
end
|
243
241
|
end
|
@@ -264,7 +262,6 @@ class Thor
|
|
264
262
|
def escape_globs(path)
|
265
263
|
path.to_s.gsub(/[*?{}\[\]]/, '\\\\\\&')
|
266
264
|
end
|
267
|
-
|
268
265
|
end
|
269
266
|
end
|
270
267
|
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.
|
5
|
+
VERSION = "1.5.2" unless defined?(::Bundler::VERSION)
|
6
6
|
end
|
data/man/bundle-install.ronn
CHANGED
@@ -61,7 +61,7 @@ update process below under [CONSERVATIVE UPDATING][].
|
|
61
61
|
Do not attempt to connect to `rubygems.org`, instead using just
|
62
62
|
the gems already present in Rubygems' cache or in `vendor/cache`.
|
63
63
|
Note that if a more appropriate platform-specific gem exists on
|
64
|
-
`rubygems.org`, it will not be found.
|
64
|
+
`rubygems.org`, it will not be found.
|
65
65
|
|
66
66
|
* `--deployment`:
|
67
67
|
Switches bundler's defaults into [deployment mode][DEPLOYMENT MODE].
|
data/man/gemfile.5.ronn
CHANGED
@@ -217,8 +217,7 @@ as they would for a normal gem.
|
|
217
217
|
A git repository `SHOULD` have at least one file, at the root of the
|
218
218
|
directory containing the gem, with the extension `.gemspec`. This file
|
219
219
|
`MUST` contain a valid gem specification, as expected by the `gem build`
|
220
|
-
command.
|
221
|
-
the git repository itself and any built-in functionality of Ruby or Rubygems.
|
220
|
+
command.
|
222
221
|
|
223
222
|
If a git repository does not have a `.gemspec`, bundler will attempt to
|
224
223
|
create one, but it will not contain any dependencies, executables, or
|
@@ -90,6 +90,19 @@ describe "bundle binstubs <gem>" do
|
|
90
90
|
|
91
91
|
expect(bundled_app("bin/foo")).to exist
|
92
92
|
end
|
93
|
+
|
94
|
+
it "sets correct permissions for binstubs" do
|
95
|
+
with_umask(0002) do
|
96
|
+
install_gemfile <<-G
|
97
|
+
source "file://#{gem_repo1}"
|
98
|
+
gem "rack"
|
99
|
+
G
|
100
|
+
|
101
|
+
bundle "binstubs rack"
|
102
|
+
binary = bundled_app("bin/rackup")
|
103
|
+
expect(File.stat(binary).mode.to_s(8)).to eq("100775")
|
104
|
+
end
|
105
|
+
end
|
93
106
|
end
|
94
107
|
|
95
108
|
context "--path" do
|
@@ -34,7 +34,7 @@ describe "bundle install with git sources" do
|
|
34
34
|
git = update_git "foo" do |s|
|
35
35
|
s.executables = ["foobar"] # we added this the first time, so keep it now
|
36
36
|
s.files = ["bin/foobar"] # updating git nukes the files list
|
37
|
-
foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files`.split("\
|
37
|
+
foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files -z`.split("\x0")')
|
38
38
|
s.write "foo.gemspec", foospec
|
39
39
|
end
|
40
40
|
|
@@ -911,4 +911,4 @@ describe "bundle install with git sources" do
|
|
911
911
|
expect(out).to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
|
912
912
|
end
|
913
913
|
end
|
914
|
-
end
|
914
|
+
end
|
@@ -162,6 +162,40 @@ describe "gemcutter's dependency API" do
|
|
162
162
|
should_be_installed "rack 1.0.0"
|
163
163
|
end
|
164
164
|
|
165
|
+
it "handles host redirects" do
|
166
|
+
gemfile <<-G
|
167
|
+
source "#{source_uri}"
|
168
|
+
gem "rack"
|
169
|
+
G
|
170
|
+
|
171
|
+
bundle :install, :artifice => "endpoint_host_redirect"
|
172
|
+
should_be_installed "rack 1.0.0"
|
173
|
+
end
|
174
|
+
|
175
|
+
it "handles host redirects without Net::HTTP::Persistent" do
|
176
|
+
gemfile <<-G
|
177
|
+
source "#{source_uri}"
|
178
|
+
gem "rack"
|
179
|
+
G
|
180
|
+
|
181
|
+
FileUtils.mkdir_p lib_path
|
182
|
+
File.open(lib_path("disable_net_http_persistent.rb"), "w") do |h|
|
183
|
+
h.write <<-H
|
184
|
+
module Kernel
|
185
|
+
alias require_without_disabled_net_http require
|
186
|
+
def require(*args)
|
187
|
+
raise LoadError, 'simulated' if args.first == 'openssl' && !caller.grep(/vendored_persistent/).empty?
|
188
|
+
require_without_disabled_net_http(*args)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
H
|
192
|
+
end
|
193
|
+
|
194
|
+
bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")]
|
195
|
+
expect(out).to_not match(/Too many redirects/)
|
196
|
+
should_be_installed "rack 1.0.0"
|
197
|
+
end
|
198
|
+
|
165
199
|
it "timeouts when Bundler::Fetcher redirects too much" do
|
166
200
|
gemfile <<-G
|
167
201
|
source "#{source_uri}"
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "bundle install with gem sources" do
|
4
4
|
describe "when cached and locked" do
|
5
|
-
it "does not hit the remote at all
|
5
|
+
it "does not hit the remote at all" do
|
6
6
|
build_repo2
|
7
7
|
install_gemfile <<-G
|
8
8
|
source "file://#{gem_repo2}"
|
@@ -14,11 +14,10 @@ describe "bundle install with gem sources" do
|
|
14
14
|
FileUtils.rm_rf gem_repo2
|
15
15
|
|
16
16
|
bundle "install --local"
|
17
|
-
expect(out).not_to include("Updating files in vendor/cache")
|
18
17
|
should_be_installed "rack 1.0.0"
|
19
18
|
end
|
20
19
|
|
21
|
-
it "does not hit the remote at all
|
20
|
+
it "does not hit the remote at all" do
|
22
21
|
build_repo2
|
23
22
|
install_gemfile <<-G
|
24
23
|
source "file://#{gem_repo2}"
|
@@ -30,7 +29,6 @@ describe "bundle install with gem sources" do
|
|
30
29
|
FileUtils.rm_rf gem_repo2
|
31
30
|
|
32
31
|
bundle "install --deployment"
|
33
|
-
expect(out).not_to include("Updating files in vendor/cache")
|
34
32
|
should_be_installed "rack 1.0.0"
|
35
33
|
end
|
36
34
|
|
data/spec/quality_spec.rb
CHANGED
@@ -55,7 +55,7 @@ describe "The library itself" do
|
|
55
55
|
exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE/
|
56
56
|
error_messages = []
|
57
57
|
Dir.chdir(File.expand_path("../..", __FILE__)) do
|
58
|
-
`git ls-files`.split("\
|
58
|
+
`git ls-files -z`.split("\x0").each do |filename|
|
59
59
|
next if filename =~ exempt
|
60
60
|
error_messages << check_for_tab_characters(filename)
|
61
61
|
error_messages << check_for_extra_spaces(filename)
|
@@ -68,7 +68,7 @@ describe "The library itself" do
|
|
68
68
|
included = /spec/
|
69
69
|
error_messages = []
|
70
70
|
Dir.chdir(File.expand_path("../", __FILE__)) do
|
71
|
-
`git ls-files`.split("\
|
71
|
+
`git ls-files -z`.split("\x0").each do |filename|
|
72
72
|
next unless filename =~ included
|
73
73
|
error_messages << check_for_spec_defs_with_single_quotes(filename)
|
74
74
|
end
|