summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rubocop_todo.yml117
-rw-r--r--Rakefile26
-rwxr-xr-xbin/rubocop2
-rw-r--r--lib/bundler/fetcher.rb4
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb (renamed from lib/bundler/vendor/net/http/faster.rb)1
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb (renamed from lib/bundler/vendor/net/http/persistent.rb)47
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb (renamed from lib/bundler/vendor/net/http/persistent/ssl_reuse.rb)3
-rw-r--r--lib/bundler/vendored_persistent.rb13
8 files changed, 161 insertions, 52 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index f0419ed089..8abe1e76eb 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,11 +1,17 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
-# on 2016-07-27 12:41:39 -0500 using RuboCop version 0.41.2.
+# on 2016-11-19 11:43:45 -0600 using RuboCop version 0.45.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
+# Offense count: 2
+Lint/EmptyWhen:
+ Exclude:
+ - 'lib/bundler/friendly_errors.rb'
+ - 'spec/support/builders.rb'
+
# Offense count: 4
Lint/Eval:
Exclude:
@@ -41,6 +47,7 @@ Lint/RescueException:
- 'lib/bundler/worker.rb'
# Offense count: 1
+# Configuration parameters: ContextCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
- 'lib/bundler/fetcher.rb'
@@ -51,17 +58,17 @@ Lint/UselessAssignment:
- 'lib/bundler/index.rb'
- 'lib/bundler/installer.rb'
-# Offense count: 1686
-# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
+# Offense count: 7
+# Configuration parameters: CountComments.
+Metrics/BlockLength:
+ Max: 46
+
+# Offense count: 1855
+# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
# URISchemes: http, https
Metrics/LineLength:
Max: 207
-# Offense count: 3
-# Configuration parameters: CountKeywordArgs.
-Metrics/ParameterLists:
- Max: 6
-
# Offense count: 6
# Cop supports --auto-correct.
Performance/RedundantBlockCall:
@@ -79,20 +86,19 @@ Performance/RedundantMatch:
- 'lib/bundler/definition.rb'
- 'lib/bundler/lockfile_parser.rb'
-# Offense count: 6
+# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: MaxKeyValuePairs.
Performance/RedundantMerge:
Exclude:
- 'lib/bundler/cli/gem.rb'
- - 'spec/support/helpers.rb'
# Offense count: 1
Style/AccessorMethodName:
Exclude:
- 'lib/bundler/source/git.rb'
-# Offense count: 3
+# Offense count: 4
Style/CaseEquality:
Exclude:
- 'lib/bundler/dsl.rb'
@@ -105,7 +111,7 @@ Style/CaseEquality:
Style/ClassAndModuleChildren:
Enabled: false
-# Offense count: 10
+# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
# SupportedStyles: assign_to_condition, assign_inside_condition
@@ -113,7 +119,6 @@ Style/ConditionalAssignment:
Exclude:
- 'lib/bundler/cli.rb'
- 'lib/bundler/cli/gem.rb'
- - 'lib/bundler/cli/lock.rb'
- 'lib/bundler/cli/platform.rb'
- 'lib/bundler/dsl.rb'
- 'lib/bundler/lazy_specification.rb'
@@ -122,7 +127,7 @@ Style/ConditionalAssignment:
- 'lib/bundler/source/git.rb'
- 'lib/bundler/source/rubygems.rb'
-# Offense count: 138
+# Offense count: 148
Style/Documentation:
Enabled: false
@@ -133,13 +138,32 @@ Style/ExtraSpacing:
Exclude:
- 'lib/bundler/cli.rb'
-# Offense count: 4
+# Offense count: 2
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Exclude:
- 'lib/bundler/cli.rb'
- 'spec/spec_helper.rb'
- - 'spec/support/helpers.rb'
+
+# Offense count: 19
+# Configuration parameters: MinBodyLength.
+Style/GuardClause:
+ Exclude:
+ - 'lib/bundler/cli/cache.rb'
+ - 'lib/bundler/cli/clean.rb'
+ - 'lib/bundler/cli/install.rb'
+ - 'lib/bundler/cli/outdated.rb'
+ - 'lib/bundler/cli/package.rb'
+ - 'lib/bundler/definition.rb'
+ - 'lib/bundler/dsl.rb'
+ - 'lib/bundler/installer.rb'
+ - 'lib/bundler/lockfile_parser.rb'
+ - 'lib/bundler/runtime.rb'
+ - 'lib/bundler/shared_helpers.rb'
+ - 'lib/bundler/source/path/installer.rb'
+ - 'lib/bundler/source_list.rb'
+ - 'spec/commands/newgem_spec.rb'
+ - 'spec/support/sometimes.rb'
# Offense count: 1
Style/IfInsideElse:
@@ -151,13 +175,23 @@ Style/IfUnlessModifierOfIfUnless:
Exclude:
- 'spec/support/helpers.rb'
-# Offense count: 4
+# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Style/IndentArray:
EnforcedStyle: consistent
+# Offense count: 6
+Style/MethodMissing:
+ Exclude:
+ - 'lib/bundler/dep_proxy.rb'
+ - 'lib/bundler/dsl.rb'
+ - 'lib/bundler/lazy_specification.rb'
+ - 'lib/bundler/plugin/dsl.rb'
+ - 'lib/bundler/remote_specification.rb'
+ - 'spec/support/builders.rb'
+
# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: module_function, extend_self
@@ -166,6 +200,17 @@ Style/ModuleFunction:
- 'lib/bundler/shared_helpers.rb'
- 'spec/support/path.rb'
+# Offense count: 11
+# Cop supports --auto-correct.
+Style/MultilineIfModifier:
+ Exclude:
+ - 'bin/with_rubygems'
+ - 'lib/bundler/installer.rb'
+ - 'lib/bundler/psyched_yaml.rb'
+ - 'lib/bundler/rubygems_ext.rb'
+ - 'lib/bundler/runtime.rb'
+ - 'lib/bundler/source/rubygems.rb'
+
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
@@ -183,6 +228,18 @@ Style/NestedParenthesizedCalls:
- 'spec/commands/lock_spec.rb'
- 'spec/runtime/setup_spec.rb'
+# Offense count: 6
+# Cop supports --auto-correct.
+# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
+# SupportedStyles: predicate, comparison
+Style/NumericPredicate:
+ Exclude:
+ - 'spec/**/*'
+ - 'lib/bundler/gem_helper.rb'
+ - 'lib/bundler/mirror.rb'
+ - 'lib/bundler/source/git/git_proxy.rb'
+ - 'lib/bundler/source/path.rb'
+
# Offense count: 9
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
# NamePrefix: is_, has_, have_
@@ -219,6 +276,23 @@ Style/SpaceAroundOperators:
Exclude:
- 'lib/bundler/retry.rb'
+# Offense count: 1
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
+# SupportedStyles: space, no_space
+Style/SpaceInsideBlockBraces:
+ Exclude:
+ - 'lib/bundler/installer/parallel_installer.rb'
+
+# Offense count: 2
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment.
+# SupportedStyles: require_parentheses, require_no_parentheses
+Style/TernaryParentheses:
+ Exclude:
+ - 'lib/bundler/cli/common.rb'
+ - 'lib/bundler/gem_version_promoter.rb'
+
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
@@ -245,3 +319,12 @@ Style/UnneededInterpolation:
- 'spec/commands/exec_spec.rb'
- 'spec/support/artifice/endpoint.rb'
- 'spec/support/artifice/endpoint_500.rb'
+
+# Offense count: 2
+# Configuration parameters: SupportedStyles.
+# SupportedStyles: snake_case, normalcase, non_integer
+Style/VariableNumber:
+ EnforcedStyle: normalcase
+ Exclude:
+ - 'spec/commands/help_spec.rb'
+ - 'spec/other/ext_spec.rb'
diff --git a/Rakefile b/Rakefile
index 28e8e7fb3a..7fb41ff4a0 100644
--- a/Rakefile
+++ b/Rakefile
@@ -39,7 +39,7 @@ namespace :spec do
deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d|
[d.name, d.requirement.to_s]
end]
- deps["rubocop"] ||= "= 0.41.2" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement
+ deps["rubocop"] ||= "= 0.45.0" if RUBY_VERSION >= "2.0.0" # can't go in the gemspec because of the ruby version requirement
# JRuby can't build ronn or rdiscount, so we skip that
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
@@ -91,9 +91,9 @@ begin
RSpec::Core::RakeTask.new
task :spec => "man:build"
- if RUBY_VERSION >= "1.9.3"
+ if RUBY_VERSION >= "2.0.0"
# can't go in the gemspec because of the ruby version requirement
- gem "rubocop", "= 0.41.2"
+ gem "rubocop", "= 0.45.0"
require "rubocop/rake_task"
RuboCop::RakeTask.new
end
@@ -190,7 +190,7 @@ begin
task :travis do
rg = ENV["RGV"] || raise("Rubygems version is required on Travis!")
- if RUBY_VERSION > "1.9.3"
+ if RUBY_VERSION >= "2.0.0"
puts "\n\e[1;33m[Travis CI] Running bundler linter\e[m\n\n"
Rake::Task["rubocop"].invoke
end
@@ -305,11 +305,29 @@ begin
lib.prefix = "BundlerVendoredPostIt"
lib.vendor_lib = "lib/bundler/vendor/postit"
end
+
+ Automatiek::RakeTask.new("net-http-persistent") do |lib|
+ lib.download = { :github => "https://github.com/drbrain/net-http-persistent" }
+ lib.namespace = "Net::HTTP::Persistent"
+ lib.prefix = "Bundler::Persistent"
+ lib.vendor_lib = "lib/bundler/vendor/net-http-persistent"
+
+ mixin = Module.new do
+ def namespace_files
+ super
+ require_target = vendor_lib.sub(%r{^(.+?/)?lib/}, "") << "/lib"
+ relative_files = files.map {|f| Pathname.new(f).relative_path_from(Pathname.new(vendor_lib) / "lib").sub_ext("").to_s }
+ process_files(/require (['"])(#{Regexp.union(relative_files)})/, "require \\1#{require_target}/\\2")
+ end
+ end
+ lib.send(:extend, mixin)
+ end
rescue LoadError
namespace :vendor do
task(:molinillo) { abort "Install the automatiek gem to be able to vendor gems." }
task(:thor) { abort "Install the automatiek gem to be able to vendor gems." }
task(:postit) { abort "Install the automatiek gem to be able to vendor gems." }
+ task("net-http-persistent") { abort "Install the automatiek gem to be able to vendor gems." }
end
end
diff --git a/bin/rubocop b/bin/rubocop
index 78641c589f..83e8e78c08 100755
--- a/bin/rubocop
+++ b/bin/rubocop
@@ -10,7 +10,7 @@ bundler_spec.dependencies.each do |dep|
gem dep.name, dep.requirement
end
-gem "rubocop", "= 0.41.2"
+gem "rubocop", "= 0.45.0"
Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 0e890d491c..9e208e4957 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -237,7 +237,7 @@ module Bundler
Bundler.settings[:ssl_client_cert]
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
- con = Net::HTTP::Persistent.new "bundler", :ENV
+ con = Bundler::Persistent::Net::HTTP::Persistent.new "bundler", :ENV
if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy
end
@@ -273,7 +273,7 @@ module Bundler
Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
- Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
+ Bundler::Persistent::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
].freeze
def bundler_cert_store
diff --git a/lib/bundler/vendor/net/http/faster.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb
index 74b94d1d99..e5e09080c2 100644
--- a/lib/bundler/vendor/net/http/faster.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb
@@ -24,3 +24,4 @@ class Net::BufferedIO #:nodoc:
end
end
end if RUBY_VERSION < '1.9'
+
diff --git a/lib/bundler/vendor/net/http/persistent.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
index e2805b1236..5195be2152 100644
--- a/lib/bundler/vendor/net/http/persistent.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
@@ -4,7 +4,7 @@ begin
rescue LoadError
# net/https or openssl
end if RUBY_VERSION < '1.9' # but only for 1.8
-require 'net/http/faster'
+require 'bundler/vendor/net-http-persistent/lib/net/http/faster'
require 'uri'
require 'cgi' # for escaping
@@ -18,27 +18,27 @@ autoload :OpenSSL, 'openssl'
##
# Persistent connections for Net::HTTP
#
-# Net::HTTP::Persistent maintains persistent connections across all the
+# Bundler::Persistent::Net::HTTP::Persistent maintains persistent connections across all the
# servers you wish to talk to. For each host:port you communicate with a
# single persistent connection is created.
#
-# Multiple Net::HTTP::Persistent objects will share the same set of
+# Multiple Bundler::Persistent::Net::HTTP::Persistent objects will share the same set of
# connections.
#
# For each thread you start a new connection will be created. A
-# Net::HTTP::Persistent connection will not be shared across threads.
+# Bundler::Persistent::Net::HTTP::Persistent connection will not be shared across threads.
#
# You can shut down the HTTP connections when done by calling #shutdown. You
-# should name your Net::HTTP::Persistent object if you intend to call this
+# should name your Bundler::Persistent::Net::HTTP::Persistent object if you intend to call this
# method.
#
# Example:
#
-# require 'net/http/persistent'
+# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
#
# uri = URI 'http://example.com/awesome/web/service'
#
-# http = Net::HTTP::Persistent.new 'my_app_name'
+# http = Bundler::Persistent::Net::HTTP::Persistent.new 'my_app_name'
#
# # perform a GET
# response = http.request uri
@@ -149,19 +149,19 @@ autoload :OpenSSL, 'openssl'
#
# The recommended way to handle non-idempotent requests is the following:
#
-# require 'net/http/persistent'
+# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
#
# uri = URI 'http://example.com/awesome/web/service'
# post_uri = uri + 'create'
#
-# http = Net::HTTP::Persistent.new 'my_app_name'
+# http = Bundler::Persistent::Net::HTTP::Persistent.new 'my_app_name'
#
# post = Net::HTTP::Post.new post_uri.path
# # ... fill in POST request
#
# begin
# response = http.request post_uri, post
-# rescue Net::HTTP::Persistent::Error
+# rescue Bundler::Persistent::Net::HTTP::Persistent::Error
#
# # POST failed, make a new request to verify the server did not process
# # the request
@@ -178,7 +178,7 @@ autoload :OpenSSL, 'openssl'
#
# === Connection Termination
#
-# If you are done using the Net::HTTP::Persistent instance you may shut down
+# If you are done using the Bundler::Persistent::Net::HTTP::Persistent instance you may shut down
# all the connections in the current thread with #shutdown. This is not
# recommended for normal use, it should only be used when it will be several
# minutes before you make another HTTP request.
@@ -188,7 +188,7 @@ autoload :OpenSSL, 'openssl'
# Ruby will automatically garbage collect and shutdown your HTTP connections
# when the thread terminates.
-class Net::HTTP::Persistent
+class Bundler::Persistent::Net::HTTP::Persistent
##
# The beginning of Time
@@ -201,9 +201,9 @@ class Net::HTTP::Persistent
HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
##
- # The version of Net::HTTP::Persistent you are using
+ # The version of Bundler::Persistent::Net::HTTP::Persistent you are using
- VERSION = '2.9.3'
+ VERSION = '2.9.4'
##
# Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
@@ -221,7 +221,7 @@ class Net::HTTP::Persistent
].compact
##
- # Error class for errors raised by Net::HTTP::Persistent. Various
+ # Error class for errors raised by Bundler::Persistent::Net::HTTP::Persistent. Various
# SystemCallErrors are re-raised with a human-readable message under this
# class.
@@ -241,7 +241,7 @@ class Net::HTTP::Persistent
# NOTE: This may not work on ruby > 1.9.
def self.detect_idle_timeout uri, max = 10
- uri = URI uri unless uri.is_a?(URI::Generic)
+ uri = URI uri unless URI::Generic === uri
uri += '/'
req = Net::HTTP::Head.new uri.request_uri
@@ -257,7 +257,7 @@ class Net::HTTP::Persistent
$stderr.puts "HEAD #{uri} => #{response.code}" if $DEBUG
- unless response.is_a?(Net::HTTPOK) then
+ unless Net::HTTPOK === response then
raise Error, "bad response code #{response.code} detecting idle timeout"
end
@@ -463,7 +463,7 @@ class Net::HTTP::Persistent
attr_accessor :retry_change_requests
##
- # Creates a new Net::HTTP::Persistent.
+ # Creates a new Bundler::Persistent::Net::HTTP::Persistent.
#
# Set +name+ to keep your connections apart from everybody else's. Not
# required currently, but highly recommended. Your library name should be
@@ -594,7 +594,7 @@ class Net::HTTP::Persistent
use_ssl = uri.scheme.downcase == 'https'
if use_ssl then
- raise Net::HTTP::Persistent::Error, 'OpenSSL is not available' unless
+ raise Bundler::Persistent::Net::HTTP::Persistent::Error, 'OpenSSL is not available' unless
HAVE_OPENSSL
ssl_generation = @ssl_generation
@@ -728,7 +728,7 @@ class Net::HTTP::Persistent
} or not @reuse_ssl_sessions then
Net::HTTP
else
- Net::HTTP::Persistent::SSLReuse
+ Bundler::Persistent::Net::HTTP::Persistent::SSLReuse
end
end
@@ -1065,7 +1065,7 @@ class Net::HTTP::Persistent
# Returns the request.
def request_setup req_or_uri # :nodoc:
- req = if req_or_uri.is_a?(URI) then
+ req = if URI === req_or_uri then
Net::HTTP::Get.new req_or_uri.request_uri
else
req_or_uri
@@ -1092,7 +1092,7 @@ class Net::HTTP::Persistent
#
# Uses the current thread by default.
#
- # If you've used Net::HTTP::Persistent across multiple threads you should
+ # If you've used Bundler::Persistent::Net::HTTP::Persistent across multiple threads you should
# call this in each thread when you're done making HTTP requests.
#
# *NOTE*: Calling shutdown for another thread can be dangerous!
@@ -1227,4 +1227,5 @@ application:
end
-require 'net/http/persistent/ssl_reuse'
+require 'bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse'
+
diff --git a/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb
index d73aa54996..1b6b789f6d 100644
--- a/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb
@@ -7,7 +7,7 @@
# This class is an implementation detail and is subject to change or removal
# at any time.
-class Net::HTTP::Persistent::SSLReuse < Net::HTTP
+class Bundler::Persistent::Net::HTTP::Persistent::SSLReuse < Net::HTTP
@is_proxy_class = false
@proxy_addr = nil
@@ -126,3 +126,4 @@ class Net::HTTP::Persistent::SSLReuse < Net::HTTP
private :connect
end
+
diff --git a/lib/bundler/vendored_persistent.rb b/lib/bundler/vendored_persistent.rb
index d5ae513c59..729ac6b6f5 100644
--- a/lib/bundler/vendored_persistent.rb
+++ b/lib/bundler/vendored_persistent.rb
@@ -6,7 +6,12 @@ begin
rescue LoadError
# some Ruby builds don't have OpenSSL
end
-
-vendor = File.expand_path("../vendor", __FILE__)
-$:.unshift(vendor) unless $:.include?(vendor)
-require "net/http/persistent"
+module Bundler
+ module Persistent
+ module Net
+ module HTTP
+ end
+ end
+ end
+end
+require "bundler/vendor/net-http-persistent/lib/net/http/persistent"