rubygems-update 2.6.7 → 2.6.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +11 -0
  3. data/Manifest.txt +10 -5
  4. data/bundler/CHANGELOG.md +108 -0
  5. data/bundler/DEVELOPMENT.md +6 -4
  6. data/bundler/ISSUES.md +17 -0
  7. data/bundler/README.md +2 -0
  8. data/bundler/exe/bundle +4 -6
  9. data/bundler/exe/bundle_ruby +2 -4
  10. data/bundler/exe/bundler +1 -19
  11. data/bundler/lib/bundler.rb +114 -44
  12. data/bundler/lib/bundler/cli.rb +90 -17
  13. data/bundler/lib/bundler/cli/binstubs.rb +4 -3
  14. data/bundler/lib/bundler/cli/cache.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +1 -1
  16. data/bundler/lib/bundler/cli/clean.rb +1 -1
  17. data/bundler/lib/bundler/cli/common.rb +13 -0
  18. data/bundler/lib/bundler/cli/console.rb +3 -0
  19. data/bundler/lib/bundler/cli/doctor.rb +93 -0
  20. data/bundler/lib/bundler/cli/exec.rb +18 -2
  21. data/bundler/lib/bundler/cli/gem.rb +3 -2
  22. data/bundler/lib/bundler/cli/inject.rb +25 -7
  23. data/bundler/lib/bundler/cli/install.rb +25 -7
  24. data/bundler/lib/bundler/cli/lock.rb +20 -7
  25. data/bundler/lib/bundler/cli/outdated.rb +97 -38
  26. data/bundler/lib/bundler/cli/platform.rb +1 -1
  27. data/bundler/lib/bundler/cli/show.rb +1 -1
  28. data/bundler/lib/bundler/cli/update.rb +9 -6
  29. data/bundler/lib/bundler/compact_index_client.rb +102 -0
  30. data/bundler/lib/bundler/compact_index_client/cache.rb +119 -0
  31. data/bundler/lib/bundler/compact_index_client/updater.rb +88 -0
  32. data/bundler/lib/bundler/current_ruby.rb +3 -3
  33. data/bundler/lib/bundler/definition.rb +210 -46
  34. data/bundler/lib/bundler/dependency.rb +1 -1
  35. data/bundler/lib/bundler/deployment.rb +6 -0
  36. data/bundler/lib/bundler/deprecate.rb +16 -0
  37. data/bundler/lib/bundler/dsl.rb +70 -24
  38. data/bundler/lib/bundler/endpoint_specification.rb +2 -0
  39. data/bundler/lib/bundler/env.rb +5 -1
  40. data/bundler/lib/bundler/environment_preserver.rb +1 -1
  41. data/bundler/lib/bundler/errors.rb +12 -1
  42. data/bundler/lib/bundler/feature_flag.rb +32 -0
  43. data/bundler/lib/bundler/fetcher.rb +3 -2
  44. data/bundler/lib/bundler/fetcher/base.rb +10 -0
  45. data/bundler/lib/bundler/fetcher/compact_index.rb +33 -12
  46. data/bundler/lib/bundler/fetcher/dependency.rb +2 -13
  47. data/bundler/lib/bundler/fetcher/downloader.rb +12 -1
  48. data/bundler/lib/bundler/friendly_errors.rb +9 -2
  49. data/bundler/lib/bundler/gem_helper.rb +3 -3
  50. data/bundler/lib/bundler/gem_helpers.rb +69 -1
  51. data/bundler/lib/bundler/gem_version_promoter.rb +175 -0
  52. data/bundler/lib/bundler/gemdeps.rb +28 -0
  53. data/bundler/lib/bundler/graph.rb +4 -25
  54. data/bundler/lib/bundler/index.rb +11 -2
  55. data/bundler/lib/bundler/injector.rb +12 -5
  56. data/bundler/lib/bundler/inline.rb +4 -4
  57. data/bundler/lib/bundler/installer.rb +25 -9
  58. data/bundler/lib/bundler/installer/gem_installer.rb +13 -15
  59. data/bundler/lib/bundler/installer/parallel_installer.rb +121 -99
  60. data/bundler/lib/bundler/lazy_specification.rb +28 -3
  61. data/bundler/lib/bundler/lockfile_parser.rb +27 -17
  62. data/bundler/lib/bundler/match_platform.rb +2 -1
  63. data/bundler/lib/bundler/mirror.rb +2 -2
  64. data/bundler/lib/bundler/plugin.rb +156 -32
  65. data/bundler/lib/bundler/plugin/api.rb +29 -5
  66. data/bundler/lib/bundler/plugin/api/source.rb +293 -0
  67. data/bundler/lib/bundler/plugin/dsl.rb +25 -1
  68. data/bundler/lib/bundler/plugin/index.rb +80 -13
  69. data/bundler/lib/bundler/plugin/installer.rb +6 -10
  70. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  71. data/bundler/lib/bundler/postit_trampoline.rb +56 -40
  72. data/bundler/lib/bundler/remote_specification.rb +5 -0
  73. data/bundler/lib/bundler/resolver.rb +64 -47
  74. data/bundler/lib/bundler/retry.rb +2 -1
  75. data/bundler/lib/bundler/ruby_version.rb +11 -4
  76. data/bundler/lib/bundler/rubygems_ext.rb +25 -3
  77. data/bundler/lib/bundler/rubygems_gem_installer.rb +54 -0
  78. data/bundler/lib/bundler/rubygems_integration.rb +148 -70
  79. data/bundler/lib/bundler/runtime.rb +27 -3
  80. data/bundler/lib/bundler/settings.rb +80 -17
  81. data/bundler/lib/bundler/setup.rb +7 -4
  82. data/bundler/lib/bundler/shared_helpers.rb +45 -8
  83. data/bundler/lib/bundler/source.rb +2 -1
  84. data/bundler/lib/bundler/source/gemspec.rb +4 -0
  85. data/bundler/lib/bundler/source/git.rb +9 -6
  86. data/bundler/lib/bundler/source/git/git_proxy.rb +37 -4
  87. data/bundler/lib/bundler/source/path.rb +10 -27
  88. data/bundler/lib/bundler/source/path/installer.rb +39 -11
  89. data/bundler/lib/bundler/source/rubygems.rb +3 -2
  90. data/bundler/lib/bundler/source_list.rb +28 -8
  91. data/bundler/lib/bundler/spec_set.rb +30 -15
  92. data/bundler/lib/bundler/templates/Executable.standalone +4 -2
  93. data/bundler/lib/bundler/templates/Gemfile +0 -1
  94. data/bundler/lib/bundler/templates/newgem/README.md.tt +1 -1
  95. data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -1
  96. data/bundler/lib/bundler/ui/shell.rb +25 -9
  97. data/bundler/lib/bundler/ui/silent.rb +10 -0
  98. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  99. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +8 -2
  100. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +5 -5
  101. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +3 -3
  102. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +1 -1
  103. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +1 -1
  104. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +4 -4
  105. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +2 -2
  106. data/bundler/lib/bundler/version.rb +1 -1
  107. data/bundler/lib/bundler/yaml_serializer.rb +34 -11
  108. data/bundler/man/bundle-binstubs.ronn +29 -0
  109. data/bundler/man/bundle-config.ronn +33 -1
  110. data/bundler/man/bundle-exec.ronn +9 -0
  111. data/bundler/man/bundle-install.ronn +6 -41
  112. data/bundler/man/bundle-package.ronn +1 -1
  113. data/bundler/man/bundle.ronn +9 -8
  114. data/bundler/man/gemfile.5.ronn +1 -1
  115. data/lib/rubygems.rb +1 -1
  116. data/lib/rubygems/dependency.rb +7 -4
  117. data/lib/rubygems/request.rb +46 -0
  118. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +7 -0
  119. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  120. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -2
  121. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -2
  122. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
  123. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  124. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +12 -1
  125. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -2
  126. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  127. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  128. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +11 -3
  129. data/test/rubygems/test_gem_request.rb +132 -0
  130. data/test/rubygems/test_gem_specification.rb +7 -0
  131. metadata +34 -29
  132. data/bundler/lib/bundler/environment.rb +0 -42
  133. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
  134. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -98
  135. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
  136. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/postit_trampoline" unless ENV["BUNDLE_DISABLE_POSTIT"]
