bundler 1.13.7 → 1.14.0.pre.1

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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop_todo.yml +100 -18
  4. data/.travis.yml +32 -18
  5. data/CHANGELOG.md +64 -2
  6. data/DEVELOPMENT.md +5 -3
  7. data/ISSUES.md +17 -0
  8. data/README.md +7 -0
  9. data/Rakefile +34 -23
  10. data/bin/rubocop +1 -1
  11. data/bundler.gemspec +2 -2
  12. data/exe/bundle +4 -6
  13. data/lib/bundler.rb +57 -5
  14. data/lib/bundler/cli.rb +51 -38
  15. data/lib/bundler/cli/binstubs.rb +1 -1
  16. data/lib/bundler/cli/cache.rb +1 -1
  17. data/lib/bundler/cli/check.rb +1 -1
  18. data/lib/bundler/cli/clean.rb +1 -1
  19. data/lib/bundler/cli/common.rb +30 -0
  20. data/lib/bundler/cli/doctor.rb +17 -19
  21. data/lib/bundler/cli/exec.rb +6 -0
  22. data/lib/bundler/cli/gem.rb +18 -4
  23. data/lib/bundler/cli/install.rb +9 -25
  24. data/lib/bundler/cli/lock.rb +8 -7
  25. data/lib/bundler/cli/outdated.rb +163 -56
  26. data/lib/bundler/cli/platform.rb +1 -1
  27. data/lib/bundler/cli/show.rb +1 -1
  28. data/lib/bundler/cli/update.rb +10 -23
  29. data/lib/bundler/compact_index_client.rb +108 -0
  30. data/lib/bundler/compact_index_client/cache.rb +119 -0
  31. data/lib/bundler/compact_index_client/updater.rb +88 -0
  32. data/lib/bundler/current_ruby.rb +4 -3
  33. data/lib/bundler/definition.rb +107 -17
  34. data/lib/bundler/dependency.rb +6 -0
  35. data/lib/bundler/dsl.rb +3 -2
  36. data/lib/bundler/env.rb +27 -18
  37. data/lib/bundler/errors.rb +22 -0
  38. data/lib/bundler/feature_flag.rb +32 -0
  39. data/lib/bundler/fetcher.rb +2 -2
  40. data/lib/bundler/fetcher/compact_index.rb +17 -5
  41. data/lib/bundler/fetcher/dependency.rb +1 -1
  42. data/lib/bundler/fetcher/downloader.rb +11 -0
  43. data/lib/bundler/friendly_errors.rb +28 -7
  44. data/lib/bundler/gem_helper.rb +1 -1
  45. data/lib/bundler/gem_helpers.rb +69 -1
  46. data/lib/bundler/gemdeps.rb +28 -0
  47. data/lib/bundler/index.rb +9 -4
  48. data/lib/bundler/inline.rb +3 -3
  49. data/lib/bundler/installer.rb +3 -2
  50. data/lib/bundler/installer/gem_installer.rb +2 -2
  51. data/lib/bundler/installer/parallel_installer.rb +40 -9
  52. data/lib/bundler/lazy_specification.rb +16 -1
  53. data/lib/bundler/lockfile_parser.rb +1 -2
  54. data/lib/bundler/match_platform.rb +12 -3
  55. data/lib/bundler/plugin.rb +4 -2
  56. data/lib/bundler/plugin/api.rb +2 -1
  57. data/lib/bundler/plugin/api/source.rb +1 -1
  58. data/lib/bundler/postit_trampoline.rb +12 -7
  59. data/lib/bundler/remote_specification.rb +5 -0
  60. data/lib/bundler/resolver.rb +59 -49
  61. data/lib/bundler/retry.rb +4 -1
  62. data/lib/bundler/ruby_version.rb +5 -0
  63. data/lib/bundler/rubygems_ext.rb +5 -0
  64. data/lib/bundler/rubygems_gem_installer.rb +60 -0
  65. data/lib/bundler/rubygems_integration.rb +28 -2
  66. data/lib/bundler/runtime.rb +2 -1
  67. data/lib/bundler/settings.rb +29 -5
  68. data/lib/bundler/setup.rb +1 -1
  69. data/lib/bundler/shared_helpers.rb +26 -15
  70. data/lib/bundler/source.rb +5 -0
  71. data/lib/bundler/source/git.rb +1 -1
  72. data/lib/bundler/source/git/git_proxy.rb +5 -0
  73. data/lib/bundler/source/path.rb +6 -1
  74. data/lib/bundler/source/rubygems.rb +11 -1
  75. data/lib/bundler/spec_set.rb +32 -13
  76. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  77. data/lib/bundler/templates/newgem/bin/console.tt +1 -1
  78. data/lib/bundler/templates/newgem/gitignore.tt +5 -0
  79. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -1
  80. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +10 -1
  81. data/lib/bundler/ui/shell.rb +4 -0
  82. data/lib/bundler/ui/silent.rb +9 -0
  83. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +7 -0
  84. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  85. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -2
  86. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -2
  87. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
  88. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  89. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +12 -1
  90. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -2
  91. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  92. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  93. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +22 -13
  94. data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
  95. data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +24 -23
  96. data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
  97. data/lib/bundler/vendored_persistent.rb +9 -4
  98. data/lib/bundler/version.rb +1 -1
  99. data/lib/bundler/worker.rb +27 -5
  100. data/lib/bundler/yaml_serializer.rb +1 -1
  101. data/man/bundle-config.ronn +29 -2
  102. data/man/bundle-install.ronn +1 -1
  103. data/man/bundle-lock.ronn +47 -0
  104. data/man/bundle-outdated.ronn +107 -0
  105. data/man/bundle-update.ronn +152 -3
  106. data/man/bundle.ronn +27 -9
  107. data/man/gemfile.5.ronn +8 -0
  108. metadata +37 -31
  109. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
  110. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -112
  111. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
  112. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
