bundler 2.0.0.pre.1 → 2.1.0.pre.3

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.

Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +774 -574
  3. data/LICENSE.md +18 -19
  4. data/README.md +9 -8
  5. data/bundler.gemspec +12 -23
  6. data/exe/bundle +19 -3
  7. data/lib/bundler.rb +203 -87
  8. data/lib/bundler/build_metadata.rb +14 -7
  9. data/lib/bundler/capistrano.rb +5 -5
  10. data/lib/bundler/cli.rb +181 -143
  11. data/lib/bundler/cli/add.rb +28 -16
  12. data/lib/bundler/cli/cache.rb +25 -13
  13. data/lib/bundler/cli/common.rb +11 -12
  14. data/lib/bundler/cli/config.rb +161 -86
  15. data/lib/bundler/cli/console.rb +2 -2
  16. data/lib/bundler/cli/doctor.rb +4 -4
  17. data/lib/bundler/cli/exec.rb +4 -16
  18. data/lib/bundler/cli/gem.rb +5 -5
  19. data/lib/bundler/cli/info.rb +17 -5
  20. data/lib/bundler/cli/init.rb +1 -1
  21. data/lib/bundler/cli/install.rb +12 -11
  22. data/lib/bundler/cli/issue.rb +3 -3
  23. data/lib/bundler/cli/open.rb +10 -6
  24. data/lib/bundler/cli/outdated.rb +85 -81
  25. data/lib/bundler/cli/plugin.rb +9 -2
  26. data/lib/bundler/cli/pristine.rb +1 -1
  27. data/lib/bundler/cli/show.rb +1 -1
  28. data/lib/bundler/cli/update.rb +32 -12
  29. data/lib/bundler/compact_index_client.rb +25 -9
  30. data/lib/bundler/compact_index_client/updater.rb +2 -6
  31. data/lib/bundler/current_ruby.rb +9 -7
  32. data/lib/bundler/definition.rb +36 -27
  33. data/lib/bundler/dependency.rb +16 -4
  34. data/lib/bundler/deployment.rb +2 -2
  35. data/lib/bundler/dsl.rb +18 -42
  36. data/lib/bundler/env.rb +8 -13
  37. data/lib/bundler/environment_preserver.rb +0 -1
  38. data/lib/bundler/feature_flag.rb +1 -11
  39. data/lib/bundler/fetcher.rb +14 -11
  40. data/lib/bundler/fetcher/compact_index.rb +26 -12
  41. data/lib/bundler/fetcher/dependency.rb +1 -1
  42. data/lib/bundler/fetcher/downloader.rb +4 -1
  43. data/lib/bundler/fetcher/index.rb +4 -2
  44. data/lib/bundler/friendly_errors.rb +5 -6
  45. data/lib/bundler/gem_helper.rb +38 -25
  46. data/lib/bundler/gem_helpers.rb +2 -4
  47. data/lib/bundler/gem_tasks.rb +1 -1
  48. data/lib/bundler/gem_version_promoter.rb +3 -3
  49. data/lib/bundler/graph.rb +2 -2
  50. data/lib/bundler/injector.rb +10 -8
  51. data/lib/bundler/inline.rb +25 -20
  52. data/lib/bundler/installer.rb +7 -14
  53. data/lib/bundler/installer/gem_installer.rb +5 -1
  54. data/lib/bundler/installer/parallel_installer.rb +4 -8
  55. data/lib/bundler/installer/standalone.rb +1 -2
  56. data/lib/bundler/lazy_specification.rb +2 -2
  57. data/lib/bundler/lockfile_parser.rb +14 -21
  58. data/lib/bundler/match_platform.rb +1 -1
  59. data/lib/bundler/plugin.rb +42 -29
  60. data/lib/bundler/plugin/api.rb +1 -1
  61. data/lib/bundler/plugin/api/source.rb +2 -2
  62. data/lib/bundler/plugin/index.rb +14 -3
  63. data/lib/bundler/plugin/installer.rb +28 -15
  64. data/lib/bundler/psyched_yaml.rb +1 -1
  65. data/lib/bundler/resolver.rb +72 -24
  66. data/lib/bundler/resolver/spec_group.rb +3 -2
  67. data/lib/bundler/retry.rb +2 -2
  68. data/lib/bundler/ruby_version.rb +4 -19
  69. data/lib/bundler/rubygems_ext.rb +11 -67
  70. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  71. data/lib/bundler/rubygems_integration.rb +143 -395
  72. data/lib/bundler/runtime.rb +2 -9
  73. data/lib/bundler/settings.rb +15 -48
  74. data/lib/bundler/setup.rb +7 -13
  75. data/lib/bundler/shared_helpers.rb +57 -73
  76. data/lib/bundler/similarity_detector.rb +2 -2
  77. data/lib/bundler/source.rb +5 -5
  78. data/lib/bundler/source/git.rb +19 -12
  79. data/lib/bundler/source/git/git_proxy.rb +36 -40
  80. data/lib/bundler/source/metadata.rb +9 -5
  81. data/lib/bundler/source/path.rb +13 -8
  82. data/lib/bundler/source/rubygems.rb +11 -5
  83. data/lib/bundler/source/rubygems/remote.rb +1 -2
  84. data/lib/bundler/source_list.rb +9 -12
  85. data/lib/bundler/spec_set.rb +23 -12
  86. data/lib/bundler/stub_specification.rb +18 -30
  87. data/lib/bundler/templates/Executable.bundler +23 -14
  88. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
  89. data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
  90. data/lib/bundler/templates/newgem/README.md.tt +4 -3
  91. data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -27
  92. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +1 -1
  93. data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
  94. data/lib/bundler/ui.rb +3 -3
  95. data/lib/bundler/ui/rg_proxy.rb +1 -1
  96. data/lib/bundler/ui/shell.rb +4 -8
  97. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
  98. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
  99. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
  100. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  101. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
  102. data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
  103. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
  104. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  105. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  106. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  107. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  108. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  109. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
  110. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  111. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  112. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
  113. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  114. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
  115. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
  116. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +248 -279
  117. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  118. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  119. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  120. data/lib/bundler/vendor/thor/lib/thor.rb +12 -4
  121. data/lib/bundler/vendor/thor/lib/thor/actions.rb +22 -11
  122. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  123. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
  124. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  125. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +16 -7
  126. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
  127. data/lib/bundler/vendor/thor/lib/thor/base.rb +25 -24
  128. data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  129. data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
  130. data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  131. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  132. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  133. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  134. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  135. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  136. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  137. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +8 -6
  138. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +20 -5
  139. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  140. data/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -6
  141. data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
  142. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +52 -7
  143. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -2
  144. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  145. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  146. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  147. data/lib/bundler/vendored_fileutils.rb +1 -6
  148. data/lib/bundler/vendored_molinillo.rb +1 -1
  149. data/lib/bundler/vendored_persistent.rb +7 -5
  150. data/lib/bundler/vendored_thor.rb +2 -2
  151. data/lib/bundler/version.rb +1 -20
  152. data/lib/bundler/version_ranges.rb +51 -5
  153. data/lib/bundler/vlad.rb +3 -3
  154. data/lib/bundler/worker.rb +1 -3
  155. data/lib/bundler/yaml_serializer.rb +2 -3
  156. data/man/bundle-add.1 +10 -2
  157. data/man/bundle-add.1.txt +11 -5
  158. data/man/bundle-add.ronn +7 -1
  159. data/man/bundle-binstubs.1 +2 -2
  160. data/man/bundle-binstubs.1.txt +2 -2
  161. data/man/bundle-binstubs.ronn +1 -1
  162. data/man/bundle-cache.1 +55 -0
  163. data/man/bundle-cache.1.txt +78 -0
  164. data/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
  165. data/man/bundle-check.1 +1 -1
  166. data/man/bundle-check.1.txt +6 -6
  167. data/man/bundle-clean.1 +1 -1
  168. data/man/bundle-clean.1.txt +1 -1
  169. data/man/bundle-config.1 +36 -36
  170. data/man/bundle-config.1.txt +66 -67
  171. data/man/bundle-config.ronn +42 -40
  172. data/man/bundle-doctor.1 +1 -1
  173. data/man/bundle-doctor.1.txt +1 -1
  174. data/man/bundle-exec.1 +2 -2
  175. data/man/bundle-exec.1.txt +2 -2
  176. data/man/bundle-exec.ronn +1 -1
  177. data/man/bundle-gem.1 +1 -1
  178. data/man/bundle-gem.1.txt +3 -3
  179. data/man/bundle-info.1 +1 -1
  180. data/man/bundle-info.1.txt +1 -1
  181. data/man/bundle-init.1 +2 -2
  182. data/man/bundle-init.1.txt +2 -2
  183. data/man/bundle-init.ronn +1 -1
  184. data/man/bundle-inject.1 +1 -1
  185. data/man/bundle-inject.1.txt +1 -1
  186. data/man/bundle-install.1 +8 -5
  187. data/man/bundle-install.1.txt +56 -51
  188. data/man/bundle-install.ronn +9 -4
  189. data/man/bundle-list.1 +1 -1
  190. data/man/bundle-list.1.txt +1 -1
  191. data/man/bundle-lock.1 +1 -1
  192. data/man/bundle-lock.1.txt +16 -16
  193. data/man/bundle-open.1 +1 -1
  194. data/man/bundle-open.1.txt +1 -1
  195. data/man/bundle-outdated.1 +1 -1
  196. data/man/bundle-outdated.1.txt +1 -1
  197. data/man/bundle-platform.1 +1 -1
  198. data/man/bundle-platform.1.txt +1 -1
  199. data/man/bundle-pristine.1 +1 -1
  200. data/man/bundle-pristine.1.txt +1 -1
  201. data/man/bundle-remove.1 +1 -1
  202. data/man/bundle-remove.1.txt +1 -1
  203. data/man/bundle-show.1 +1 -1
  204. data/man/bundle-show.1.txt +1 -1
  205. data/man/bundle-update.1 +4 -4
  206. data/man/bundle-update.1.txt +64 -65
  207. data/man/bundle-update.ronn +3 -3
  208. data/man/bundle-viz.1 +1 -1
  209. data/man/bundle-viz.1.txt +1 -1
  210. data/man/bundle.1 +7 -3
  211. data/man/bundle.1.txt +11 -8
  212. data/man/bundle.ronn +5 -2
  213. data/man/gemfile.5 +17 -20
  214. data/man/gemfile.5.ronn +14 -18
  215. data/man/gemfile.5.txt +108 -112
  216. data/man/index.txt +1 -1
  217. metadata +19 -107
  218. data/exe/bundle_ruby +0 -60
  219. data/lib/bundler/cli/package.rb +0 -49
  220. data/lib/bundler/compatibility_guard.rb +0 -14
  221. data/lib/bundler/ssl_certs/.document +0 -1
  222. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  223. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  224. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  225. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  226. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  227. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  228. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  229. data/man/bundle-package.1 +0 -55
  230. data/man/bundle-package.1.txt +0 -79
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/vendored_thor" unless defined?(Thor)
4
- require "bundler"
3
+ require_relative "../bundler"
4
+ require "shellwords"
5
5
 
