bundler 1.5.3 → 1.6.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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +14 -11
  3. data/CHANGELOG.md +10 -3
  4. data/CONTRIBUTING.md +21 -12
  5. data/DEVELOPMENT.md +2 -2
  6. data/README.md +3 -2
  7. data/Rakefile +19 -9
  8. data/bundler.gemspec +1 -1
  9. data/lib/bundler.rb +9 -5
  10. data/lib/bundler/cli.rb +51 -10
  11. data/lib/bundler/dsl.rb +10 -6
  12. data/lib/bundler/friendly_errors.rb +1 -1
  13. data/lib/bundler/installer.rb +28 -17
  14. data/lib/bundler/parallel_workers/worker.rb +1 -1
  15. data/lib/bundler/resolver.rb +191 -207
  16. data/lib/bundler/rubygems_ext.rb +2 -4
  17. data/lib/bundler/rubygems_integration.rb +5 -0
  18. data/lib/bundler/runtime.rb +15 -12
  19. data/lib/bundler/settings.rb +4 -2
  20. data/lib/bundler/source.rb +11 -1
  21. data/lib/bundler/source/git.rb +11 -7
  22. data/lib/bundler/source/git/git_proxy.rb +4 -7
  23. data/lib/bundler/source/path.rb +21 -12
  24. data/lib/bundler/source/path/installer.rb +1 -1
  25. data/lib/bundler/source/rubygems.rb +18 -8
  26. data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
  27. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  28. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -2
  29. data/lib/bundler/ui.rb +4 -141
  30. data/lib/bundler/ui/rg_proxy.rb +21 -0
  31. data/lib/bundler/ui/shell.rb +98 -0
  32. data/lib/bundler/ui/silent.rb +44 -0
  33. data/lib/bundler/vendor/net/http/faster.rb +0 -1
  34. data/lib/bundler/vendor/net/http/persistent.rb +0 -1
  35. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +0 -1
  36. data/lib/bundler/version.rb +1 -1
  37. data/spec/bundler/definition_spec.rb +2 -2
  38. data/spec/bundler/dsl_spec.rb +3 -3
  39. data/spec/bundler/gem_helper_spec.rb +5 -7
  40. data/spec/bundler/settings_spec.rb +15 -0
  41. data/spec/bundler/source_spec.rb +1 -1
  42. data/spec/commands/config_spec.rb +18 -0
  43. data/spec/commands/console_spec.rb +22 -0
  44. data/spec/commands/exec_spec.rb +1 -0
  45. data/spec/commands/newgem_spec.rb +2 -2
  46. data/spec/commands/open_spec.rb +13 -0
  47. data/spec/{install/gems/packed_spec.rb → commands/package_spec.rb} +30 -0
  48. data/spec/commands/show_spec.rb +87 -71
  49. data/spec/install/binstubs_spec.rb +1 -1
  50. data/spec/install/bundler_spec.rb +1 -1
  51. data/spec/install/gemfile/git_spec.rb +1 -1
  52. data/spec/install/gemfile/path_spec.rb +12 -0
  53. data/spec/install/gemfile_spec.rb +1 -1
  54. data/spec/install/gems/groups_spec.rb +1 -1
  55. data/spec/install/gems/platform_spec.rb +0 -1
  56. data/spec/install/gems/post_install_spec.rb +74 -0
  57. data/spec/install/gems/resolving_spec.rb +22 -26
  58. data/spec/install/gems/simple_case_spec.rb +17 -1
  59. data/spec/install/gemspecs_spec.rb +1 -1
  60. data/spec/install/path_spec.rb +1 -1
  61. data/spec/install/prereleases_spec.rb +1 -1
  62. data/spec/other/ext_spec.rb +1 -1
  63. data/spec/other/ssl_cert_spec.rb +10 -0
  64. data/spec/realworld/edgecases_spec.rb +1 -1
  65. data/spec/resolver/basic_spec.rb +29 -0
  66. data/spec/support/builders.rb +42 -43
  67. data/spec/support/indexes.rb +129 -1
  68. data/spec/support/permissions.rb +1 -0
  69. data/spec/update/gems_spec.rb +37 -0
  70. data/spec/update/git_spec.rb +24 -1
  71. data/spec/update/source_spec.rb +14 -1
  72. metadata +14 -9
  73. data/lib/bundler/safe_catch.rb +0 -101
  74. data/spec/bundler/safe_catch_spec.rb +0 -37
