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,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# used for Creating Specifications from the Gemcutter Endpoint
|
5
|
+
class EndpointSpecification < Gem::Specification
|
6
|
+
ILLFORMED_MESSAGE = 'Ill-formed requirement ["#<YAML::Syck::DefaultKey'.freeze
|
7
|
+
include MatchPlatform
|
8
|
+
|
9
|
+
attr_reader :name, :version, :platform, :required_rubygems_version, :required_ruby_version, :checksum
|
10
|
+
attr_accessor :source, :remote, :dependencies
|
11
|
+
|
12
|
+
def initialize(name, version, platform, dependencies, metadata = nil)
|
13
|
+
super()
|
14
|
+
@name = name
|
15
|
+
@version = Gem::Version.create version
|
16
|
+
@platform = platform
|
17
|
+
@dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
|
18
|
+
|
19
|
+
@loaded_from = nil
|
20
|
+
@remote_specification = nil
|
21
|
+
|
22
|
+
parse_metadata(metadata)
|
23
|
+
end
|
24
|
+
|
25
|
+
def fetch_platform
|
26
|
+
@platform
|
27
|
+
end
|
28
|
+
|
29
|
+
# needed for standalone, load required_paths from local gemspec
|
30
|
+
# after the gem is installed
|
31
|
+
def require_paths
|
32
|
+
if @remote_specification
|
33
|
+
@remote_specification.require_paths
|
34
|
+
elsif _local_specification
|
35
|
+
_local_specification.require_paths
|
36
|
+
else
|
37
|
+
super
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# needed for inline
|
42
|
+
def load_paths
|
43
|
+
# remote specs aren't installed, and can't have load_paths
|
44
|
+
if _local_specification
|
45
|
+
_local_specification.load_paths
|
46
|
+
else
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# needed for binstubs
|
52
|
+
def executables
|
53
|
+
if @remote_specification
|
54
|
+
@remote_specification.executables
|
55
|
+
elsif _local_specification
|
56
|
+
_local_specification.executables
|
57
|
+
else
|
58
|
+
super
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# needed for bundle clean
|
63
|
+
def bindir
|
64
|
+
if @remote_specification
|
65
|
+
@remote_specification.bindir
|
66
|
+
elsif _local_specification
|
67
|
+
_local_specification.bindir
|
68
|
+
else
|
69
|
+
super
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# needed for post_install_messages during install
|
74
|
+
def post_install_message
|
75
|
+
if @remote_specification
|
76
|
+
@remote_specification.post_install_message
|
77
|
+
elsif _local_specification
|
78
|
+
_local_specification.post_install_message
|
79
|
+
else
|
80
|
+
super
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# needed for "with native extensions" during install
|
85
|
+
def extensions
|
86
|
+
if @remote_specification
|
87
|
+
@remote_specification.extensions
|
88
|
+
elsif _local_specification
|
89
|
+
_local_specification.extensions
|
90
|
+
else
|
91
|
+
super
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def _local_specification
|
96
|
+
return unless @loaded_from && File.exist?(local_specification_path)
|
97
|
+
eval(File.read(local_specification_path)).tap do |spec|
|
98
|
+
spec.loaded_from = @loaded_from
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def __swap__(spec)
|
103
|
+
SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies)
|
104
|
+
@remote_specification = spec
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def local_specification_path
|
110
|
+
"#{base_dir}/specifications/#{full_name}.gemspec"
|
111
|
+
end
|
112
|
+
|
113
|
+
def parse_metadata(data)
|
114
|
+
return unless data
|
115
|
+
data.each do |k, v|
|
116
|
+
next unless v
|
117
|
+
case k.to_s
|
118
|
+
when "checksum"
|
119
|
+
@checksum = v.last
|
120
|
+
when "rubygems"
|
121
|
+
@required_rubygems_version = Gem::Requirement.new(v)
|
122
|
+
when "ruby"
|
123
|
+
@required_ruby_version = Gem::Requirement.new(v)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
rescue StandardError => e
|
127
|
+
raise GemspecError, "There was an error parsing the metadata for the gem #{name} (#{version}): #{e.class}\n#{e}\nThe metadata was #{data.inspect}"
|
128
|
+
end
|
129
|
+
|
130
|
+
def build_dependency(name, requirements)
|
131
|
+
Gem::Dependency.new(name, requirements)
|
132
|
+
rescue ArgumentError => e
|
133
|
+
raise unless e.message.include?(ILLFORMED_MESSAGE)
|
134
|
+
puts # we shouldn't print the error message on the "fetching info" status line
|
135
|
+
raise GemspecError,
|
136
|
+
"Unfortunately, the gem #{name} (#{version}) has an invalid " \
|
137
|
+
"gemspec.\nPlease ask the gem author to yank the bad version to fix " \
|
138
|
+
"this issue. For more information, see http://bit.ly/syck-defaultkey."
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
data/lib/bundler/env.rb
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/rubygems_integration"
|
4
|
+
require "bundler/source/git/git_proxy"
|
5
|
+
|
6
|
+
module Bundler
|
7
|
+
class Env
|
8
|
+
def self.write(io)
|
9
|
+
io.write report
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.report(options = {})
|
13
|
+
print_gemfile = options.delete(:print_gemfile) { true }
|
14
|
+
print_gemspecs = options.delete(:print_gemspecs) { true }
|
15
|
+
|
16
|
+
out = String.new
|
17
|
+
append_formatted_table("Environment", environment, out)
|
18
|
+
append_formatted_table("Bundler Build Metadata", BuildMetadata.to_h, out)
|
19
|
+
|
20
|
+
unless Bundler.settings.all.empty?
|
21
|
+
out << "\n## Bundler settings\n\n```\n"
|
22
|
+
Bundler.settings.all.each do |setting|
|
23
|
+
out << setting << "\n"
|
24
|
+
Bundler.settings.pretty_values_for(setting).each do |line|
|
25
|
+
out << " " << line << "\n"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
out << "```\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
return out unless SharedHelpers.in_bundle?
|
32
|
+
|
33
|
+
if print_gemfile
|
34
|
+
gemfiles = [Bundler.default_gemfile]
|
35
|
+
begin
|
36
|
+
gemfiles = Bundler.definition.gemfiles
|
37
|
+
rescue GemfileNotFound
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
out << "\n## Gemfile\n"
|
42
|
+
gemfiles.each do |gemfile|
|
43
|
+
out << "\n### #{Pathname.new(gemfile).relative_path_from(SharedHelpers.pwd)}\n\n"
|
44
|
+
out << "```ruby\n" << read_file(gemfile).chomp << "\n```\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
out << "\n### #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n"
|
48
|
+
out << "```\n" << read_file(Bundler.default_lockfile).chomp << "\n```\n"
|
49
|
+
end
|
50
|
+
|
51
|
+
if print_gemspecs
|
52
|
+
dsl = Dsl.new.tap {|d| d.eval_gemfile(Bundler.default_gemfile) }
|
53
|
+
out << "\n## Gemspecs\n" unless dsl.gemspecs.empty?
|
54
|
+
dsl.gemspecs.each do |gs|
|
55
|
+
out << "\n### #{File.basename(gs.loaded_from)}"
|
56
|
+
out << "\n\n```ruby\n" << read_file(gs.loaded_from).chomp << "\n```\n"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
out
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.read_file(filename)
|
64
|
+
Bundler.read_file(filename.to_s).strip
|
65
|
+
rescue Errno::ENOENT
|
66
|
+
"<No #{filename} found>"
|
67
|
+
rescue RuntimeError => e
|
68
|
+
"#{e.class}: #{e.message}"
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.ruby_version
|
72
|
+
str = String.new("#{RUBY_VERSION}")
|
73
|
+
str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
|
74
|
+
str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.git_version
|
78
|
+
Bundler::Source::Git::GitProxy.new(nil, nil, nil).full_version
|
79
|
+
rescue Bundler::Source::Git::GitNotInstalledError
|
80
|
+
"not installed"
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.version_of(script)
|
84
|
+
return "not installed" unless Bundler.which(script)
|
85
|
+
`#{script} --version`.chomp
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.chruby_version
|
89
|
+
return "not installed" unless Bundler.which("chruby-exec")
|
90
|
+
`chruby-exec -- chruby --version`.
|
91
|
+
sub(/.*^chruby: (#{Gem::Version::VERSION_PATTERN}).*/m, '\1')
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.environment
|
95
|
+
out = []
|
96
|
+
|
97
|
+
out << ["Bundler", Bundler::VERSION]
|
98
|
+
out << [" Platforms", Gem.platforms.join(", ")]
|
99
|
+
out << ["Ruby", ruby_version]
|
100
|
+
out << [" Full Path", Gem.ruby]
|
101
|
+
out << [" Config Dir", Pathname.new(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE).dirname]
|
102
|
+
out << ["RubyGems", Gem::VERSION]
|
103
|
+
out << [" Gem Home", ENV.fetch("GEM_HOME") { Gem.dir }]
|
104
|
+
out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(File::PATH_SEPARATOR) }]
|
105
|
+
out << [" User Path", Gem.user_dir]
|
106
|
+
out << [" Bin Dir", Gem.bindir]
|
107
|
+
if defined?(OpenSSL)
|
108
|
+
out << ["OpenSSL"]
|
109
|
+
out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
|
110
|
+
out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
|
111
|
+
out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
|
112
|
+
out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
|
113
|
+
end
|
114
|
+
out << ["Tools"]
|
115
|
+
out << [" Git", git_version]
|
116
|
+
out << [" RVM", ENV.fetch("rvm_version") { version_of("rvm") }]
|
117
|
+
out << [" rbenv", version_of("rbenv")]
|
118
|
+
out << [" chruby", chruby_version]
|
119
|
+
|
120
|
+
%w[rubygems-bundler open_gem].each do |name|
|
121
|
+
specs = Bundler.rubygems.find_name(name)
|
122
|
+
out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty?
|
123
|
+
end
|
124
|
+
if (exe = caller.last.split(":").first) && exe =~ %r{(exe|bin)/bundler?\z}
|
125
|
+
shebang = File.read(exe).lines.first
|
126
|
+
shebang.sub!(/^#!\s*/, "")
|
127
|
+
unless shebang.start_with?(Gem.ruby, "/usr/bin/env ruby")
|
128
|
+
out << ["Gem.ruby", Gem.ruby]
|
129
|
+
out << ["bundle #!", shebang]
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
out
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.append_formatted_table(title, pairs, out)
|
137
|
+
return if pairs.empty?
|
138
|
+
out << "\n" unless out.empty?
|
139
|
+
out << "## #{title}\n\n```\n"
|
140
|
+
ljust = pairs.map {|k, _v| k.to_s.length }.max
|
141
|
+
pairs.each do |k, v|
|
142
|
+
out << "#{k.to_s.ljust(ljust)} #{v}\n"
|
143
|
+
end
|
144
|
+
out << "```\n"
|
145
|
+
end
|
146
|
+
|
147
|
+
private_class_method :read_file, :ruby_version, :git_version, :append_formatted_table, :version_of, :chruby_version
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class EnvironmentPreserver
|
5
|
+
INTENTIONALLY_NIL = "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL".freeze
|
6
|
+
BUNDLER_KEYS = %w[
|
7
|
+
BUNDLE_BIN_PATH
|
8
|
+
BUNDLE_GEMFILE
|
9
|
+
BUNDLER_ORIG_MANPATH
|
10
|
+
BUNDLER_VERSION
|
11
|
+
GEM_HOME
|
12
|
+
GEM_PATH
|
13
|
+
MANPATH
|
14
|
+
PATH
|
15
|
+
RB_USER_INSTALL
|
16
|
+
RUBYLIB
|
17
|
+
RUBYOPT
|
18
|
+
].map(&:freeze).freeze
|
19
|
+
BUNDLER_PREFIX = "BUNDLER_ORIG_".freeze
|
20
|
+
|
21
|
+
# @param env [ENV]
|
22
|
+
# @param keys [Array<String>]
|
23
|
+
def initialize(env, keys)
|
24
|
+
@original = env.to_hash
|
25
|
+
@keys = keys
|
26
|
+
@prefix = BUNDLER_PREFIX
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Hash]
|
30
|
+
def backup
|
31
|
+
env = @original.clone
|
32
|
+
@keys.each do |key|
|
33
|
+
value = env[key]
|
34
|
+
if !value.nil? && !value.empty?
|
35
|
+
env[@prefix + key] ||= value
|
36
|
+
elsif value.nil?
|
37
|
+
env[@prefix + key] ||= INTENTIONALLY_NIL
|
38
|
+
end
|
39
|
+
end
|
40
|
+
env
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Hash]
|
44
|
+
def restore
|
45
|
+
env = @original.clone
|
46
|
+
@keys.each do |key|
|
47
|
+
value_original = env[@prefix + key]
|
48
|
+
next if value_original.nil? || value_original.empty?
|
49
|
+
if value_original == INTENTIONALLY_NIL
|
50
|
+
env.delete(key)
|
51
|
+
else
|
52
|
+
env[key] = value_original
|
53
|
+
end
|
54
|
+
env.delete(@prefix + key)
|
55
|
+
end
|
56
|
+
env
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class BundlerError < StandardError
|
5
|
+
def self.status_code(code)
|
6
|
+
define_method(:status_code) { code }
|
7
|
+
if match = BundlerError.all_errors.find {|_k, v| v == code }
|
8
|
+
error, _ = match
|
9
|
+
raise ArgumentError,
|
10
|
+
"Trying to register #{self} for status code #{code} but #{error} is already registered"
|
11
|
+
end
|
12
|
+
BundlerError.all_errors[self] = code
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.all_errors
|
16
|
+
@all_errors ||= {}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class GemfileError < BundlerError; status_code(4); end
|
21
|
+
class InstallError < BundlerError; status_code(5); end
|
22
|
+
|
23
|
+
# Internal error, should be rescued
|
24
|
+
class VersionConflict < BundlerError
|
25
|
+
attr_reader :conflicts
|
26
|
+
|
27
|
+
def initialize(conflicts, msg = nil)
|
28
|
+
super(msg)
|
29
|
+
@conflicts = conflicts
|
30
|
+
end
|
31
|
+
|
32
|
+
status_code(6)
|
33
|
+
end
|
34
|
+
|
35
|
+
class GemNotFound < BundlerError; status_code(7); end
|
36
|
+
class InstallHookError < BundlerError; status_code(8); end
|
37
|
+
class GemfileNotFound < BundlerError; status_code(10); end
|
38
|
+
class GitError < BundlerError; status_code(11); end
|
39
|
+
class DeprecatedError < BundlerError; status_code(12); end
|
40
|
+
class PathError < BundlerError; status_code(13); end
|
41
|
+
class GemspecError < BundlerError; status_code(14); end
|
42
|
+
class InvalidOption < BundlerError; status_code(15); end
|
43
|
+
class ProductionError < BundlerError; status_code(16); end
|
44
|
+
class HTTPError < BundlerError
|
45
|
+
status_code(17)
|
46
|
+
def filter_uri(uri)
|
47
|
+
URICredentialsFilter.credential_filtered_uri(uri)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
class RubyVersionMismatch < BundlerError; status_code(18); end
|
51
|
+
class SecurityError < BundlerError; status_code(19); end
|
52
|
+
class LockfileError < BundlerError; status_code(20); end
|
53
|
+
class CyclicDependencyError < BundlerError; status_code(21); end
|
54
|
+
class GemfileLockNotFound < BundlerError; status_code(22); end
|
55
|
+
class PluginError < BundlerError; status_code(29); end
|
56
|
+
class SudoNotPermittedError < BundlerError; status_code(30); end
|
57
|
+
class ThreadCreationError < BundlerError; status_code(33); end
|
58
|
+
class APIResponseMismatchError < BundlerError; status_code(34); end
|
59
|
+
class GemfileEvalError < GemfileError; end
|
60
|
+
class MarshalError < StandardError; end
|
61
|
+
|
62
|
+
class PermissionError < BundlerError
|
63
|
+
def initialize(path, permission_type = :write)
|
64
|
+
@path = path
|
65
|
+
@permission_type = permission_type
|
66
|
+
end
|
67
|
+
|
68
|
+
def action
|
69
|
+
case @permission_type
|
70
|
+
when :read then "read from"
|
71
|
+
when :write then "write to"
|
72
|
+
when :executable, :exec then "execute"
|
73
|
+
else @permission_type.to_s
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def message
|
78
|
+
"There was an error while trying to #{action} `#{@path}`. " \
|
79
|
+
"It is likely that you need to grant #{@permission_type} permissions " \
|
80
|
+
"for that path."
|
81
|
+
end
|
82
|
+
|
83
|
+
status_code(23)
|
84
|
+
end
|
85
|
+
|
86
|
+
class GemRequireError < BundlerError
|
87
|
+
attr_reader :orig_exception
|
88
|
+
|
89
|
+
def initialize(orig_exception, msg)
|
90
|
+
full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
|
91
|
+
"Backtrace for gem load error is:\n"\
|
92
|
+
"#{orig_exception.backtrace.join("\n")}\n"\
|
93
|
+
"Bundler Error Backtrace:\n"
|
94
|
+
super(full_message)
|
95
|
+
@orig_exception = orig_exception
|
96
|
+
end
|
97
|
+
|
98
|
+
status_code(24)
|
99
|
+
end
|
100
|
+
|
101
|
+
class YamlSyntaxError < BundlerError
|
102
|
+
attr_reader :orig_exception
|
103
|
+
|
104
|
+
def initialize(orig_exception, msg)
|
105
|
+
super(msg)
|
106
|
+
@orig_exception = orig_exception
|
107
|
+
end
|
108
|
+
|
109
|
+
status_code(25)
|
110
|
+
end
|
111
|
+
|
112
|
+
class TemporaryResourceError < PermissionError
|
113
|
+
def message
|
114
|
+
"There was an error while trying to #{action} `#{@path}`. " \
|
115
|
+
"Some resource was temporarily unavailable. It's suggested that you try" \
|
116
|
+
"the operation again."
|
117
|
+
end
|
118
|
+
|
119
|
+
status_code(26)
|
120
|
+
end
|
121
|
+
|
122
|
+
class VirtualProtocolError < BundlerError
|
123
|
+
def message
|
124
|
+
"There was an error relating to virtualization and file access." \
|
125
|
+
"It is likely that you need to grant access to or mount some file system correctly."
|
126
|
+
end
|
127
|
+
|
128
|
+
status_code(27)
|
129
|
+
end
|
130
|
+
|
131
|
+
class OperationNotSupportedError < PermissionError
|
132
|
+
def message
|
133
|
+
"Attempting to #{action} `#{@path}` is unsupported by your OS."
|
134
|
+
end
|
135
|
+
|
136
|
+
status_code(28)
|
137
|
+
end
|
138
|
+
|
139
|
+
class NoSpaceOnDeviceError < PermissionError
|
140
|
+
def message
|
141
|
+
"There was an error while trying to #{action} `#{@path}`. " \
|
142
|
+
"There was insufficient space remaining on the device."
|
143
|
+
end
|
144
|
+
|
145
|
+
status_code(31)
|
146
|
+
end
|
147
|
+
|
148
|
+
class GenericSystemCallError < BundlerError
|
149
|
+
attr_reader :underlying_error
|
150
|
+
|
151
|
+
def initialize(underlying_error, message)
|
152
|
+
@underlying_error = underlying_error
|
153
|
+
super("#{message}\nThe underlying system error is #{@underlying_error.class}: #{@underlying_error}")
|
154
|
+
end
|
155
|
+
|
156
|
+
status_code(32)
|
157
|
+
end
|
158
|
+
end
|