6
6
  module Bundler
7
7
  class GemHelper
@@ -25,7 +25,6 @@ module Bundler
25
25
  attr_reader :spec_path, :base, :gemspec
26
26
 
27
27
  def initialize(base = nil, name = nil)
28
- Bundler.ui = UI::Shell.new
29
28
  @base = (base ||= SharedHelpers.pwd)
30
29
  gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
31
30
  raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
@@ -74,7 +73,8 @@ module Bundler
74
73
 
75
74
  def build_gem
76
75
  file_name = nil
77
- sh("gem build -V '#{spec_path}'") do
76
+ gem = ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
77
+ sh("#{gem} build -V #{spec_path}".shellsplit) do
78
78
  file_name = File.basename(built_gem_path)
79
79
  SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
80
80
  FileUtils.mv(built_gem_path, "pkg")
@@ -85,21 +85,26 @@ module Bundler
85
85
 
86
86
  def install_gem(built_gem_path = nil, local = false)
87
87
  built_gem_path ||= build_gem
88
- out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}")
89
- raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
88
+ gem = ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
89
+ cmd = "#{gem} install #{built_gem_path}"
90
+ cmd += " --local" if local
91
+ out, status = sh_with_status(cmd.shellsplit)
92
+ unless status.success? && out[/Successfully installed/]
93
+ raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
94
+ end
90
95
  Bundler.ui.confirm "#{name} (#{version}) installed."
