bundler 2.0.1 → 2.1.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +788 -572
- data/LICENSE.md +18 -19
- data/README.md +9 -8
- data/bundler.gemspec +8 -25
- data/exe/bundle +19 -3
- data/lib/bundler.rb +202 -87
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/capistrano.rb +5 -5
- data/lib/bundler/cli.rb +182 -144
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/cache.rb +25 -13
- data/lib/bundler/cli/common.rb +11 -12
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +4 -16
- data/lib/bundler/cli/gem.rb +5 -5
- data/lib/bundler/cli/info.rb +17 -5
- data/lib/bundler/cli/init.rb +1 -1
- data/lib/bundler/cli/install.rb +15 -13
- data/lib/bundler/cli/issue.rb +3 -3
- data/lib/bundler/cli/open.rb +10 -6
- data/lib/bundler/cli/outdated.rb +85 -81
- data/lib/bundler/cli/plugin.rb +9 -2
- data/lib/bundler/cli/pristine.rb +1 -1
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +31 -11
- data/lib/bundler/compact_index_client.rb +25 -9
- data/lib/bundler/compact_index_client/updater.rb +2 -6
- data/lib/bundler/current_ruby.rb +8 -7
- data/lib/bundler/definition.rb +36 -27
- data/lib/bundler/dependency.rb +16 -4
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/dsl.rb +19 -43
- data/lib/bundler/env.rb +8 -13
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +2 -14
- data/lib/bundler/fetcher.rb +16 -13
- data/lib/bundler/fetcher/compact_index.rb +26 -12
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +5 -2
- data/lib/bundler/fetcher/index.rb +5 -3
- data/lib/bundler/friendly_errors.rb +6 -7
- data/lib/bundler/gem_helper.rb +39 -25
- data/lib/bundler/gem_helpers.rb +2 -4
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +3 -3
- data/lib/bundler/graph.rb +2 -2
- data/lib/bundler/injector.rb +10 -8
- data/lib/bundler/inline.rb +40 -30
- data/lib/bundler/installer.rb +7 -14
- data/lib/bundler/installer/gem_installer.rb +5 -1
- data/lib/bundler/installer/parallel_installer.rb +4 -8
- data/lib/bundler/installer/standalone.rb +1 -2
- data/lib/bundler/lazy_specification.rb +2 -3
- data/lib/bundler/lockfile_parser.rb +14 -21
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +3 -3
- data/lib/bundler/plugin.rb +42 -29
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +4 -6
- data/lib/bundler/plugin/index.rb +14 -3
- data/lib/bundler/plugin/installer.rb +28 -15
- data/lib/bundler/psyched_yaml.rb +1 -1
- data/lib/bundler/remote_specification.rb +0 -2
- data/lib/bundler/resolver.rb +72 -24
- data/lib/bundler/resolver/spec_group.rb +3 -2
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_version.rb +4 -19
- data/lib/bundler/rubygems_ext.rb +11 -67
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +149 -399
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +22 -52
- data/lib/bundler/setup.rb +11 -12
- data/lib/bundler/shared_helpers.rb +51 -77
- data/lib/bundler/similarity_detector.rb +2 -2
- data/lib/bundler/source.rb +5 -5
- data/lib/bundler/source/git.rb +24 -17
- data/lib/bundler/source/git/git_proxy.rb +38 -41
- data/lib/bundler/source/metadata.rb +7 -2
- data/lib/bundler/source/path.rb +13 -8
- data/lib/bundler/source/rubygems.rb +14 -8
- data/lib/bundler/source/rubygems/remote.rb +2 -3
- data/lib/bundler/source_list.rb +9 -12
- data/lib/bundler/spec_set.rb +1 -6
- data/lib/bundler/stub_specification.rb +18 -30
- data/lib/bundler/templates/Executable.bundler +23 -14
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -27
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +1 -1
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +4 -8
- data/lib/bundler/uri_credentials_filter.rb +7 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +270 -323
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +19 -4
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +27 -12
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +16 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/base.rb +54 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +20 -5
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +62 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -5
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +3 -3
- data/lib/bundler/worker.rb +1 -3
- data/lib/bundler/yaml_serializer.rb +2 -3
- data/man/bundle-add.1 +10 -2
- data/man/bundle-add.1.txt +11 -5
- data/man/bundle-add.ronn +7 -1
- data/man/bundle-binstubs.1 +2 -2
- data/man/bundle-binstubs.1.txt +2 -2
- data/man/bundle-binstubs.ronn +1 -1
- data/man/bundle-cache.1 +55 -0
- data/man/bundle-cache.1.txt +78 -0
- data/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
- data/man/bundle-check.1 +1 -1
- data/man/bundle-check.1.txt +6 -6
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +1 -1
- data/man/bundle-config.1 +36 -36
- data/man/bundle-config.1.txt +66 -67
- data/man/bundle-config.ronn +42 -40
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +2 -2
- data/man/bundle-exec.1.txt +2 -2
- data/man/bundle-exec.ronn +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-gem.1.txt +3 -3
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +1 -1
- data/man/bundle-init.1 +2 -2
- data/man/bundle-init.1.txt +2 -2
- data/man/bundle-init.ronn +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +8 -5
- data/man/bundle-install.1.txt +56 -51
- data/man/bundle-install.ronn +9 -4
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +16 -16
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +4 -4
- data/man/bundle-update.1.txt +64 -65
- data/man/bundle-update.ronn +3 -3
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +3 -3
- data/man/bundle.1.txt +8 -8
- data/man/bundle.ronn +2 -2
- data/man/gemfile.5 +13 -16
- data/man/gemfile.5.ronn +10 -14
- data/man/gemfile.5.txt +104 -108
- data/man/index.txt +1 -1
- metadata +33 -108
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/ssl_certs/.document +0 -1
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
data/lib/bundler/source_list.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "set"
|
4
|
+
|
3
5
|
module Bundler
|
4
6
|
class SourceList
|
5
7
|
attr_reader :path_sources,
|
@@ -41,17 +43,14 @@ module Bundler
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def global_rubygems_source=(uri)
|
44
|
-
if Bundler.feature_flag.
|
46
|
+
if Bundler.feature_flag.disable_multisource?
|
45
47
|
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
|
46
48
|
end
|
47
49
|
add_rubygems_remote(uri)
|
48
50
|
end
|
49
51
|
|
50
52
|
def add_rubygems_remote(uri)
|
51
|
-
if Bundler.feature_flag.
|
52
|
-
return if Bundler.feature_flag.disable_multisource?
|
53
|
-
raise InvalidOption, "`lockfile_uses_separate_rubygems_sources` cannot be set without `disable_multisource` being set"
|
54
|
-
end
|
53
|
+
return if Bundler.feature_flag.disable_multisource?
|
55
54
|
@rubygems_aggregate.add_remote(uri)
|
56
55
|
@rubygems_aggregate
|
57
56
|
end
|
@@ -77,12 +76,10 @@ module Bundler
|
|
77
76
|
end
|
78
77
|
|
79
78
|
def lock_sources
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end.flatten(1)
|
79
|
+
lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
80
|
+
if Bundler.feature_flag.disable_multisource?
|
81
|
+
lock_sources + rubygems_sources.sort_by(&:to_s)
|
84
82
|
else
|
85
|
-
lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
86
83
|
lock_sources << combine_rubygems_sources
|
87
84
|
end
|
88
85
|
end
|
@@ -97,7 +94,7 @@ module Bundler
|
|
97
94
|
end
|
98
95
|
end
|
99
96
|
|
100
|
-
replacement_rubygems = !Bundler.feature_flag.
|
97
|
+
replacement_rubygems = !Bundler.feature_flag.disable_multisource? &&
|
101
98
|
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
|
102
99
|
@rubygems_aggregate = replacement_rubygems if replacement_rubygems
|
103
100
|
|
@@ -150,7 +147,7 @@ module Bundler
|
|
150
147
|
if source.uri =~ /^git\:/
|
151
148
|
Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
|
152
149
|
"which transmits data without encryption. Disable this warning with " \
|
153
|
-
"`bundle config git.allow_insecure true`, or switch to the `https` " \
|
150
|
+
"`bundle config set git.allow_insecure true`, or switch to the `https` " \
|
154
151
|
"protocol to keep your data secure."
|
155
152
|
end
|
156
153
|
end
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -60,7 +60,6 @@ module Bundler
|
|
60
60
|
@specs << value
|
61
61
|
@lookup = nil
|
62
62
|
@sorted = nil
|
63
|
-
value
|
64
63
|
end
|
65
64
|
|
66
65
|
def sort!
|
@@ -163,11 +162,7 @@ module Bundler
|
|
163
162
|
end
|
164
163
|
|
165
164
|
def extract_circular_gems(error)
|
166
|
-
|
167
|
-
error.message.scan(/(\w+) \([^)]/).flatten
|
168
|
-
else
|
169
|
-
error.message.scan(/@name="(.*?)"/).flatten
|
170
|
-
end
|
165
|
+
error.message.scan(/@name="(.*?)"/).flatten
|
171
166
|
end
|
172
167
|
|
173
168
|
def lookup
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "remote_specification"
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class StubSpecification < RemoteSpecification
|
@@ -13,17 +13,13 @@ module Bundler
|
|
13
13
|
|
14
14
|
attr_accessor :stub, :ignored
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
return unless source.respond_to?(:extension_dir_name)
|
24
|
-
path = File.join(stub.extensions_dir, source.extension_dir_name)
|
25
|
-
stub.extension_dir = File.expand_path(path)
|
26
|
-
end
|
16
|
+
def source=(source)
|
17
|
+
super
|
18
|
+
# Stub has no concept of source, which means that extension_dir may be wrong
|
19
|
+
# This is the case for git-based gems. So, instead manually assign the extension dir
|
20
|
+
return unless source.respond_to?(:extension_dir_name)
|
21
|
+
path = File.join(stub.extensions_dir, source.extension_dir_name)
|
22
|
+
stub.extension_dir = File.expand_path(path)
|
27
23
|
end
|
28
24
|
|
29
25
|
def to_yaml
|
@@ -32,11 +28,9 @@ module Bundler
|
|
32
28
|
|
33
29
|
# @!group Stub Delegates
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
stub.missing_extensions?
|
39
|
-
end
|
31
|
+
# This is defined directly to avoid having to load every installed spec
|
32
|
+
def missing_extensions?
|
33
|
+
stub.missing_extensions?
|
40
34
|
end
|
41
35
|
|
42
36
|
def activated
|
@@ -57,26 +51,20 @@ module Bundler
|
|
57
51
|
stub.full_gem_path || method_missing(:full_gem_path)
|
58
52
|
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
54
|
+
def full_require_paths
|
55
|
+
stub.full_require_paths
|
56
|
+
end
|
64
57
|
|
65
|
-
|
66
|
-
|
67
|
-
def load_paths
|
68
|
-
full_require_paths
|
69
|
-
end
|
58
|
+
def load_paths
|
59
|
+
full_require_paths
|
70
60
|
end
|
71
61
|
|
72
62
|
def loaded_from
|
73
63
|
stub.loaded_from
|
74
64
|
end
|
75
65
|
|
76
|
-
|
77
|
-
|
78
|
-
stub.matches_for_glob(glob)
|
79
|
-
end
|
66
|
+
def matches_for_glob(glob)
|
67
|
+
stub.matches_for_glob(glob)
|
80
68
|
end
|
81
69
|
|
82
70
|
def raw_require_paths
|
@@ -11,7 +11,7 @@
|
|
11
11
|
require "rubygems"
|
12
12
|
|
13
13
|
m = Module.new do
|
14
|
-
|
14
|
+
module_function
|
15
15
|
|
16
16
|
def invoked_as_script?
|
17
17
|
File.expand_path($0) == File.expand_path(__FILE__)
|
@@ -31,7 +31,7 @@ m = Module.new do
|
|
31
31
|
bundler_version = a
|
32
32
|
end
|
33
33
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1
|
34
|
+
bundler_version = $1
|
35
35
|
update_index = i
|
36
36
|
end
|
37
37
|
bundler_version
|
@@ -61,32 +61,41 @@ m = Module.new do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def bundler_version
|
64
|
-
@bundler_version ||=
|
64
|
+
@bundler_version ||=
|
65
65
|
env_var_version || cli_arg_version ||
|
66
|
-
lockfile_version
|
67
|
-
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
68
81
|
end
|
69
82
|
|
70
83
|
def load_bundler!
|
71
84
|
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
85
|
|
73
|
-
|
74
|
-
activate_bundler(bundler_version.dup)
|
86
|
+
activate_bundler
|
75
87
|
end
|
76
88
|
|
77
|
-
def activate_bundler
|
78
|
-
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
-
bundler_version = "< 2"
|
80
|
-
end
|
89
|
+
def activate_bundler
|
81
90
|
gem_error = activation_error_handling do
|
82
|
-
gem "bundler",
|
91
|
+
gem "bundler", bundler_requirement
|
83
92
|
end
|
84
93
|
return if gem_error.nil?
|
85
94
|
require_error = activation_error_handling do
|
86
95
|
require "bundler/version"
|
87
96
|
end
|
88
|
-
return if require_error.nil? && Gem::Requirement.new(
|
89
|
-
warn "Activating bundler (#{
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
90
99
|
exit 42
|
91
100
|
end
|
92
101
|
|
@@ -68,7 +68,7 @@ members of the project's leadership.
|
|
68
68
|
## Attribution
|
69
69
|
|
70
70
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
72
|
|
73
|
-
[homepage]:
|
74
|
-
[version]:
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
@@ -2,3 +2,11 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in <%= config[:name] %>.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
gem "rake", "~> 12.0"
|
7
|
+
<%- if config[:ext] -%>
|
8
|
+
gem "rake-compiler"
|
9
|
+
<%- end -%>
|
10
|
+
<%- if config[:test] -%>
|
11
|
+
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
|
12
|
+
<%- end -%>
|
@@ -14,7 +14,7 @@ gem '<%= config[:name] %>'
|
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
-
$ bundle
|
17
|
+
$ bundle install
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
@@ -32,7 +32,8 @@ 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/<%= config[:github_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 [
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_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 [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).<% end %>
|
36
|
+
|
36
37
|
<% if config[:mit] -%>
|
37
38
|
|
38
39
|
## License
|
@@ -43,5 +44,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
43
44
|
|
44
45
|
## Code of Conduct
|
45
46
|
|
46
|
-
Everyone interacting in the <%= config[:constant_name] %> project
|
47
|
+
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).
|
47
48
|
<% end -%>
|
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
# coding: utf-8
|
3
|
-
<%- end -%>
|
4
|
-
|
5
|
-
lib = File.expand_path("../lib", __FILE__)
|
6
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
-
require "<%= config[:namespaced_path] %>/version"
|
1
|
+
require_relative 'lib/<%=config[:namespaced_path]%>/version'
|
8
2
|
|
9
3
|
Gem::Specification.new do |spec|
|
10
4
|
spec.name = <%= config[:name].inspect %>
|
@@ -18,19 +12,13 @@ Gem::Specification.new do |spec|
|
|
18
12
|
<%- if config[:mit] -%>
|
19
13
|
spec.license = "MIT"
|
20
14
|
<%- end -%>
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
21
16
|
|
22
|
-
|
23
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
24
|
-
if spec.respond_to?(:metadata)
|
25
|
-
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
17
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
else
|
31
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
32
|
-
"public gem pushes."
|
33
|
-
end
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
21
|
+
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
34
22
|
|
35
23
|
# Specify which files should be added to the gem when it is released.
|
36
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -43,13 +31,4 @@ Gem::Specification.new do |spec|
|
|
43
31
|
<%- if config[:ext] -%>
|
44
32
|
spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
|
45
33
|
<%- end -%>
|
46
|
-
|
47
|
-
spec.add_development_dependency "bundler", "~> <%= config[:bundler_version] %>"
|
48
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
49
|
-
<%- if config[:ext] -%>
|
50
|
-
spec.add_development_dependency "rake-compiler"
|
51
|
-
<%- end -%>
|
52
|
-
<%- if config[:test] -%>
|
53
|
-
spec.add_development_dependency "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
|
54
|
-
<%- end -%>
|
55
34
|
end
|
data/lib/bundler/ui.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
module UI
|
5
|
-
autoload :RGProxy, "
|
6
|
-
autoload :Shell, "
|
7
|
-
autoload :Silent, "
|
5
|
+
autoload :RGProxy, File.expand_path("ui/rg_proxy", __dir__)
|
6
|
+
autoload :Shell, File.expand_path("ui/shell", __dir__)
|
7
|
+
autoload :Silent, File.expand_path("ui/silent", __dir__)
|
8
8
|
end
|
9
9
|
end
|
data/lib/bundler/ui/rg_proxy.rb
CHANGED
data/lib/bundler/ui/shell.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../vendored_thor"
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
module UI
|
@@ -10,9 +10,7 @@ module Bundler
|
|
10
10
|
attr_writer :shell
|
11
11
|
|
12
12
|
def initialize(options = {})
|
13
|
-
|
14
|
-
Thor::Base.shell = Thor::Shell::Basic
|
15
|
-
end
|
13
|
+
Thor::Base.shell = options["no-color"] ? Thor::Shell::Basic : nil
|
16
14
|
@shell = Thor::Base.shell.new
|
17
15
|
@level = ENV["DEBUG"] ? "debug" : "info"
|
18
16
|
@warning_history = []
|
@@ -35,14 +33,12 @@ module Bundler
|
|
35
33
|
return if @warning_history.include? msg
|
36
34
|
@warning_history << msg
|
37
35
|
|
38
|
-
|
39
|
-
tell_me(msg, :yellow, newline)
|
36
|
+
tell_err(msg, :yellow, newline)
|
40
37
|
end
|
41
38
|
|
42
39
|
def error(msg, newline = nil)
|
43
40
|
return unless level("error")
|
44
|
-
|
45
|
-
tell_me(msg, :red, newline)
|
41
|
+
tell_err(msg, :red, newline)
|
46
42
|
end
|
47
43
|
|
48
44
|
def debug(msg, newline = nil)
|
@@ -7,7 +7,11 @@ module Bundler
|
|
7
7
|
def credential_filtered_uri(uri_to_anonymize)
|
8
8
|
return uri_to_anonymize if uri_to_anonymize.nil?
|
9
9
|
uri = uri_to_anonymize.dup
|
10
|
-
|
10
|
+
if uri.is_a?(String)
|
11
|
+
require_relative "vendored_uri"
|
12
|
+
uri = Bundler::URI(uri)
|
13
|
+
end
|
14
|
+
|
11
15
|
if uri.userinfo
|
12
16
|
# oauth authentication
|
13
17
|
if uri.password == "x-oauth-basic" || uri.password == "x"
|
@@ -17,9 +21,9 @@ module Bundler
|
|
17
21
|
end
|
18
22
|
uri.password = nil
|
19
23
|
end
|
20
|
-
return uri if uri_to_anonymize.is_a?(URI)
|
21
24
|
return uri.to_s if uri_to_anonymize.is_a?(String)
|
22
|
-
|
25
|
+
uri
|
26
|
+
rescue Bundler::URI::InvalidURIError # uri is not canonical uri scheme
|
23
27
|
uri
|
24
28
|
end
|
25
29
|
|
@@ -0,0 +1,161 @@
|
|
1
|
+
require_relative 'connection_pool/version'
|
2
|
+
require_relative 'connection_pool/timed_stack'
|
3
|
+
|
4
|
+
|
5
|
+
# Generic connection pool class for e.g. sharing a limited number of network connections
|
6
|
+
# among many threads. Note: Connections are lazily created.
|
7
|
+
#
|
8
|
+
# Example usage with block (faster):
|
9
|
+
#
|
10
|
+
# @pool = Bundler::ConnectionPool.new { Redis.new }
|
11
|
+
#
|
12
|
+
# @pool.with do |redis|
|
13
|
+
# redis.lpop('my-list') if redis.llen('my-list') > 0
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Using optional timeout override (for that single invocation)
|
17
|
+
#
|
18
|
+
# @pool.with(timeout: 2.0) do |redis|
|
19
|
+
# redis.lpop('my-list') if redis.llen('my-list') > 0
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# Example usage replacing an existing connection (slower):
|
23
|
+
#
|
24
|
+
# $redis = Bundler::ConnectionPool.wrap { Redis.new }
|
25
|
+
#
|
26
|
+
# def do_work
|
27
|
+
# $redis.lpop('my-list') if $redis.llen('my-list') > 0
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# Accepts the following options:
|
31
|
+
# - :size - number of connections to pool, defaults to 5
|
32
|
+
# - :timeout - amount of time to wait for a connection if none currently available, defaults to 5 seconds
|
33
|
+
#
|
34
|
+
class Bundler::ConnectionPool
|
35
|
+
DEFAULTS = {size: 5, timeout: 5}
|
36
|
+
|
37
|
+
class Error < RuntimeError
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.wrap(options, &block)
|
41
|
+
Wrapper.new(options, &block)
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(options = {}, &block)
|
45
|
+
raise ArgumentError, 'Connection pool requires a block' unless block
|
46
|
+
|
47
|
+
options = DEFAULTS.merge(options)
|
48
|
+
|
49
|
+
@size = options.fetch(:size)
|
50
|
+
@timeout = options.fetch(:timeout)
|
51
|
+
|
52
|
+
@available = TimedStack.new(@size, &block)
|
53
|
+
@key = :"current-#{@available.object_id}"
|
54
|
+
@key_count = :"current-#{@available.object_id}-count"
|
55
|
+
end
|
56
|
+
|
57
|
+
if Thread.respond_to?(:handle_interrupt)
|
58
|
+
|
59
|
+
# MRI
|
60
|
+
def with(options = {})
|
61
|
+
Thread.handle_interrupt(Exception => :never) do
|
62
|
+
conn = checkout(options)
|
63
|
+
begin
|
64
|
+
Thread.handle_interrupt(Exception => :immediate) do
|
65
|
+
yield conn
|
66
|
+
end
|
67
|
+
ensure
|
68
|
+
checkin
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
else
|
74
|
+
|
75
|
+
# jruby 1.7.x
|
76
|
+
def with(options = {})
|
77
|
+
conn = checkout(options)
|
78
|
+
begin
|
79
|
+
yield conn
|
80
|
+
ensure
|
81
|
+
checkin
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def checkout(options = {})
|
88
|
+
if ::Thread.current[@key]
|
89
|
+
::Thread.current[@key_count]+= 1
|
90
|
+
::Thread.current[@key]
|
91
|
+
else
|
92
|
+
::Thread.current[@key_count]= 1
|
93
|
+
::Thread.current[@key]= @available.pop(options[:timeout] || @timeout)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def checkin
|
98
|
+
if ::Thread.current[@key]
|
99
|
+
if ::Thread.current[@key_count] == 1
|
100
|
+
@available.push(::Thread.current[@key])
|
101
|
+
::Thread.current[@key]= nil
|
102
|
+
else
|
103
|
+
::Thread.current[@key_count]-= 1
|
104
|
+
end
|
105
|
+
else
|
106
|
+
raise Bundler::ConnectionPool::Error, 'no connections are checked out'
|
107
|
+
end
|
108
|
+
|
109
|
+
nil
|
110
|
+
end
|
111
|
+
|
112
|
+
def shutdown(&block)
|
113
|
+
@available.shutdown(&block)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Size of this connection pool
|
117
|
+
def size
|
118
|
+
@size
|
119
|
+
end
|
120
|
+
|
121
|
+
# Number of pool entries available for checkout at this instant.
|
122
|
+
def available
|
123
|
+
@available.length
|
124
|
+
end
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
class Wrapper < ::BasicObject
|
129
|
+
METHODS = [:with, :pool_shutdown]
|
130
|
+
|
131
|
+
def initialize(options = {}, &block)
|
132
|
+
@pool = options.fetch(:pool) { ::Bundler::ConnectionPool.new(options, &block) }
|
133
|
+
end
|
134
|
+
|
135
|
+
def with(&block)
|
136
|
+
@pool.with(&block)
|
137
|
+
end
|
138
|
+
|
139
|
+
def pool_shutdown(&block)
|
140
|
+
@pool.shutdown(&block)
|
141
|
+
end
|
142
|
+
|
143
|
+
def pool_size
|
144
|
+
@pool.size
|
145
|
+
end
|
146
|
+
|
147
|
+
def pool_available
|
148
|
+
@pool.available
|
149
|
+
end
|
150
|
+
|
151
|
+
def respond_to?(id, *args)
|
152
|
+
METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
|
153
|
+
end
|
154
|
+
|
155
|
+
def method_missing(name, *args, &block)
|
156
|
+
with do |connection|
|
157
|
+
connection.send(name, *args, &block)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|