@@ -24,17 +24,9 @@ module Bundler
24
24
  dep = deps.shift
25
25
  next if handled[dep] || skip.include?(dep.name)
26
26
 
27
- spec = lookup[dep.name].find do |s|
28
- if match_current_platform
29
- Gem::Platform.match(s.platform)
30
- else
31
- s.match_platform(dep.__platform)
32
- end
33
- end
34
-
35
27
  handled[dep] = true
36
28
 
37
- if spec
29
+ if spec = spec_for_dependency(dep, match_current_platform)
38
30
  specs << spec
39
31
 
40
32
  spec.dependencies.each do |d|
@@ -99,6 +91,20 @@ module Bundler
99
91
  SpecSet.new(materialized.compact)
100
92
  end
101
93
 
94
+ # Materialize for all the specs in the spec set, regardless of what platform they're for
95
+ # This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
96
+ # @return [Array<Gem::Specification>]
97
+ def materialized_for_all_platforms
98
+ names = @specs.map(&:name).uniq
99
+ @specs.map do |s|
100
+ next s unless s.is_a?(LazySpecification)
101
+ s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
102
+ spec = s.__materialize__
103
+ raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
104
+ spec
105
+ end
106
+ end
107
+
102
108
  def merge(set)
103
109
  arr = sorted.dup
104
110
  set.each do |s|
@@ -108,6 +114,10 @@ module Bundler
108
114
  SpecSet.new(arr)
109
115
  end
110
116
 
117
+ def find_by_name_and_platform(name, platform)
118
+ @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
119
+ end
120
+
111
121
  private
112
122
 
113
123
  def sorted
@@ -133,10 +143,7 @@ module Bundler
133
143
  def lookup
134
144
  @lookup ||= begin
135
145
  lookup = Hash.new {|h, k| h[k] = [] }
136
- specs = @specs.sort_by do |s|
137
- s.platform.to_s == "ruby" ? "\0" : s.platform.to_s
138
- end
139
- specs.reverse_each do |s|
146
+ Index.sort_specs(@specs).reverse_each do |s|
140
147
  lookup[s.name] << s
141
148
  end
142
149
  lookup
@@ -147,6 +154,18 @@ module Bundler
147
154
  @specs.each {|s| yield s }