2
+ require "bundler/postit_trampoline"
3
3
  require "bundler/shared_helpers"
4
4
 
5
5
  if Bundler::SharedHelpers.in_bundle?
@@ -20,9 +20,12 @@ if Bundler::SharedHelpers.in_bundle?
20
20
  Bundler.setup
21
21
  end
22
22
 
23
- # Add bundler to the load path after disabling system gems
24
- bundler_lib = File.expand_path("../..", __FILE__)
25
- $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
23
+ unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"]
24
+ # Add bundler to the load path after disabling system gems
25
+ # This is guarenteed to be done already if we've trampolined
26
+ bundler_lib = File.expand_path("../..", __FILE__)
27
+ $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
28
+ end
26
29
 
27
30
  Bundler.ui = nil
28
31
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
  def default_gemfile
24
24
  gemfile = find_gemfile
25
25
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
26
- Pathname.new(gemfile)
26
+ Pathname.new(gemfile).untaint
27
27
  end
28
28
 
29
29
  def default_lockfile
@@ -32,17 +32,19 @@ module Bundler
32
32
  case gemfile.basename.to_s
33
33
  when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
34
34
  else Pathname.new("#{gemfile}.lock")
35
- end
35
+ end.untaint
36
36
  end
37
37
 
38
38
  def default_bundle_dir
