bundler 2.0.2
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 +7 -0
- data/CHANGELOG.md +3111 -0
- data/LICENSE.md +23 -0
- data/README.md +63 -0
- data/bundler.gemspec +65 -0
- data/exe/bundle +31 -0
- data/exe/bundle_ruby +60 -0
- data/exe/bundler +4 -0
- data/lib/bundler.rb +567 -0
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +22 -0
- data/lib/bundler/cli.rb +792 -0
- data/lib/bundler/cli/add.rb +35 -0
- data/lib/bundler/cli/binstubs.rb +49 -0
- data/lib/bundler/cli/cache.rb +36 -0
- data/lib/bundler/cli/check.rb +38 -0
- data/lib/bundler/cli/clean.rb +25 -0
- data/lib/bundler/cli/common.rb +102 -0
- data/lib/bundler/cli/config.rb +119 -0
- data/lib/bundler/cli/console.rb +43 -0
- data/lib/bundler/cli/doctor.rb +140 -0
- data/lib/bundler/cli/exec.rb +105 -0
- data/lib/bundler/cli/gem.rb +252 -0
- data/lib/bundler/cli/info.rb +50 -0
- data/lib/bundler/cli/init.rb +47 -0
- data/lib/bundler/cli/inject.rb +60 -0
- data/lib/bundler/cli/install.rb +218 -0
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +63 -0
- data/lib/bundler/cli/open.rb +26 -0
- data/lib/bundler/cli/outdated.rb +266 -0
- data/lib/bundler/cli/package.rb +49 -0
- data/lib/bundler/cli/platform.rb +46 -0
- data/lib/bundler/cli/plugin.rb +24 -0
- data/lib/bundler/cli/pristine.rb +47 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +75 -0
- data/lib/bundler/cli/update.rb +91 -0
- data/lib/bundler/cli/viz.rb +31 -0
- data/lib/bundler/compact_index_client.rb +109 -0
- data/lib/bundler/compact_index_client/cache.rb +118 -0
- data/lib/bundler/compact_index_client/updater.rb +116 -0
- data/lib/bundler/compatibility_guard.rb +13 -0
- data/lib/bundler/constants.rb +7 -0
- data/lib/bundler/current_ruby.rb +94 -0
- data/lib/bundler/definition.rb +995 -0
- data/lib/bundler/dep_proxy.rb +48 -0
- data/lib/bundler/dependency.rb +139 -0
- data/lib/bundler/deployment.rb +69 -0
- data/lib/bundler/deprecate.rb +44 -0
- data/lib/bundler/dsl.rb +615 -0
- data/lib/bundler/endpoint_specification.rb +141 -0
- data/lib/bundler/env.rb +149 -0
- data/lib/bundler/environment_preserver.rb +59 -0
- data/lib/bundler/errors.rb +158 -0
- data/lib/bundler/feature_flag.rb +75 -0
- data/lib/bundler/fetcher.rb +312 -0
- data/lib/bundler/fetcher/base.rb +52 -0
- data/lib/bundler/fetcher/compact_index.rb +126 -0
- data/lib/bundler/fetcher/dependency.rb +82 -0
- data/lib/bundler/fetcher/downloader.rb +84 -0
- data/lib/bundler/fetcher/index.rb +52 -0
- data/lib/bundler/friendly_errors.rb +131 -0
- data/lib/bundler/gem_helper.rb +217 -0
- data/lib/bundler/gem_helpers.rb +101 -0
- data/lib/bundler/gem_remote_fetcher.rb +43 -0
- data/lib/bundler/gem_tasks.rb +7 -0
- data/lib/bundler/gem_version_promoter.rb +190 -0
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +152 -0
- data/lib/bundler/index.rb +213 -0
- data/lib/bundler/injector.rb +253 -0
- data/lib/bundler/inline.rb +74 -0
- data/lib/bundler/installer.rb +318 -0
- data/lib/bundler/installer/gem_installer.rb +85 -0
- data/lib/bundler/installer/parallel_installer.rb +229 -0
- data/lib/bundler/installer/standalone.rb +53 -0
- data/lib/bundler/lazy_specification.rb +123 -0
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +256 -0
- data/lib/bundler/match_platform.rb +24 -0
- data/lib/bundler/mirror.rb +223 -0
- data/lib/bundler/plugin.rb +294 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/api/source.rb +306 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +165 -0
- data/lib/bundler/plugin/installer.rb +96 -0
- data/lib/bundler/plugin/installer/git.rb +38 -0
- data/lib/bundler/plugin/installer/rubygems.rb +27 -0
- data/lib/bundler/plugin/source_list.rb +27 -0
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +37 -0
- data/lib/bundler/remote_specification.rb +114 -0
- data/lib/bundler/resolver.rb +373 -0
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/retry.rb +66 -0
- data/lib/bundler/ruby_dsl.rb +18 -0
- data/lib/bundler/ruby_version.rb +152 -0
- data/lib/bundler/rubygems_ext.rb +209 -0
- data/lib/bundler/rubygems_gem_installer.rb +99 -0
- data/lib/bundler/rubygems_integration.rb +915 -0
- data/lib/bundler/runtime.rb +322 -0
- data/lib/bundler/settings.rb +464 -0
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +28 -0
- data/lib/bundler/shared_helpers.rb +386 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +94 -0
- data/lib/bundler/source/gemspec.rb +18 -0
- data/lib/bundler/source/git.rb +329 -0
- data/lib/bundler/source/git/git_proxy.rb +262 -0
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path.rb +249 -0
- data/lib/bundler/source/path/installer.rb +74 -0
- data/lib/bundler/source/rubygems.rb +539 -0
- data/lib/bundler/source/rubygems/remote.rb +69 -0
- data/lib/bundler/source_list.rb +186 -0
- data/lib/bundler/spec_set.rb +208 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +66 -0
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
- data/lib/bundler/stub_specification.rb +108 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +29 -0
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Executable.standalone +14 -0
- data/lib/bundler/templates/Gemfile +7 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/lib/bundler/templates/newgem/README.md.tt +47 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +29 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +20 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +13 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +50 -0
- data/lib/bundler/templates/newgem/rspec.tt +3 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +14 -0
- data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +8 -0
- data/lib/bundler/templates/newgem/travis.yml.tt +7 -0
- data/lib/bundler/ui.rb +9 -0
- data/lib/bundler/ui/rg_proxy.rb +19 -0
- data/lib/bundler/ui/shell.rb +146 -0
- data/lib/bundler/ui/silent.rb +69 -0
- data/lib/bundler/uri_credentials_filter.rb +37 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1741 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +12 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +81 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +223 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +136 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +143 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +101 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +67 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +837 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +46 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +58 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1233 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +129 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +509 -0
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +331 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +104 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +60 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +373 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +109 -0
- data/lib/bundler/vendor/thor/lib/thor/base.rb +678 -0
- data/lib/bundler/vendor/thor/lib/thor/command.rb +135 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +97 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +12 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +129 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +114 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +177 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +70 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +146 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +226 -0
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +324 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +482 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/lib/thor/util.rb +268 -0
- data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +4 -0
- data/lib/bundler/vendored_persistent.rb +52 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +28 -0
- data/lib/bundler/version_ranges.rb +76 -0
- data/lib/bundler/vlad.rb +17 -0
- data/lib/bundler/worker.rb +106 -0
- data/lib/bundler/yaml_serializer.rb +90 -0
- data/man/bundle-add.1 +58 -0
- data/man/bundle-add.1.txt +52 -0
- data/man/bundle-add.ronn +40 -0
- data/man/bundle-binstubs.1 +40 -0
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +43 -0
- data/man/bundle-check.1 +31 -0
- data/man/bundle-check.1.txt +33 -0
- data/man/bundle-check.ronn +26 -0
- data/man/bundle-clean.1 +24 -0
- data/man/bundle-clean.1.txt +26 -0
- data/man/bundle-clean.ronn +18 -0
- data/man/bundle-config.1 +497 -0
- data/man/bundle-config.1.txt +529 -0
- data/man/bundle-config.ronn +397 -0
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/man/bundle-exec.1 +165 -0
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +152 -0
- data/man/bundle-gem.1 +80 -0
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +78 -0
- data/man/bundle-info.1 +20 -0
- data/man/bundle-info.1.txt +21 -0
- data/man/bundle-info.ronn +17 -0
- data/man/bundle-init.1 +25 -0
- data/man/bundle-init.1.txt +34 -0
- data/man/bundle-init.ronn +29 -0
- data/man/bundle-inject.1 +33 -0
- data/man/bundle-inject.1.txt +32 -0
- data/man/bundle-inject.ronn +22 -0
- data/man/bundle-install.1 +308 -0
- data/man/bundle-install.1.txt +396 -0
- data/man/bundle-install.ronn +378 -0
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/man/bundle-lock.1 +84 -0
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-lock.ronn +94 -0
- data/man/bundle-open.1 +32 -0
- data/man/bundle-open.1.txt +29 -0
- data/man/bundle-open.ronn +19 -0
- data/man/bundle-outdated.1 +155 -0
- data/man/bundle-outdated.1.txt +131 -0
- data/man/bundle-outdated.ronn +111 -0
- data/man/bundle-package.1 +55 -0
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +72 -0
- data/man/bundle-platform.1 +61 -0
- data/man/bundle-platform.1.txt +57 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-pristine.1 +34 -0
- data/man/bundle-pristine.1.txt +44 -0
- data/man/bundle-pristine.ronn +34 -0
- data/man/bundle-remove.1 +31 -0
- data/man/bundle-remove.1.txt +34 -0
- data/man/bundle-remove.ronn +23 -0
- data/man/bundle-show.1 +23 -0
- data/man/bundle-show.1.txt +27 -0
- data/man/bundle-show.ronn +21 -0
- data/man/bundle-update.1 +394 -0
- data/man/bundle-update.1.txt +391 -0
- data/man/bundle-update.ronn +350 -0
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +39 -0
- data/man/bundle-viz.ronn +30 -0
- data/man/bundle.1 +136 -0
- data/man/bundle.1.txt +116 -0
- data/man/bundle.ronn +111 -0
- data/man/gemfile.5 +689 -0
- data/man/gemfile.5.ronn +521 -0
- data/man/gemfile.5.txt +653 -0
- data/man/index.txt +25 -0
- metadata +463 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# We forcibly require OpenSSL, because net/http/persistent will only autoload
|
4
|
+
# it. On some Rubies, autoload fails but explicit require succeeds.
|
5
|
+
begin
|
6
|
+
require "openssl"
|
7
|
+
rescue LoadError
|
8
|
+
# some Ruby builds don't have OpenSSL
|
9
|
+
end
|
10
|
+
module Bundler
|
11
|
+
module Persistent
|
12
|
+
module Net
|
13
|
+
module HTTP
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
require "bundler/vendor/net-http-persistent/lib/net/http/persistent"
|
19
|
+
|
20
|
+
module Bundler
|
21
|
+
class PersistentHTTP < Persistent::Net::HTTP::Persistent
|
22
|
+
def connection_for(uri)
|
23
|
+
connection = super
|
24
|
+
warn_old_tls_version_rubygems_connection(uri, connection)
|
25
|
+
connection
|
26
|
+
end
|
27
|
+
|
28
|
+
def warn_old_tls_version_rubygems_connection(uri, connection)
|
29
|
+
return unless connection.use_ssl?
|
30
|
+
return unless (uri.host || "").end_with?("rubygems.org")
|
31
|
+
|
32
|
+
socket = connection.instance_variable_get(:@socket)
|
33
|
+
return unless socket
|
34
|
+
socket_io = socket.io
|
35
|
+
return unless socket_io.respond_to?(:ssl_version)
|
36
|
+
ssl_version = socket_io.ssl_version
|
37
|
+
|
38
|
+
case ssl_version
|
39
|
+
when /TLSv([\d\.]+)/
|
40
|
+
version = Gem::Version.new($1)
|
41
|
+
if version < Gem::Version.new("1.2")
|
42
|
+
Bundler.ui.warn \
|
43
|
+
"Warning: Your Ruby version is compiled against a copy of OpenSSL that is very old. " \
|
44
|
+
"Starting in January 2018, RubyGems.org will refuse connection requests from these " \
|
45
|
+
"very old versions of OpenSSL. If you will need to continue installing gems after " \
|
46
|
+
"January 2018, please follow this guide to upgrade: http://ruby.to/tls-outdated.",
|
47
|
+
:wrap => true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
# Ruby 1.9.3 and old RubyGems don't play nice with frozen version strings
|
4
|
+
# rubocop:disable MutableConstant
|
5
|
+
|
6
|
+
module Bundler
|
7
|
+
# We're doing this because we might write tests that deal
|
8
|
+
# with other versions of bundler and we are unsure how to
|
9
|
+
# handle this better.
|
10
|
+
VERSION = "2.0.2" unless defined?(::Bundler::VERSION)
|
11
|
+
|
12
|
+
def self.overwrite_loaded_gem_version
|
13
|
+
begin
|
14
|
+
require "rubygems"
|
15
|
+
rescue LoadError
|
16
|
+
return
|
17
|
+
end
|
18
|
+
return unless bundler_spec = Gem.loaded_specs["bundler"]
|
19
|
+
return if bundler_spec.version == VERSION
|
20
|
+
bundler_spec.version = Bundler::VERSION
|
21
|
+
end
|
22
|
+
private_class_method :overwrite_loaded_gem_version
|
23
|
+
overwrite_loaded_gem_version
|
24
|
+
|
25
|
+
def self.bundler_major_version
|
26
|
+
@bundler_major_version ||= VERSION.split(".").first.to_i
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module VersionRanges
|
5
|
+
NEq = Struct.new(:version)
|
6
|
+
ReqR = Struct.new(:left, :right)
|
7
|
+
class ReqR
|
8
|
+
Endpoint = Struct.new(:version, :inclusive)
|
9
|
+
def to_s
|
10
|
+
"#{left.inclusive ? "[" : "("}#{left.version}, #{right.version}#{right.inclusive ? "]" : ")"}"
|
11
|
+
end
|
12
|
+
INFINITY = Object.new.freeze
|
13
|
+
ZERO = Gem::Version.new("0.a")
|
14
|
+
|
15
|
+
def cover?(v)
|
16
|
+
return false if left.inclusive && left.version > v
|
17
|
+
return false if !left.inclusive && left.version >= v
|
18
|
+
|
19
|
+
if right.version != INFINITY
|
20
|
+
return false if right.inclusive && right.version < v
|
21
|
+
return false if !right.inclusive && right.version <= v
|
22
|
+
end
|
23
|
+
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def empty?
|
28
|
+
left.version == right.version && !(left.inclusive && right.inclusive)
|
29
|
+
end
|
30
|
+
|
31
|
+
def single?
|
32
|
+
left.version == right.version
|
33
|
+
end
|
34
|
+
|
35
|
+
UNIVERSAL = ReqR.new(ReqR::Endpoint.new(Gem::Version.new("0.a"), true), ReqR::Endpoint.new(ReqR::INFINITY, false)).freeze
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.for_many(requirements)
|
39
|
+
requirements = requirements.map(&:requirements).flatten(1).map {|r| r.join(" ") }
|
40
|
+
requirements << ">= 0.a" if requirements.empty?
|
41
|
+
requirement = Gem::Requirement.new(requirements)
|
42
|
+
self.for(requirement)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.for(requirement)
|
46
|
+
ranges = requirement.requirements.map do |op, v|
|
47
|
+
case op
|
48
|
+
when "=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v, true))
|
49
|
+
when "!=" then NEq.new(v)
|
50
|
+
when ">=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(ReqR::INFINITY, false))
|
51
|
+
when ">" then ReqR.new(ReqR::Endpoint.new(v, false), ReqR::Endpoint.new(ReqR::INFINITY, false))
|
52
|
+
when "<" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, false))
|
53
|
+
when "<=" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, true))
|
54
|
+
when "~>" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v.bump, false))
|
55
|
+
else raise "unknown version op #{op} in requirement #{requirement}"
|
56
|
+
end
|
57
|
+
end.uniq
|
58
|
+
ranges, neqs = ranges.partition {|r| !r.is_a?(NEq) }
|
59
|
+
|
60
|
+
[ranges.sort_by {|range| [range.left.version, range.left.inclusive ? 0 : 1] }, neqs.map(&:version)]
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.empty?(ranges, neqs)
|
64
|
+
!ranges.reduce(ReqR::UNIVERSAL) do |last_range, curr_range|
|
65
|
+
next false unless last_range
|
66
|
+
next false if curr_range.single? && neqs.include?(curr_range.left.version)
|
67
|
+
next curr_range if last_range.right.version == ReqR::INFINITY
|
68
|
+
case last_range.right.version <=> curr_range.left.version
|
69
|
+
when 1 then next curr_range
|
70
|
+
when 0 then next(last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version) && curr_range)
|
71
|
+
when -1 then next false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/bundler/vlad.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/shared_helpers"
|
4
|
+
Bundler::SharedHelpers.major_deprecation 3,
|
5
|
+
"The Bundler task for Vlad"
|
6
|
+
|
7
|
+
# Vlad task for Bundler.
|
8
|
+
#
|
9
|
+
# Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
|
10
|
+
# include the vlad:bundle:install task in your vlad:deploy task.
|
11
|
+
require "bundler/deployment"
|
12
|
+
|
13
|
+
include Rake::DSL if defined? Rake::DSL
|
14
|
+
|
15
|
+
namespace :vlad do
|
16
|
+
Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, :roles => :app)
|
17
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thread"
|
4
|
+
|
5
|
+
module Bundler
|
6
|
+
class Worker
|
7
|
+
POISON = Object.new
|
8
|
+
|
9
|
+
class WrappedException < StandardError
|
10
|
+
attr_reader :exception
|
11
|
+
def initialize(exn)
|
12
|
+
@exception = exn
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String] the name of the worker
|
17
|
+
attr_reader :name
|
18
|
+
|
19
|
+
# Creates a worker pool of specified size
|
20
|
+
#
|
21
|
+
# @param size [Integer] Size of pool
|
22
|
+
# @param name [String] name the name of the worker
|
23
|
+
# @param func [Proc] job to run in inside the worker pool
|
24
|
+
def initialize(size, name, func)
|
25
|
+
@name = name
|
26
|
+
@request_queue = Queue.new
|
27
|
+
@response_queue = Queue.new
|
28
|
+
@func = func
|
29
|
+
@size = size
|
30
|
+
@threads = nil
|
31
|
+
SharedHelpers.trap("INT") { abort_threads }
|
32
|
+
end
|
33
|
+
|
34
|
+
# Enqueue a request to be executed in the worker pool
|
35
|
+
#
|
36
|
+
# @param obj [String] mostly it is name of spec that should be downloaded
|
37
|
+
def enq(obj)
|
38
|
+
create_threads unless @threads
|
39
|
+
@request_queue.enq obj
|
40
|
+
end
|
41
|
+
|
42
|
+
# Retrieves results of job function being executed in worker pool
|
43
|
+
def deq
|
44
|
+
result = @response_queue.deq
|
45
|
+
raise result.exception if result.is_a?(WrappedException)
|
46
|
+
result
|
47
|
+
end
|
48
|
+
|
49
|
+
def stop
|
50
|
+
stop_threads
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def process_queue(i)
|
56
|
+
loop do
|
57
|
+
obj = @request_queue.deq
|
58
|
+
break if obj.equal? POISON
|
59
|
+
@response_queue.enq apply_func(obj, i)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def apply_func(obj, i)
|
64
|
+
@func.call(obj, i)
|
65
|
+
rescue Exception => e
|
66
|
+
WrappedException.new(e)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Stop the worker threads by sending a poison object down the request queue
|
70
|
+
# so as worker threads after retrieving it, shut themselves down
|
71
|
+
def stop_threads
|
72
|
+
return unless @threads
|
73
|
+
@threads.each { @request_queue.enq POISON }
|
74
|
+
@threads.each(&:join)
|
75
|
+
@threads = nil
|
76
|
+
end
|
77
|
+
|
78
|
+
def abort_threads
|
79
|
+
return unless @threads
|
80
|
+
Bundler.ui.debug("\n#{caller.join("\n")}")
|
81
|
+
@threads.each(&:exit)
|
82
|
+
exit 1
|
83
|
+
end
|
84
|
+
|
85
|
+
def create_threads
|
86
|
+
creation_errors = []
|
87
|
+
|
88
|
+
@threads = Array.new(@size) do |i|
|
89
|
+
begin
|
90
|
+
Thread.start { process_queue(i) }.tap do |thread|
|
91
|
+
thread.name = "#{name} Worker ##{i}" if thread.respond_to?(:name=)
|
92
|
+
end
|
93
|
+
rescue ThreadError => e
|
94
|
+
creation_errors << e
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
end.compact
|
98
|
+
|
99
|
+
return if creation_errors.empty?
|
100
|
+
|
101
|
+
message = "Failed to create threads for the #{name} worker: #{creation_errors.map(&:to_s).uniq.join(", ")}"
|
102
|
+
raise ThreadCreationError, message if @threads.empty?
|
103
|
+
Bundler.ui.info message
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# A stub yaml serializer that can handle only hashes and strings (as of now).
|
5
|
+
module YAMLSerializer
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def dump(hash)
|
9
|
+
yaml = String.new("---")
|
10
|
+
yaml << dump_hash(hash)
|
11
|
+
end
|
12
|
+
|
13
|
+
def dump_hash(hash)
|
14
|
+
yaml = String.new("\n")
|
15
|
+
hash.each do |k, v|
|
16
|
+
yaml << k << ":"
|
17
|
+
if v.is_a?(Hash)
|
18
|
+
yaml << dump_hash(v).gsub(/^(?!$)/, " ") # indent all non-empty lines
|
19
|
+
elsif v.is_a?(Array) # Expected to be array of strings
|
20
|
+
yaml << "\n- " << v.map {|s| s.to_s.gsub(/\s+/, " ").inspect }.join("\n- ") << "\n"
|
21
|
+
else
|
22
|
+
yaml << " " << v.to_s.gsub(/\s+/, " ").inspect << "\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
yaml
|
26
|
+
end
|
27
|
+
|
28
|
+
ARRAY_REGEX = /
|
29
|
+
^
|
30
|
+
(?:[ ]*-[ ]) # '- ' before array items
|
31
|
+
(['"]?) # optional opening quote
|
32
|
+
(.*) # value
|
33
|
+
\1 # matching closing quote
|
34
|
+
$
|
35
|
+
/xo
|
36
|
+
|
37
|
+
HASH_REGEX = /
|
38
|
+
^
|
39
|
+
([ ]*) # indentations
|
40
|
+
(.+) # key
|
41
|
+
(?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
|
42
|
+
[ ]?
|
43
|
+
(?: !\s)? # optional exclamation mark found with ruby 1.9.3
|
44
|
+
(['"]?) # optional opening quote
|
45
|
+
(.*) # value
|
46
|
+
\3 # matching closing quote
|
47
|
+
$
|
48
|
+
/xo
|
49
|
+
|
50
|
+
def load(str)
|
51
|
+
res = {}
|
52
|
+
stack = [res]
|
53
|
+
last_hash = nil
|
54
|
+
last_empty_key = nil
|
55
|
+
str.split(/\r?\n/).each do |line|
|
56
|
+
if match = HASH_REGEX.match(line)
|
57
|
+
indent, key, quote, val = match.captures
|
58
|
+
key = convert_to_backward_compatible_key(key)
|
59
|
+
depth = indent.scan(/ /).length
|
60
|
+
if quote.empty? && val.empty?
|
61
|
+
new_hash = {}
|
62
|
+
stack[depth][key] = new_hash
|
63
|
+
stack[depth + 1] = new_hash
|
64
|
+
last_empty_key = key
|
65
|
+
last_hash = stack[depth]
|
66
|
+
else
|
67
|
+
stack[depth][key] = val
|
68
|
+
end
|
69
|
+
elsif match = ARRAY_REGEX.match(line)
|
70
|
+
_, val = match.captures
|
71
|
+
last_hash[last_empty_key] = [] unless last_hash[last_empty_key].is_a?(Array)
|
72
|
+
|
73
|
+
last_hash[last_empty_key].push(val)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
res
|
77
|
+
end
|
78
|
+
|
79
|
+
# for settings' keys
|
80
|
+
def convert_to_backward_compatible_key(key)
|
81
|
+
key = "#{key}/" if key =~ /https?:/i && key !~ %r{/\Z}
|
82
|
+
key = key.gsub(".", "__") if key.include?(".")
|
83
|
+
key
|
84
|
+
end
|
85
|
+
|
86
|
+
class << self
|
87
|
+
private :dump_hash, :convert_to_backward_compatible_key
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/man/bundle-add.1
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "BUNDLE\-ADD" "1" "June 2019" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
|
11
|
+
.
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
|
14
|
+
.
|
15
|
+
.P
|
16
|
+
Example:
|
17
|
+
.
|
18
|
+
.P
|
19
|
+
bundle add rails
|
20
|
+
.
|
21
|
+
.P
|
22
|
+
bundle add rails \-\-version "< 3\.0, > 1\.1"
|
23
|
+
.
|
24
|
+
.P
|
25
|
+
bundle add rails \-\-version "~> 5\.0\.0" \-\-source "https://gems\.example\.com" \-\-group "development"
|
26
|
+
.
|
27
|
+
.P
|
28
|
+
bundle add rails \-\-skip\-install
|
29
|
+
.
|
30
|
+
.P
|
31
|
+
bundle add rails \-\-group "development, test"
|
32
|
+
.
|
33
|
+
.SH "OPTIONS"
|
34
|
+
.
|
35
|
+
.TP
|
36
|
+
\fB\-\-version\fR, \fB\-v\fR
|
37
|
+
Specify version requirements(s) for the added gem\.
|
38
|
+
.
|
39
|
+
.TP
|
40
|
+
\fB\-\-group\fR, \fB\-g\fR
|
41
|
+
Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
|
42
|
+
.
|
43
|
+
.TP
|
44
|
+
\fB\-\-source\fR, , \fB\-s\fR
|
45
|
+
Specify the source for the added gem\.
|
46
|
+
.
|
47
|
+
.TP
|
48
|
+
\fB\-\-skip\-install\fR
|
49
|
+
Adds the gem to the Gemfile but does not install it\.
|
50
|
+
.
|
51
|
+
.TP
|
52
|
+
\fB\-\-optimistic\fR
|
53
|
+
Adds optimistic declaration of version
|
54
|
+
.
|
55
|
+
.TP
|
56
|
+
\fB\-\-strict\fR
|
57
|
+
Adds strict declaration of version
|
58
|
+
|