148
155
  end
149
156
 
157
+ def spec_for_dependency(dep, match_current_platform)
158
+ if match_current_platform
159
+ Bundler.rubygems.platforms.reverse_each do |pl|
160
+ match = GemHelpers.select_best_platform_match(lookup[dep.name], pl)
161
+ return match if match
162
+ end
163
+ nil
164
+ else
165
+ GemHelpers.select_best_platform_match(lookup[dep.name], dep.__platform)
166
+ end
167
+ end
168
+
150
169
  def tsort_each_child(s)
151
170
  s.dependencies.sort_by(&:name).each do |d|
152
171
  next if d.type == :development
@@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
32
 
33
33
  ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.<% end %>
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:git_user_name] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.<% end %>
36
36
  <% if config[:mit] %>
37
37
 
38
38
  ## License
@@ -11,4 +11,4 @@ require "<%= config[:namespaced_path] %>"
11
11
  # Pry.start
12
12
 
13
13
  require "irb"
14
- IRB.start
14
+ IRB.start(__FILE__)
@@ -14,3 +14,8 @@
14
14
  *.a
15
15
  mkmf.log
16
16
  <%- end -%>
17
+ <%- if config[:test] == "rspec" -%>
18
+
19
+ # rspec failure tracking
20
+ .rspec_status
21
+ <%- end -%>
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe <%= config[:constant_name] %> do
3
+ RSpec.describe <%= config[:constant_name] %> do
4
4
  it "has a version number" do
5
5
  expect(<%= config[:constant_name] %>::VERSION).not_to be nil
6
6
  end
@@ -1,2 +1,11 @@
1
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
1
+ require "bundler/setup"
2
2
  require "<%= config[:namespaced_path] %>"
3
+
4
+ RSpec.configure do |config|
5
+ # Enable flags like --only-failures and --next-failure
6
+ config.example_status_persistence_file_path = ".rspec_status"
7
+
8
+ config.expect_with :rspec do |c|
9
+ c.syntax = :expect
10
+ end
11
+ end
@@ -83,6 +83,10 @@ module Bundler
83
83
  with_level("silent", &blk)
84
84
  end
85
85
 
86
+ def unprinted_warnings
87
+ []
88
+ end
89
+
86
90
  private
87
91
 
88
92
  # valimism
@@ -2,6 +2,10 @@
2
2
  module Bundler
3
3
  module UI
4
4
  class Silent
5
+ def initialize
6
+ @warnings = []
7
+ end
8
+
5
9
  def add_color(string, color)
6
10
  string
7
11
  end
@@ -13,6 +17,7 @@ module Bundler
13
17
  end
14
18
 
15
19
  def warn(message, newline = nil)
20
+ @warnings |= [message]
16
21
  end
17
22
 
18
23
  def error(message, newline = nil)
@@ -44,6 +49,10 @@ module Bundler
44
49
  def silence
45
50
  yield
46
51
  end
52
+
53
+ def unprinted_warnings
54
+ @warnings
55
+ end
47
56
  end
48
57
  end
49
58
  end
@@ -182,6 +182,13 @@ module Bundler::Molinillo
182
182
  add_edge_no_circular(origin, destination, requirement)
183
183
  end
184
184
 
185
+ # Deletes an {Edge} from the dependency graph
186
+ # @param [Edge] edge
187
+ # @return [Void]
188
+ def delete_edge(edge)
189
+ log.delete_edge(self, edge.origin.name, edge.destination.name, edge.requirement)
190
+ end
191
+
185
192
  # Sets the payload of the vertex with the given name
186
193
  # @param [String] name the name of the vertex
187
194
  # @param [Object] payload the payload
@@ -7,7 +7,7 @@ module Bundler::Molinillo
7
7
  # rubocop:disable Lint/UnusedMethodArgument
8
8
 
9
9
  # @return [Symbol] The name of the action.
10
- def self.name
10
+ def self.action_name
11
11
  raise 'Abstract'
12
12
  end
13
13
 
@@ -7,8 +7,8 @@ module Bundler::Molinillo
7
7
  class AddEdgeNoCircular < Action