39
39
  bundle_dir = find_directory(".bundle")
40
40
  return nil unless bundle_dir
41
41
 
42
- global_bundle_dir = File.join(Bundler.rubygems.user_home, ".bundle")
42
+ bundle_dir = Pathname.new(bundle_dir)
43
+
44
+ global_bundle_dir = Bundler.user_home.join(".bundle")
43
45
  return nil if bundle_dir == global_bundle_dir
44
46
 
45
- Pathname.new(bundle_dir)
47
+ bundle_dir
46
48
  end
47
49
 
48
50
  def in_bundle?
@@ -102,7 +104,7 @@ module Bundler
102
104
  #
103
105
  # @see {Bundler::PermissionError}
104
106
  def filesystem_access(path, action = :write)
105
- yield path
107
+ yield path.dup.untaint
106
108
  rescue Errno::EACCES
107
109
  raise PermissionError.new(path, action)
108
110
  rescue Errno::EAGAIN
@@ -120,12 +122,27 @@ module Bundler
120
122
  namespace.const_get(constant_name)
121
123
  end
122
124
 
125
+ def major_deprecation(message)
126
+ return unless prints_major_deprecations?
127
+ @major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
128
+ ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
129
+ ui.warn("[DEPRECATED FOR #{Bundler::VERSION.split(".").first.to_i + 1}.0] #{message}")
130
+ end
131
+
132
+ def print_major_deprecations!
133
+ deprecate_gemfile(find_gemfile) if find_gemfile == find_file("Gemfile")
134
+ if RUBY_VERSION < "2"
135
+ major_deprecation("Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
136
+ end
137
+ return if Bundler.rubygems.provides?(">= 2")
138
+ major_deprecation("Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
139
+ end
140
+
123
141
  private
124
142
 
125
143
  def find_gemfile
126
144
  given = ENV["BUNDLE_GEMFILE"]
127
145
  return given if given && !given.empty?
128
-
129
146
  find_file("Gemfile", "gems.rb")
130
147
  end
131
148
 
@@ -143,7 +160,7 @@ module Bundler
143
160
 
144
161
  def search_up(*names)
145
162
  previous = nil
146
- current = File.expand_path(SharedHelpers.pwd)
163
+ current = File.expand_path(SharedHelpers.pwd).untaint
147
164
 
148
165
  until !File.directory?(current) || current == previous
149
166
  if ENV["BUNDLE_SPEC_RUN"]
@@ -187,10 +204,15 @@ module Bundler
187
204
 
188
205
  def set_rubylib
189
206
  rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
190
- rubylib.unshift File.expand_path("../..", __FILE__)
207
+ rubylib.unshift bundler_ruby_lib
191
208
  ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR)
192
209
  end
193
210
 
211
+ def bundler_ruby_lib
212
+ File.expand_path("../..", __FILE__)
213
+ end
214
+ private :bundler_ruby_lib
215
+
194
216
  def clean_load_path
195
217
  # handle 1.9 where system gems are always on the load path
196
218
  if defined?(::Gem)
@@ -207,6 +229,21 @@ module Bundler
207
229
  end
208
230
  end
209
231
 
232
+ def prints_major_deprecations?
233
+ require "bundler"
234
+ deprecation_release = Bundler::VERSION.split(".").drop(1).include?("99")
235
+ return false if !deprecation_release && !Bundler.settings[:major_deprecations]
236
+ require "bundler/deprecate"
237
+ return false if Bundler::Deprecate.skip
238
+ true
239
+ end
240
+
241
+ def deprecate_gemfile(gemfile)
242
+ return unless gemfile && File.basename(gemfile) == "Gemfile"
243
+ Bundler::SharedHelpers.major_deprecation \
244
+ "gems.rb and gems.locked will be prefered to Gemfile and Gemfile.lock."
245
+ end
246
+
210
247
  extend self
211
248
  end
212
249
  end
@@ -14,12 +14,13 @@ module Bundler
14
14
 
15
15
  def version_message(spec)
16
16
  message = "#{spec.name} #{spec.version}"
17
+ message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
17
18
 
18
19
  if Bundler.locked_gems
19
20
  locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
20
21
  locked_spec_version = locked_spec.version if locked_spec
21
22
  if locked_spec_version && spec.version != locked_spec_version
22
- message += " (#{Bundler.ui.add_color("was #{locked_spec_version}", :green)})"
23
+ message += Bundler.ui.add_color(" (was #{locked_spec_version})", :green)
23
24
  end
24
25
  end
25
26
 
@@ -8,6 +8,10 @@ module Bundler
8
8
  super
9
9
  @gemspec = options["gemspec"]
10
10
  end
11
+
12
+ def as_path_source
13
+ Path.new(options)
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -152,7 +152,7 @@ module Bundler
152
152
  set_local!(app_cache_path) if has_app_cache? && !local?
153
153
 
154
154
  if requires_checkout? && !@copied
155
- git_proxy.checkout
155
+ fetch
156
156
  git_proxy.copy_to(install_path, submodules)
157
157
  serialize_gemspecs_in(install_path)
158
158
  @copied = true
@@ -170,7 +170,7 @@ module Bundler
170
170
  serialize_gemspecs_in(install_path)
171
171
  @copied = true
172
172
  end
173
- generate_bin(spec)
173
+ generate_bin(spec, !Bundler.rubygems.spec_missing_extensions?(spec))
174
174
 
175
175
  requires_checkout? ? spec.post_install_message : nil
176
176
  end
@@ -223,10 +223,6 @@ module Bundler
223
223
 
224
224
  private
225
225
 
226
- def build_extensions(installer)
227
- super if Bundler.rubygems.spec_missing_extensions?(installer.spec)
228
- end
229
-
230
226
  def serialize_gemspecs_in(destination)
231
227
  destination = destination.expand_path(Bundler.root) if destination.relative?
232
228
  Dir["#{destination}/#{@glob}"].each do |spec_path|
@@ -292,6 +288,13 @@ module Bundler
292
288
  def git_proxy
293
289
  @git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision, self)
