bundler 2.0.1 → 2.0.2

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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/bundler.gemspec +6 -5
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/cli.rb +3 -1
  7. data/lib/bundler/cli/common.rb +1 -1
  8. data/lib/bundler/cli/install.rb +9 -8
  9. data/lib/bundler/cli/issue.rb +2 -2
  10. data/lib/bundler/compatibility_guard.rb +0 -1
  11. data/lib/bundler/definition.rb +3 -1
  12. data/lib/bundler/dsl.rb +1 -1
  13. data/lib/bundler/env.rb +2 -8
  14. data/lib/bundler/feature_flag.rb +1 -1
  15. data/lib/bundler/fetcher/downloader.rb +1 -1
  16. data/lib/bundler/gem_helper.rb +37 -22
  17. data/lib/bundler/injector.rb +7 -7
  18. data/lib/bundler/installer/parallel_installer.rb +0 -4
  19. data/lib/bundler/plugin.rb +13 -11
  20. data/lib/bundler/plugin/index.rb +4 -1
  21. data/lib/bundler/rubygems_ext.rb +0 -1
  22. data/lib/bundler/rubygems_integration.rb +19 -2
  23. data/lib/bundler/shared_helpers.rb +7 -5
  24. data/lib/bundler/templates/Executable.bundler +1 -1
  25. data/lib/bundler/templates/newgem/newgem.gemspec.tt +7 -12
  26. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
  27. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +151 -48
  28. data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
  29. data/lib/bundler/vendor/thor/lib/thor/actions.rb +14 -4
  30. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +11 -2
  31. data/lib/bundler/vendor/thor/lib/thor/base.rb +3 -4
  32. data/lib/bundler/vendor/thor/lib/thor/error.rb +82 -0
  33. data/lib/bundler/vendor/thor/lib/thor/group.rb +2 -2
  34. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +7 -2
  35. data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
  36. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  37. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +52 -7
  38. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  39. data/lib/bundler/version.rb +1 -1
  40. data/man/bundle-add.1 +1 -1
  41. data/man/bundle-add.1.txt +1 -1
  42. data/man/bundle-binstubs.1 +1 -1
  43. data/man/bundle-binstubs.1.txt +1 -1
  44. data/man/bundle-check.1 +1 -1
  45. data/man/bundle-check.1.txt +1 -1
  46. data/man/bundle-clean.1 +1 -1
  47. data/man/bundle-clean.1.txt +1 -1
  48. data/man/bundle-config.1 +2 -2
  49. data/man/bundle-config.1.txt +3 -3
  50. data/man/bundle-config.ronn +1 -1
  51. data/man/bundle-doctor.1 +1 -1
  52. data/man/bundle-doctor.1.txt +1 -1
  53. data/man/bundle-exec.1 +1 -1
  54. data/man/bundle-exec.1.txt +1 -1
  55. data/man/bundle-gem.1 +1 -1
  56. data/man/bundle-gem.1.txt +1 -1
  57. data/man/bundle-info.1 +1 -1
  58. data/man/bundle-info.1.txt +1 -1
  59. data/man/bundle-init.1 +2 -2
  60. data/man/bundle-init.1.txt +2 -2
  61. data/man/bundle-init.ronn +1 -1
  62. data/man/bundle-inject.1 +1 -1
  63. data/man/bundle-inject.1.txt +1 -1
  64. data/man/bundle-install.1 +1 -1
  65. data/man/bundle-install.1.txt +1 -1
  66. data/man/bundle-list.1 +1 -1
  67. data/man/bundle-list.1.txt +1 -1
  68. data/man/bundle-lock.1 +1 -1
  69. data/man/bundle-lock.1.txt +1 -1
  70. data/man/bundle-open.1 +1 -1
  71. data/man/bundle-open.1.txt +1 -1
  72. data/man/bundle-outdated.1 +1 -1
  73. data/man/bundle-outdated.1.txt +1 -1
  74. data/man/bundle-package.1 +1 -1
  75. data/man/bundle-package.1.txt +1 -1
  76. data/man/bundle-platform.1 +1 -1
  77. data/man/bundle-platform.1.txt +1 -1
  78. data/man/bundle-pristine.1 +1 -1
  79. data/man/bundle-pristine.1.txt +1 -1
  80. data/man/bundle-remove.1 +1 -1
  81. data/man/bundle-remove.1.txt +1 -1
  82. data/man/bundle-show.1 +1 -1
  83. data/man/bundle-show.1.txt +1 -1
  84. data/man/bundle-update.1 +1 -1
  85. data/man/bundle-update.1.txt +1 -1
  86. data/man/bundle-viz.1 +1 -1
  87. data/man/bundle-viz.1.txt +1 -1
  88. data/man/bundle.1 +2 -2
  89. data/man/bundle.1.txt +2 -2
  90. data/man/bundle.ronn +1 -1
  91. data/man/gemfile.5 +2 -2
  92. data/man/gemfile.5.ronn +1 -1
  93. data/man/gemfile.5.txt +2 -2
  94. metadata +23 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2678b129ab26db6bebb8b45f2ac39404734c51a03d17983e84b59b0662d23ab1