8
8
  # @!group Action
9
9
 
10
- # (see Action.name)
11
- def self.name
10
+ # (see Action.action_name)
11
+ def self.action_name
12
12
  :add_vertex
13
13
  end
14
14
 
@@ -7,8 +7,8 @@ module Bundler::Molinillo
7
7
  class AddVertex < Action # :nodoc:
8
8
  # @!group Action
9
9
 
10
- # (see Action.name)
11
- def self.name
10
+ # (see Action.action_name)
11
+ def self.action_name
12
12
  :add_vertex
13
13
  end
14
14
 
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
3
+ module Bundler::Molinillo
4
+ class DependencyGraph
5
+ # @!visibility private
6
+ # (see DependencyGraph#delete_edge)
7
+ class DeleteEdge < Action
8
+ # @!group Action
9
+
10
+ # (see Action.action_name)
11
+ def self.action_name
12
+ :delete_edge
13
+ end
14
+
15
+ # (see Action#up)
16
+ def up(graph)
17
+ edge = make_edge(graph)
18
+ edge.origin.outgoing_edges.delete(edge)
19
+ edge.destination.incoming_edges.delete(edge)
20
+ end
21
+
22
+ # (see Action#down)
23
+ def down(graph)
24
+ edge = make_edge(graph)
25
+ edge.origin.outgoing_edges << edge
26
+ edge.destination.incoming_edges << edge
27
+ edge
28
+ end
29
+
30
+ # @!group DeleteEdge
31
+
32
+ # @return [String] the name of the origin of the edge
33
+ attr_reader :origin_name
34
+
35
+ # @return [String] the name of the destination of the edge
36
+ attr_reader :destination_name
37
+
38
+ # @return [Object] the requirement that the edge represents
39
+ attr_reader :requirement
40
+
41
+ # @param [DependencyGraph] graph the graph to find vertices from
42
+ # @return [Edge] The edge this action adds
43
+ def make_edge(graph)
44
+ Edge.new(
45
+ graph.vertex_named(origin_name),
46
+ graph.vertex_named(destination_name),
47
+ requirement
48
+ )
49
+ end
50
+
51
+ # Initialize an action to add an edge to a dependency graph
52
+ # @param [String] origin_name the name of the origin of the edge
53
+ # @param [String] destination_name the name of the destination of the edge
54
+ # @param [Object] requirement the requirement that the edge represents
55
+ def initialize(origin_name, destination_name, requirement)
56
+ @origin_name = origin_name
57
+ @destination_name = destination_name
58
+ @requirement = requirement
59
+ end
60
+ end
61
+ end
62
+ end
@@ -8,7 +8,7 @@ module Bundler::Molinillo
8
8
  # @!group Action
9
9
 
10
10
  # (see Action#name)
11
- def self.name
11
+ def self.action_name
12
12
  :add_vertex
13
13
  end
14
14
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular'
3
3
  require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex'
4
+ require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge'
4
5
  require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named'
5
6
  require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload'
6
7
  require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag'
@@ -40,6 +41,16 @@ module Bundler::Molinillo
40
41
  push_action(graph, AddEdgeNoCircular.new(origin, destination, requirement))
41
42
  end
42
43
 
44
+ # {include:DependencyGraph#delete_edge}
45
+ # @param [Graph] graph the graph to perform the action on
46
+ # @param [String] origin_name
47
+ # @param [String] destination_name
48
+ # @param [Object] requirement
49
+ # @return (see DependencyGraph#delete_edge)
50
+ def delete_edge(graph, origin_name, destination_name, requirement)
51
+ push_action(graph, DeleteEdge.new(origin_name, destination_name, requirement))
52
+ end
53
+
43
54
  # @macro action
44
55
  def set_payload(graph, name, payload)
45
56
  push_action(graph, SetPayload.new(name, payload))
@@ -92,7 +103,7 @@ module Bundler::Molinillo
92
103
  loop do
93
104
  action = pop!(graph)
94
105
  raise "No tag #{tag.inspect} found" unless action