294
290
  end
291
+
292
+ def fetch
293
+ git_proxy.checkout
294
+ rescue GitError
295
+ raise unless Bundler.feature_flag.allow_offline_install?
296
+ Bundler.ui.warn "Using cached git data because of network errors"
297
+ end
295
298
  end
296
299
  end
297
300
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require "tempfile"
2
3
  module Bundler
3
4
  class Source
4
5
  class Git < Path
@@ -80,6 +81,10 @@ module Bundler
80
81
  end
81
82
 
82
83
  def version
84
+ git("--version").match(/(git version\s*)?((\.?\d+)+).*/)[2]
85
+ end
86
+
87
+ def full_version
83
88
  git("--version").sub("git version", "").strip
84
89
  end
85
90
 
@@ -110,7 +115,7 @@ module Bundler
110
115
  FileUtils.rm_rf(p)
111
116
  end
112
117
  git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
113
- File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination)
118
+ File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
114
119
  rescue Errno::EEXIST => e
115
120
  file_path = e.message[%r{.*?(/.*)}, 1]
116
121
  raise GitError, "Bundler could not install a gem because it needs to " \
@@ -123,7 +128,11 @@ module Bundler
123
128
  git_retry %(fetch --force --quiet --tags "#{path}")
124
129
  git "reset --hard #{@revision}"
