bundler 1.7.15 → 1.8.0.pre
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/.gitignore +5 -14
- data/.rspec +1 -0
- data/.travis.yml +22 -15
- data/CHANGELOG.md +43 -13
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +14 -12
- data/DEVELOPMENT.md +4 -2
- data/ISSUES.md +1 -1
- data/README.md +10 -14
- data/Rakefile +10 -10
- data/bin/bundle +1 -1
- data/bundler.gemspec +5 -4
- data/lib/bundler.rb +22 -3
- data/lib/bundler/anonymizable_uri.rb +24 -8
- data/lib/bundler/cli.rb +103 -66
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/clean.rb +11 -4
- data/lib/bundler/cli/common.rb +2 -0
- data/lib/bundler/cli/console.rb +22 -26
- data/lib/bundler/cli/exec.rb +29 -22
- data/lib/bundler/cli/gem.rb +125 -37
- data/lib/bundler/cli/install.rb +22 -9
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/package.rb +8 -1
- data/lib/bundler/cli/show.rb +29 -3
- data/lib/bundler/cli/update.rb +2 -2
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/definition.rb +14 -22
- data/lib/bundler/dependency.rb +8 -1
- data/lib/bundler/dsl.rb +17 -4
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +44 -25
- data/lib/bundler/fetcher.rb +33 -25
- data/lib/bundler/friendly_errors.rb +38 -5
- data/lib/bundler/gem_helper.rb +16 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/graph.rb +4 -1
- data/lib/bundler/index.rb +15 -25
- data/lib/bundler/installer.rb +6 -6
- data/lib/bundler/lockfile_parser.rb +7 -7
- data/lib/bundler/resolver.rb +2 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +1 -1
- data/lib/bundler/runtime.rb +22 -40
- data/lib/bundler/settings.rb +14 -5
- data/lib/bundler/setup.rb +2 -1
- data/lib/bundler/shared_helpers.rb +56 -4
- data/lib/bundler/source.rb +8 -9
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/git/git_proxy.rb +4 -0
- data/lib/bundler/source/path.rb +8 -11
- data/lib/bundler/source/path/installer.rb +0 -2
- data/lib/bundler/source/rubygems.rb +58 -72
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
- data/lib/bundler/templates/newgem/README.md.tt +9 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +73 -0
- data/man/bundle-config.ronn +17 -15
- data/man/bundle-install.ronn +102 -93
- data/man/bundle-update.ronn +39 -30
- data/man/bundle.ronn +6 -0
- data/man/gemfile.5.ronn +74 -13
- metadata +10 -231
- data/lib/bundler/parallel_workers.rb +0 -18
- data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
- data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
- data/lib/bundler/parallel_workers/worker.rb +0 -69
- data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
- data/spec/bundler/anonymizable_uri_spec.rb +0 -32
- data/spec/bundler/bundler_spec.rb +0 -72
- data/spec/bundler/cli_spec.rb +0 -16
- data/spec/bundler/definition_spec.rb +0 -22
- data/spec/bundler/dsl_spec.rb +0 -82
- data/spec/bundler/friendly_errors_spec.rb +0 -13
- data/spec/bundler/gem_helper_spec.rb +0 -226
- data/spec/bundler/psyched_yaml_spec.rb +0 -8
- data/spec/bundler/retry_spec.rb +0 -59
- data/spec/bundler/settings_spec.rb +0 -13
- data/spec/bundler/source/rubygems_spec.rb +0 -25
- data/spec/bundler/source_list_spec.rb +0 -361
- data/spec/cache/gems_spec.rb +0 -284
- data/spec/cache/git_spec.rb +0 -188
- data/spec/cache/path_spec.rb +0 -121
- data/spec/cache/platform_spec.rb +0 -57
- data/spec/commands/binstubs_spec.rb +0 -219
- data/spec/commands/check_spec.rb +0 -278
- data/spec/commands/clean_spec.rb +0 -592
- data/spec/commands/config_spec.rb +0 -263
- data/spec/commands/console_spec.rb +0 -76
- data/spec/commands/exec_spec.rb +0 -309
- data/spec/commands/help_spec.rb +0 -39
- data/spec/commands/init_spec.rb +0 -39
- data/spec/commands/inject_spec.rb +0 -78
- data/spec/commands/licenses_spec.rb +0 -18
- data/spec/commands/newgem_spec.rb +0 -428
- data/spec/commands/open_spec.rb +0 -68
- data/spec/commands/outdated_spec.rb +0 -156
- data/spec/commands/package_spec.rb +0 -114
- data/spec/commands/show_spec.rb +0 -125
- data/spec/install/binstubs_spec.rb +0 -24
- data/spec/install/bundler_spec.rb +0 -146
- data/spec/install/deploy_spec.rb +0 -250
- data/spec/install/gemfile/gemspec_spec.rb +0 -170
- data/spec/install/gemfile/git_spec.rb +0 -967
- data/spec/install/gemfile/path_spec.rb +0 -500
- data/spec/install/gemfile_spec.rb +0 -44
- data/spec/install/gems/c_ext_spec.rb +0 -48
- data/spec/install/gems/dependency_api_spec.rb +0 -652
- data/spec/install/gems/env_spec.rb +0 -107
- data/spec/install/gems/flex_spec.rb +0 -314
- data/spec/install/gems/groups_spec.rb +0 -308
- data/spec/install/gems/mirror_spec.rb +0 -39
- data/spec/install/gems/platform_spec.rb +0 -195
- data/spec/install/gems/post_install_spec.rb +0 -121
- data/spec/install/gems/resolving_spec.rb +0 -124
- data/spec/install/gems/simple_case_spec.rb +0 -377
- data/spec/install/gems/sources_spec.rb +0 -386
- data/spec/install/gems/standalone_spec.rb +0 -260
- data/spec/install/gems/sudo_spec.rb +0 -136
- data/spec/install/gems/win32_spec.rb +0 -26
- data/spec/install/gemspecs_spec.rb +0 -50
- data/spec/install/path_spec.rb +0 -150
- data/spec/install/post_bundle_message_spec.rb +0 -142
- data/spec/install/prereleases_spec.rb +0 -43
- data/spec/install/security_policy_spec.rb +0 -77
- data/spec/install/upgrade_spec.rb +0 -26
- data/spec/lock/git_spec.rb +0 -34
- data/spec/lock/lockfile_spec.rb +0 -924
- data/spec/other/bundle_ruby_spec.rb +0 -142
- data/spec/other/cli_dispatch_spec.rb +0 -21
- data/spec/other/ext_spec.rb +0 -60
- data/spec/other/platform_spec.rb +0 -1285
- data/spec/other/ssl_cert_spec.rb +0 -23
- data/spec/quality_spec.rb +0 -88
- data/spec/realworld/dependency_api_spec.rb +0 -60
- data/spec/realworld/edgecases_spec.rb +0 -212
- data/spec/realworld/parallel_spec.rb +0 -71
- data/spec/resolver/basic_spec.rb +0 -66
- data/spec/resolver/platform_spec.rb +0 -88
- data/spec/runtime/executable_spec.rb +0 -149
- data/spec/runtime/load_spec.rb +0 -107
- data/spec/runtime/platform_spec.rb +0 -90
- data/spec/runtime/require_spec.rb +0 -332
- data/spec/runtime/setup_spec.rb +0 -853
- data/spec/runtime/with_clean_env_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -123
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint.rb +0 -71
- data/spec/support/artifice/endpoint_500.rb +0 -37
- data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
- data/spec/support/artifice/endpoint_api_missing.rb +0 -16
- data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
- data/spec/support/artifice/endpoint_extra.rb +0 -31
- data/spec/support/artifice/endpoint_extra_api.rb +0 -32
- data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
- data/spec/support/artifice/endpoint_fallback.rb +0 -17
- data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
- data/spec/support/artifice/endpoint_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
- data/spec/support/artifice/endpoint_timeout.rb +0 -13
- data/spec/support/builders.rb +0 -693
- data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
- data/spec/support/fakeweb/windows.rb +0 -23
- data/spec/support/hax.rb +0 -22
- data/spec/support/helpers.rb +0 -361
- data/spec/support/indexes.rb +0 -280
- data/spec/support/matchers.rb +0 -77
- data/spec/support/path.rb +0 -85
- data/spec/support/permissions.rb +0 -10
- data/spec/support/platforms.rb +0 -94
- data/spec/support/ruby_ext.rb +0 -20
- data/spec/support/rubygems_ext.rb +0 -39
- data/spec/support/streams.rb +0 -13
- data/spec/support/sudo.rb +0 -16
- data/spec/update/gems_spec.rb +0 -201
- data/spec/update/git_spec.rb +0 -283
- data/spec/update/path_spec.rb +0 -18
data/lib/bundler/settings.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Bundler
|
2
2
|
class Settings
|
3
|
+
BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check gem.mit gem.coc).freeze
|
4
|
+
|
3
5
|
def initialize(root = nil)
|
4
6
|
@root = root
|
5
7
|
@local_config = load_config(local_config_file)
|
@@ -115,14 +117,22 @@ module Bundler
|
|
115
117
|
ENV['BUNDLE_IGNORE_CONFIG']
|
116
118
|
end
|
117
119
|
|
120
|
+
def app_cache_path
|
121
|
+
@app_cache_path ||= begin
|
122
|
+
path = self[:cache_path] || "vendor/cache"
|
123
|
+
raise InvalidOption, "Cache path must be relative to the bundle path" if path.start_with?("/")
|
124
|
+
path
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
118
128
|
private
|
119
129
|
def key_for(key)
|
120
|
-
key = key.to_s.
|
130
|
+
key = key.to_s.gsub(".", "__").upcase
|
121
131
|
"BUNDLE_#{key}"
|
122
132
|
end
|
123
133
|
|
124
134
|
def is_bool(key)
|
125
|
-
|
135
|
+
BOOL_KEYS.include?(key.to_s)
|
126
136
|
end
|
127
137
|
|
128
138
|
def to_bool(value)
|
@@ -155,10 +165,9 @@ module Bundler
|
|
155
165
|
def load_config(config_file)
|
156
166
|
valid_file = config_file && config_file.exist? && !config_file.size.zero?
|
157
167
|
if !ignore_config? && valid_file
|
158
|
-
config_regex = /^(BUNDLE_.+): (['"]
|
168
|
+
config_regex = /^(BUNDLE_.+): (?:['"](.*)['"]|(.+(?:\n(?!BUNDLE).+))|(.+))$/
|
159
169
|
config_pairs = config_file.read.scan(config_regex).map do |m|
|
160
|
-
|
161
|
-
[key, value.gsub(/\s+/, " ").tr('"', "'")]
|
170
|
+
m.compact.map { |n| n.gsub(/\s+/, " ").tr('"', "'") }
|
162
171
|
end
|
163
172
|
Hash[config_pairs]
|
164
173
|
else
|
data/lib/bundler/setup.rb
CHANGED
@@ -28,7 +28,23 @@ module Bundler
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def default_lockfile
|
31
|
-
|
31
|
+
gemfile = default_gemfile
|
32
|
+
|
33
|
+
case gemfile.basename.to_s
|
34
|
+
when 'gems.rb' then Pathname.new(gemfile.sub(/.rb$/, '.locked'))
|
35
|
+
else Pathname.new("#{gemfile}.lock")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def default_bundle_dir
|
40
|
+
global_bundle_dir = File.join(Bundler.rubygems.user_home, ".bundle")
|
41
|
+
bundle_dir = find_directory(".bundle")
|
42
|
+
|
43
|
+
if bundle_dir && bundle_dir != global_bundle_dir
|
44
|
+
Pathname.new(bundle_dir)
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
32
48
|
end
|
33
49
|
|
34
50
|
def in_bundle?
|
@@ -64,12 +80,47 @@ module Bundler
|
|
64
80
|
keys.each {|key| ENV[key] = old_env[key] }
|
65
81
|
end
|
66
82
|
|
83
|
+
def set_bundle_environment
|
84
|
+
# Set PATH
|
85
|
+
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
|
86
|
+
paths.unshift "#{Bundler.bundle_path}/bin"
|
87
|
+
ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
|
88
|
+
|
89
|
+
# Set RUBYOPT
|
90
|
+
rubyopt = [ENV["RUBYOPT"]].compact
|
91
|
+
if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/
|
92
|
+
rubyopt.unshift %|-rbundler/setup|
|
93
|
+
ENV["RUBYOPT"] = rubyopt.join(' ')
|
94
|
+
end
|
95
|
+
|
96
|
+
# Set RUBYLIB
|
97
|
+
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
|
98
|
+
rubylib.unshift File.expand_path('../..', __FILE__)
|
99
|
+
ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR)
|
100
|
+
end
|
101
|
+
|
67
102
|
private
|
68
103
|
|
69
104
|
def find_gemfile
|
70
105
|
given = ENV['BUNDLE_GEMFILE']
|
71
106
|
return given if given && !given.empty?
|
72
107
|
|
108
|
+
find_file('Gemfile', 'gems.rb')
|
109
|
+
end
|
110
|
+
|
111
|
+
def find_file(*names)
|
112
|
+
search_up(*names) {|filename|
|
113
|
+
return filename if File.file?(filename)
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
117
|
+
def find_directory(*names)
|
118
|
+
search_up(*names) do |dirname|
|
119
|
+
return dirname if File.directory?(dirname)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def search_up(*names)
|
73
124
|
previous = nil
|
74
125
|
current = File.expand_path(SharedHelpers.pwd)
|
75
126
|
|
@@ -79,9 +130,10 @@ module Bundler
|
|
79
130
|
return nil if File.file?(File.join(current, 'bundler.gemspec'))
|
80
131
|
end
|
81
132
|
|
82
|
-
|
83
|
-
|
84
|
-
|
133
|
+
names.each do |name|
|
134
|
+
filename = File.join(current, name)
|
135
|
+
yield filename
|
136
|
+
end
|
85
137
|
current, previous = File.expand_path("..", current), current
|
86
138
|
end
|
87
139
|
end
|
data/lib/bundler/source.rb
CHANGED
@@ -21,22 +21,21 @@ module Bundler
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def version_message(spec)
|
24
|
-
locked_spec = Bundler.locked_gems.specs.find { |s| s.name == spec.name } if Bundler.locked_gems
|
25
|
-
locked_spec_version = locked_spec.version if locked_spec
|
26
24
|
message = "#{spec.name} #{spec.version}"
|
27
|
-
|
28
|
-
|
25
|
+
|
26
|
+
if Bundler.locked_gems
|
27
|
+
locked_spec = Bundler.locked_gems.specs.find { |s| s.name == spec.name }
|
28
|
+
locked_spec_version = locked_spec.version if locked_spec
|
29
|
+
if locked_spec_version && spec.version != locked_spec_version
|
30
|
+
message << " (was #{locked_spec_version})"
|
31
|
+
end
|
29
32
|
end
|
33
|
+
|
30
34
|
message
|
31
35
|
end
|
32
36
|
|
33
37
|
def can_lock?(spec)
|
34
38
|
spec.source == self
|
35
39
|
end
|
36
|
-
|
37
|
-
def include?(other)
|
38
|
-
other == self
|
39
|
-
end
|
40
|
-
|
41
40
|
end
|
42
41
|
end
|
data/lib/bundler/source/git.rb
CHANGED
@@ -20,7 +20,7 @@ module Bundler
|
|
20
20
|
# Stringify options that could be set as symbols
|
21
21
|
%w(ref branch tag revision).each{|k| options[k] = options[k].to_s if options[k] }
|
22
22
|
|
23
|
-
@uri = options["uri"]
|
23
|
+
@uri = options["uri"] || ''
|
24
24
|
@branch = options["branch"]
|
25
25
|
@ref = options["ref"] || options["branch"] || options["tag"] || 'master'
|
26
26
|
@submodules = options["submodules"]
|
@@ -46,6 +46,10 @@ module Bundler
|
|
46
46
|
out << " specs:\n"
|
47
47
|
end
|
48
48
|
|
49
|
+
def hash
|
50
|
+
[self.class, uri, ref, branch, name, version, submodules].hash
|
51
|
+
end
|
52
|
+
|
49
53
|
def eql?(o)
|
50
54
|
o.is_a?(Git) &&
|
51
55
|
uri == o.uri &&
|
data/lib/bundler/source/path.rb
CHANGED
@@ -54,19 +54,19 @@ module Bundler
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def hash
|
57
|
-
self.class.hash
|
57
|
+
[self.class, expanded_path, version].hash
|
58
58
|
end
|
59
59
|
|
60
60
|
def eql?(o)
|
61
61
|
o.instance_of?(Path) &&
|
62
|
-
|
62
|
+
expanded_path == expand(o.path) &&
|
63
63
|
version == o.version
|
64
64
|
end
|
65
65
|
|
66
66
|
alias == eql?
|
67
67
|
|
68
68
|
def name
|
69
|
-
File.basename(
|
69
|
+
File.basename(expanded_path.to_s)
|
70
70
|
end
|
71
71
|
|
72
72
|
def install(spec)
|
@@ -95,6 +95,7 @@ module Bundler
|
|
95
95
|
def specs
|
96
96
|
if has_app_cache?
|
97
97
|
@path = app_cache_path
|
98
|
+
@expanded_path = nil # Invalidate
|
98
99
|
end
|
99
100
|
local_specs
|
100
101
|
end
|
@@ -105,6 +106,10 @@ module Bundler
|
|
105
106
|
|
106
107
|
private
|
107
108
|
|
109
|
+
def expanded_path
|
110
|
+
@expanded_path ||= expand(path)
|
111
|
+
end
|
112
|
+
|
108
113
|
def expand(somepath)
|
109
114
|
somepath.expand_path(Bundler.root)
|
110
115
|
rescue ArgumentError => e
|
@@ -123,7 +128,6 @@ module Bundler
|
|
123
128
|
|
124
129
|
def load_spec_files
|
125
130
|
index = Index.new
|
126
|
-
expanded_path = expand(path)
|
127
131
|
|
128
132
|
if File.directory?(expanded_path)
|
129
133
|
Dir["#{expanded_path}/#{@glob}"].each do |file|
|
@@ -169,7 +173,6 @@ module Bundler
|
|
169
173
|
|
170
174
|
def generate_bin(spec, disable_extensions = false)
|
171
175
|
gem_dir = Pathname.new(spec.full_gem_path)
|
172
|
-
gem_file = nil
|
173
176
|
|
174
177
|
# Some gem authors put absolute paths in their gemspec
|
175
178
|
# and we have to save them from themselves
|
@@ -183,8 +186,6 @@ module Bundler
|
|
183
186
|
end.compact
|
184
187
|
|
185
188
|
SharedHelpers.chdir(gem_dir) do
|
186
|
-
gem_file = Bundler.rubygems.build_gem gem_dir, spec
|
187
|
-
|
188
189
|
installer = Path::Installer.new(spec, :env_shebang => false)
|
189
190
|
run_hooks(:pre_install, installer)
|
190
191
|
installer.build_extensions unless disable_extensions
|
@@ -204,10 +205,6 @@ module Bundler
|
|
204
205
|
end
|
205
206
|
|
206
207
|
Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
|
207
|
-
ensure
|
208
|
-
if gem_dir && gem_file
|
209
|
-
FileUtils.rm_rf(gem_dir.join gem_file)
|
210
|
-
end
|
211
208
|
end
|
212
209
|
|
213
210
|
def run_hooks(type, installer)
|
@@ -5,8 +5,7 @@ require 'rubygems/spec_fetcher'
|
|
5
5
|
module Bundler
|
6
6
|
class Source
|
7
7
|
class Rubygems < Source
|
8
|
-
# threshold for switching back to the modern index instead of fetching every spec
|
9
|
-
API_REQUEST_LIMIT = 100
|
8
|
+
API_REQUEST_LIMIT = 100 # threshold for switching back to the modern index instead of fetching every spec
|
10
9
|
|
11
10
|
attr_reader :remotes, :caches
|
12
11
|
|
@@ -34,15 +33,11 @@ module Bundler
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def eql?(o)
|
37
|
-
o.is_a?(Rubygems) && o.
|
36
|
+
o.is_a?(Rubygems) && remotes_equal?(o.remotes)
|
38
37
|
end
|
39
38
|
|
40
39
|
alias == eql?
|
41
40
|
|
42
|
-
def include?(o)
|
43
|
-
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
|
44
|
-
end
|
45
|
-
|
46
41
|
def can_lock?(spec)
|
47
42
|
spec.source.is_a?(Rubygems)
|
48
43
|
end
|
@@ -97,49 +92,50 @@ module Bundler
|
|
97
92
|
spec.__swap__(s)
|
98
93
|
end
|
99
94
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
95
|
+
unless Bundler.settings[:no_install]
|
96
|
+
path = cached_gem(spec)
|
97
|
+
if Bundler.requires_sudo?
|
98
|
+
install_path = Bundler.tmp(spec.full_name)
|
99
|
+
bin_path = install_path.join("bin")
|
100
|
+
else
|
101
|
+
install_path = Bundler.rubygems.gem_dir
|
102
|
+
bin_path = Bundler.system_bindir
|
103
|
+
end
|
108
104
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
105
|
+
installed_spec = nil
|
106
|
+
Bundler.rubygems.preserve_paths do
|
107
|
+
installed_spec = Bundler::GemInstaller.new(path,
|
108
|
+
:install_dir => install_path.to_s,
|
109
|
+
:bin_dir => bin_path.to_s,
|
110
|
+
:ignore_dependencies => true,
|
111
|
+
:wrappers => true,
|
112
|
+
:env_shebang => true
|
113
|
+
).install
|
114
|
+
end
|
119
115
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
116
|
+
# SUDO HAX
|
117
|
+
if Bundler.requires_sudo?
|
118
|
+
Bundler.rubygems.repository_subdirectories.each do |name|
|
119
|
+
src = File.join(install_path, name, "*")
|
120
|
+
dst = File.join(Bundler.rubygems.gem_dir, name)
|
121
|
+
if name == "extensions" && Dir.glob(src).any?
|
122
|
+
src = File.join(src, "*/*")
|
123
|
+
ext_src = Dir.glob(src).first
|
124
|
+
ext_src.gsub!(src[0..-6], '')
|
125
|
+
dst = File.dirname(File.join(dst, ext_src))
|
126
|
+
end
|
127
|
+
Bundler.mkdir_p dst
|
128
|
+
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
130
129
|
end
|
131
|
-
Bundler.mkdir_p dst
|
132
|
-
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
133
|
-
end
|
134
130
|
|
135
|
-
|
136
|
-
|
137
|
-
|
131
|
+
spec.executables.each do |exe|
|
132
|
+
Bundler.mkdir_p Bundler.system_bindir
|
133
|
+
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
|
134
|
+
end
|
138
135
|
end
|
136
|
+
installed_spec.loaded_from = loaded_from(spec)
|
139
137
|
end
|
140
|
-
|
141
|
-
spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec"
|
142
|
-
installed_spec.loaded_from = spec.loaded_from
|
138
|
+
spec.loaded_from = loaded_from(spec)
|
143
139
|
["Installing #{version_message(spec)}", spec.post_install_message]
|
144
140
|
ensure
|
145
141
|
if install_path && Bundler.requires_sudo?
|
@@ -190,21 +186,27 @@ module Bundler
|
|
190
186
|
end
|
191
187
|
end
|
192
188
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
189
|
+
def fetchers
|
190
|
+
@fetchers ||= remotes.map do |uri|
|
191
|
+
Bundler::Fetcher.new(uri)
|
192
|
+
end
|
197
193
|
end
|
198
194
|
|
199
|
-
|
195
|
+
protected
|
200
196
|
|
201
197
|
def source_uris_for_spec(spec)
|
202
|
-
specs.search_all(spec.name).inject([]) do |uris,
|
203
|
-
uris <<
|
198
|
+
specs.search_all(spec.name).inject([]) do |uris, s|
|
199
|
+
uris << s.source_uri.without_credentials if s.source_uri
|
204
200
|
uris
|
205
201
|
end
|
206
202
|
end
|
207
203
|
|
204
|
+
private
|
205
|
+
|
206
|
+
def loaded_from(spec)
|
207
|
+
"#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec"
|
208
|
+
end
|
209
|
+
|
208
210
|
def cached_gem(spec)
|
209
211
|
cached_gem = cached_path(spec)
|
210
212
|
unless cached_gem
|
@@ -281,12 +283,6 @@ module Bundler
|
|
281
283
|
idx
|
282
284
|
end
|
283
285
|
|
284
|
-
def fetchers
|
285
|
-
@fetchers ||= remotes.map do |url|
|
286
|
-
Bundler::Fetcher.new(url)
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
286
|
def api_fetchers
|
291
287
|
fetchers.select{|f| f.use_api }
|
292
288
|
end
|
@@ -313,20 +309,6 @@ module Bundler
|
|
313
309
|
Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over
|
314
310
|
end
|
315
311
|
|
316
|
-
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
|
317
|
-
# sources A and B. At this point, the API request will have found all the versions of Bar in source A,
|
318
|
-
# but will not have found any versions of Bar from source B, which is a problem if the requested version
|
319
|
-
# of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
|
320
|
-
# each spec we found, we add all possible versions from all sources to the index.
|
321
|
-
begin
|
322
|
-
idxcount = idx.size
|
323
|
-
api_fetchers.each do |f|
|
324
|
-
Bundler.ui.info "Fetching version metadata from #{f.uri}", Bundler.ui.debug?
|
325
|
-
idx.use f.specs(idx.dependency_names, self), true
|
326
|
-
Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over
|
327
|
-
end
|
328
|
-
end until idxcount == idx.size
|
329
|
-
|
330
312
|
if api_fetchers.any? && api_fetchers.all?{|f| f.use_api }
|
331
313
|
# it's possible that gems from one source depend on gems from some
|
332
314
|
# other source, so now we download gemspecs and iterate over those
|
@@ -335,7 +317,7 @@ module Bundler
|
|
335
317
|
|
336
318
|
# if there are any cross-site gems we missed, get them now
|
337
319
|
api_fetchers.each do |f|
|
338
|
-
Bundler.ui.info "Fetching
|
320
|
+
Bundler.ui.info "Fetching additional metadata from #{f.uri}", Bundler.ui.debug?
|
339
321
|
idx.use f.specs(unmet, self)
|
340
322
|
Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over
|
341
323
|
end if unmet.any?
|
@@ -366,6 +348,10 @@ module Bundler
|
|
366
348
|
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
|
367
349
|
end
|
368
350
|
|
351
|
+
def remotes_equal?(other_remotes)
|
352
|
+
remotes.map(&method(:suppress_configured_credentials)) == other_remotes.map(&method(:suppress_configured_credentials))
|
353
|
+
end
|
354
|
+
|
369
355
|
end
|
370
356
|
end
|
371
357
|
end
|