95
- break if action.class.name == :tag && action.tag == tag
106
+ break if action.class.action_name == :tag && action.tag == tag
96
107
  end
97
108
  end
98
109
 
@@ -7,8 +7,8 @@ module Bundler::Molinillo
7
7
  class SetPayload < Action # :nodoc:
8
8
  # @!group Action
9
9
 
10
- # (see Action.name)
11
- def self.name
10
+ # (see Action.action_name)
11
+ def self.action_name
12
12
  :set_payload
13
13
  end
14
14
 
@@ -7,8 +7,8 @@ module Bundler::Molinillo
7
7
  class Tag < Action
8
8
  # @!group Action
9
9
 
10
- # (see Action.name)
11
- def self.name
10
+ # (see Action.action_name)
11
+ def self.action_name
12
12
  :tag
13
13
  end
14
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Bundler::Molinillo
3
3
  # The version of Bundler::Molinillo.
4
- VERSION = '0.5.1'.freeze
4
+ VERSION = '0.5.4'.freeze
5
5
  end
@@ -194,18 +194,20 @@ module Bundler::Molinillo
194
194
  def state_index_for_unwind
195
195
  current_requirement = requirement
196
196
  existing_requirement = requirement_for_existing_name(name)
197
- until current_requirement.nil?
198
- current_state = find_state_for(current_requirement)
199
- return states.index(current_state) if state_any?(current_state)
200
- current_requirement = parent_of(current_requirement)
197
+ index = -1
198
+ [current_requirement, existing_requirement].each do |r|
199
+ until r.nil?
200
+ current_state = find_state_for(r)
201
+ if state_any?(current_state)
202
+ current_index = states.index(current_state)
203
+ index = current_index if current_index > index
204
+ break
205
+ end
206
+ r = parent_of(r)
207
+ end
201
208
  end
202
209
 
203
- until existing_requirement.nil?
204
- existing_state = find_state_for(existing_requirement)
205
- return states.index(existing_state) if state_any?(existing_state)
206
- existing_requirement = parent_of(existing_requirement)
207
- end
208
- -1
210
+ index
209
211
  end
210
212
 
211
213
  # @return [Object] the requirement that led to `requirement` being added
@@ -356,10 +358,14 @@ module Bundler::Molinillo
356
358
  # @return [void]
357
359
  def fixup_swapped_children(vertex)
358
360
  payload = vertex.payload
359
- dep_names = dependencies_for(payload).map(&method(:name_for))
360
- vertex.successors.each do |succ|
361
- if !dep_names.include?(succ.name) && !succ.root? && succ.predecessors.to_a == [vertex]
361
+ deps = dependencies_for(payload).group_by(&method(:name_for))
362
+ vertex.outgoing_edges.each do |outgoing_edge|
363
+ @parent_of[outgoing_edge.requirement] = states.size - 1
364
+ succ = outgoing_edge.destination
365
+ matching_deps = Array(deps[succ.name])
366
+ if matching_deps.empty? && !succ.root? && succ.predecessors.to_a == [vertex]
362
367
  debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
368
+ succ.requirements.each { |r| @parent_of.delete(r) }
363
369
  activated.detach_vertex_named(succ.name)
364
370
 
365
371
  all_successor_names = succ.recursive_successors.map(&:name)
@@ -368,6 +374,9 @@ module Bundler::Molinillo
368
374
  requirement_name = name_for(requirement)
369
375
  (requirement_name == succ.name) || all_successor_names.include?(requirement_name)
370
376
  end
377
+ elsif !matching_deps.include?(outgoing_edge.requirement)
378
+ activated.delete_edge(outgoing_edge)
379
+ requirements.delete(outgoing_edge.requirement)
371
380
  end
372
381
  end
373
382
  end
@@ -24,3 +24,4 @@ class Net::BufferedIO #:nodoc:
24
24
  end
25
25
  end
26
26
  end if RUBY_VERSION < '1.9'
27
+
@@ -4,7 +4,7 @@ begin
4
4
  rescue LoadError
5
5
  # net/https or openssl
6
6
  end if RUBY_VERSION < '1.9' # but only for 1.8