125
130
 
126
- git_retry "submodule update --init --recursive" if submodules
131
+ if submodules
132
+ git_retry "submodule update --init --recursive"
133
+ elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
134
+ git_retry "submodule deinit --all"
135
+ end
127
136
  end
128
137
  end
129
138
 
@@ -139,7 +148,7 @@ module Bundler
139
148
  end
140
149
 
141
150
  def git_retry(command)
142
- Bundler::Retry.new("git #{command}", GitNotAllowedError).attempts do
151
+ Bundler::Retry.new("`git #{command}`", GitNotAllowedError).attempts do
143
152
  git(command)
144
153
  end
145
154
  end
@@ -148,7 +157,9 @@ module Bundler
148
157
  command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
149
158
  raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
150
159
 
151
- out = SharedHelpers.with_clean_git_env { `git #{command}` }
160
+ out = SharedHelpers.with_clean_git_env do
161
+ capture_and_filter_stderr(uri) { `git #{command}` }
162
+ end
152
163
 
153
164
  stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
154
165
  raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !$?.success?
@@ -212,6 +223,28 @@ module Bundler
212
223
  return in_path { yield } if allow?
213
224
  raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
214
225
  end
226
+
227
+ # TODO: Replace this with Open3 when upgrading to bundler 2
228
+ # Similar to #git_null, as Open3 is not cross-platform,
229
+ # a temporary way is to use Tempfile to capture the stderr.
230
+ # When replacing this using Open3, make sure git_null is
231
+ # also replaced by Open3, so stdout and stderr all got handled properly.
232
+ def capture_and_filter_stderr(uri)
233
+ return_value, captured_err = ""
234
+ backup_stderr = STDERR.dup
235
+ begin
236
+ Tempfile.open("captured_stderr") do |f|
237
+ STDERR.reopen(f)
238
+ return_value = yield
239
+ f.rewind
240
+ captured_err = f.read
241
+ end
242
+ ensure
243
+ STDERR.reopen backup_stderr
244
+ end
245
+ $stderr.puts URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
246
+ return_value
247
+ end
215
248
  end
216
249
  end
217
250
  end
@@ -11,7 +11,7 @@ module Bundler
11
11
  DEFAULT_GLOB = "{,*,*/*}.gemspec".freeze
12
12
 
13
13
  def initialize(options)
14
- @options = options
14
+ @options = options.dup
15
15
  @glob = options["glob"] || DEFAULT_GLOB
16
16
 
17
17
  @allow_cached = false
@@ -46,7 +46,7 @@ module Bundler
46
46
 
47
47
  def to_lock
48
48
  out = String.new("PATH\n")
49
- out << " remote: #{relative_path}\n"
49
+ out << " remote: #{lockfile_path}\n"
50
50
  out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
51
51
  out << " specs:\n"
52
52
  end
@@ -60,7 +60,7 @@ module Bundler
60
60
  end
61
61
 
62
62
  def eql?(other)
63
- return unless other.class == Path || other.class == Gemspec
63
+ return unless other.class == self.class
64
64
  expanded_path == expand(other.path) &&
65
65
  version == other.version
66
66
  end
@@ -129,6 +129,11 @@ module Bundler
129
129
  "`#{somepath}`.\nThe error message was: #{e.message}."
130
130
  end
131
131
 
132
+ def lockfile_path
133
+ return relative_path if path.absolute?
134
+ expand(path).relative_path_from(Bundler.root)
135
+ end
136
+
132
137
  def app_cache_path(custom_path = nil)
133
138
  @app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname)
134
139
  end
@@ -203,13 +208,8 @@ module Bundler
203
208
  end
204
209
  end.compact
205
210
 
206
- SharedHelpers.chdir(gem_dir) do
207
- installer = Path::Installer.new(spec, :env_shebang => false)
208
- run_hooks(:pre_install, installer)
209
- build_extensions(installer) unless disable_extensions
210
- installer.generate_bin
211
- run_hooks(:post_install, installer)
212
- end
211
+ installer = Path::Installer.new(spec, :env_shebang => false, :disable_extensions => disable_extensions)
212
+ installer.post_install
213
213
  rescue Gem::InvalidSpecificationException => e