91
96
  end
92
97
 
93
98
  protected
94
99
 
95
100
  def rubygem_push(path)
96
- gem_command = "gem push '#{path}'"
97
- gem_command += " --key #{gem_key}" if gem_key
98
- gem_command += " --host #{allowed_push_host}" if allowed_push_host
101
+ gem_command = %W[gem push #{path}]
102
+ gem_command << "--key" << gem_key if gem_key
103
+ gem_command << "--host" << allowed_push_host if allowed_push_host
99
104
  unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
100
105
  raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
101
106
  end
102
- sh(gem_command)
107
+ sh_with_input(gem_command)
103
108
  Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
104
109
  end
105
110
 
@@ -127,12 +132,14 @@ module Bundler
127
132
 
128
133
  def perform_git_push(options = "")
129
134
  cmd = "git push #{options}"
130
- out, code = sh_with_code(cmd)
131
- raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0
135
+ out, status = sh_with_status(cmd)
136
+ return if status.success?
137
+ cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
138
+ raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
132
139
  end
133
140
 
134
141
  def already_tagged?
135
- return false unless sh("git tag").split(/\n/).include?(version_tag)
142
+ return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
136
143
  Bundler.ui.confirm "Tag #{version_tag} has already been created."
137
144
  true
138
145
  end
@@ -142,20 +149,20 @@ module Bundler
142
149
  end
143
150
 
144
151
  def clean?
145
- sh_with_code("git diff --exit-code")[1] == 0
152
+ sh_with_status(%w[git diff --exit-code])[1].success?
146
153
  end
147
154
 
148
155
  def committed?
149
- sh_with_code("git diff-index --quiet --cached HEAD")[1] == 0
156
+ sh_with_status(%w[git diff-index --quiet --cached HEAD])[1].success?
150
157
  end
151
158
 
152
159
  def tag_version
153
- sh "git tag -m \"Version #{version}\" #{version_tag}"
160
+ sh %W[git tag -m Version\ #{version} #{version_tag}]
154
161
  Bundler.ui.confirm "Tagged #{version_tag}."
155
162
  yield if block_given?
156
163
  rescue RuntimeError
157
164
  Bundler.ui.error "Untagging #{version_tag} due to error."
158
- sh_with_code "git tag -d #{version_tag}"
165
+ sh_with_status %W[git tag -d #{version_tag}]
159
166
  raise
160
167
  end
161
168
 
@@ -171,22 +178,28 @@ module Bundler
171
178
  gemspec.name
172
179
  end
173
180
 
181
+ def sh_with_input(cmd)
182
+ Bundler.ui.debug(cmd)
183
+ SharedHelpers.chdir(base) do
184
+ abort unless Kernel.system(*cmd)
185
+ end
186
+ end
187
+
174
188
  def sh(cmd, &block)
175
- out, code = sh_with_code(cmd, &block)
176
- unless code.zero?
189
+ out, status = sh_with_status(cmd, &block)
190
+ unless status.success?
191
+ cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
177
192
  raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
178
193
  end
179
194
  out
180
195
  end
181
196
 
182
- def sh_with_code(cmd, &block)
183
- cmd += " 2>&1"
184
- outbuf = String.new
197
+ def sh_with_status(cmd, &block)
185
198
  Bundler.ui.debug(cmd)
186
199
  SharedHelpers.chdir(base) do
187
- outbuf = `#{cmd}`
188
- status = $?.exitstatus
189
- block.call(outbuf) if status.zero? && block
200
+ outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
201
+ status = $?
202
+ block.call(outbuf) if status.success? && block
190
203
  [outbuf, status]
191
204
  end
192
205
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Bundler
4
4
  module GemHelpers
5
- GENERIC_CACHE = {} # rubocop:disable MutableConstant
5
+ GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
6
6
  GENERICS = [
7
7
  [Gem::Platform.new("java"), Gem::Platform.new("java")],
8
8
  [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
@@ -10,12 +10,10 @@ module Bundler
10
10
  [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
11
11
  [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
12
12
  [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
13
- [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")]
13
+ [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")],
14
14
  ].freeze
15
15
 
16
16
  def generic(p)
17
- return p if p == Gem::Platform::RUBY
18
-
19
17
  GENERIC_CACHE[p] ||= begin
20
18
  _, found = GENERICS.find do |match, _generic|
21
19
  p.os == match.os && (!match.cpu || p.cpu == match.cpu)
@@ -3,5 +3,5 @@
3
3
  require "rake/clean"
4
4
  CLOBBER.include "pkg"
5
5
 
6
- require "bundler/gem_helper"
6
+ require_relative "gem_helper"
7
7
  Bundler::GemHelper.install_tasks
@@ -81,8 +81,8 @@ module Bundler
81
81
  sort_dep_specs(spec_groups, locked_spec)
82
82
  end.tap do |specs|
83
83
  if DEBUG
84
- STDERR.puts before_result
85
- STDERR.puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
84
+ warn before_result
85
+ warn " after sort_versions: #{debug_format_result(dep, specs).inspect}"
86
86
  end
87
87
  end
88
88
  end
@@ -109,7 +109,7 @@ module Bundler
109
109
  must_match = minor? ? [0] : [0, 1]
110
110
 
111
111
  matches = must_match.map {|idx| gsv.segments[idx] == lsv.segments[idx] }
112
- (matches.uniq == [true]) ? (gsv >= lsv) : false
112
+ matches.uniq == [true] ? (gsv >= lsv) : false
113
113
  else
114
114
  true
115
115
  end
@@ -117,7 +117,7 @@ module Bundler
117
117
  :style => "filled",
118
118
  :fillcolor => "#B9B9D5",
119
119
  :shape => "box3d",
120
- :fontsize => 16
120
+ :fontsize => 16,
121
121
  }.merge(@node_options[group])
122
122
  )
123
123
  end
@@ -142,7 +142,7 @@ module Bundler
142
142
  g.output @output_format.to_sym => "#{@output_file}.#{@output_format}"
143
143
  Bundler.ui.info "#{@output_file}.#{@output_format}"
144
144
  rescue ArgumentError => e
145
- $stderr.puts "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb"
145
+ warn "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb"
146
146
  raise e
147
147
  end
148
148
  end
@@ -111,8 +111,10 @@ module Bundler
111
111
  end
112
112
 
113
113
  source = ", :source => \"#{d.source}\"" unless d.source.nil?
114
+ git = ", :git => \"#{d.git}\"" unless d.git.nil?
115
+ branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
114
116
 
115
- %(gem #{name}#{requirement}#{group}#{source})
117
+ %(gem #{name}#{requirement}#{group}#{source}#{git}#{branch})
116
118
  end.join("\n")
117
119
  end
118
120
 
@@ -123,7 +125,7 @@ module Bundler
123
125
  end
124
126
  end
125
127
 
126
- # evalutes a gemfile to remove the specified gem
128
+ # evaluates a gemfile to remove the specified gem
127
129
  # from it.
128
130
  def remove_deps(gemfile_path)
129
131
  initial_gemfile = IO.readlines(gemfile_path)
@@ -136,8 +138,8 @@ module Bundler
136
138
 
137
139
  removed_deps = remove_gems_from_dependencies(builder, @deps, gemfile_path)
138
140
 
139
- # abort the opertion if no gems were removed
140
- # no need to operate on gemfile furthur
141
+ # abort the operation if no gems were removed
142
+ # no need to operate on gemfile further
141
143
  return [] if removed_deps.empty?
142
144
 
143
145
  cleaned_gemfile = remove_gems_from_gemfile(@deps, gemfile_path)
@@ -153,8 +155,8 @@ module Bundler
153
155
 
154
156
  # @param [Dsl] builder Dsl object of current Gemfile.
155
157
  # @param [Array] gems Array of names of gems to be removed.
156
- # @param [Pathname] path of the Gemfile
157
- # @return [Array] removed_deps Array of removed dependencies.
158
+ # @param [Pathname] gemfile_path Path of the Gemfile.
159
+ # @return [Array] Array of removed dependencies.
158
160
  def remove_gems_from_dependencies(builder, gems, gemfile_path)
159
161
  removed_deps = []
160
162
 
@@ -206,7 +208,7 @@ module Bundler
206
208
  nested_blocks -= 1
207
209
 
208
210
  gemfile.each_with_index do |line, index|
209
- next unless !line.nil? && line.include?(block_name)
211
+ next unless !line.nil? && line.strip.start_with?(block_name)
210
212
  if gemfile[index + 1] =~ /^\s*end\s*$/
211
213
  gemfile[index] = nil
212
214
  gemfile[index + 1] = nil
@@ -222,7 +224,7 @@ module Bundler
222
224
  # @param [Array] removed_deps Array of removed dependencies.
223
225
  # @param [Array] initial_gemfile Contents of original Gemfile before any operation.
224
226
  def cross_check_for_errors(gemfile_path, original_deps, removed_deps, initial_gemfile)
225
- # evalute the new gemfile to look for any failure cases
227
+ # evaluate the new gemfile to look for any failure cases
226
228
  builder = Dsl.new
227
229
  builder.eval_gemfile(gemfile_path)
228
230
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/compatibility_guard"
4
-
5
3
  # Allows for declaring a Gemfile inline in a ruby script, optionally installing
6
4
  # any gems that aren't already installed on the user's system.
7
5
  #
@@ -32,13 +30,16 @@ require "bundler/compatibility_guard"
32
30
  # puts Pod::VERSION # => "0.34.4"
33
31
  #
34
32
  def gemfile(install = false, options = {}, &gemfile)
35
- require "bundler"
33
+ require_relative "../bundler"
36
34
 
37
35
  opts = options.dup
38
36
  ui = opts.delete(:ui) { Bundler::UI::Shell.new }
37
+ ui.level = "silent" if opts.delete(:quiet)
39
38
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
40
39
 
41
40
  old_root = Bundler.method(:root)
41
+ bundler_module = class << Bundler; self; end
42
+ bundler_module.send(:remove_method, :root)
42
43
  def Bundler.root
43
44
  Bundler::SharedHelpers.pwd.expand_path
44
45
  end
@@ -48,27 +49,31 @@ def gemfile(install = false, options = {}, &gemfile)
48
49
  builder = Bundler::Dsl.new
49
50
  builder.instance_eval(&gemfile)
50
51
 
51
- definition = builder.to_definition(nil, true)
52
- def definition.lock(*); end
53
- definition.validate_runtime!
52
+ Bundler.settings.temporary(:frozen => false) do
53
+ definition = builder.to_definition(nil, true)
54
+ def definition.lock(*); end
55
+ definition.validate_runtime!
54
56
 
55
- missing_specs = proc do
56
- definition.missing_specs?
57
- end
57
+ missing_specs = proc do
58
+ definition.missing_specs?
59
+ end
58
60
 
59
- Bundler.ui = ui if install
60
- if install || missing_specs.call
61
- Bundler.settings.temporary(:inline => true) do
62
- installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
63
- installer.post_install_messages.each do |name, message|
64
- Bundler.ui.info "Post-install message from #{name}:\n#{message}"
61
+ Bundler.ui = install ? ui : Bundler::UI::Silent.new
62
+ if install || missing_specs.call
63
+ Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do
64
+ installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
65
+ installer.post_install_messages.each do |name, message|
66
+ Bundler.ui.info "Post-install message from #{name}:\n#{message}"
67
+ end
65
68
  end
66
69
  end
67
- end
68
70
 
69
- runtime = Bundler::Runtime.new(nil, definition)
70
- runtime.setup.require
71
+ runtime = Bundler::Runtime.new(nil, definition)
72
+ runtime.setup.require
73
+ end
71
74
  ensure
72
- bundler_module = class << Bundler; self; end
73
- bundler_module.send(:define_method, :root, old_root) if old_root
75
+ if bundler_module
76
+ bundler_module.send(:remove_method, :root)
77
+ bundler_module.send(:define_method, :root, old_root)
78
+ end
74
79
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  require "erb"
4
4
  require "rubygems/dependency_installer"
5
- require "bundler/worker"
6
- require "bundler/installer/parallel_installer"
7
- require "bundler/installer/standalone"
8
- require "bundler/installer/gem_installer"
5
+ require_relative "worker"
6
+ require_relative "installer/parallel_installer"
7
+ require_relative "installer/standalone"
8
+ require_relative "installer/gem_installer"
9
9
 
10
10
  module Bundler
11
11
  class Installer
@@ -221,7 +221,7 @@ module Bundler
221
221
  def processor_count
222
222
  require "etc"
223
223
  Etc.nprocessors
224
- rescue
224
+ rescue StandardError
225
225
  1
226
226
  end
227
227
 
@@ -275,14 +275,7 @@ module Bundler
275
275
  end
276
276
 
277
277
  def can_install_in_parallel?
278
- if Bundler.rubygems.provides?(">= 2.1.0")
279
- true
280
- else
281
- Bundler.ui.warn "RubyGems #{Gem::VERSION} is not threadsafe, so your "\
282
- "gems will be installed one at a time. Upgrade to RubyGems 2.1.0 " \
283
- "or higher to enable parallel gem installation."
284
- false
285
- end
278
+ true
286
279
  end
287
280
 
288
281
  def install_in_parallel(size, standalone, force = false)
@@ -303,7 +296,7 @@ module Bundler
303
296
 
304
297
  # returns whether or not a re-resolve was needed
305
298
  def resolve_if_needed(options)
306
- if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
299
+ if !@definition.unlocking? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
307
300
  return false if @definition.nothing_changed? && !@definition.missing_specs?
308
301
  end
309
302
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "shellwords"
4
+
3
5
  module Bundler
4
6
  class GemInstaller
5
7
  attr_reader :spec, :standalone, :worker, :force, :installer
@@ -56,7 +58,9 @@ module Bundler
56
58
 
57
59
  def spec_settings
58
60
  # Fetch the build settings, if there are any
59
- Bundler.settings["build.#{spec.name}"]
61
+ if settings = Bundler.settings["build.#{spec.name}"]
62
+ Shellwords.shellsplit(settings)
63
+ end
60
64
  end
61
65
 
62
66
  def install
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/worker"
4
- require "bundler/installer/gem_installer"
3
+ require_relative "../worker"
4
+ require_relative "gem_installer"
5
5
 
6
6
  module Bundler
7
7
  class ParallelInstaller
@@ -91,10 +91,6 @@ module Bundler
91
91
  end
92
92
 
93
93
  def call
94
- # Since `autoload` has the potential for threading issues on 1.8.7
95
- # TODO: remove in bundler 2.0
96
- require "bundler/gem_remote_fetcher" if RUBY_VERSION < "1.9"
97
-
98
94
  check_for_corrupt_lockfile
99
95
 
100
96
  if @size > 1
@@ -115,7 +111,7 @@ module Bundler
115
111
  s,
116
112
  s.missing_lockfile_dependencies(@specs.map(&:name)),
117
113
  ]
118
- end.reject { |a| a.last.empty? }
114
+ end.reject {|a| a.last.empty? }
119
115
  return if missing_dependencies.empty?
120
116
 
121
117
  warning = []
@@ -150,7 +146,7 @@ module Bundler
150
146
  end
151
147
 
152
148
  def worker_pool
153
- @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
149
+ @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda {|spec_install, worker_num|
154
150
  do_install(spec_install, worker_num)
155
151
  }
156
152
  end
@@ -12,8 +12,7 @@ module Bundler
12
12
  end
13
13
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
14
14
  file.puts "require 'rbconfig'"
15
- file.puts "# ruby 1.8.7 doesn't define RUBY_ENGINE"
16
- file.puts "ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'"
15
+ file.puts "ruby_engine = RUBY_ENGINE"
17
16
  file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
18
17
  file.puts "path = File.expand_path('..', __FILE__)"
19
18
  paths.each do |path|