7
- require 'net/http/faster'
7
+ require 'bundler/vendor/net-http-persistent/lib/net/http/faster'
8
8
  require 'uri'
9
9
  require 'cgi' # for escaping
10
10
 
@@ -18,27 +18,27 @@ autoload :OpenSSL, 'openssl'
18
18
  ##
19
19
  # Persistent connections for Net::HTTP
20
20
  #
21
- # Net::HTTP::Persistent maintains persistent connections across all the
21
+ # Bundler::Persistent::Net::HTTP::Persistent maintains persistent connections across all the
22
22
  # servers you wish to talk to. For each host:port you communicate with a
23
23
  # single persistent connection is created.
24
24
  #
25
- # Multiple Net::HTTP::Persistent objects will share the same set of
25
+ # Multiple Bundler::Persistent::Net::HTTP::Persistent objects will share the same set of
26
26
  # connections.
27
27
  #
28
28
  # For each thread you start a new connection will be created. A
29
- # Net::HTTP::Persistent connection will not be shared across threads.
29
+ # Bundler::Persistent::Net::HTTP::Persistent connection will not be shared across threads.
30
30
  #
31
31
  # You can shut down the HTTP connections when done by calling #shutdown. You
32
- # should name your Net::HTTP::Persistent object if you intend to call this
32
+ # should name your Bundler::Persistent::Net::HTTP::Persistent object if you intend to call this
33
33
  # method.
34
34
  #
35
35
  # Example:
36
36
  #
37
- # require 'net/http/persistent'
37
+ # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
38
38
  #
39
39
  # uri = URI 'http://example.com/awesome/web/service'
40
40
  #
41
- # http = Net::HTTP::Persistent.new 'my_app_name'
41
+ # http = Bundler::Persistent::Net::HTTP::Persistent.new 'my_app_name'
42
42
  #
43
43
  # # perform a GET
44
44
  # response = http.request uri
@@ -149,19 +149,19 @@ autoload :OpenSSL, 'openssl'
149
149
  #
150
150
  # The recommended way to handle non-idempotent requests is the following:
151
151
  #
152
- # require 'net/http/persistent'
152
+ # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
153
153
  #
154
154
  # uri = URI 'http://example.com/awesome/web/service'
155
155
  # post_uri = uri + 'create'
156
156
  #
157
- # http = Net::HTTP::Persistent.new 'my_app_name'
157
+ # http = Bundler::Persistent::Net::HTTP::Persistent.new 'my_app_name'
158
158
  #
159
159
  # post = Net::HTTP::Post.new post_uri.path
160
160
  # # ... fill in POST request
161
161
  #
162
162
  # begin
163
163
  # response = http.request post_uri, post
164
- # rescue Net::HTTP::Persistent::Error
164
+ # rescue Bundler::Persistent::Net::HTTP::Persistent::Error
165
165
  #
166
166
  # # POST failed, make a new request to verify the server did not process
167
167
  # # the request
@@ -178,7 +178,7 @@ autoload :OpenSSL, 'openssl'
178
178
  #
179
179
  # === Connection Termination
180
180
  #
181
- # If you are done using the Net::HTTP::Persistent instance you may shut down
181
+ # If you are done using the Bundler::Persistent::Net::HTTP::Persistent instance you may shut down
182
182
  # all the connections in the current thread with #shutdown. This is not
183
183
  # recommended for normal use, it should only be used when it will be several
184
184
  # minutes before you make another HTTP request.
@@ -188,7 +188,7 @@ autoload :OpenSSL, 'openssl'
188
188
  # Ruby will automatically garbage collect and shutdown your HTTP connections
189
189
  # when the thread terminates.
190
190
 
191
- class Net::HTTP::Persistent
191
+ class Bundler::Persistent::Net::HTTP::Persistent
192
192
 
193
193
  ##
194
194
  # The beginning of Time
@@ -201,9 +201,9 @@ class Net::HTTP::Persistent
201
201
  HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
202
202
 
203
203
  ##
