bundler 1.13.6 → 1.17.3
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 +5 -5
- data/CHANGELOG.md +554 -9
- data/README.md +28 -5
- data/bundler.gemspec +40 -11
- data/exe/bundle +4 -8
- data/exe/bundle_ruby +4 -3
- data/lib/bundler.rb +162 -68
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli.rb +360 -118
- data/lib/bundler/cli/add.rb +35 -0
- data/lib/bundler/cli/binstubs.rb +18 -10
- data/lib/bundler/cli/cache.rb +6 -5
- data/lib/bundler/cli/check.rb +4 -6
- data/lib/bundler/cli/clean.rb +6 -7
- data/lib/bundler/cli/common.rb +47 -1
- data/lib/bundler/cli/config.rb +26 -7
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +63 -18
- data/lib/bundler/cli/exec.rb +12 -5
- data/lib/bundler/cli/gem.rb +59 -21
- data/lib/bundler/cli/info.rb +50 -0
- data/lib/bundler/cli/init.rb +21 -7
- data/lib/bundler/cli/inject.rb +13 -4
- data/lib/bundler/cli/install.rb +72 -101
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +9 -6
- data/lib/bundler/cli/open.rb +4 -3
- data/lib/bundler/cli/outdated.rb +175 -60
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +2 -1
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +47 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +44 -34
- data/lib/bundler/cli/viz.rb +5 -1
- 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 +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +17 -8
- data/lib/bundler/definition.rb +353 -182
- data/lib/bundler/dep_proxy.rb +3 -1
- data/lib/bundler/dependency.rb +22 -10
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +15 -3
- data/lib/bundler/dsl.rb +122 -64
- data/lib/bundler/endpoint_specification.rb +13 -3
- data/lib/bundler/env.rb +110 -38
- data/lib/bundler/environment_preserver.rb +27 -6
- data/lib/bundler/errors.rb +24 -0
- data/lib/bundler/feature_flag.rb +74 -0
- data/lib/bundler/fetcher.rb +18 -11
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +7 -5
- data/lib/bundler/fetcher/dependency.rb +3 -2
- data/lib/bundler/fetcher/downloader.rb +25 -7
- data/lib/bundler/fetcher/index.rb +3 -2
- data/lib/bundler/friendly_errors.rb +33 -7
- data/lib/bundler/gem_helper.rb +25 -11
- data/lib/bundler/gem_helpers.rb +70 -1
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/gem_version_promoter.rb +17 -2
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +28 -15
- data/lib/bundler/injector.rb +216 -33
- data/lib/bundler/inline.rb +12 -12
- data/lib/bundler/installer.rb +139 -53
- data/lib/bundler/installer/gem_installer.rb +15 -5
- data/lib/bundler/installer/parallel_installer.rb +113 -28
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/lazy_specification.rb +31 -3
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +50 -37
- data/lib/bundler/match_platform.rb +13 -3
- data/lib/bundler/mirror.rb +10 -5
- data/lib/bundler/plugin.rb +22 -8
- data/lib/bundler/plugin/api.rb +2 -1
- data/lib/bundler/plugin/api/source.rb +17 -4
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +9 -2
- data/lib/bundler/plugin/installer.rb +7 -6
- data/lib/bundler/plugin/source_list.rb +7 -8
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +10 -0
- data/lib/bundler/remote_specification.rb +30 -1
- data/lib/bundler/resolver.rb +187 -194
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/retry.rb +5 -1
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +12 -2
- data/lib/bundler/rubygems_ext.rb +23 -8
- data/lib/bundler/rubygems_gem_installer.rb +90 -0
- data/lib/bundler/rubygems_integration.rb +193 -70
- data/lib/bundler/runtime.rb +39 -22
- data/lib/bundler/settings.rb +245 -85
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +4 -7
- data/lib/bundler/shared_helpers.rb +183 -40
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +58 -1
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git.rb +52 -23
- data/lib/bundler/source/git/git_proxy.rb +30 -14
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path.rb +42 -16
- data/lib/bundler/source/path/installer.rb +4 -2
- data/lib/bundler/source/rubygems.rb +171 -82
- data/lib/bundler/source/rubygems/remote.rb +12 -2
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +67 -32
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +86 -2
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +13 -1
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Executable.standalone +5 -5
- data/lib/bundler/templates/Gemfile +3 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -2
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/lib/bundler/templates/newgem/README.md.tt +14 -8
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
- data/lib/bundler/templates/newgem/gitignore.tt +5 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -6
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -12
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -3
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +13 -1
- data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
- data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +30 -10
- data/lib/bundler/ui/silent.rb +21 -1
- data/lib/bundler/uri_credentials_filter.rb +1 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +26 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +12 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +3 -2
- 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 +11 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +13 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +18 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +499 -128
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +27 -24
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +46 -21
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
- data/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
- data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
- data/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +43 -3
- data/lib/bundler/vendored_thor.rb +6 -2
- data/lib/bundler/version.rb +19 -2
- data/lib/bundler/version_ranges.rb +76 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +30 -6
- data/lib/bundler/yaml_serializer.rb +4 -4
- data/man/bundle-add.1 +58 -0
- data/man/bundle-add.1.txt +52 -0
- data/man/bundle-add.ronn +40 -0
- data/{lib/bundler/man/bundle-binstubs → man/bundle-binstubs.1} +11 -1
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +15 -1
- 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 +233 -61
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/{lib/bundler/man/bundle-exec → man/bundle-exec.1} +6 -3
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +10 -3
- data/{lib/bundler/man/bundle-gem → man/bundle-gem.1} +4 -4
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +3 -2
- 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/{lib/bundler/man/bundle-install → man/bundle-install.1} +32 -29
- data/man/bundle-install.1.txt +396 -0
- data/man/bundle-install.ronn +45 -36
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/{lib/bundler/man/bundle-lock → man/bundle-lock.1} +43 -2
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-lock.ronn +47 -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/{lib/bundler/man/bundle-package → man/bundle-package.1} +6 -3
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +7 -2
- data/{lib/bundler/man/bundle-platform → man/bundle-platform.1} +1 -1
- data/man/bundle-platform.1.txt +57 -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 +172 -16
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +39 -0
- data/man/bundle-viz.ronn +30 -0
- data/{lib/bundler/man/bundle → man/bundle.1} +44 -28
- data/man/bundle.1.txt +116 -0
- data/man/bundle.ronn +39 -27
- data/{lib/bundler/man → man}/gemfile.5 +67 -84
- data/man/gemfile.5.ronn +77 -55
- data/man/gemfile.5.txt +653 -0
- data/man/index.txt +25 -8
- metadata +118 -58
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.rubocop.yml +0 -128
- data/.rubocop_todo.yml +0 -248
- data/.travis.yml +0 -108
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -36
- data/DEVELOPMENT.md +0 -148
- data/ISSUES.md +0 -100
- data/Rakefile +0 -333
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/lib/bundler/man/bundle-binstubs.txt +0 -33
- data/lib/bundler/man/bundle-config +0 -254
- data/lib/bundler/man/bundle-config.txt +0 -282
- data/lib/bundler/man/bundle-exec.txt +0 -171
- data/lib/bundler/man/bundle-gem.txt +0 -90
- data/lib/bundler/man/bundle-install.txt +0 -385
- data/lib/bundler/man/bundle-lock.txt +0 -52
- data/lib/bundler/man/bundle-package.txt +0 -74
- data/lib/bundler/man/bundle-platform.txt +0 -57
- data/lib/bundler/man/bundle-update +0 -221
- data/lib/bundler/man/bundle-update.txt +0 -227
- data/lib/bundler/man/bundle.txt +0 -104
- data/lib/bundler/man/gemfile.5.txt +0 -636
- data/lib/bundler/postit_trampoline.rb +0 -68
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -112
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
- data/lib/bundler/vendor/postit/lib/postit.rb +0 -15
- data/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
- data/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
- data/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
- data/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
- data/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
data/lib/bundler/source.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Source
|
4
5
|
autoload :Gemspec, "bundler/source/gemspec"
|
5
6
|
autoload :Git, "bundler/source/git"
|
7
|
+
autoload :Metadata, "bundler/source/metadata"
|
6
8
|
autoload :Path, "bundler/source/path"
|
7
9
|
autoload :Rubygems, "bundler/source/rubygems"
|
8
10
|
|
@@ -14,12 +16,13 @@ module Bundler
|
|
14
16
|
|
15
17
|
def version_message(spec)
|
16
18
|
message = "#{spec.name} #{spec.version}"
|
19
|
+
message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
|
17
20
|
|
18
21
|
if Bundler.locked_gems
|
19
22
|
locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
|
20
23
|
locked_spec_version = locked_spec.version if locked_spec
|
21
24
|
if locked_spec_version && spec.version != locked_spec_version
|
22
|
-
message += Bundler.ui.add_color(" (was #{locked_spec_version})",
|
25
|
+
message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
@@ -30,8 +33,62 @@ module Bundler
|
|
30
33
|
spec.source == self
|
31
34
|
end
|
32
35
|
|
36
|
+
# it's possible that gems from one source depend on gems from some
|
37
|
+
# other source, so now we download gemspecs and iterate over those
|
38
|
+
# dependencies, looking for gems we don't have info on yet.
|
39
|
+
def double_check_for(*); end
|
40
|
+
|
41
|
+
def dependency_names_to_double_check
|
42
|
+
specs.dependency_names
|
43
|
+
end
|
44
|
+
|
33
45
|
def include?(other)
|
34
46
|
other == self
|
35
47
|
end
|
48
|
+
|
49
|
+
def inspect
|
50
|
+
"#<#{self.class}:0x#{object_id} #{self}>"
|
51
|
+
end
|
52
|
+
|
53
|
+
def path?
|
54
|
+
instance_of?(Bundler::Source::Path)
|
55
|
+
end
|
56
|
+
|
57
|
+
def extension_cache_path(spec)
|
58
|
+
return unless Bundler.feature_flag.global_gem_cache?
|
59
|
+
return unless source_slug = extension_cache_slug(spec)
|
60
|
+
Bundler.user_cache.join(
|
61
|
+
"extensions", Gem::Platform.local.to_s, Bundler.ruby_scope,
|
62
|
+
source_slug, spec.full_name
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def version_color(spec_version, locked_spec_version)
|
69
|
+
if Gem::Version.correct?(spec_version) && Gem::Version.correct?(locked_spec_version)
|
70
|
+
# display yellow if there appears to be a regression
|
71
|
+
earlier_version?(spec_version, locked_spec_version) ? :yellow : :green
|
72
|
+
else
|
73
|
+
# default to green if the versions cannot be directly compared
|
74
|
+
:green
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def earlier_version?(spec_version, locked_spec_version)
|
79
|
+
Gem::Version.new(spec_version) < Gem::Version.new(locked_spec_version)
|
80
|
+
end
|
81
|
+
|
82
|
+
def print_using_message(message)
|
83
|
+
if !message.include?("(was ") && Bundler.feature_flag.suppress_install_using_messages?
|
84
|
+
Bundler.ui.debug message
|
85
|
+
else
|
86
|
+
Bundler.ui.info message
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def extension_cache_slug(_)
|
91
|
+
nil
|
92
|
+
end
|
36
93
|
end
|
37
94
|
end
|
data/lib/bundler/source/git.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "bundler/vendored_fileutils"
|
3
4
|
require "uri"
|
4
|
-
require "digest/sha1"
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class Source
|
@@ -18,9 +18,10 @@ module Bundler
|
|
18
18
|
@allow_remote = false
|
19
19
|
|
20
20
|
# Stringify options that could be set as symbols
|
21
|
-
%w
|
21
|
+
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
|
22
22
|
|
23
23
|
@uri = options["uri"] || ""
|
24
|
+
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
|
24
25
|
@branch = options["branch"]
|
25
26
|
@ref = options["ref"] || options["branch"] || options["tag"] || "master"
|
26
27
|
@submodules = options["submodules"]
|
@@ -39,7 +40,7 @@ module Bundler
|
|
39
40
|
out = String.new("GIT\n")
|
40
41
|
out << " remote: #{@uri}\n"
|
41
42
|
out << " revision: #{revision}\n"
|
42
|
-
%w
|
43
|
+
%w[ref branch tag submodules].each do |opt|
|
43
44
|
out << " #{opt}: #{options[opt]}\n" if options[opt]
|
44
45
|
end
|
45
46
|
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
|
@@ -61,8 +62,12 @@ module Bundler
|
|
61
62
|
def to_s
|
62
63
|
at = if local?
|
63
64
|
path
|
64
|
-
elsif options["ref"]
|
65
|
-
|
65
|
+
elsif user_ref = options["ref"]
|
66
|
+
if ref =~ /\A[a-z0-9]{4,}\z/i
|
67
|
+
shortref_for_display(user_ref)
|
68
|
+
else
|
69
|
+
user_ref
|
70
|
+
end
|
66
71
|
else
|
67
72
|
ref
|
68
73
|
end
|
@@ -73,7 +78,7 @@ module Bundler
|
|
73
78
|
nil
|
74
79
|
end
|
75
80
|
|
76
|
-
"#{
|
81
|
+
"#{@safe_uri} (at #{at}#{rev})"
|
77
82
|
end
|
78
83
|
|
79
84
|
def name
|
@@ -105,6 +110,8 @@ module Bundler
|
|
105
110
|
|
106
111
|
def unlock!
|
107
112
|
git_proxy.revision = nil
|
113
|
+
options["revision"] = nil
|
114
|
+
|
108
115
|
@unlocked = true
|
109
116
|
end
|
110
117
|
|
@@ -147,7 +154,6 @@ module Bundler
|
|
147
154
|
changed
|
148
155
|
end
|
149
156
|
|
150
|
-
# TODO: cache git specs
|
151
157
|
def specs(*)
|
152
158
|
set_local!(app_cache_path) if has_app_cache? && !local?
|
153
159
|
|
@@ -161,23 +167,27 @@ module Bundler
|
|
161
167
|
local_specs
|
162
168
|
end
|
163
169
|
|
164
|
-
def install(spec,
|
165
|
-
|
170
|
+
def install(spec, options = {})
|
171
|
+
force = options[:force]
|
166
172
|
|
167
|
-
|
173
|
+
print_using_message "Using #{version_message(spec)} from #{self}"
|
174
|
+
|
175
|
+
if (requires_checkout? && !@copied) || force
|
168
176
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
169
177
|
git_proxy.copy_to(install_path, submodules)
|
170
178
|
serialize_gemspecs_in(install_path)
|
171
179
|
@copied = true
|
172
180
|
end
|
173
|
-
|
181
|
+
|
182
|
+
generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] }
|
183
|
+
generate_bin(spec, generate_bin_options)
|
174
184
|
|
175
185
|
requires_checkout? ? spec.post_install_message : nil
|
176
186
|
end
|
177
187
|
|
178
188
|
def cache(spec, custom_path = nil)
|
179
189
|
app_cache_path = app_cache_path(custom_path)
|
180
|
-
return unless Bundler.
|
190
|
+
return unless Bundler.feature_flag.cache_all?
|
181
191
|
return if path == app_cache_path
|
182
192
|
cached!
|
183
193
|
FileUtils.rm_rf(app_cache_path)
|
@@ -199,13 +209,11 @@ module Bundler
|
|
199
209
|
# When using local git repos, this is set to the local repo.
|
200
210
|
def cache_path
|
201
211
|
@cache_path ||= begin
|
202
|
-
|
203
|
-
|
204
|
-
if Bundler.requires_sudo?
|
205
|
-
Bundler.user_bundle_path.join("cache/git", git_scope)
|
212
|
+
if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
|
213
|
+
Bundler.user_cache
|
206
214
|
else
|
207
|
-
Bundler.
|
208
|
-
end
|
215
|
+
Bundler.bundle_path.join("cache", "bundler")
|
216
|
+
end.join("git", git_scope)
|
209
217
|
end
|
210
218
|
end
|
211
219
|
|
@@ -231,6 +239,8 @@ module Bundler
|
|
231
239
|
# The gemspecs we cache should already be evaluated.
|
232
240
|
spec = Bundler.load_gemspec(spec_path)
|
233
241
|
next unless spec
|
242
|
+
Bundler.rubygems.set_installed_by_version(spec)
|
243
|
+
Bundler.rubygems.validate(spec)
|
234
244
|
File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
|
235
245
|
end
|
236
246
|
end
|
@@ -274,7 +284,7 @@ module Bundler
|
|
274
284
|
# If there is no URI scheme, assume it is an ssh/git URI
|
275
285
|
input = uri
|
276
286
|
end
|
277
|
-
|
287
|
+
SharedHelpers.digest(:SHA1).hexdigest(input)
|
278
288
|
end
|
279
289
|
|
280
290
|
def cached_revision
|
@@ -291,9 +301,28 @@ module Bundler
|
|
291
301
|
|
292
302
|
def fetch
|
293
303
|
git_proxy.checkout
|
294
|
-
rescue GitError
|
295
|
-
raise unless Bundler.
|
296
|
-
Bundler.ui.warn "Using cached git data because of network errors"
|
304
|
+
rescue GitError => e
|
305
|
+
raise unless Bundler.feature_flag.allow_offline_install?
|
306
|
+
Bundler.ui.warn "Using cached git data because of network errors:\n#{e}"
|
307
|
+
end
|
308
|
+
|
309
|
+
# no-op, since we validate when re-serializing the gemspec
|
310
|
+
def validate_spec(_spec); end
|
311
|
+
|
312
|
+
if Bundler.rubygems.stubs_provide_full_functionality?
|
313
|
+
def load_gemspec(file)
|
314
|
+
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
315
|
+
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
|
316
|
+
StubSpecification.from_stub(stub)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
def git_scope
|
321
|
+
"#{base_name}-#{uri_hash}"
|
322
|
+
end
|
323
|
+
|
324
|
+
def extension_cache_slug(_)
|
325
|
+
extension_dir_name
|
297
326
|
end
|
298
327
|
end
|
299
328
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "shellwords"
|
2
4
|
require "tempfile"
|
3
5
|
module Bundler
|
4
6
|
class Source
|
5
|
-
class Git
|
7
|
+
class Git
|
6
8
|
class GitNotInstalledError < GitError
|
7
9
|
def initialize
|
8
10
|
msg = String.new
|
@@ -61,7 +63,7 @@ module Bundler
|
|
61
63
|
begin
|
62
64
|
@revision ||= find_local_revision
|
63
65
|
rescue GitCommandError
|
64
|
-
raise MissingGitRevisionError.new(ref, uri)
|
66
|
+
raise MissingGitRevisionError.new(ref, URICredentialsFilter.credential_filtered_uri(uri))
|
65
67
|
end
|
66
68
|
|
67
69
|
@revision
|
@@ -89,18 +91,21 @@ module Bundler
|
|
89
91
|
end
|
90
92
|
|
91
93
|
def checkout
|
92
|
-
if path.exist?
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
else
|
99
|
-
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
94
|
+
return if path.exist? && has_revision_cached?
|
95
|
+
extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
|
96
|
+
|
97
|
+
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
98
|
+
|
99
|
+
unless path.exist?
|
100
100
|
SharedHelpers.filesystem_access(path.dirname) do |p|
|
101
101
|
FileUtils.mkdir_p(p)
|
102
102
|
end
|
103
103
|
git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
|
104
|
+
return unless extra_ref
|
105
|
+
end
|
106
|
+
|
107
|
+
in_path do
|
108
|
+
git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref})
|
104
109
|
end
|
105
110
|
end
|
106
111
|
|
@@ -126,12 +131,17 @@ module Bundler
|
|
126
131
|
# method 2
|
127
132
|
SharedHelpers.chdir(destination) do
|
128
133
|
git_retry %(fetch --force --quiet --tags "#{path}")
|
129
|
-
|
134
|
+
|
135
|
+
begin
|
136
|
+
git "reset --hard #{@revision}"
|
137
|
+
rescue GitCommandError
|
138
|
+
raise MissingGitRevisionError.new(@revision, URICredentialsFilter.credential_filtered_uri(uri))
|
139
|
+
end
|
130
140
|
|
131
141
|
if submodules
|
132
142
|
git_retry "submodule update --init --recursive"
|
133
143
|
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
|
134
|
-
git_retry "submodule deinit --all"
|
144
|
+
git_retry "submodule deinit --all --force"
|
135
145
|
end
|
136
146
|
end
|
137
147
|
end
|
@@ -148,7 +158,7 @@ module Bundler
|
|
148
158
|
end
|
149
159
|
|
150
160
|
def git_retry(command)
|
151
|
-
Bundler::Retry.new("`git #{command}`", GitNotAllowedError).attempts do
|
161
|
+
Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
|
152
162
|
git(command)
|
153
163
|
end
|
154
164
|
end
|
@@ -180,7 +190,7 @@ module Bundler
|
|
180
190
|
|
181
191
|
def find_local_revision
|
182
192
|
allowed_in_path do
|
183
|
-
git("rev-parse --verify #{ref}", true).strip
|
193
|
+
git("rev-parse --verify #{Shellwords.shellescape(ref)}", true).strip
|
184
194
|
end
|
185
195
|
end
|
186
196
|
|
@@ -216,6 +226,7 @@ module Bundler
|
|
216
226
|
|
217
227
|
def in_path(&blk)
|
218
228
|
checkout unless path.exist?
|
229
|
+
_ = URICredentialsFilter # load it before we chdir
|
219
230
|
SharedHelpers.chdir(path, &blk)
|
220
231
|
end
|
221
232
|
|
@@ -224,6 +235,11 @@ module Bundler
|
|
224
235
|
raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
|
225
236
|
end
|
226
237
|
|
238
|
+
# TODO: Replace this with Open3 when upgrading to bundler 2
|
239
|
+
# Similar to #git_null, as Open3 is not cross-platform,
|
240
|
+
# a temporary way is to use Tempfile to capture the stderr.
|
241
|
+
# When replacing this using Open3, make sure git_null is
|
242
|
+
# also replaced by Open3, so stdout and stderr all got handled properly.
|
227
243
|
def capture_and_filter_stderr(uri)
|
228
244
|
return_value, captured_err = ""
|
229
245
|
backup_stderr = STDERR.dup
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class Source
|
5
|
+
class Metadata < Source
|
6
|
+
def specs
|
7
|
+
@specs ||= Index.build do |idx|
|
8
|
+
idx << Gem::Specification.new("ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
|
9
|
+
idx << Gem::Specification.new("rubygems\0", Gem::VERSION)
|
10
|
+
|
11
|
+
idx << Gem::Specification.new do |s|
|
12
|
+
s.name = "bundler"
|
13
|
+
s.version = VERSION
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.source = self
|
16
|
+
s.authors = ["bundler team"]
|
17
|
+
s.bindir = "exe"
|
18
|
+
s.executables = %w[bundle]
|
19
|
+
# can't point to the actual gemspec or else the require paths will be wrong
|
20
|
+
s.loaded_from = File.expand_path("..", __FILE__)
|
21
|
+
end
|
22
|
+
|
23
|
+
if local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION }
|
24
|
+
idx << local_spec
|
25
|
+
end
|
26
|
+
|
27
|
+
idx.each {|s| s.source = self }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def cached!; end
|
32
|
+
|
33
|
+
def remote!; end
|
34
|
+
|
35
|
+
def options
|
36
|
+
{}
|
37
|
+
end
|
38
|
+
|
39
|
+
def install(spec, _opts = {})
|
40
|
+
print_using_message "Using #{version_message(spec)}"
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
"the local ruby installation"
|
46
|
+
end
|
47
|
+
|
48
|
+
def ==(other)
|
49
|
+
self.class == other.class
|
50
|
+
end
|
51
|
+
alias_method :eql?, :==
|
52
|
+
|
53
|
+
def hash
|
54
|
+
self.class.hash
|
55
|
+
end
|
56
|
+
|
57
|
+
def version_message(spec)
|
58
|
+
"#{spec.name} #{spec.version}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/bundler/source/path.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Source
|
4
5
|
class Path < Source
|
5
6
|
autoload :Installer, "bundler/source/path/installer"
|
6
7
|
|
7
|
-
attr_reader :path, :options, :root_path
|
8
|
+
attr_reader :path, :options, :root_path, :original_path
|
8
9
|
attr_writer :name
|
9
10
|
attr_accessor :version
|
10
11
|
|
12
|
+
protected :original_path
|
13
|
+
|
11
14
|
DEFAULT_GLOB = "{,*,*/*}.gemspec".freeze
|
12
15
|
|
13
16
|
def initialize(options)
|
@@ -33,10 +36,12 @@ module Bundler
|
|
33
36
|
end
|
34
37
|
|
35
38
|
def remote!
|
39
|
+
@local_specs = nil
|
36
40
|
@allow_remote = true
|
37
41
|
end
|
38
42
|
|
39
43
|
def cached!
|
44
|
+
@local_specs = nil
|
40
45
|
@allow_cached = true
|
41
46
|
end
|
42
47
|
|
@@ -46,7 +51,7 @@ module Bundler
|
|
46
51
|
|
47
52
|
def to_lock
|
48
53
|
out = String.new("PATH\n")
|
49
|
-
out << " remote: #{
|
54
|
+
out << " remote: #{lockfile_path}\n"
|
50
55
|
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
|
51
56
|
out << " specs:\n"
|
52
57
|
end
|
@@ -61,7 +66,7 @@ module Bundler
|
|
61
66
|
|
62
67
|
def eql?(other)
|
63
68
|
return unless other.class == self.class
|
64
|
-
|
69
|
+
expanded_original_path == other.expanded_original_path &&
|
65
70
|
version == other.version
|
66
71
|
end
|
67
72
|
|
@@ -71,15 +76,15 @@ module Bundler
|
|
71
76
|
File.basename(expanded_path.to_s)
|
72
77
|
end
|
73
78
|
|
74
|
-
def install(spec,
|
75
|
-
|
76
|
-
generate_bin(spec, :disable_extensions)
|
79
|
+
def install(spec, options = {})
|
80
|
+
print_using_message "Using #{version_message(spec)} from #{self}"
|
81
|
+
generate_bin(spec, :disable_extensions => true)
|
77
82
|
nil # no post-install message
|
78
83
|
end
|
79
84
|
|
80
85
|
def cache(spec, custom_path = nil)
|
81
86
|
app_cache_path = app_cache_path(custom_path)
|
82
|
-
return unless Bundler.
|
87
|
+
return unless Bundler.feature_flag.cache_all?
|
83
88
|
return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0
|
84
89
|
|
85
90
|
unless @original_path.exist?
|
@@ -111,8 +116,8 @@ module Bundler
|
|
111
116
|
Bundler.root
|
112
117
|
end
|
113
118
|
|
114
|
-
def
|
115
|
-
|
119
|
+
def expanded_original_path
|
120
|
+
@expanded_original_path ||= expand(original_path)
|
116
121
|
end
|
117
122
|
|
118
123
|
private
|
@@ -129,6 +134,11 @@ module Bundler
|
|
129
134
|
"`#{somepath}`.\nThe error message was: #{e.message}."
|
130
135
|
end
|
131
136
|
|
137
|
+
def lockfile_path
|
138
|
+
return relative_path(original_path) if original_path.absolute?
|
139
|
+
expand(original_path).relative_path_from(Bundler.root)
|
140
|
+
end
|
141
|
+
|
132
142
|
def app_cache_path(custom_path = nil)
|
133
143
|
@app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname)
|
134
144
|
end
|
@@ -137,18 +147,28 @@ module Bundler
|
|
137
147
|
SharedHelpers.in_bundle? && app_cache_path.exist?
|
138
148
|
end
|
139
149
|
|
150
|
+
def load_gemspec(file)
|
151
|
+
return unless spec = Bundler.load_gemspec(file)
|
152
|
+
Bundler.rubygems.set_installed_by_version(spec)
|
153
|
+
spec
|
154
|
+
end
|
155
|
+
|
156
|
+
def validate_spec(spec)
|
157
|
+
Bundler.rubygems.validate(spec)
|
158
|
+
end
|
159
|
+
|
140
160
|
def load_spec_files
|
141
161
|
index = Index.new
|
142
162
|
|
143
163
|
if File.directory?(expanded_path)
|
144
164
|
# We sort depth-first since `<<` will override the earlier-found specs
|
145
165
|
Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
|
146
|
-
next unless spec =
|
166
|
+
next unless spec = load_gemspec(file)
|
147
167
|
spec.source = self
|
148
|
-
|
168
|
+
|
149
169
|
# Validation causes extension_dir to be calculated, which depends
|
150
170
|
# on #source, so we validate here instead of load_gemspec
|
151
|
-
|
171
|
+
validate_spec(spec)
|
152
172
|
index << spec
|
153
173
|
end
|
154
174
|
|
@@ -181,14 +201,14 @@ module Bundler
|
|
181
201
|
index
|
182
202
|
end
|
183
203
|
|
184
|
-
def relative_path
|
204
|
+
def relative_path(path = self.path)
|
185
205
|
if path.to_s.start_with?(root_path.to_s)
|
186
206
|
return path.relative_path_from(root_path)
|
187
207
|
end
|
188
208
|
path
|
189
209
|
end
|
190
210
|
|
191
|
-
def generate_bin(spec,
|
211
|
+
def generate_bin(spec, options = {})
|
192
212
|
gem_dir = Pathname.new(spec.full_gem_path)
|
193
213
|
|
194
214
|
# Some gem authors put absolute paths in their gemspec
|
@@ -203,7 +223,13 @@ module Bundler
|
|
203
223
|
end
|
204
224
|
end.compact
|
205
225
|
|
206
|
-
installer = Path::Installer.new(
|
226
|
+
installer = Path::Installer.new(
|
227
|
+
spec,
|
228
|
+
:env_shebang => false,
|
229
|
+
:disable_extensions => options[:disable_extensions],
|
230
|
+
:build_args => options[:build_args],
|
231
|
+
:bundler_extension_cache_path => extension_cache_path(spec)
|
232
|
+
)
|
207
233
|
installer.post_install
|
208
234
|
rescue Gem::InvalidSpecificationException => e
|
209
235
|
Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" \
|
@@ -216,7 +242,7 @@ module Bundler
|
|
216
242
|
"to modify their .gemspec so it can work with `gem build`."
|
217
243
|
end
|
218
244
|
|
219
|
-
Bundler.ui.warn "The validation message from
|
245
|
+
Bundler.ui.warn "The validation message from RubyGems was:\n #{e.message}"
|
220
246
|
end
|
221
247
|
end
|
222
248
|
end
|