@@ -1,101 +0,0 @@
1
- # SafeCatch provides a mechanism to safely deepen the stack, performing
2
- # stack-unrolling similar to catch/throw, but using Fiber or Thread to avoid
3
- # deepening the stack too quickly.
4
- #
5
- # The API is the same as that of catch/throw: SafeCatch#safe_catch takes a "tag"
6
- # to be rescued when some code deeper in the process raises it. If the catch
7
- # block completes successfully, that value is returned. If the tag is "thrown"
8
- # by safe_throw, the tag's value is returned. Other exceptions propagate out as
9
- # normal.
10
- #
11
- # The implementation, however, uses fibers or threads along with raise/rescue to
12
- # handle "deepening" the stack and unrolling it. On implementations where Fiber
13
- # is available, it will be used. If Fiber is not available, Thread will be used.
14
- # If neither of these classes are available, Proc will be used, effectively
15
- # deepening the stack for each recursion as in normal catch/throw.
16
- #
17
- # In order to avoid causing a new issue of creating too many fibers or threads,
18
- # especially on implementations where fibers are actually backed by native
19
- # threads, the "safe" recursion mechanism is only used every 20 recursions.
20
- # Based on experiments with JRuby (which seems to suffer the most from
21
- # excessively deep stacks), this appears to be a sufficient granularity to
22
- # prevent stack overflow without spinning up excessive numbers of fibers or
23
- # threads. This value can be adjusted with the BUNDLER_SAFE_RECURSE_EVERY env
24
- # var; setting it to zero effectively disables safe recursion.
25
-
26
- module Bundler
27
- module SafeCatch
28
- def safe_catch(tag, &block)
29
- if Bundler.current_ruby.jruby?
30
- Internal.catch(tag, &block)
31
- else
32
- catch(tag, &block)
33
- end
34
- end
35
-
36
- def safe_throw(tag, value = nil)
37
- if Bundler.current_ruby.jruby?
38
- Internal.throw(tag, value)
39
- else
40
- throw(tag, value)
41
- end
42
- end
43
-
44
- module Internal
45
- SAFE_RECURSE_EVERY = (ENV['BUNDLER_SAFE_RECURSE_EVERY'] || 20).to_i
46
-
47
- SAFE_RECURSE_CLASS, SAFE_RECURSE_START = case
48
- when defined?(Fiber)
49
- [Fiber, :resume]
50
- when defined?(Thread)
51
- [Thread, :join]
52
- else
53
- [Proc, :call]
54
- end
55
-
56
- @recurse_count = 0
57
-
58
- def self.catch(tag, &block)
59
- @recurse_count += 1
60
- if SAFE_RECURSE_EVERY >= 0 && @recurse_count % SAFE_RECURSE_EVERY == 0
61
- SAFE_RECURSE_CLASS.new(&block).send(SAFE_RECURSE_START)
62
- else
63
- block.call
64
- end
65
- rescue Result.matcher(tag)
66
- $!.value
67
- end
68
-
69
- def self.throw(tag, value = nil)
70
- raise Result.new(tag, value)
71
- end
72
-
73
- class Result < StopIteration
74
- def initialize(tag, value)
75
- @tag = tag
76
- @value = value
77
- end
78
-
79
- attr_reader :tag, :value
80
-
81
- # The Matcher class is never instantiated; it is dup'ed and used as a
82
- # rescue-clause argument to match Result exceptions based on their tags.
83
- module Matcher
84
- class << self
85
- attr_accessor :tag
86
-
87
- def ===(other)
88
- other.respond_to? :tag and @tag.equal? other.tag
89
- end
90
- end
91
- end
92
-
93
- def self.matcher(tag)
94
- matcher = Matcher.dup
95
- matcher.tag = tag
96
- matcher
97
- end
98
- end
99
- end
100
- end
101
- end
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
- require 'bundler'
4
- require 'bundler/safe_catch'
5
- require 'bundler/current_ruby'
6
-
7
- class RecursiveTmpResolver
8
- include Bundler::SafeCatch
9
- end
10
-
11
- describe Bundler::SafeCatch do
12
- let(:resolver) { RecursiveTmpResolver.new() }
13
-
14
- it "should use safe_catch on jruby" do
15
- if Bundler.current_ruby.jruby?
16
- expect(Bundler::SafeCatch::Internal).to receive(:catch).and_call_original
17
- expect(Bundler::SafeCatch::Internal).to receive(:throw).and_call_original
18
-
19
- retval = resolver.safe_catch(:resolve) do
20
- resolver.safe_throw(:resolve, "good bye world")
21
- end
22
- expect(retval).to eq("good bye world")
23
- end
24
- end
25
-
26
- it "should use regular catch/throw on MRI" do
27
- if Bundler.current_ruby.mri?
28
- expect(Bundler::SafeCatch::Internal).to_not receive(:catch)
29
- expect(Bundler::SafeCatch::Internal).to_not receive(:throw)
30
-
31
- retval = resolver.safe_catch(:resolve) do
32
- resolver.safe_throw(:resolve, "good bye world")
33
- end
34
- expect(retval).to eq("good bye world")
35
- end
36
- end
37
- end