214
214
  Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" \
215
215
  "This prevents bundler from installing bins or native extensions, but " \
@@ -223,23 +223,6 @@ module Bundler
223
223
 
224
224
  Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
225
225
  end
226
-
227
- def build_extensions(installer)
228
- installer.build_extensions
229
- run_hooks(:post_build, installer)
230
- end
231
-
232
- def run_hooks(type, installer)
233
- hooks_meth = "#{type}_hooks"
234
- return unless Gem.respond_to?(hooks_meth)
235
- Gem.send(hooks_meth).each do |hook|
236
- result = hook.call(installer)
237
- next unless result == false
238
- location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
239
- message = "#{type} hook#{location} failed for #{installer.spec.full_name}"
240
- raise InstallHookError, message
241
- end
242
- end
243
226
  end
244
227
  end
245
228
  end
@@ -6,13 +6,14 @@ module Bundler
6
6
  attr_reader :spec
7
7
 
8
8
  def initialize(spec, options = {})
9
- @spec = spec
10
- @gem_dir = Bundler.rubygems.path(spec.full_gem_path)
11
- @wrappers = true
12
- @env_shebang = true
13
- @format_executable = options[:format_executable] || false
14
- @build_args = options[:build_args] || Bundler.rubygems.build_args
15
- @gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin"
9
+ @spec = spec
10
+ @gem_dir = Bundler.rubygems.path(spec.full_gem_path)
11
+ @wrappers = true
12
+ @env_shebang = true
13
+ @format_executable = options[:format_executable] || false
14
+ @build_args = options[:build_args] || Bundler.rubygems.build_args
15
+ @gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin"
16
+ @disable_extentions = options[:disable_extensions]
16
17
 
17
18
  if Bundler.requires_sudo?
18
19
  @tmp_dir = Bundler.tmp(spec.full_name).to_s
@@ -22,9 +23,26 @@ module Bundler
22
23
  end
23
24
  end
24
25
 
25
- def generate_bin
26
- return if spec.executables.nil? || spec.executables.empty?
26
+ def post_install
27
+ SharedHelpers.chdir(@gem_dir) do
28
+ run_hooks(:pre_install)
29
+
30
+ unless @disable_extentions
31
+ build_extensions
32
+ run_hooks(:post_build)
33
+ end
34
+
35
+ generate_bin unless spec.executables.nil? || spec.executables.empty?
36
+
37
+ run_hooks(:post_install)
38
+ end
39
+ ensure
40
+ Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
41
+ end
42
+
43
+ private
27
44
 
45
+ def generate_bin
28
46
  super
29
47
 
30
48
  if Bundler.requires_sudo?
@@ -35,8 +53,18 @@ module Bundler
35
53
  Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}"
36
54
  end
37
55
  end
38
- ensure
39
- Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
56
+ end
57
+
58
+ def run_hooks(type)
59
+ hooks_meth = "#{type}_hooks"
60
+ return unless Gem.respond_to?(hooks_meth)
61
+ Gem.send(hooks_meth).each do |hook|
62
+ result = hook.call(self)
63
+ next unless result == false
64
+ location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
65
+ message = "#{type} hook#{location} failed for #{spec.full_name}"
66
+ raise InstallHookError, message
67
+ end
40
68
  end
41
69
  end
42
70
  end
@@ -134,13 +134,14 @@ module Bundler
134
134
 
135
135
  installed_spec = nil
136
136
  Bundler.rubygems.preserve_paths do
137
- installed_spec = Bundler::RubyGemsGemInstaller.new(
137
+ installed_spec = Bundler::RubyGemsGemInstaller.at(
138
138
  path,
139
139
  :install_dir => install_path.to_s,
140
140
  :bin_dir => bin_path.to_s,
141
141
  :ignore_dependencies => true,
142
142
  :wrappers => true,
143
- :env_shebang => true
143
+ :env_shebang => true,
144
+ :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum
144
145
  ).install
145
146
  end
146
147
  spec.full_gem_path = installed_spec.full_gem_path