Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge tag 'v1.5.2' into 'master'

Conflicts:
	CHANGELOG.md
	Rakefile
	lib/bundler/installer.rb
	lib/bundler/rubygems_ext.rb
	lib/bundler/source/rubygems.rb
	spec/realworld/parallel_install_spec.rb
	spec/realworld/parallel_update_spec.rb
  • Loading branch information...
commit ec9165fdffe63f6d5a8b2a9a302252ec1116618c 1 parent 27205e9
@indirect indirect authored
View
55 CHANGELOG.md
@@ -7,6 +7,44 @@ Features:
- highlight updating logs (#2741, @simi)
- display post_install_message's for gems installed via :git (@phallstrom)
+## 1.5.2 (2014-01-10)
+
+Bugfixes:
+
+ - fix integration with Rubygems 1.8.0-1.8.19
+ - handle ENETDOWN exception during network requests
+ - gracefully shut down after interrupt during parallel install (@Who828)
+ - allow Rails to run Thor without debug mode (@rafaelfranca)
+ - set git binstub permissions by umask (@v-yarotsky)
+ - remove parallel install debug log
+
+## 1.5.1 (2013-12-28)
+
+Bugfixes:
+
+ - correctly find gems installed with Ruby by default
+
+## 1.5.0 (2013-12-26)
+
+Features:
+
+ - install missing gems if their specs are present (@hone)
+
+Bugfixes:
+
+ - use print for "Installing…" so messages are thread-safe (@TimMoore)
+
+## 1.5.0.rc.2 (2013-12-18)
+
+"Features":
+
+ - Support threaded installation on Rubygems 2.0.7+
+ - Debug installation logs in .bundle/install.log
+
+"Bugfixes":
+
+ - Try to catch gem installation race conditions
+
## 1.5.0.rc.1 (2013-11-09)
Features:
@@ -78,12 +116,25 @@ Bugfixes:
- allow the same options hash to be passed to multiple gems (#2447)
- handle missing binaries without an exception (#2019, @luismreis)
-## 1.3.6
+## 1.3.6 (8 January 2014)
Bugfixes:
- - set --no-cache when bundle install --local is called (@TimMoore)
- make gemspec path option preserve relative paths in lock file (@bwillis)
+ - use umask when creating binstubs (#1618, @v-yarotsky)
+ - warn if graphviz is not installed (#2435, @Agis-)
+ - show git errors while loading gemspecs
+ - don't mutate gem method options hash (#2447)
+ - print Thor errors (#2478, @pjvds)
+ - print Rubygems system exit errors (James Cook)
+ - more Pathnames into Strings for MacRuby (@kml)
+ - preserve original gemspec path (@bwillis)
+ - remove warning about deps with :git (#1651, @ixti)
+ - split git files on null (#2634, @jasonmp85)
+ - handle cross-host redirects without SSL (#2686, @grddev)
+ - handle Rubygems 2 security exception (@zzak)
+ - reinstall gems if they are missing with spec present
+ - set binstub permissions using umask (#1618, @v-yarotsky)
## 1.3.5 (3 April 2013)
View
2  bundler.gemspec
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'ronn', '~> 0.7.3'
spec.add_development_dependency 'rspec', '~> 2.99.0.beta1'
- spec.files = `git ls-files`.split($/)
+ spec.files = `git ls-files -z`.split("\x0")
spec.files += Dir.glob('lib/bundler/man/**/*') # man/ is ignored by git
spec.test_files = spec.files.grep(%r{^spec/})
View
6 lib/bundler/cli.rb
@@ -20,7 +20,7 @@ def initialize(*)
rescue UnknownArgumentError => e
raise InvalidOption, e.message
ensure
- options ||= {}
+ self.options ||= {}
Bundler.ui = UI::Shell.new(options)
Bundler.ui.level = "debug" if options["verbose"]
end
@@ -231,8 +231,6 @@ def install
opts[:system] = true
end
- opts["no-cache"] ||= opts[:local]
-
Bundler.settings[:path] = nil if opts[:system]
Bundler.settings[:path] = "vendor/bundle" if opts[:deployment]
Bundler.settings[:path] = opts["path"] if opts["path"]
@@ -254,7 +252,7 @@ def install
definition = Bundler.definition
definition.validate_ruby!
Installer.install(Bundler.root, definition, opts)
- Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !opts["no-cache"]
+ Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
if Bundler.settings[:path]
absolute_path = File.expand_path(Bundler.settings[:path])
View
25 lib/bundler/fetcher.rb
@@ -226,7 +226,7 @@ def inspect
private
HTTP_ERRORS = [
- Timeout::Error, EOFError, SocketError,
+ Timeout::Error, EOFError, SocketError, Errno::ENETDOWN,
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
Net::HTTP::Persistent::Error
@@ -235,17 +235,7 @@ def inspect
def fetch(uri, counter = 0)
raise HTTPError, "Too many redirects" if counter >= @redirect_limit
- begin
- Bundler.ui.debug "Fetching from: #{uri}"
- req = Net::HTTP::Get.new uri.request_uri
- req.basic_auth(uri.user, uri.password) if uri.user
- response = connection.request(uri, req)
- rescue OpenSSL::SSL::SSLError
- raise CertificateFailureError.new(uri)
- rescue *HTTP_ERRORS
- raise HTTPError, "Network error while fetching #{uri}"
- end
-
+ response = request(uri)
case response
when Net::HTTPRedirection
Bundler.ui.debug("HTTP Redirection")
@@ -265,6 +255,17 @@ def fetch(uri, counter = 0)
end
end
+ def request(uri)
+ Bundler.ui.debug "Fetching from: #{uri}"
+ req = Net::HTTP::Get.new uri.request_uri
+ req.basic_auth(uri.user, uri.password) if uri.user
+ response = connection.request(uri, req)
+ rescue OpenSSL::SSL::SSLError
+ raise CertificateFailureError.new(uri)
+ rescue *HTTP_ERRORS
+ raise HTTPError, "Network error while fetching #{uri}"
+ end
+
def dependency_api_uri(gem_names = [])
url = "#{@remote_uri}api/v1/dependencies"
url << "?gems=#{URI.encode(gem_names.join(","))}" if gem_names.any?
View
9 lib/bundler/gem_installer.rb
@@ -5,14 +5,5 @@ class GemInstaller < Gem::Installer
def check_executable_overwrite(filename)
# Bundler needs to install gems regardless of binstub overwriting
end
-
- if Bundler.current_ruby.mswin? || Bundler.current_ruby.jruby?
- def build_extensions
- # Gain the lock because rubygems use Dir.chdir
- SharedHelpers.chdir('.') do
- super
- end
- end
- end
end
end
View
10 lib/bundler/installer.rb
@@ -177,7 +177,7 @@ def generate_bundler_executable_stubs(spec, options = {})
next
end
- File.open(binstub_path, 'w', 0755) do |f|
+ File.open(binstub_path, 'w', 0777 & ~File.umask) do |f|
f.puts ERB.new(template, nil, '-').result(binding)
end
end
@@ -198,13 +198,15 @@ def generate_bundler_executable_stubs(spec, options = {})
end
private
+
def can_install_parallely?
- if Bundler.current_ruby.mri? || Bundler.rubygems.provides?(">= 2.1.0.rc")
+ min_rubygems = "2.0.7"
+ if Bundler.current_ruby.mri? || Bundler.rubygems.provides?(">= #{min_rubygems}")
true
else
Bundler.ui.warn "Rubygems #{Gem::VERSION} is not threadsafe, so your "\
- "gems must be installed one at a time. Upgrade to Rubygems 2.1 or "\
- "higher to enable parallel gem installation."
+ "gems must be installed one at a time. Upgrade to Rubygems " \
+ "#{min_rubygems} or higher to enable parallel gem installation."
false
end
end
View
2  lib/bundler/rubygems_ext.rb
@@ -56,7 +56,7 @@ def groups
end
def git_version
- if @loaded_from && File.exist?(File.join(full_gem_path, ".git"))
+ if loaded_from && File.exist?(File.join(full_gem_path, ".git"))
sha = Bundler::SharedHelpers.chdir(full_gem_path) do
null_command("git rev-parse HEAD").strip
end
View
17 lib/bundler/rubygems_integration.rb
@@ -1,6 +1,4 @@
require 'rubygems'
-# rubygems master requires UI for ConfigFile but doesn't require it
-require 'rubygems/user_interaction'
require 'rubygems/config_file'
module Bundler
@@ -188,7 +186,8 @@ def build_gem(gem_dir, spec)
def download_gem(spec, uri, path)
uri = Bundler::Source.mirror_for(uri)
- Gem::RemoteFetcher.fetcher.download(spec, uri, path)
+ fetcher = Gem::RemoteFetcher.new(configuration[:http_proxy])
+ fetcher.download(spec, uri, path)
end
def security_policies
@@ -476,9 +475,9 @@ class Future < RubygemsIntegration
def stub_rubygems(specs)
Gem::Specification.all = specs
- Gem.post_reset {
+ Gem.post_reset do
Gem::Specification.all = specs
- }
+ end
end
def all_specs
@@ -514,6 +513,14 @@ def fetch_all_remote_specs
hash
end
+ def download_gem(spec, uri, path)
+ require 'resolv'
+ uri = Bundler::Source.mirror_for(uri)
+ proxy, dns = configuration[:http_proxy], Resolv::DNS.new
+ fetcher = Gem::RemoteFetcher.new(proxy, dns)
+ fetcher.download(spec, uri, path)
+ end
+
def gem_from_path(path, policy = nil)
require 'rubygems/package'
p = Gem::Package.new(path)
View
18 lib/bundler/source/rubygems.rb
@@ -68,7 +68,13 @@ def specs
end
def install(spec)
+<<<<<<< HEAD
return ["Using #{version_message(spec)}", nil] if installed_specs[spec].any? && gem_dir_exists?(spec)
+=======
+ if installed_specs[spec].any? && gem_dir_exists?(spec)
+ return ["Using #{spec.name} (#{spec.version})", nil]
+ end
+>>>>>>> 1-5-stable
# Download the gem to get the spec, because some specs that are returned
# by rubygems.org are broken and wrong.
@@ -275,11 +281,13 @@ def remote_specs
end
def gem_dir_exists?(spec)
- if spec.name == "bundler"
- true
- else
- File.directory?(spec.full_gem_path)
- end
+ return true if spec.name == "bundler"
+ # Ruby 2 default gems
+ return true if spec.loaded_from.include?("specifications/default/")
+ # Ruby 1.9 default gems
+ return true if spec.summary =~ /is bundled with Ruby/
+
+ File.directory?(spec.full_gem_path)
end
end
View
2  lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = ""
spec.license = "MIT"
- spec.files = `git ls-files`.split($/)
+ spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
View
2  lib/bundler/version.rb
@@ -2,5 +2,5 @@ module Bundler
# We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to
# handle this better.
- VERSION = "1.5.0.rc.1" unless defined?(::Bundler::VERSION)
+ VERSION = "1.5.2" unless defined?(::Bundler::VERSION)
end
View
2  man/bundle-install.ronn
@@ -61,7 +61,7 @@ update process below under [CONSERVATIVE UPDATING][].
Do not attempt to connect to `rubygems.org`, instead using just
the gems already present in Rubygems' cache or in `vendor/cache`.
Note that if a more appropriate platform-specific gem exists on
- `rubygems.org`, it will not be found. This option implies `--no-cache`.
+ `rubygems.org`, it will not be found.
* `--deployment`:
Switches bundler's defaults into [deployment mode][DEPLOYMENT MODE].
View
13 spec/commands/binstubs_spec.rb
@@ -90,6 +90,19 @@
expect(bundled_app("bin/foo")).to exist
end
+
+ it "sets correct permissions for binstubs" do
+ with_umask(0002) do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ bundle "binstubs rack"
+ binary = bundled_app("bin/rackup")
+ expect(File.stat(binary).mode.to_s(8)).to eq("100775")
+ end
+ end
end
context "--path" do
View
6 spec/commands/package_spec.rb
@@ -32,7 +32,7 @@
describe "bundle install with gem sources" do
describe "when cached and locked" do
- it "does not hit the remote at all if --local is passed" do
+ it "does not hit the remote at all" do
build_repo2
install_gemfile <<-G
source "file://#{gem_repo2}"
@@ -44,11 +44,10 @@
FileUtils.rm_rf gem_repo2
bundle "install --local"
- expect(out).not_to include("Updating files in vendor/cache")
should_be_installed "rack 1.0.0"
end
- it "does not hit the remote at all if --deployment is passed" do
+ it "does not hit the remote at all" do
build_repo2
install_gemfile <<-G
source "file://#{gem_repo2}"
@@ -60,7 +59,6 @@
FileUtils.rm_rf gem_repo2
bundle "install --deployment"
- expect(out).not_to include("Updating files in vendor/cache")
should_be_installed "rack 1.0.0"
end
View
2  spec/install/gemfile/git_spec.rb
@@ -34,7 +34,7 @@
git = update_git "foo" do |s|
s.executables = ["foobar"] # we added this the first time, so keep it now
s.files = ["bin/foobar"] # updating git nukes the files list
- foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files`.split("\n")')
+ foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files -z`.split("\x0")')
s.write "foo.gemspec", foospec
end
View
34 spec/install/gems/dependency_api_spec.rb
@@ -162,6 +162,40 @@
should_be_installed "rack 1.0.0"
end
+ it "handles host redirects" do
+ gemfile <<-G
+ source "#{source_uri}"
+ gem "rack"
+ G
+
+ bundle :install, :artifice => "endpoint_host_redirect"
+ should_be_installed "rack 1.0.0"
+ end
+
+ it "handles host redirects without Net::HTTP::Persistent" do
+ gemfile <<-G
+ source "#{source_uri}"
+ gem "rack"
+ G
+
+ FileUtils.mkdir_p lib_path
+ File.open(lib_path("disable_net_http_persistent.rb"), "w") do |h|
+ h.write <<-H
+ module Kernel
+ alias require_without_disabled_net_http require
+ def require(*args)
+ raise LoadError, 'simulated' if args.first == 'openssl' && !caller.grep(/vendored_persistent/).empty?
+ require_without_disabled_net_http(*args)
+ end
+ end
+ H
+ end
+
+ bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")]
+ expect(out).to_not match(/Too many redirects/)
+ should_be_installed "rack 1.0.0"
+ end
+
it "timeouts when Bundler::Fetcher redirects too much" do
gemfile <<-G
source "#{source_uri}"
View
4 spec/quality_spec.rb
@@ -55,7 +55,7 @@ def check_for_extra_spaces(filename)
exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE/
error_messages = []
Dir.chdir(File.expand_path("../..", __FILE__)) do
- `git ls-files`.split("\n").each do |filename|
+ `git ls-files -z`.split("\x0").each do |filename|
next if filename =~ exempt
error_messages << check_for_tab_characters(filename)
error_messages << check_for_extra_spaces(filename)
@@ -68,7 +68,7 @@ def check_for_extra_spaces(filename)
included = /spec/
error_messages = []
Dir.chdir(File.expand_path("../", __FILE__)) do
- `git ls-files`.split("\n").each do |filename|
+ `git ls-files -z`.split("\x0").each do |filename|
next unless filename =~ included
error_messages << check_for_spec_defs_with_single_quotes(filename)
end
View
69 spec/realworld/parallel_spec.rb
@@ -0,0 +1,69 @@
+require 'spec_helper'
+
+describe "parallel", :realworld => true do
+ it "installs", :ruby => "1.8" do
+ gemfile <<-G
+ source "https://rubygems.org"
+ gem 'activesupport', '~> 3.2.13'
+ gem 'faker', '~> 1.1.2'
+ G
+
+ bundle :install, :jobs => 4, :env => {"DEBUG" => "1"}
+ expect(out).to match(/[1-3]: /)
+
+ bundle "show activesupport"
+ expect(out).to match(/activesupport/)
+
+ bundle "show faker"
+ expect(out).to match(/faker/)
+
+ bundle "config jobs"
+ expect(out).to match(/: "4"/)
+ end
+
+ it "installs even with circular dependency", :ruby => "1.9" do
+ gemfile <<-G
+ source 'https://rubygems.org'
+ gem 'activesupport', '~> 3.2.13'
+ gem 'mongoid_auto_increment', "0.1.1"
+ G
+
+ bundle :install, :jobs => 4, :env => {"DEBUG" => "1"}
+ expect(out).to match(/[1-3]: /)
+
+ bundle "show activesupport"
+ expect(out).to match(/activesupport/)
+
+ bundle "show mongoid_auto_increment"
+ expect(out).to match(%r{gems/mongoid_auto_increment})
+
+ bundle "config jobs"
+ expect(out).to match(/: "4"/)
+ end
+
+ it "updates" do
+ install_gemfile <<-G
+ source "https://rubygems.org"
+ gem 'activesupport', '3.2.12'
+ gem 'faker', '~> 1.1.2'
+ G
+
+ gemfile <<-G
+ source "https://rubygems.org"
+ gem 'activesupport', '~> 3.2.12'
+ gem 'faker', '~> 1.1.2'
+ G
+
+ bundle :update, :jobs => 4, :env => {"DEBUG" => "1"}
+ expect(out).to match(/[1-3]: /)
+
+ bundle "show activesupport"
+ expect(out).to match(/activesupport-3\.2\.1[3-9]/)
+
+ bundle "show faker"
+ expect(out).to match(/faker/)
+
+ bundle "config jobs"
+ expect(out).to match(/: "4"/)
+ end
+end
View
5 spec/runtime/setup_spec.rb
@@ -631,7 +631,7 @@
expect(out).to eq("yay")
end
- it "ignores Gem.refresh" do
+ it "stubs out Gem.refresh so it does not reveal system gems" do
system_gems "rack-1.0.0"
install_gemfile <<-G
@@ -640,11 +640,12 @@
G
run <<-R
+ puts Bundler.rubygems.find_name("rack").inspect
Gem.refresh
puts Bundler.rubygems.find_name("rack").inspect
R
- expect(out).to eq("[]")
+ expect(out).to eq("[]\n[]")
end
describe "when a vendored gem specification uses the :path option" do
View
1  spec/spec_helper.rb
@@ -43,6 +43,7 @@
config.include Spec::Rubygems
config.include Spec::Platforms
config.include Spec::Sudo
+ config.include Spec::Permissions
if Spec::Sudo.test_sudo?
config.filter_run :sudo => true
View
15 spec/support/artifice/endpoint_host_redirect.rb
@@ -0,0 +1,15 @@
+require File.expand_path("../endpoint", __FILE__)
+
+Artifice.deactivate
+
+class EndpointHostRedirect < Endpoint
+ get "/fetch/actual/gem/:id", :host_name => 'localgemserver.test' do
+ redirect "http://bundler.localgemserver.test#{request.path_info}"
+ end
+
+ get "/api/v1/dependencies" do
+ status 404
+ end
+end
+
+Artifice.activate_with(EndpointHostRedirect)
View
11 spec/support/permissions.rb
@@ -0,0 +1,11 @@
+module Spec
+ module Permissions
+ def with_umask(new_umask)
+ old_umask = File.umask(new_umask)
+ yield if block_given?
+ ensure
+ File.umask(old_umask)
+ end
+ end
+end
+

0 comments on commit ec9165f

Please sign in to comment.
Something went wrong with that request. Please try again.