204
- # The version of Net::HTTP::Persistent you are using
204
+ # The version of Bundler::Persistent::Net::HTTP::Persistent you are using
205
205
 
206
- VERSION = '2.9.3'
206
+ VERSION = '2.9.4'
207
207
 
208
208
  ##
209
209
  # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
@@ -221,7 +221,7 @@ class Net::HTTP::Persistent
221
221
  ].compact
222
222
 
223
223
  ##
224
- # Error class for errors raised by Net::HTTP::Persistent. Various
224
+ # Error class for errors raised by Bundler::Persistent::Net::HTTP::Persistent. Various
225
225
  # SystemCallErrors are re-raised with a human-readable message under this
226
226
  # class.
227
227
 
@@ -241,7 +241,7 @@ class Net::HTTP::Persistent
241
241
  # NOTE: This may not work on ruby > 1.9.
242
242
 
243
243
  def self.detect_idle_timeout uri, max = 10
244
- uri = URI uri unless uri.is_a?(URI::Generic)
244
+ uri = URI uri unless URI::Generic === uri
245
245
  uri += '/'
246
246
 
247
247
  req = Net::HTTP::Head.new uri.request_uri
@@ -257,7 +257,7 @@ class Net::HTTP::Persistent
257
257
 
258
258
  $stderr.puts "HEAD #{uri} => #{response.code}" if $DEBUG
259
259
 
260
- unless response.is_a?(Net::HTTPOK) then
260
+ unless Net::HTTPOK === response then
261
261
  raise Error, "bad response code #{response.code} detecting idle timeout"
262
262
  end
263
263
 
@@ -463,7 +463,7 @@ class Net::HTTP::Persistent
463
463
  attr_accessor :retry_change_requests
464
464
 
465
465
  ##
466
- # Creates a new Net::HTTP::Persistent.
466
+ # Creates a new Bundler::Persistent::Net::HTTP::Persistent.
467
467
  #
468
468
  # Set +name+ to keep your connections apart from everybody else's. Not
469
469
  # required currently, but highly recommended. Your library name should be
@@ -594,7 +594,7 @@ class Net::HTTP::Persistent
594
594
  use_ssl = uri.scheme.downcase == 'https'
595
595
 
596
596
  if use_ssl then
597
- raise Net::HTTP::Persistent::Error, 'OpenSSL is not available' unless
597
+ raise Bundler::Persistent::Net::HTTP::Persistent::Error, 'OpenSSL is not available' unless
598
598
  HAVE_OPENSSL
599
599
 
600
600
  ssl_generation = @ssl_generation
@@ -728,7 +728,7 @@ class Net::HTTP::Persistent
728
728
  } or not @reuse_ssl_sessions then
729
729
  Net::HTTP
730
730
  else
731
- Net::HTTP::Persistent::SSLReuse
731
+ Bundler::Persistent::Net::HTTP::Persistent::SSLReuse
732
732
  end
733
733
  end
734
734
 
@@ -1065,7 +1065,7 @@ class Net::HTTP::Persistent
1065
1065
  # Returns the request.
1066
1066
 
1067
1067
  def request_setup req_or_uri # :nodoc:
1068
- req = if req_or_uri.is_a?(URI) then
1068
+ req = if URI === req_or_uri then
1069
1069
  Net::HTTP::Get.new req_or_uri.request_uri
1070
1070
  else
1071
1071
  req_or_uri
@@ -1092,7 +1092,7 @@ class Net::HTTP::Persistent
1092
1092
  #
1093
1093
  # Uses the current thread by default.
1094
1094
  #
1095
- # If you've used Net::HTTP::Persistent across multiple threads you should
1095
+ # If you've used Bundler::Persistent::Net::HTTP::Persistent across multiple threads you should
1096
1096
  # call this in each thread when you're done making HTTP requests.
1097
1097
  #
1098
1098
  # *NOTE*: Calling shutdown for another thread can be dangerous!
@@ -1227,4 +1227,5 @@ application:
1227
1227
 
1228
1228
  end
1229
1229
 
1230
- require 'net/http/persistent/ssl_reuse'
1230
+ require 'bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse'
1231
+