4
- data.tar.gz: c02c61762dec2f6a2c4635a1b98f577bee778deef4bfd02f121d5e99b54b304f
3
+ metadata.gz: ba9f01c9d4d5c45ebdad1d3d271fae57c3e0b2969d56b1b4bf2d03580e3acd6f
4
+ data.tar.gz: b25dafd15d9cb0f49aa1aee5f0b9e86c9ba1a35d8177432d747a17669b8cdb8e
5
5
  SHA512:
6
- metadata.gz: c70c0b22d6813cec201b5ac0baf5df9d483654904e563a1497a8cf76bd85d681c35dfcd2ab88f76d1c6950270c0a4d43f8cd78453cdae1b076efcba670c7fdce
7
- data.tar.gz: f1a5be6de3b2f6588a4d8ed767215e6aaa2dfdd8397b5b8971ab4baf9883b8dca89d78d0fa7edbfcff5a9b5710850c5928b6af6cc3d791ccfc8f1d3d442eafb7
6
+ metadata.gz: 933f1a8367648b2d60a29f09649c108548e837c32778e337bc6490619d81e09920110802cad428c82c51418e8632fdc39415602f41104d6775509dd16a217654
7
+ data.tar.gz: 07a08bb7fb1d8d20793b4fa7c7088c73a0afecb3832d8194ed9fbc14a6e2dee07f9a519e28e1450cd191d913d3da3942aa60be9fe2bb1592d6e2e7f0c9d62678
@@ -1,3 +1,29 @@
1
+ ## 2.0.2 (2019-05-13)
2
+
3
+ Changes:
4
+
5
+ - Fixes for Bundler integration with ruby-src ([#6941](https://github.com/bundler/bundler/pull/6941), [#6973](https://github.com/bundler/bundler/pull/6973), [#6977](https://github.com/bundler/bundler/pull/6977), [#6315](https://github.com/bundler/bundler/pull/6315), [#7061](https://github.com/bundler/bundler/pull/7061))
6
+ - Use `__dir__` instead of `__FILE__` when generating a gem with `bundle gem` ([#6503](https://github.com/bundler/bundler/pull/6503))
7
+ - Use `https` on externals links in the Bundler gemspec ([#6721](https://github.com/bundler/bundler/pull/6721))
8
+ - Removed duplicate gem names from the suggested `did you mean` list for gem typos ([#6739](https://github.com/bundler/bundler/pull/6739))
9
+ - Removed Ruby 1.x compatibility code ([#6764](https://github.com/bundler/bundler/pull/6764), [#6806](https://github.com/bundler/bundler/pull/6806))
10
+ - Fixed an issue where `bundle remove` would crash with certain Gemfiles ([#6768](https://github.com/bundler/bundler/pull/6769))
11
+ - Fixed indentation in the Bundler executable template ([#6773](https://github.com/bundler/bundler/pull/6773))
12
+ - Fixed an issue where plugins could register for the same Bundler hook multiple times ([#6775](https://github.com/bundler/bundler/pull/6775))
13
+ - Changed the "multiple sources" message in `bundle install` to be a warning instead of an error ([#6790](https://github.com/bundler/bundler/pull/6790))
14
+ - Fixed a bug where path gems would break when using `only_update_to_newer_versions` ([#6774](https://github.com/bundler/bundler/pull/6774))
15
+ - Fixed a bug where installing plugins with the `--delpoyment` setting would fail ([#6805](https://github.com/bundler/bundler/pull/6805))
16
+ - Fixed an issue where `bundle update` couldn't update & install a gem when `no_install` was set (a `bundle package` config) ([#7078](https://github.com/bundler/bundler/pull/7078))
17
+ - Fixed an issue where users could not run `bundle exec` on default gems ([#6963](https://github.com/bundler/bundler/pull/6963))
18
+ - Updated vendor libraries to their latest version ([#7076](https://github.com/bundler/bundler/pull/7067), [#7068](https://github.com/bundler/bundler/pull/7068))
19
+ - Fixed an issue where the `github` source was not using `https` by default that we mentioned in the 2.0 release ([#7182](https://github.com/bundler/bundler/pull/7182))
20
+ - Fixed an issue where `rake release` was not outputting the message to users asking for a 2fa token ([#7199](https://github.com/bundler/bundler/pull/7199))
21
+
22
+ Documentation:
23
+
24
+ - Fix incorrect documented `BUNDLE_PATH_RELATIVE_TO_CWD` env var ([#6751](https://github.com/bundler/bundler/pull/6751))
25
+ - Update URLs in Bundler's documentation to use `https` ([#6935](https://github.com/bundler/bundler/pull/6935))
26
+
1
27
  ## 2.0.1 (2019-01-04)
2
28
 
3
29
  Changes:
data/README.md CHANGED
@@ -29,7 +29,7 @@ bundle install
29
29
  bundle exec rspec
30
30
  ```
31
31
 
32
- See [bundler.io](http://bundler.io) for the full documentation.
32
+ See [bundler.io](https://bundler.io) for the full documentation.
33
33
 
34
34
  ### Troubleshooting
35
35
 
@@ -5,7 +5,7 @@ begin
5
5
  require File.expand_path("../lib/bundler/version", __FILE__)
6
6
  rescue LoadError
7
7
  # for Ruby core repository
8
- require File.expand_path("../bundler/version", __FILE__)
8
+ require File.expand_path("../version", __FILE__)
9
9
  end
10
10
 
11
11
  Gem::Specification.new do |s|
@@ -19,16 +19,16 @@ Gem::Specification.new do |s|
19
19
  "Yehuda Katz"
20
20
  ]
21
21
  s.email = ["team@bundler.io"]
22
- s.homepage = "http://bundler.io"
22
+ s.homepage = "https://bundler.io"
23
23
  s.summary = "The best way to manage your application's dependencies"
24
24
  s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
25
25
 
26
26
  if s.respond_to?(:metadata=)
27
27
  s.metadata = {
28
- "bug_tracker_uri" => "http://github.com/bundler/bundler/issues",
28
+ "bug_tracker_uri" => "https://github.com/bundler/bundler/issues",
29
29
  "changelog_uri" => "https://github.com/bundler/bundler/blob/master/CHANGELOG.md",
30
30
  "homepage_uri" => "https://bundler.io/",
31
- "source_code_uri" => "http://github.com/bundler/bundler/",
31
+ "source_code_uri" => "https://github.com/bundler/bundler/",
32
32
  }
33
33
  end
34
34
 
@@ -42,10 +42,11 @@ Gem::Specification.new do |s|
42
42
 
43
43
  s.add_development_dependency "automatiek", "~> 0.1.0"
44
44
  s.add_development_dependency "mustache", "0.99.6"
45
- s.add_development_dependency "rake", "~> 10.0"
45
+ s.add_development_dependency "rake", "~> 12.0"
46
46
  s.add_development_dependency "rdiscount", "~> 2.2"
47
47
  s.add_development_dependency "ronn", "~> 0.7.3"
48
48
  s.add_development_dependency "rspec", "~> 3.6"
49
+ s.add_development_dependency "rubocop", "= 0.50.0"
49
50
 
50
51
  base_dir = File.dirname(__FILE__).gsub(%r{([^A-Za-z0-9_\-.,:\/@\n])}, "\\\\\\1")
51
52
  s.files = IO.popen("git -C #{base_dir} ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2019-01-04".freeze
8
- @git_commit_sha = "d7ad2192f".freeze
7
+ @built_at = "2019-06-13".freeze
8
+ @git_commit_sha = "496bca538".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -277,7 +277,9 @@ module Bundler
277
277
  def update(*gems)
278
278
  SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
279
279
  require "bundler/cli/update"
280
- Update.new(options, gems).run
280
+ Bundler.settings.temporary(:no_install => false) do
281
+ Update.new(options, gems).run
282
+ end
281
283
  end
282
284
 
283
285
  desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
@@ -72,7 +72,7 @@ module Bundler
72
72
  end
73
73
 
74
74
  def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
75
- locked_names = locked_gems.specs.map(&:name)
75
+ locked_names = locked_gems.specs.map(&:name).uniq
76
76
  names.-(locked_names).each do |g|
77
77
  raise GemNotFound, gem_not_found_message(g, locked_names)
78
78
  end
@@ -202,15 +202,16 @@ module Bundler
202
202
  end
203
203
 
204
204
  def warn_ambiguous_gems
205
+ # TODO: remove this when we drop Bundler 1.x support
205
206
  Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
206
- Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
207
- Bundler.ui.error "Installed from: #{installed_from_uri}"
208
- Bundler.ui.error "Also found in:"
209
- also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
210
- Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
211
- Bundler.ui.error "For example:"
212
- Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
213
- Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
207
+ Bundler.ui.warn "Warning: the gem '#{name}' was found in multiple sources."
208
+ Bundler.ui.warn "Installed from: #{installed_from_uri}"
209
+ Bundler.ui.warn "Also found in:"
210
+ also_found_in_uris.each {|uri| Bundler.ui.warn " * #{uri}" }
211
+ Bundler.ui.warn "You should add a source requirement to restrict this gem to your preferred source."
212
+ Bundler.ui.warn "For example:"
213
+ Bundler.ui.warn " gem '#{name}', :source => '#{installed_from_uri}'"
214
+ Bundler.ui.warn "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
214
215
  end
215
216
  end
216
217
  end
@@ -13,10 +13,10 @@ module Bundler
13
13
  https://github.com/bundler/bundler/blob/master/doc/TROUBLESHOOTING.md
14
14
 
15
15
  2. Instructions for common Bundler uses can be found on the documentation
16
- site: http://bundler.io/
16
+ site: https://bundler.io/
17
17
 
18
18
  3. Information about each Bundler command can be found in the Bundler
19
- man pages: http://bundler.io/man/bundle.1.html
19
+ man pages: https://bundler.io/man/bundle.1.html
20
20
 
21
21
  Hopefully the troubleshooting steps above resolved your problem! If things
22
22
  still aren't working the way you expect them to, please let us know so
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- require "rubygems"
4
3
  require "bundler/version"
5
4
 
6
5
  if Bundler::VERSION.split(".").first.to_i >= 2
@@ -977,7 +977,9 @@ module Bundler
977
977
  dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
978
978
  @locked_gems.specs.reduce({}) do |requirements, locked_spec|
979
979
  name = locked_spec.name
980
- next requirements if @locked_gems.dependencies[name] != dependencies_by_name[name]
980
+ dependency = dependencies_by_name[name]
981
+ next requirements if @locked_gems.dependencies[name] != dependency
982
+ next requirements if dependency && dependency.source.is_a?(Source::Path)
981
983
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
982
984
  requirements[name] = DepProxy.new(dep, locked_spec.platform)
983
985
  requirements
@@ -305,7 +305,7 @@ module Bundler
305
305
  # end
306
306
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
307
307
  # TODO: 2.0 upgrade this setting to the default
308
- if Bundler.settings["github.https"]
308
+ if Bundler.feature_flag.github_https?
309
309
  Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed"
310
310
  "https://github.com/#{repo_name}.git"
311
311
  else
@@ -70,14 +70,8 @@ module Bundler
70
70
 
71
71
  def self.ruby_version
72
72
  str = String.new("#{RUBY_VERSION}")
73
- if RUBY_VERSION < "1.9"
74
- str << " (#{RUBY_RELEASE_DATE}"
75
- str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
76
- str << ") [#{RUBY_PLATFORM}]"
77
- else
78
- str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
79
- str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
80
- end
73
+ str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
74
+ str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
81
75
  end
82
76
 
83
77
  def self.git_version
@@ -19,7 +19,7 @@ module Bundler
19
19
  def self.settings_method(name, key, &default)
20
20
  define_method(name) do
21
21
  value = Bundler.settings[key]
22
- value = instance_eval(&default) if value.nil? && !default.nil?
22
+ value = instance_eval(&default) if value.nil?
23
23
  value
24
24
  end
25
25
  end
@@ -37,7 +37,7 @@ module Bundler
37
37
  when Net::HTTPUnauthorized
38
38
  raise AuthenticationRequiredError, uri.host
39
39
  when Net::HTTPNotFound
40
- raise FallbackError, "Net::HTTPNotFound"
40
+ raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
41
41
  else
42
42
  raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
43
43
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "bundler/vendored_thor" unless defined?(Thor)
4
4
  require "bundler"
5
+ require "shellwords"
5
6
 
6
7
  module Bundler
7
8
  class GemHelper
@@ -74,7 +75,8 @@ module Bundler
74
75
 
75
76
  def build_gem
76
77
  file_name = nil
77
- sh("gem build -V '#{spec_path}'") do
78
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
79
+ sh(%W[#{gem} build -V #{spec_path}]) do
78
80
  file_name = File.basename(built_gem_path)
79
81
  SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
80
82
  FileUtils.mv(built_gem_path, "pkg")
@@ -85,21 +87,26 @@ module Bundler
85
87
 
86
88
  def install_gem(built_gem_path = nil, local = false)
87
89
  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/]
90
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
91
+ cmd = %W[#{gem} install #{built_gem_path}]
92
+ cmd << "--local" if local
93
+ out, status = sh_with_status(cmd)
94
+ unless status.success? && out[/Successfully installed/]
95
+ raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
96
+ end
90
97
  Bundler.ui.confirm "#{name} (#{version}) installed."
91
98
  end
92
99
 
93
100
  protected
94
101
 
95
102
  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
103
+ gem_command = %W[gem push #{path}]
104
+ gem_command << "--key" << gem_key if gem_key
105
+ gem_command << "--host" << allowed_push_host if allowed_push_host
99
106
  unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
100
107
  raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
101
108
  end
102
- sh(gem_command)
109
+ sh_with_input(gem_command)
103
110
  Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
104
111
  end
105
112
 
@@ -127,12 +134,14 @@ module Bundler
127
134
 
128
135
  def perform_git_push(options = "")
129
136
  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
137
+ out, status = sh_with_status(cmd)
138
+ return if status.success?
139
+ cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
140
+ raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
132
141
  end
133
142
 
134
143
  def already_tagged?
135
- return false unless sh("git tag").split(/\n/).include?(version_tag)
144
+ return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
136
145
  Bundler.ui.confirm "Tag #{version_tag} has already been created."
137
146
  true
138
147
  end
@@ -142,20 +151,20 @@ module Bundler
142
151
  end
143
152
 
144
153
  def clean?
145
- sh_with_code("git diff --exit-code")[1] == 0
154
+ sh_with_status(%w[git diff --exit-code])[1].success?
146
155
  end
147
156
 
148
157
  def committed?
149
- sh_with_code("git diff-index --quiet --cached HEAD")[1] == 0
158
+ sh_with_status(%w[git diff-index --quiet --cached HEAD])[1].success?
150
159
  end
151
160
 
152
161
  def tag_version
153
- sh "git tag -m \"Version #{version}\" #{version_tag}"
162
+ sh %W[git tag -m Version\ #{version} #{version_tag}]
154
163
  Bundler.ui.confirm "Tagged #{version_tag}."
155
164
  yield if block_given?
156
165
  rescue RuntimeError
157
166
  Bundler.ui.error "Untagging #{version_tag} due to error."
158
- sh_with_code "git tag -d #{version_tag}"
167
+ sh_with_status %W[git tag -d #{version_tag}]
159
168
  raise
160
169
  end
161
170
 
@@ -171,22 +180,28 @@ module Bundler
171
180
  gemspec.name
172
181
  end
173
182
 
183
+ def sh_with_input(cmd)
184
+ Bundler.ui.debug(cmd)
185
+ SharedHelpers.chdir(base) do
186
+ abort unless Kernel.system(*cmd)
187
+ end
188
+ end
189
+
174
190
  def sh(cmd, &block)
175
- out, code = sh_with_code(cmd, &block)
176
- unless code.zero?
191
+ out, status = sh_with_status(cmd, &block)
192
+ unless status.success?
193
+ cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
177
194
  raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
178
195
  end
179
196
  out
180
197
  end
181
198
 
182
- def sh_with_code(cmd, &block)
183
- cmd += " 2>&1"
184
- outbuf = String.new
199
+ def sh_with_status(cmd, &block)
185
200
  Bundler.ui.debug(cmd)
186
201
  SharedHelpers.chdir(base) do
187
- outbuf = `#{cmd}`
188
- status = $?.exitstatus
189
- block.call(outbuf) if status.zero? && block
202
+ outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
203
+ status = $?
204
+ block.call(outbuf) if status.success? && block
190
205
  [outbuf, status]
191
206
  end
192
207
  end
@@ -123,7 +123,7 @@ module Bundler
123
123
  end
124
124
  end
125
125
 
126
- # evalutes a gemfile to remove the specified gem
126
+ # evaluates a gemfile to remove the specified gem
127
127
  # from it.
128
128
  def remove_deps(gemfile_path)
129
129
  initial_gemfile = IO.readlines(gemfile_path)
@@ -136,8 +136,8 @@ module Bundler
136
136
 
137
137
  removed_deps = remove_gems_from_dependencies(builder, @deps, gemfile_path)
138
138
 
139
- # abort the opertion if no gems were removed
140
- # no need to operate on gemfile furthur
139
+ # abort the operation if no gems were removed
140
+ # no need to operate on gemfile further
141
141
  return [] if removed_deps.empty?
142
142
 
143
143
  cleaned_gemfile = remove_gems_from_gemfile(@deps, gemfile_path)
@@ -153,8 +153,8 @@ module Bundler
153
153
 
154
154
  # @param [Dsl] builder Dsl object of current Gemfile.
155
155
  # @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.
156
+ # @param [Pathname] gemfile_path Path of the Gemfile.
157
+ # @return [Array] Array of removed dependencies.
158
158
  def remove_gems_from_dependencies(builder, gems, gemfile_path)
159
159
  removed_deps = []
160
160
 
@@ -206,7 +206,7 @@ module Bundler
206
206
  nested_blocks -= 1
207
207
 
208
208
  gemfile.each_with_index do |line, index|
209
- next unless !line.nil? && line.include?(block_name)
209
+ next unless !line.nil? && line.strip.start_with?(block_name)
210
210
  if gemfile[index + 1] =~ /^\s*end\s*$/
211
211
  gemfile[index] = nil
212
212
  gemfile[index + 1] = nil
@@ -222,7 +222,7 @@ module Bundler
222
222
  # @param [Array] removed_deps Array of removed dependencies.
223
223
  # @param [Array] initial_gemfile Contents of original Gemfile before any operation.
224
224
  def cross_check_for_errors(gemfile_path, original_deps, removed_deps, initial_gemfile)
225
- # evalute the new gemfile to look for any failure cases
225
+ # evaluate the new gemfile to look for any failure cases
226
226
  builder = Dsl.new
227
227
  builder.eval_gemfile(gemfile_path)
228
228
 
@@ -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
@@ -53,20 +53,22 @@ module Bundler
53
53
  # @param [Pathname] gemfile path
54
54
  # @param [Proc] block that can be evaluated for (inline) Gemfile
55
55
  def gemfile_install(gemfile = nil, &inline)
56
- builder = DSL.new
57
- if block_given?
58
- builder.instance_eval(&inline)
59
- else
60
- builder.eval_gemfile(gemfile)
61
- end
62
- definition = builder.to_definition(nil, true)
56
+ Bundler.settings.temporary(:frozen => false, :deployment => false) do
57
+ builder = DSL.new
58
+ if block_given?
59
+ builder.instance_eval(&inline)
60
+ else
61
+ builder.eval_gemfile(gemfile)
62
+ end
63
+ definition = builder.to_definition(nil, true)
63
64
 
64
- return if definition.dependencies.empty?
65
+ return if definition.dependencies.empty?
65
66
 
66
- plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
67
- installed_specs = Installer.new.install_definition(definition)
67
+ plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
68
+ installed_specs = Installer.new.install_definition(definition)
68
69
 
69
- save_plugins plugins, installed_specs, builder.inferred_plugins
70
+ save_plugins plugins, installed_specs, builder.inferred_plugins
71
+ end
70
72
  rescue RuntimeError => e
71
73
  unless e.is_a?(GemfileError)
72
74
  Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"