bundler 1.10.6 → 1.11.0.pre.1
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +105 -0
- data/.rubocop_todo.yml +120 -0
- data/.travis.yml +8 -23
- data/CHANGELOG.md +69 -0
- data/CODE_OF_CONDUCT.md +6 -4
- data/DEVELOPMENT.md +4 -5
- data/README.md +2 -2
- data/Rakefile +70 -87
- data/bin/rake +14 -0
- data/bin/rspec +10 -0
- data/bin/rubocop +11 -0
- data/bundler.gemspec +17 -15
- data/exe/bundle +20 -0
- data/{bin → exe}/bundle_ruby +6 -4
- data/exe/bundler +20 -0
- data/lib/bundler.rb +98 -119
- data/lib/bundler/capistrano.rb +2 -2
- data/lib/bundler/cli.rb +85 -74
- data/lib/bundler/cli/binstubs.rb +1 -2
- data/lib/bundler/cli/cache.rb +0 -1
- data/lib/bundler/cli/check.rb +7 -5
- data/lib/bundler/cli/clean.rb +0 -1
- data/lib/bundler/cli/common.rb +6 -7
- data/lib/bundler/cli/config.rb +69 -56
- data/lib/bundler/cli/console.rb +8 -8
- data/lib/bundler/cli/exec.rb +4 -3
- data/lib/bundler/cli/gem.rb +50 -39
- data/lib/bundler/cli/init.rb +5 -6
- data/lib/bundler/cli/inject.rb +1 -2
- data/lib/bundler/cli/install.rb +18 -21
- data/lib/bundler/cli/lock.rb +8 -3
- data/lib/bundler/cli/open.rb +4 -5
- data/lib/bundler/cli/outdated.rb +7 -8
- data/lib/bundler/cli/package.rb +1 -1
- data/lib/bundler/cli/platform.rb +2 -3
- data/lib/bundler/cli/show.rb +9 -9
- data/lib/bundler/cli/update.rb +2 -3
- data/lib/bundler/cli/viz.rb +1 -2
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +38 -3
- data/lib/bundler/definition.rb +83 -88
- data/lib/bundler/dep_proxy.rb +11 -9
- data/lib/bundler/dependency.rb +26 -11
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/deprecate.rb +3 -3
- data/lib/bundler/dsl.rb +63 -44
- data/lib/bundler/env.rb +19 -12
- data/lib/bundler/environment.rb +1 -2
- data/lib/bundler/errors.rb +82 -0
- data/lib/bundler/fetcher.rb +45 -39
- data/lib/bundler/fetcher/base.rb +20 -7
- data/lib/bundler/fetcher/dependency.rb +5 -5
- data/lib/bundler/fetcher/downloader.rb +1 -2
- data/lib/bundler/fetcher/index.rb +4 -7
- data/lib/bundler/friendly_errors.rb +15 -8
- data/lib/bundler/gem_helper.rb +44 -35
- data/lib/bundler/gem_helpers.rb +7 -8
- data/lib/bundler/gem_remote_fetcher.rb +41 -0
- data/lib/bundler/gem_tasks.rb +4 -1
- data/lib/bundler/graph.rb +25 -24
- data/lib/bundler/index.rb +21 -18
- data/lib/bundler/injector.rb +2 -4
- data/lib/bundler/inline.rb +3 -3
- data/lib/bundler/installer.rb +57 -144
- data/lib/bundler/installer/gem_installer.rb +76 -0
- data/lib/bundler/installer/parallel_installer.rb +22 -13
- data/lib/bundler/installer/standalone.rb +48 -0
- data/lib/bundler/lazy_specification.rb +3 -4
- data/lib/bundler/lockfile_parser.rb +21 -19
- data/lib/bundler/match_platform.rb +4 -4
- data/lib/bundler/psyched_yaml.rb +3 -3
- data/lib/bundler/remote_specification.rb +1 -1
- data/lib/bundler/resolver.rb +93 -88
- data/lib/bundler/retry.rb +9 -10
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +7 -10
- data/lib/bundler/rubygems_ext.rb +32 -27
- data/lib/bundler/{gem_installer.rb → rubygems_gem_installer.rb} +2 -2
- data/lib/bundler/rubygems_integration.rb +85 -70
- data/lib/bundler/runtime.rb +57 -61
- data/lib/bundler/settings.rb +27 -26
- data/lib/bundler/setup.rb +3 -3
- data/lib/bundler/shared_helpers.rb +45 -20
- data/lib/bundler/similarity_detector.rb +19 -21
- data/lib/bundler/source.rb +4 -5
- data/lib/bundler/source/git.rb +29 -31
- data/lib/bundler/source/git/git_proxy.rb +52 -26
- data/lib/bundler/source/path.rb +25 -28
- data/lib/bundler/source/path/installer.rb +4 -4
- data/lib/bundler/source/rubygems.rb +62 -48
- data/lib/bundler/source/rubygems/remote.rb +3 -3
- data/lib/bundler/source_list.rb +4 -4
- data/lib/bundler/spec_set.rb +17 -15
- data/lib/bundler/ssl_certs/certificate_manager.rb +5 -6
- data/lib/bundler/stub_specification.rb +2 -2
- data/lib/bundler/templates/Executable +5 -5
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +42 -6
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +4 -2
- data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +2 -2
- data/lib/bundler/ui/shell.rb +10 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +82 -71
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +40 -21
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -0
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -3
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +1 -1
- data/lib/bundler/worker.rb +4 -5
- data/man/bundle-config.ronn +4 -2
- data/man/bundle-gem.ronn +77 -0
- data/man/bundle-install.ronn +13 -6
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle.ronn +1 -1
- data/man/gemfile.5.ronn +8 -0
- data/man/index.txt +1 -0
- metadata +37 -8
- data/bin/bundle +0 -21
- data/bin/bundler +0 -21
@@ -8,56 +8,54 @@ module Bundler
|
|
8
8
|
end
|
9
9
|
|
10
10
|
# return an array of words similar to 'word' from the corpus
|
11
|
-
def similar_words(word, limit=3)
|
12
|
-
words_by_similarity = @corpus.map{|w| SimilarityScore.new(w, levenshtein_distance(word, w))}
|
13
|
-
words_by_similarity.select{|s| s.distance<=limit}.sort_by(&:distance).map(&:string)
|
11
|
+
def similar_words(word, limit = 3)
|
12
|
+
words_by_similarity = @corpus.map {|w| SimilarityScore.new(w, levenshtein_distance(word, w)) }
|
13
|
+
words_by_similarity.select {|s| s.distance <= limit }.sort_by(&:distance).map(&:string)
|
14
14
|
end
|
15
15
|
|
16
16
|
# return the result of 'similar_words', concatenated into a list
|
17
17
|
# (eg "a, b, or c")
|
18
|
-
def similar_word_list(word, limit=3)
|
19
|
-
words = similar_words(word,limit)
|
20
|
-
if words.length==1
|
18
|
+
def similar_word_list(word, limit = 3)
|
19
|
+
words = similar_words(word, limit)
|
20
|
+
if words.length == 1
|
21
21
|
words[0]
|
22
|
-
elsif words.length>1
|
23
|
-
[words[0..-2].join(
|
22
|
+
elsif words.length > 1
|
23
|
+
[words[0..-2].join(", "), words[-1]].join(" or ")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
27
|
protected
|
28
|
+
|
29
29
|
# http://www.informit.com/articles/article.aspx?p=683059&seqNum=36
|
30
|
-
def levenshtein_distance(this, that, ins=2, del=2, sub=1)
|
30
|
+
def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
|
31
31
|
# ins, del, sub are weighted costs
|
32
32
|
return nil if this.nil?
|
33
33
|
return nil if that.nil?
|
34
|
-
dm = []
|
34
|
+
dm = [] # distance matrix
|
35
35
|
|
36
36
|
# Initialize first row values
|
37
|
-
dm[0] = (0..this.length).collect {
|
37
|
+
dm[0] = (0..this.length).collect {|i| i * ins }
|
38
38
|
fill = [0] * (this.length - 1)
|
39
39
|
|
40
40
|
# Initialize first column values
|
41
|
-
|
41
|
+
(1..that.length).each do |i|
|
42
42
|
dm[i] = [i * del, fill.flatten]
|
43
43
|
end
|
44
44
|
|
45
45
|
# populate matrix
|
46
|
-
|
47
|
-
|
46
|
+
(1..that.length).each do |i|
|
47
|
+
(1..this.length).each do |j|
|
48
48
|
# critical comparison
|
49
49
|
dm[i][j] = [
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
].min
|
50
|
+
dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
|
51
|
+
dm[i][j - 1] + ins,
|
52
|
+
dm[i - 1][j] + del
|
53
|
+
].min
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
58
57
|
# The last value in matrix is the Levenshtein distance between the strings
|
59
58
|
dm[that.length][this.length]
|
60
59
|
end
|
61
|
-
|
62
60
|
end
|
63
61
|
end
|
data/lib/bundler/source.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Bundler
|
2
2
|
class Source
|
3
|
-
autoload :Rubygems,
|
4
|
-
autoload :Path,
|
5
|
-
autoload :Git,
|
3
|
+
autoload :Rubygems, "bundler/source/rubygems"
|
4
|
+
autoload :Path, "bundler/source/path"
|
5
|
+
autoload :Git, "bundler/source/git"
|
6
6
|
|
7
7
|
attr_accessor :dependency_names
|
8
8
|
|
@@ -14,7 +14,7 @@ module Bundler
|
|
14
14
|
message = "#{spec.name} #{spec.version}"
|
15
15
|
|
16
16
|
if Bundler.locked_gems
|
17
|
-
locked_spec = Bundler.locked_gems.specs.find {
|
17
|
+
locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
|
18
18
|
locked_spec_version = locked_spec.version if locked_spec
|
19
19
|
if locked_spec_version && spec.version != locked_spec_version
|
20
20
|
message << " (was #{locked_spec_version})"
|
@@ -31,6 +31,5 @@ module Bundler
|
|
31
31
|
def include?(other)
|
32
32
|
other == self
|
33
33
|
end
|
34
|
-
|
35
34
|
end
|
36
35
|
end
|
data/lib/bundler/source/git.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "fileutils"
|
2
|
+
require "uri"
|
3
|
+
require "digest/sha1"
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class Source
|
7
|
-
|
8
7
|
class Git < Path
|
9
|
-
autoload :GitProxy,
|
8
|
+
autoload :GitProxy, "bundler/source/git/git_proxy"
|
10
9
|
|
11
10
|
attr_reader :uri, :ref, :branch, :options, :submodules
|
12
11
|
|
@@ -18,11 +17,11 @@ module Bundler
|
|
18
17
|
@allow_remote = false
|
19
18
|
|
20
19
|
# Stringify options that could be set as symbols
|
21
|
-
%w(ref branch tag revision).each{|k| options[k] = options[k].to_s if options[k] }
|
20
|
+
%w(ref branch tag revision).each {|k| options[k] = options[k].to_s if options[k] }
|
22
21
|
|
23
|
-
@uri = options["uri"] ||
|
22
|
+
@uri = options["uri"] || ""
|
24
23
|
@branch = options["branch"]
|
25
|
-
@ref = options["ref"] || options["branch"] || options["tag"] ||
|
24
|
+
@ref = options["ref"] || options["branch"] || options["tag"] || "master"
|
26
25
|
@submodules = options["submodules"]
|
27
26
|
@name = options["name"]
|
28
27
|
@version = options["version"]
|
@@ -50,17 +49,13 @@ module Bundler
|
|
50
49
|
[self.class, uri, ref, branch, name, version, submodules].hash
|
51
50
|
end
|
52
51
|
|
53
|
-
def eql?(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
branch == o.branch &&
|
58
|
-
name == o.name &&
|
59
|
-
version == o.version &&
|
60
|
-
submodules == o.submodules
|
52
|
+
def eql?(other)
|
53
|
+
other.is_a?(Git) && uri == other.uri && ref == other.ref &&
|
54
|
+
branch == other.branch && name == other.name &&
|
55
|
+
version == other.version && submodules == other.submodules
|
61
56
|
end
|
62
57
|
|
63
|
-
|
58
|
+
alias_method :==, :eql?
|
64
59
|
|
65
60
|
def to_s
|
66
61
|
at = if local?
|
@@ -70,11 +65,18 @@ module Bundler
|
|
70
65
|
else
|
71
66
|
ref
|
72
67
|
end
|
73
|
-
|
68
|
+
|
69
|
+
rev = begin
|
70
|
+
"@#{shortref_for_display(revision)}"
|
71
|
+
rescue GitError
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
|
75
|
+
"#{uri} (at #{at}#{rev})"
|
74
76
|
end
|
75
77
|
|
76
78
|
def name
|
77
|
-
File.basename(@uri,
|
79
|
+
File.basename(@uri, ".git")
|
78
80
|
end
|
79
81
|
|
80
82
|
# This is the path which is going to contain a specific
|
@@ -93,7 +95,7 @@ module Bundler
|
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
96
|
-
|
98
|
+
alias_method :path, :install_path
|
97
99
|
|
98
100
|
def extension_dir_name
|
99
101
|
"#{base_name}-#{shortref_for_path(revision)}"
|
@@ -145,9 +147,7 @@ module Bundler
|
|
145
147
|
|
146
148
|
# TODO: actually cache git specs
|
147
149
|
def specs(*)
|
148
|
-
if has_app_cache? && !local?
|
149
|
-
set_local!(app_cache_path)
|
150
|
-
end
|
150
|
+
set_local!(app_cache_path) if has_app_cache? && !local?
|
151
151
|
|
152
152
|
if requires_checkout? && !@copied
|
153
153
|
git_proxy.checkout
|
@@ -160,7 +160,7 @@ module Bundler
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def install(spec, force = false)
|
163
|
-
Bundler.ui.info "Using #{version_message(spec)} from #{
|
163
|
+
Bundler.ui.info "Using #{version_message(spec)} from #{self}"
|
164
164
|
|
165
165
|
if requires_checkout? && !@copied && !force
|
166
166
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
@@ -188,7 +188,7 @@ module Bundler
|
|
188
188
|
super
|
189
189
|
rescue PathError => e
|
190
190
|
Bundler.ui.trace e
|
191
|
-
raise GitError, "#{
|
191
|
+
raise GitError, "#{self} is not yet checked out. Run `bundle install` first."
|
192
192
|
end
|
193
193
|
|
194
194
|
# This is the path which is going to contain a cache
|
@@ -219,7 +219,7 @@ module Bundler
|
|
219
219
|
@allow_remote || @allow_cached
|
220
220
|
end
|
221
221
|
|
222
|
-
|
222
|
+
private
|
223
223
|
|
224
224
|
def serialize_gemspecs_in(destination)
|
225
225
|
expanded_path = destination.expand_path(Bundler.root)
|
@@ -229,7 +229,7 @@ module Bundler
|
|
229
229
|
# The gemspecs we cache should already be evaluated.
|
230
230
|
spec = Bundler.load_gemspec(spec_path)
|
231
231
|
next unless spec
|
232
|
-
File.open(spec_path,
|
232
|
+
File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
@@ -252,7 +252,7 @@ module Bundler
|
|
252
252
|
end
|
253
253
|
|
254
254
|
def base_name
|
255
|
-
File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)?(//\w*/)?(\w*/)*},
|
255
|
+
File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)?(//\w*/)?(\w*/)*}, ""), ".git")
|
256
256
|
end
|
257
257
|
|
258
258
|
def shortref_for_display(ref)
|
@@ -267,7 +267,7 @@ module Bundler
|
|
267
267
|
if uri =~ %r{^\w+://(\w+@)?}
|
268
268
|
# Downcase the domain component of the URI
|
269
269
|
# and strip off a trailing slash, if one is present
|
270
|
-
input = URI.parse(uri).normalize.to_s.sub(%r{/$},
|
270
|
+
input = URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
271
271
|
else
|
272
272
|
# If there is no URI scheme, assume it is an ssh/git URI
|
273
273
|
input = uri
|
@@ -286,8 +286,6 @@ module Bundler
|
|
286
286
|
def git_proxy
|
287
287
|
@git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision, self)
|
288
288
|
end
|
289
|
-
|
290
289
|
end
|
291
|
-
|
292
290
|
end
|
293
291
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Bundler
|
2
2
|
class Source
|
3
3
|
class Git < Path
|
4
|
-
|
5
4
|
class GitNotInstalledError < GitError
|
6
5
|
def initialize
|
7
6
|
msg = "You need to install git to be able to use gems from git repositories. "
|
@@ -20,8 +19,9 @@ module Bundler
|
|
20
19
|
end
|
21
20
|
|
22
21
|
class GitCommandError < GitError
|
23
|
-
def initialize(command, path = nil)
|
24
|
-
msg = "Git error: command `git #{command}` in directory #{
|
22
|
+
def initialize(command, path = nil, extra_info = nil)
|
23
|
+
msg = "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed."
|
24
|
+
msg << "\n#{extra_info}" if extra_info
|
25
25
|
msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist?
|
26
26
|
super msg
|
27
27
|
end
|
@@ -44,7 +44,10 @@ module Bundler
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def revision
|
47
|
-
@revision ||= allowed_in_path
|
47
|
+
@revision ||= allowed_in_path do
|
48
|
+
msg = "Ref '#{ref}' was not found. Perhaps you mispelled it?"
|
49
|
+
git("rev-parse --verify #{ref}", true, msg).strip
|
50
|
+
end
|
48
51
|
end
|
49
52
|
|
50
53
|
def branch
|
@@ -67,32 +70,44 @@ module Bundler
|
|
67
70
|
def checkout
|
68
71
|
if path.exist?
|
69
72
|
return if has_revision_cached?
|
70
|
-
Bundler.ui.
|
73
|
+
Bundler.ui.info "Fetching #{uri}"
|
71
74
|
in_path do
|
72
|
-
git_retry
|
75
|
+
git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*")
|
73
76
|
end
|
74
77
|
else
|
75
78
|
Bundler.ui.info "Fetching #{uri}"
|
76
|
-
|
77
|
-
|
79
|
+
SharedHelpers.filesystem_access(path.dirname) do |p|
|
80
|
+
FileUtils.mkdir_p(p)
|
81
|
+
end
|
82
|
+
git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
|
78
83
|
end
|
79
84
|
end
|
80
85
|
|
81
|
-
def copy_to(destination, submodules=false)
|
86
|
+
def copy_to(destination, submodules = false)
|
87
|
+
# method 1
|
82
88
|
unless File.exist?(destination.join(".git"))
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
89
|
+
begin
|
90
|
+
SharedHelpers.filesystem_access(destination.dirname) do |p|
|
91
|
+
FileUtils.mkdir_p(p)
|
92
|
+
end
|
93
|
+
SharedHelpers.filesystem_access(destination) do |p|
|
94
|
+
FileUtils.rm_rf(p)
|
95
|
+
end
|
96
|
+
git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
|
97
|
+
File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination)
|
98
|
+
rescue Errno::EEXIST => e
|
99
|
+
file_path = e.message[%r{.*?(/.*)}, 1]
|
100
|
+
raise GitError, "Bundler could not install a gem because it needs to " \
|
101
|
+
"create a directory, but a file exists - #{file_path}. Please delete " \
|
102
|
+
"this file and try again."
|
103
|
+
end
|
87
104
|
end
|
88
|
-
|
105
|
+
# method 2
|
89
106
|
SharedHelpers.chdir(destination) do
|
90
|
-
git_retry
|
107
|
+
git_retry %(fetch --force --quiet --tags "#{path}")
|
91
108
|
git "reset --hard #{@revision}"
|
92
109
|
|
93
|
-
if submodules
|
94
|
-
git_retry "submodule update --init --recursive"
|
95
|
-
end
|
110
|
+
git_retry "submodule update --init --recursive" if submodules
|
96
111
|
end
|
97
112
|
end
|
98
113
|
|
@@ -113,10 +128,10 @@ module Bundler
|
|
113
128
|
end
|
114
129
|
end
|
115
130
|
|
116
|
-
def git(command, check_errors=true)
|
131
|
+
def git(command, check_errors = true, error_msg = nil)
|
117
132
|
raise GitNotAllowedError.new(command) unless allow?
|
118
|
-
out = SharedHelpers.with_clean_git_env {
|
119
|
-
raise GitCommandError.new(command, path) if check_errors && !$?.success?
|
133
|
+
out = SharedHelpers.with_clean_git_env { `git #{command}` }
|
134
|
+
raise GitCommandError.new(command, path, error_msg) if check_errors && !$?.success?
|
120
135
|
out
|
121
136
|
end
|
122
137
|
|
@@ -129,15 +144,28 @@ module Bundler
|
|
129
144
|
end
|
130
145
|
|
131
146
|
# Escape the URI for git commands
|
132
|
-
def
|
147
|
+
def uri_escaped_with_configured_credentials
|
148
|
+
remote = configured_uri_for(uri)
|
133
149
|
if Bundler::WINDOWS
|
134
150
|
# Windows quoting requires double quotes only, with double quotes
|
135
151
|
# inside the string escaped by being doubled.
|
136
|
-
'"' +
|
152
|
+
'"' + remote.gsub('"') { '""' } + '"'
|
137
153
|
else
|
138
154
|
# Bash requires single quoted strings, with the single quotes escaped
|
139
155
|
# by ending the string, escaping the quote, and restarting the string.
|
140
|
-
"'" +
|
156
|
+
"'" + remote.gsub("'") { "'\\''" } + "'"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# Adds credentials to the URI as Fetcher#configured_uri_for does
|
161
|
+
def configured_uri_for(uri)
|
162
|
+
if /https?:/ =~ uri
|
163
|
+
remote = URI(uri)
|
164
|
+
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
|
165
|
+
remote.userinfo ||= config_auth
|
166
|
+
remote.to_s
|
167
|
+
else
|
168
|
+
uri
|
141
169
|
end
|
142
170
|
end
|
143
171
|
|
@@ -154,9 +182,7 @@ module Bundler
|
|
154
182
|
return in_path { yield } if allow?
|
155
183
|
raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
|
156
184
|
end
|
157
|
-
|
158
185
|
end
|
159
|
-
|
160
186
|
end
|
161
187
|
end
|
162
188
|
end
|
data/lib/bundler/source/path.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Bundler
|
2
2
|
class Source
|
3
3
|
class Path < Source
|
4
|
-
autoload :Installer,
|
4
|
+
autoload :Installer, "bundler/source/path/installer"
|
5
5
|
|
6
|
-
attr_reader
|
7
|
-
attr_writer
|
6
|
+
attr_reader :path, :options
|
7
|
+
attr_writer :name
|
8
8
|
attr_accessor :version
|
9
9
|
|
10
10
|
DEFAULT_GLOB = "{,*,*/*}.gemspec"
|
@@ -49,27 +49,27 @@ module Bundler
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def to_s
|
52
|
-
"source at
|
52
|
+
"source at `#{@path}`"
|
53
53
|
end
|
54
54
|
|
55
55
|
def hash
|
56
56
|
[self.class, expanded_path, version].hash
|
57
57
|
end
|
58
58
|
|
59
|
-
def eql?(
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
def eql?(other)
|
60
|
+
other.instance_of?(Path) &&
|
61
|
+
expanded_path == expand(other.path) &&
|
62
|
+
version == other.version
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
alias_method :==, :eql?
|
66
66
|
|
67
67
|
def name
|
68
68
|
File.basename(expanded_path.to_s)
|
69
69
|
end
|
70
70
|
|
71
71
|
def install(spec, force = false)
|
72
|
-
Bundler.ui.info "Using #{version_message(spec)} from #{
|
72
|
+
Bundler.ui.info "Using #{version_message(spec)} from #{self}"
|
73
73
|
generate_bin(spec, :disable_extensions)
|
74
74
|
nil # no post-install message
|
75
75
|
end
|
@@ -77,10 +77,10 @@ module Bundler
|
|
77
77
|
def cache(spec, custom_path = nil)
|
78
78
|
app_cache_path = app_cache_path(custom_path)
|
79
79
|
return unless Bundler.settings[:cache_all]
|
80
|
-
return if expand(@original_path).to_s.index(Bundler.root.to_s) == 0
|
80
|
+
return if expand(@original_path).to_s.index(Bundler.root.to_s + "/") == 0
|
81
81
|
|
82
82
|
unless @original_path.exist?
|
83
|
-
raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{
|
83
|
+
raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{self} is missing!"
|
84
84
|
end
|
85
85
|
|
86
86
|
FileUtils.rm_rf(app_cache_path)
|
@@ -131,12 +131,11 @@ module Bundler
|
|
131
131
|
|
132
132
|
if File.directory?(expanded_path)
|
133
133
|
# We sort depth-first since `<<` will override the earlier-found specs
|
134
|
-
Dir["#{expanded_path}/#{@glob}"].sort_by {
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
end
|
134
|
+
Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
|
135
|
+
next unless spec = Bundler.load_gemspec(file, :validate)
|
136
|
+
spec.loaded_from = file.to_s
|
137
|
+
spec.source = self
|
138
|
+
index << spec
|
140
139
|
end
|
141
140
|
|
142
141
|
if index.empty? && @name && @version
|
@@ -147,11 +146,11 @@ module Bundler
|
|
147
146
|
s.platform = Gem::Platform::RUBY
|
148
147
|
s.summary = "Fake gemspec for #{@name}"
|
149
148
|
s.relative_loaded_from = "#{@name}.gemspec"
|
150
|
-
s.authors
|
149
|
+
s.authors = ["no one"]
|
151
150
|
if expanded_path.join("bin").exist?
|
152
151
|
executables = expanded_path.join("bin").children
|
153
|
-
executables.reject!{|p| File.directory?(p) }
|
154
|
-
s.executables = executables.map{|c| c.basename.to_s }
|
152
|
+
executables.reject! {|p| File.directory?(p) }
|
153
|
+
s.executables = executables.map {|c| c.basename.to_s }
|
155
154
|
end
|
156
155
|
end
|
157
156
|
end
|
@@ -165,7 +164,7 @@ module Bundler
|
|
165
164
|
end
|
166
165
|
|
167
166
|
def relative_path
|
168
|
-
if path.to_s.
|
167
|
+
if path.to_s.start_with?(Bundler.root.to_s)
|
169
168
|
return path.relative_path_from(Bundler.root)
|
170
169
|
end
|
171
170
|
path
|
@@ -212,14 +211,12 @@ module Bundler
|
|
212
211
|
return unless Gem.respond_to?(hooks_meth)
|
213
212
|
Gem.send(hooks_meth).each do |hook|
|
214
213
|
result = hook.call(installer)
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
end
|
214
|
+
next unless result == false
|
215
|
+
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
|
216
|
+
message = "#{type} hook#{location} failed for #{installer.spec.full_name}"
|
217
|
+
raise InstallHookError, message
|
220
218
|
end
|
221
219
|
end
|
222
|
-
|
223
220
|
end
|
224
221
|
end
|
225
222
|
end
|