bundler 1.9.0 → 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 +1157 -6
- data/README.md +33 -6
- data/bundler.gemspec +51 -18
- data/exe/bundle +31 -0
- data/{bin → exe}/bundle_ruby +10 -6
- data/exe/bundler +4 -0
- data/lib/bundler.rb +326 -207
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +9 -3
- data/lib/bundler/cli.rb +522 -141
- data/lib/bundler/cli/add.rb +35 -0
- data/lib/bundler/cli/binstubs.rb +22 -11
- data/lib/bundler/cli/cache.rb +7 -6
- data/lib/bundler/cli/check.rb +11 -8
- data/lib/bundler/cli/clean.rb +7 -8
- data/lib/bundler/cli/common.rb +53 -7
- data/lib/bundler/cli/config.rb +84 -49
- data/lib/bundler/cli/console.rb +13 -8
- data/lib/bundler/cli/doctor.rb +140 -0
- data/lib/bundler/cli/exec.rb +77 -16
- data/lib/bundler/cli/gem.rb +120 -52
- data/lib/bundler/cli/info.rb +50 -0
- data/lib/bundler/cli/init.rb +21 -7
- data/lib/bundler/cli/inject.rb +37 -10
- data/lib/bundler/cli/install.rb +139 -78
- 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 +9 -6
- data/lib/bundler/cli/outdated.rb +221 -35
- data/lib/bundler/cli/package.rb +11 -7
- data/lib/bundler/cli/platform.rb +7 -4
- 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 +11 -10
- data/lib/bundler/cli/update.rb +47 -29
- data/lib/bundler/cli/viz.rb +12 -8
- 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 +3 -1
- data/lib/bundler/current_ruby.rb +47 -137
- data/lib/bundler/definition.rb +599 -230
- data/lib/bundler/dep_proxy.rb +15 -10
- data/lib/bundler/dependency.rb +54 -25
- data/lib/bundler/deployment.rb +12 -2
- data/lib/bundler/deprecate.rb +33 -4
- data/lib/bundler/dsl.rb +383 -99
- data/lib/bundler/endpoint_specification.rb +72 -7
- data/lib/bundler/env.rb +121 -41
- data/lib/bundler/environment_preserver.rb +59 -0
- data/lib/bundler/errors.rb +158 -0
- data/lib/bundler/feature_flag.rb +74 -0
- data/lib/bundler/fetcher.rb +171 -280
- 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 +113 -58
- data/lib/bundler/gem_helper.rb +73 -46
- data/lib/bundler/gem_helpers.rb +85 -9
- data/lib/bundler/gem_remote_fetcher.rb +43 -0
- data/lib/bundler/gem_tasks.rb +6 -1
- data/lib/bundler/gem_version_promoter.rb +190 -0
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +32 -49
- data/lib/bundler/index.rb +79 -67
- data/lib/bundler/injector.rb +219 -30
- data/lib/bundler/inline.rb +74 -0
- data/lib/bundler/installer.rb +191 -206
- data/lib/bundler/installer/gem_installer.rb +85 -0
- data/lib/bundler/installer/parallel_installer.rb +233 -0
- data/lib/bundler/installer/standalone.rb +53 -0
- data/lib/bundler/lazy_specification.rb +53 -13
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +157 -62
- data/lib/bundler/match_platform.rb +15 -4
- data/lib/bundler/mirror.rb +223 -0
- data/lib/bundler/plugin.rb +292 -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 +162 -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 +17 -6
- data/lib/bundler/remote_specification.rb +68 -11
- data/lib/bundler/resolver.rb +263 -229
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/retry.rb +25 -19
- data/lib/bundler/ruby_dsl.rb +9 -2
- data/lib/bundler/ruby_version.rb +101 -66
- data/lib/bundler/rubygems_ext.rb +77 -37
- data/lib/bundler/rubygems_gem_installer.rb +106 -0
- data/lib/bundler/rubygems_integration.rb +450 -163
- data/lib/bundler/runtime.rb +133 -103
- data/lib/bundler/settings.rb +344 -83
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +7 -3
- data/lib/bundler/shared_helpers.rb +284 -54
- data/lib/bundler/similarity_detector.rb +21 -21
- data/lib/bundler/source.rb +68 -15
- data/lib/bundler/source/gemspec.rb +18 -0
- data/lib/bundler/source/git.rb +90 -55
- data/lib/bundler/source/git/git_proxy.rb +135 -35
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path.rb +84 -61
- data/lib/bundler/source/path/installer.rb +53 -17
- data/lib/bundler/source/rubygems.rb +282 -122
- data/lib/bundler/source/rubygems/remote.rb +69 -0
- data/lib/bundler/source_list.rb +107 -22
- data/lib/bundler/spec_set.rb +83 -45
- data/lib/bundler/ssl_certs/certificate_manager.rb +8 -7
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/bundler/ssl_certs/{DigiCertHighAssuranceEVRootCA.pem → rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem} +0 -0
- data/lib/bundler/ssl_certs/{AddTrustExternalCARoot-2048.pem → rubygems.org/AddTrustExternalCARoot.pem} +0 -0
- data/lib/bundler/stub_specification.rb +108 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +19 -6
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Executable.standalone +6 -4
- data/lib/bundler/templates/Gemfile +4 -1
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +68 -7
- 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 +19 -11
- data/lib/bundler/templates/newgem/Rakefile.tt +10 -6
- data/lib/bundler/templates/newgem/bin/console.tt +1 -1
- data/lib/bundler/templates/newgem/bin/setup.tt +2 -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 +31 -15
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +3 -5
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +14 -2
- data/lib/bundler/templates/newgem/test/{test_newgem.rb.tt → newgem_test.rb.tt} +2 -2
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/travis.yml.tt +7 -0
- data/lib/bundler/ui.rb +5 -3
- data/lib/bundler/ui/rg_proxy.rb +5 -7
- data/lib/bundler/ui/shell.rb +69 -18
- data/lib/bundler/ui/silent.rb +26 -1
- data/lib/bundler/uri_credentials_filter.rb +37 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -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-0.2.1 → molinillo}/lib/molinillo/modules/specification_provider.rb +11 -0
- data/lib/bundler/vendor/{Molinillo-0.2.1 → molinillo}/lib/molinillo/modules/ui.rb +6 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +837 -0
- data/lib/bundler/vendor/{Molinillo-0.2.1 → molinillo}/lib/molinillo/resolver.rb +6 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +58 -0
- 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-0.19.1 → thor}/lib/thor.rb +47 -22
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions.rb +31 -29
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/create_file.rb +3 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/directory.rb +3 -3
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/file_manipulation.rb +66 -18
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/inject_into_file.rb +18 -16
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/base.rb +67 -44
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/command.rb +13 -11
- data/lib/bundler/vendor/{thor-0.19.1 → 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 +12 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +129 -0
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/error.rb +3 -3
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/group.rb +14 -14
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/invocation.rb +4 -5
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/line_editor/readline.rb +0 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/arguments.rb +16 -16
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/option.rb +42 -21
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/options.rb +13 -10
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/rake_compat.rb +1 -1
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/runner.rb +35 -33
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell/basic.rb +49 -33
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell/color.rb +2 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell/html.rb +5 -5
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/util.rb +8 -7
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/version.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +4 -5
- data/lib/bundler/vendored_persistent.rb +45 -4
- data/lib/bundler/vendored_thor.rb +8 -5
- data/lib/bundler/version.rb +23 -1
- data/lib/bundler/version_ranges.rb +76 -0
- data/lib/bundler/vlad.rb +8 -2
- data/lib/bundler/worker.rb +39 -6
- 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 +256 -31
- 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 +19 -3
- 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 +64 -67
- 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 +14 -8
- data/man/bundle-platform.1 +61 -0
- data/man/bundle-platform.1.txt +57 -0
- data/man/bundle-platform.ronn +1 -1
- 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 +180 -18
- 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 +46 -33
- data/man/gemfile.5 +689 -0
- data/man/gemfile.5.ronn +127 -79
- data/man/gemfile.5.txt +653 -0
- data/man/index.txt +25 -7
- metadata +242 -95
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.travis.yml +0 -110
- data/CODE_OF_CONDUCT.md +0 -40
- data/CONTRIBUTING.md +0 -32
- data/DEVELOPMENT.md +0 -119
- data/ISSUES.md +0 -96
- data/Rakefile +0 -302
- data/UPGRADING.md +0 -103
- data/bin/bundle +0 -21
- data/bin/bundler +0 -21
- data/lib/bundler/anonymizable_uri.rb +0 -32
- data/lib/bundler/environment.rb +0 -42
- data/lib/bundler/gem_installer.rb +0 -9
- data/lib/bundler/gem_path_manipulation.rb +0 -8
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/bundler/templates/newgem/.travis.yml.tt +0 -3
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +0 -4
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo.rb +0 -5
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/dependency_graph.rb +0 -266
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/errors.rb +0 -69
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/gem_metadata.rb +0 -3
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/resolution.rb +0 -412
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/state.rb +0 -43
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/core_ext/io_binary_read.rb +0 -10
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/core_ext/ordered_hash.rb +0 -98
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/parser.rb +0 -4
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
[![Build Status](https://img.shields.io/travis/bundler/bundler/master.svg?style=flat)](https://travis-ci.org/bundler/bundler)
|
3
3
|
[![Code Climate](https://img.shields.io/codeclimate/github/bundler/bundler.svg?style=flat)](https://codeclimate.com/github/bundler/bundler)
|
4
4
|
[![Inline docs ](http://inch-ci.org/github/bundler/bundler.svg?style=flat)](http://inch-ci.org/github/bundler/bundler)
|
5
|
+
[![Slack ](http://bundler-slackin.herokuapp.com/badge.svg)](http://bundler-slackin.herokuapp.com)
|
5
6
|
|
6
7
|
# Bundler: a gem to bundle gems
|
7
8
|
|
@@ -11,26 +12,52 @@ It does this by managing the gems that the application depends on. Given a list
|
|
11
12
|
|
12
13
|
### Installation and usage
|
13
14
|
|
15
|
+
To install (or update to the latest version):
|
16
|
+
|
14
17
|
```
|
15
18
|
gem install bundler
|
19
|
+
```
|
20
|
+
|
21
|
+
To install a prerelease version (if one is available), run `gem install bundler --pre`. To uninstall Bundler, run `gem uninstall bundler`.
|
22
|
+
|
23
|
+
Bundler is most commonly used to manage your application's dependencies. For example, these commands will allow you to use Bundler to manage the `rspec` gem for your application:
|
24
|
+
|
25
|
+
```
|
16
26
|
bundle init
|
17
|
-
|
27
|
+
bundle add rspec
|
18
28
|
bundle install
|
19
|
-
bundle exec
|
29
|
+
bundle exec rspec
|
20
30
|
```
|
21
31
|
|
22
32
|
See [bundler.io](http://bundler.io) for the full documentation.
|
23
33
|
|
24
34
|
### Troubleshooting
|
25
35
|
|
26
|
-
For help with common problems, see [
|
36
|
+
For help with common problems, see [TROUBLESHOOTING](doc/TROUBLESHOOTING.md).
|
37
|
+
|
38
|
+
Still stuck? Try [filing an issue](doc/contributing/ISSUES.md).
|
27
39
|
|
28
40
|
### Other questions
|
29
41
|
|
30
|
-
To see what has changed in recent versions of Bundler, see the [CHANGELOG](
|
42
|
+
To see what has changed in recent versions of Bundler, see the [CHANGELOG](CHANGELOG.md).
|
31
43
|
|
32
|
-
|
44
|
+
To get in touch with the Bundler core team and other Bundler users, please see [getting help](doc/contributing/GETTING_HELP.md).
|
33
45
|
|
34
46
|
### Contributing
|
35
47
|
|
36
|
-
If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in [
|
48
|
+
If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in [our documentation section](doc/README.md).
|
49
|
+
|
50
|
+
While some Bundler contributors are compensated by Ruby Together, the project maintainers make decisions independent of Ruby Together. As a project, we welcome contributions regardless of the author’s affiliation with Ruby Together.
|
51
|
+
|
52
|
+
### Supporting
|
53
|
+
|
54
|
+
<a href="https://rubytogether.org/"><img src="https://rubytogether.org/images/rubies.svg" width="150"></a><br>
|
55
|
+
<a href="https://rubytogether.org/">Ruby Together</a> pays some Bundler maintainers for their ongoing work. As a grassroots initiative committed to supporting the critical Ruby infrastructure you rely on, Ruby Together is funded entirely by the Ruby community. Contribute today <a href="https://rubytogether.org/developers">as an individual</a> or (better yet) <a href="https://rubytogether.org/companies">as a company</a> to ensure that Bundler, RubyGems, and other shared tooling is around for years to come.
|
56
|
+
|
57
|
+
### Code of Conduct
|
58
|
+
|
59
|
+
Everyone interacting in the Bundler project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/bundler/bundler/blob/master/CODE_OF_CONDUCT.md).
|
60
|
+
|
61
|
+
### License
|
62
|
+
|
63
|
+
[MIT License](https://github.com/bundler/bundler/blob/master/LICENSE.md)
|
data/bundler.gemspec
CHANGED
@@ -1,31 +1,64 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
begin
|
5
|
+
require File.expand_path("../lib/bundler/version", __FILE__)
|
6
|
+
rescue LoadError
|
7
|
+
# for Ruby core repository
|
8
|
+
require File.expand_path("../bundler/version", __FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
require "shellwords"
|
5
12
|
|
6
13
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
14
|
+
s.name = "bundler"
|
8
15
|
s.version = Bundler::VERSION
|
9
|
-
s.
|
10
|
-
s.authors = [
|
11
|
-
|
16
|
+
s.license = "MIT"
|
17
|
+
s.authors = [
|
18
|
+
"André Arko", "Samuel Giddins", "Colby Swandale", "Hiroshi Shibata",
|
19
|
+
"David Rodríguez", "Grey Baker", "Stephanie Morillo", "Chris Morris", "James Wen", "Tim Moore",
|
20
|
+
"André Medeiros", "Jessica Lynn Suttles", "Terence Lee", "Carl Lerche",
|
21
|
+
"Yehuda Katz"
|
22
|
+
]
|
23
|
+
s.email = ["team@bundler.io"]
|
12
24
|
s.homepage = "http://bundler.io"
|
13
|
-
s.summary =
|
14
|
-
s.description =
|
25
|
+
s.summary = "The best way to manage your application's dependencies"
|
26
|
+
s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
|
27
|
+
|
28
|
+
if s.respond_to?(:metadata=)
|
29
|
+
s.metadata = {
|
30
|
+
"bug_tracker_uri" => "http://github.com/bundler/bundler/issues",
|
31
|
+
"changelog_uri" => "https://github.com/bundler/bundler/blob/master/CHANGELOG.md",
|
32
|
+
"homepage_uri" => "https://bundler.io/",
|
33
|
+
"source_code_uri" => "http://github.com/bundler/bundler/",
|
34
|
+
}
|
35
|
+
end
|
15
36
|
|
16
|
-
s.
|
17
|
-
|
37
|
+
if s.version >= Gem::Version.new("2.a".dup)
|
38
|
+
s.required_ruby_version = ">= 2.3.0"
|
39
|
+
s.required_rubygems_version = ">= 2.5.0"
|
40
|
+
else
|
41
|
+
s.required_ruby_version = ">= 1.8.7"
|
42
|
+
s.required_rubygems_version = ">= 1.3.6"
|
43
|
+
end
|
18
44
|
|
19
|
-
s.add_development_dependency
|
20
|
-
s.add_development_dependency
|
21
|
-
s.add_development_dependency
|
22
|
-
s.add_development_dependency
|
45
|
+
s.add_development_dependency "automatiek", "~> 0.1.0"
|
46
|
+
s.add_development_dependency "mustache", "0.99.6"
|
47
|
+
s.add_development_dependency "rake", "~> 10.0"
|
48
|
+
s.add_development_dependency "rdiscount", "~> 2.2"
|
49
|
+
s.add_development_dependency "ronn", "~> 0.7.3"
|
50
|
+
s.add_development_dependency "rspec", "~> 3.6"
|
23
51
|
|
24
|
-
s.files
|
52
|
+
s.files = `git ls-files -z`.split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
|
25
53
|
# we don't check in man pages, but we need to ship them because
|
26
54
|
# we use them to generate the long-form help for each command.
|
27
|
-
s.files
|
55
|
+
s.files += Dir.glob("man/**/*")
|
56
|
+
# Include the CHANGELOG.md, LICENSE.md, README.md manually
|
57
|
+
s.files += %w[CHANGELOG.md LICENSE.md README.md]
|
58
|
+
# include the gemspec itself because warbler breaks w/o it
|
59
|
+
s.files += %w[bundler.gemspec]
|
28
60
|
|
29
|
-
s.
|
61
|
+
s.bindir = "exe"
|
62
|
+
s.executables = %w[bundle bundler]
|
30
63
|
s.require_paths = ["lib"]
|
31
64
|
end
|
data/exe/bundle
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Exit cleanly from an early interrupt
|
5
|
+
Signal.trap("INT") do
|
6
|
+
Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
require "bundler"
|
11
|
+
# Check if an older version of bundler is installed
|
12
|
+
$LOAD_PATH.each do |path|
|
13
|
+
next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
|
14
|
+
err = String.new
|
15
|
+
err << "Looks like you have a version of bundler that's older than 0.9.\n"
|
16
|
+
err << "Please remove your old versions.\n"
|
17
|
+
err << "An easy way to do this is by running `gem cleanup bundler`."
|
18
|
+
abort(err)
|
19
|
+
end
|
20
|
+
|
21
|
+
require "bundler/friendly_errors"
|
22
|
+
Bundler.with_friendly_errors do
|
23
|
+
require "bundler/cli"
|
24
|
+
|
25
|
+
# Allow any command to use --help flag to show help for that command
|
26
|
+
help_flags = %w[--help -h]
|
27
|
+
help_flag_used = ARGV.any? {|a| help_flags.include? a }
|
28
|
+
args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV
|
29
|
+
|
30
|
+
Bundler::CLI.start(args, :debug => true)
|
31
|
+
end
|
data/{bin → exe}/bundle_ruby
RENAMED
@@ -1,13 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/shared_helpers"
|
5
|
+
|
6
|
+
Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
|
2
7
|
|
3
8
|
Signal.trap("INT") { exit 1 }
|
4
9
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
10
|
+
require "bundler/errors"
|
11
|
+
require "bundler/ruby_version"
|
12
|
+
require "bundler/ruby_dsl"
|
8
13
|
|
9
14
|
module Bundler
|
10
|
-
class GemfileError < RuntimeError; end
|
11
15
|
class Dsl
|
12
16
|
include RubyDsl
|
13
17
|
|
@@ -18,7 +22,7 @@ module Bundler
|
|
18
22
|
end
|
19
23
|
|
20
24
|
def eval_gemfile(gemfile, contents = nil)
|
21
|
-
contents ||= File.open(gemfile, "rb"
|
25
|
+
contents ||= File.open(gemfile, "rb", &:read)
|
22
26
|
instance_eval(contents, gemfile.to_s, 1)
|
23
27
|
rescue SyntaxError => e
|
24
28
|
bt = e.message.split("\n")[1..-1]
|
@@ -36,7 +40,7 @@ module Bundler
|
|
36
40
|
def gem(name, *args)
|
37
41
|
end
|
38
42
|
|
39
|
-
def group(*args
|
43
|
+
def group(*args)
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
data/exe/bundler
ADDED
data/lib/bundler.rb
CHANGED
@@ -1,104 +1,87 @@
|
|
1
|
-
|
2
|
-
require 'pathname'
|
3
|
-
require 'rbconfig'
|
4
|
-
require 'bundler/gem_path_manipulation'
|
5
|
-
require 'bundler/rubygems_ext'
|
6
|
-
require 'bundler/rubygems_integration'
|
7
|
-
require 'bundler/version'
|
8
|
-
require 'bundler/constants'
|
9
|
-
require 'bundler/current_ruby'
|
1
|
+
# frozen_string_literal: true
|
10
2
|
|
11
|
-
|
12
|
-
preserve_gem_path
|
13
|
-
ORIGINAL_ENV = ENV.to_hash
|
14
|
-
|
15
|
-
autoload :AnonymizableURI, 'bundler/anonymizable_uri'
|
16
|
-
autoload :Definition, 'bundler/definition'
|
17
|
-
autoload :Dependency, 'bundler/dependency'
|
18
|
-
autoload :DepProxy, 'bundler/dep_proxy'
|
19
|
-
autoload :Deprecate, 'bundler/deprecate'
|
20
|
-
autoload :Dsl, 'bundler/dsl'
|
21
|
-
autoload :EndpointSpecification, 'bundler/endpoint_specification'
|
22
|
-
autoload :Environment, 'bundler/environment'
|
23
|
-
autoload :Env, 'bundler/env'
|
24
|
-
autoload :Fetcher, 'bundler/fetcher'
|
25
|
-
autoload :GemHelper, 'bundler/gem_helper'
|
26
|
-
autoload :GemHelpers, 'bundler/gem_helpers'
|
27
|
-
autoload :GemInstaller, 'bundler/gem_installer'
|
28
|
-
autoload :Graph, 'bundler/graph'
|
29
|
-
autoload :Index, 'bundler/index'
|
30
|
-
autoload :Installer, 'bundler/installer'
|
31
|
-
autoload :Injector, 'bundler/injector'
|
32
|
-
autoload :LazySpecification, 'bundler/lazy_specification'
|
33
|
-
autoload :LockfileParser, 'bundler/lockfile_parser'
|
34
|
-
autoload :MatchPlatform, 'bundler/match_platform'
|
35
|
-
autoload :RemoteSpecification, 'bundler/remote_specification'
|
36
|
-
autoload :Resolver, 'bundler/resolver'
|
37
|
-
autoload :Retry, 'bundler/retry'
|
38
|
-
autoload :RubyVersion, 'bundler/ruby_version'
|
39
|
-
autoload :RubyDsl, 'bundler/ruby_dsl'
|
40
|
-
autoload :Runtime, 'bundler/runtime'
|
41
|
-
autoload :Settings, 'bundler/settings'
|
42
|
-
autoload :SharedHelpers, 'bundler/shared_helpers'
|
43
|
-
autoload :SpecSet, 'bundler/spec_set'
|
44
|
-
autoload :Source, 'bundler/source'
|
45
|
-
autoload :SourceList, 'bundler/source_list'
|
46
|
-
autoload :Specification, 'bundler/shared_helpers'
|
47
|
-
autoload :SystemRubyVersion, 'bundler/ruby_version'
|
48
|
-
autoload :UI, 'bundler/ui'
|
49
|
-
|
50
|
-
class BundlerError < StandardError
|
51
|
-
def self.status_code(code)
|
52
|
-
define_method(:status_code) { code }
|
53
|
-
end
|
54
|
-
end
|
3
|
+
require "bundler/compatibility_guard"
|
55
4
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
class InstallHookError < BundlerError; status_code(8) ; end
|
61
|
-
class PathError < BundlerError; status_code(13) ; end
|
62
|
-
class GitError < BundlerError; status_code(11) ; end
|
63
|
-
class DeprecatedError < BundlerError; status_code(12) ; end
|
64
|
-
class GemspecError < BundlerError; status_code(14) ; end
|
65
|
-
class InvalidOption < BundlerError; status_code(15) ; end
|
66
|
-
class ProductionError < BundlerError; status_code(16) ; end
|
67
|
-
class HTTPError < BundlerError; status_code(17) ; end
|
68
|
-
class RubyVersionMismatch < BundlerError; status_code(18) ; end
|
69
|
-
class SecurityError < BundlerError; status_code(19) ; end
|
70
|
-
class LockfileError < BundlerError; status_code(20) ; end
|
71
|
-
class CyclicDependencyError < BundlerError; status_code(21) ; end
|
72
|
-
class GemfileLockNotFound < BundlerError; status_code(22) ; end
|
73
|
-
|
74
|
-
# Internal errors, should be rescued
|
75
|
-
class VersionConflict < BundlerError
|
76
|
-
attr_reader :conflicts
|
77
|
-
|
78
|
-
def initialize(conflicts, msg = nil)
|
79
|
-
super(msg)
|
80
|
-
@conflicts = conflicts
|
81
|
-
end
|
82
|
-
|
83
|
-
status_code(6)
|
84
|
-
end
|
5
|
+
require "bundler/vendored_fileutils"
|
6
|
+
require "pathname"
|
7
|
+
require "rbconfig"
|
8
|
+
require "thread"
|
85
9
|
|
86
|
-
|
10
|
+
require "bundler/errors"
|
11
|
+
require "bundler/environment_preserver"
|
12
|
+
require "bundler/plugin"
|
13
|
+
require "bundler/rubygems_ext"
|
14
|
+
require "bundler/rubygems_integration"
|
15
|
+
require "bundler/version"
|
16
|
+
require "bundler/constants"
|
17
|
+
require "bundler/current_ruby"
|
18
|
+
require "bundler/build_metadata"
|
87
19
|
|
88
|
-
|
89
|
-
|
20
|
+
module Bundler
|
21
|
+
environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
|
22
|
+
ORIGINAL_ENV = environment_preserver.restore
|
23
|
+
ENV.replace(environment_preserver.backup)
|
24
|
+
SUDO_MUTEX = Mutex.new
|
25
|
+
|
26
|
+
autoload :Definition, "bundler/definition"
|
27
|
+
autoload :Dependency, "bundler/dependency"
|
28
|
+
autoload :DepProxy, "bundler/dep_proxy"
|
29
|
+
autoload :Deprecate, "bundler/deprecate"
|
30
|
+
autoload :Dsl, "bundler/dsl"
|
31
|
+
autoload :EndpointSpecification, "bundler/endpoint_specification"
|
32
|
+
autoload :Env, "bundler/env"
|
33
|
+
autoload :Fetcher, "bundler/fetcher"
|
34
|
+
autoload :FeatureFlag, "bundler/feature_flag"
|
35
|
+
autoload :GemHelper, "bundler/gem_helper"
|
36
|
+
autoload :GemHelpers, "bundler/gem_helpers"
|
37
|
+
autoload :GemRemoteFetcher, "bundler/gem_remote_fetcher"
|
38
|
+
autoload :GemVersionPromoter, "bundler/gem_version_promoter"
|
39
|
+
autoload :Graph, "bundler/graph"
|
40
|
+
autoload :Index, "bundler/index"
|
41
|
+
autoload :Injector, "bundler/injector"
|
42
|
+
autoload :Installer, "bundler/installer"
|
43
|
+
autoload :LazySpecification, "bundler/lazy_specification"
|
44
|
+
autoload :LockfileParser, "bundler/lockfile_parser"
|
45
|
+
autoload :MatchPlatform, "bundler/match_platform"
|
46
|
+
autoload :ProcessLock, "bundler/process_lock"
|
47
|
+
autoload :RemoteSpecification, "bundler/remote_specification"
|
48
|
+
autoload :Resolver, "bundler/resolver"
|
49
|
+
autoload :Retry, "bundler/retry"
|
50
|
+
autoload :RubyDsl, "bundler/ruby_dsl"
|
51
|
+
autoload :RubyGemsGemInstaller, "bundler/rubygems_gem_installer"
|
52
|
+
autoload :RubyVersion, "bundler/ruby_version"
|
53
|
+
autoload :Runtime, "bundler/runtime"
|
54
|
+
autoload :Settings, "bundler/settings"
|
55
|
+
autoload :SharedHelpers, "bundler/shared_helpers"
|
56
|
+
autoload :Source, "bundler/source"
|
57
|
+
autoload :SourceList, "bundler/source_list"
|
58
|
+
autoload :SpecSet, "bundler/spec_set"
|
59
|
+
autoload :StubSpecification, "bundler/stub_specification"
|
60
|
+
autoload :UI, "bundler/ui"
|
61
|
+
autoload :URICredentialsFilter, "bundler/uri_credentials_filter"
|
62
|
+
autoload :VersionRanges, "bundler/version_ranges"
|
90
63
|
|
64
|
+
class << self
|
91
65
|
def configure
|
92
66
|
@configured ||= configure_gem_home_and_path
|
93
67
|
end
|
94
68
|
|
95
69
|
def ui
|
96
|
-
@ui
|
70
|
+
(defined?(@ui) && @ui) || (self.ui = UI::Silent.new)
|
71
|
+
end
|
72
|
+
|
73
|
+
def ui=(ui)
|
74
|
+
Bundler.rubygems.ui = ui ? UI::RGProxy.new(ui) : nil
|
75
|
+
@ui = ui
|
97
76
|
end
|
98
77
|
|
99
78
|
# Returns absolute path of where gems are installed on the filesystem.
|
100
79
|
def bundle_path
|
101
|
-
@bundle_path ||= Pathname.new(
|
80
|
+
@bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
|
81
|
+
end
|
82
|
+
|
83
|
+
def configured_bundle_path
|
84
|
+
@configured_bundle_path ||= settings.path.tap(&:validate!)
|
102
85
|
end
|
103
86
|
|
104
87
|
# Returns absolute location of where binstubs are installed to.
|
@@ -106,27 +89,24 @@ module Bundler
|
|
106
89
|
@bin_path ||= begin
|
107
90
|
path = settings[:bin] || "bin"
|
108
91
|
path = Pathname.new(path).expand_path(root).expand_path
|
109
|
-
FileUtils.mkdir_p(
|
92
|
+
SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) }
|
110
93
|
path
|
111
94
|
end
|
112
95
|
end
|
113
96
|
|
114
97
|
def setup(*groups)
|
115
|
-
#
|
116
|
-
return @setup if defined?(@setup)
|
98
|
+
# Return if all groups are already loaded
|
99
|
+
return @setup if defined?(@setup) && @setup
|
100
|
+
|
101
|
+
definition.validate_runtime!
|
117
102
|
|
118
|
-
|
103
|
+
SharedHelpers.print_major_deprecations!
|
119
104
|
|
120
105
|
if groups.empty?
|
121
106
|
# Load all groups, but only once
|
122
107
|
@setup = load.setup
|
123
108
|
else
|
124
|
-
|
125
|
-
# Figure out which groups haven't been loaded yet
|
126
|
-
unloaded = groups - @completed_groups
|
127
|
-
# Record groups that are now loaded
|
128
|
-
@completed_groups = groups
|
129
|
-
unloaded.any? ? load.setup(*groups) : load
|
109
|
+
load.setup(*groups)
|
130
110
|
end
|
131
111
|
end
|
132
112
|
|
@@ -139,7 +119,8 @@ module Bundler
|
|
139
119
|
end
|
140
120
|
|
141
121
|
def environment
|
142
|
-
|
122
|
+
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
|
123
|
+
load
|
143
124
|
end
|
144
125
|
|
145
126
|
# Returns an instance of Bundler::Definition for given Gemfile and lockfile
|
@@ -151,27 +132,89 @@ module Bundler
|
|
151
132
|
@definition = nil if unlock
|
152
133
|
@definition ||= begin
|
153
134
|
configure
|
154
|
-
upgrade_lockfile
|
155
135
|
Definition.build(default_gemfile, default_lockfile, unlock)
|
156
136
|
end
|
157
137
|
end
|
158
138
|
|
139
|
+
def frozen_bundle?
|
140
|
+
frozen = settings[:deployment]
|
141
|
+
frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
|
142
|
+
frozen
|
143
|
+
end
|
144
|
+
|
159
145
|
def locked_gems
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
146
|
+
@locked_gems ||=
|
147
|
+
if defined?(@definition) && @definition
|
148
|
+
definition.locked_gems
|
149
|
+
elsif Bundler.default_lockfile.file?
|
150
|
+
lock = Bundler.read_file(Bundler.default_lockfile)
|
151
|
+
LockfileParser.new(lock)
|
152
|
+
end
|
167
153
|
end
|
168
154
|
|
169
155
|
def ruby_scope
|
170
156
|
"#{Bundler.rubygems.ruby_engine}/#{Bundler.rubygems.config_map[:ruby_version]}"
|
171
157
|
end
|
172
158
|
|
173
|
-
def
|
174
|
-
|
159
|
+
def user_home
|
160
|
+
@user_home ||= begin
|
161
|
+
home = Bundler.rubygems.user_home
|
162
|
+
bundle_home = home ? File.join(home, ".bundle") : nil
|
163
|
+
|
164
|
+
warning = if home.nil?
|
165
|
+
"Your home directory is not set."
|
166
|
+
elsif !File.directory?(home)
|
167
|
+
"`#{home}` is not a directory."
|
168
|
+
elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home))
|
169
|
+
"`#{home}` is not writable."
|
170
|
+
end
|
171
|
+
|
172
|
+
if warning
|
173
|
+
Kernel.send(:require, "etc")
|
174
|
+
user_home = tmp_home_path(Etc.getlogin, warning)
|
175
|
+
Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
|
176
|
+
user_home
|
177
|
+
else
|
178
|
+
Pathname.new(home)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def tmp_home_path(login, warning)
|
184
|
+
login ||= "unknown"
|
185
|
+
Kernel.send(:require, "tmpdir")
|
186
|
+
path = Pathname.new(Dir.tmpdir).join("bundler", "home")
|
187
|
+
SharedHelpers.filesystem_access(path) do |tmp_home_path|
|
188
|
+
unless tmp_home_path.exist?
|
189
|
+
tmp_home_path.mkpath
|
190
|
+
tmp_home_path.chmod(0o777)
|
191
|
+
end
|
192
|
+
tmp_home_path.join(login).tap(&:mkpath)
|
193
|
+
end
|
194
|
+
rescue RuntimeError => e
|
195
|
+
raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
|
196
|
+
end
|
197
|
+
|
198
|
+
def user_bundle_path(dir = "home")
|
199
|
+
env_var, fallback = case dir
|
200
|
+
when "home"
|
201
|
+
["BUNDLE_USER_HOME", Pathname.new(user_home).join(".bundle")]
|
202
|
+
when "cache"
|
203
|
+
["BUNDLE_USER_CACHE", user_bundle_path.join("cache")]
|
204
|
+
when "config"
|
205
|
+
["BUNDLE_USER_CONFIG", user_bundle_path.join("config")]
|
206
|
+
when "plugin"
|
207
|
+
["BUNDLE_USER_PLUGIN", user_bundle_path.join("plugin")]
|
208
|
+
else
|
209
|
+
raise BundlerError, "Unknown user path requested: #{dir}"
|
210
|
+
end
|
211
|
+
# `fallback` will already be a Pathname, but Pathname.new() is
|
212
|
+
# idempotent so it's OK
|
213
|
+
Pathname.new(ENV.fetch(env_var, fallback))
|
214
|
+
end
|
215
|
+
|
216
|
+
def user_cache
|
217
|
+
user_bundle_path("cache")
|
175
218
|
end
|
176
219
|
|
177
220
|
def home
|
@@ -186,13 +229,9 @@ module Bundler
|
|
186
229
|
bundle_path.join("specifications")
|
187
230
|
end
|
188
231
|
|
189
|
-
def cache
|
190
|
-
bundle_path.join("cache/bundler")
|
191
|
-
end
|
192
|
-
|
193
232
|
def root
|
194
233
|
@root ||= begin
|
195
|
-
|
234
|
+
SharedHelpers.root
|
196
235
|
rescue GemfileNotFound
|
197
236
|
bundle_dir = default_bundle_dir
|
198
237
|
raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
|
@@ -201,51 +240,77 @@ module Bundler
|
|
201
240
|
end
|
202
241
|
|
203
242
|
def app_config_path
|
204
|
-
ENV[
|
205
|
-
Pathname.new(
|
206
|
-
|
243
|
+
if app_config = ENV["BUNDLE_APP_CONFIG"]
|
244
|
+
Pathname.new(app_config).expand_path(root)
|
245
|
+
else
|
246
|
+
root.join(".bundle")
|
247
|
+
end
|
207
248
|
end
|
208
249
|
|
209
250
|
def app_cache(custom_path = nil)
|
210
251
|
path = custom_path || root
|
211
|
-
path.join(
|
252
|
+
Pathname.new(path).join(settings.app_cache_path)
|
212
253
|
end
|
213
254
|
|
214
255
|
def tmp(name = Process.pid.to_s)
|
215
|
-
|
216
|
-
|
256
|
+
Kernel.send(:require, "tmpdir")
|
257
|
+
Pathname.new(Dir.mktmpdir(["bundler", name]))
|
217
258
|
end
|
218
259
|
|
219
|
-
def
|
220
|
-
FileUtils.remove_entry_secure(
|
221
|
-
rescue
|
260
|
+
def rm_rf(path)
|
261
|
+
FileUtils.remove_entry_secure(path) if path && File.exist?(path)
|
262
|
+
rescue ArgumentError
|
263
|
+
message = <<EOF
|
264
|
+
It is a security vulnerability to allow your home directory to be world-writable, and bundler can not continue.
|
265
|
+
You should probably consider fixing this issue by running `chmod o-w ~` on *nix.
|
266
|
+
Please refer to http://ruby-doc.org/stdlib-2.1.2/libdoc/fileutils/rdoc/FileUtils.html#method-c-remove_entry_secure for details.
|
267
|
+
EOF
|
268
|
+
File.world_writable?(path) ? Bundler.ui.warn(message) : raise
|
269
|
+
raise PathError, "Please fix the world-writable issue with your #{path} directory"
|
222
270
|
end
|
223
271
|
|
224
272
|
def settings
|
225
|
-
|
226
|
-
@settings = Settings.new(app_config_path)
|
273
|
+
@settings ||= Settings.new(app_config_path)
|
227
274
|
rescue GemfileNotFound
|
228
275
|
@settings = Settings.new(Pathname.new(".bundle").expand_path)
|
229
276
|
end
|
230
277
|
|
278
|
+
# @return [Hash] Environment present before Bundler was activated
|
279
|
+
def original_env
|
280
|
+
ORIGINAL_ENV.clone
|
281
|
+
end
|
282
|
+
|
283
|
+
# @deprecated Use `original_env` instead
|
284
|
+
# @return [Hash] Environment with all bundler-related variables removed
|
285
|
+
def clean_env
|
286
|
+
Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
|
287
|
+
env = original_env
|
288
|
+
|
289
|
+
if env.key?("BUNDLER_ORIG_MANPATH")
|
290
|
+
env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
|
291
|
+
end
|
292
|
+
|
293
|
+
env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
|
294
|
+
|
295
|
+
if env.key?("RUBYOPT")
|
296
|
+
env["RUBYOPT"] = env["RUBYOPT"].sub "-rbundler/setup", ""
|
297
|
+
end
|
298
|
+
|
299
|
+
if env.key?("RUBYLIB")
|
300
|
+
rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
|
301
|
+
rubylib.delete(File.expand_path("..", __FILE__))
|
302
|
+
env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
|
303
|
+
end
|
304
|
+
|
305
|
+
env
|
306
|
+
end
|
307
|
+
|
231
308
|
def with_original_env
|
232
|
-
|
233
|
-
ENV.replace(ORIGINAL_ENV)
|
234
|
-
yield
|
235
|
-
ensure
|
236
|
-
ENV.replace(bundled_env.to_hash)
|
309
|
+
with_env(original_env) { yield }
|
237
310
|
end
|
238
311
|
|
239
312
|
def with_clean_env
|
240
|
-
|
241
|
-
ENV['MANPATH'] = ENV['BUNDLE_ORIG_MANPATH']
|
242
|
-
ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
|
243
|
-
if ENV.has_key? 'RUBYOPT'
|
244
|
-
ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', ''
|
245
|
-
ENV['RUBYOPT'] = ENV['RUBYOPT'].sub "-I#{File.expand_path('..', __FILE__)}", ''
|
246
|
-
end
|
247
|
-
yield
|
248
|
-
end
|
313
|
+
with_env(clean_env) { yield }
|
249
314
|
end
|
250
315
|
|
251
316
|
def clean_system(*args)
|
@@ -256,6 +321,11 @@ module Bundler
|
|
256
321
|
with_clean_env { Kernel.exec(*args) }
|
257
322
|
end
|
258
323
|
|
324
|
+
def local_platform
|
325
|
+
return Gem::Platform::RUBY if settings[:force_ruby_platform]
|
326
|
+
Gem::Platform.local
|
327
|
+
end
|
328
|
+
|
259
329
|
def default_gemfile
|
260
330
|
SharedHelpers.default_gemfile
|
261
331
|
end
|
@@ -269,23 +339,25 @@ module Bundler
|
|
269
339
|
end
|
270
340
|
|
271
341
|
def system_bindir
|
272
|
-
# Gem.bindir doesn't always return the location that
|
273
|
-
# system binaries. If you put '-n foo' in your .gemrc,
|
274
|
-
# install binstubs there instead. Unfortunately,
|
342
|
+
# Gem.bindir doesn't always return the location that RubyGems will install
|
343
|
+
# system binaries. If you put '-n foo' in your .gemrc, RubyGems will
|
344
|
+
# install binstubs there instead. Unfortunately, RubyGems doesn't expose
|
275
345
|
# that directory at all, so rather than parse .gemrc ourselves, we allow
|
276
346
|
# the directory to be set as well, via `bundle config bindir foo`.
|
277
347
|
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
|
278
348
|
end
|
279
349
|
|
350
|
+
def use_system_gems?
|
351
|
+
configured_bundle_path.use_system_gems?
|
352
|
+
end
|
353
|
+
|
280
354
|
def requires_sudo?
|
281
355
|
return @requires_sudo if defined?(@requires_sudo_ran)
|
282
356
|
|
283
|
-
if settings.allow_sudo?
|
284
|
-
sudo_present = which "sudo"
|
285
|
-
end
|
357
|
+
sudo_present = which "sudo" if settings.allow_sudo?
|
286
358
|
|
287
359
|
if sudo_present
|
288
|
-
# the bundle path and subdirectories need to be writable for
|
360
|
+
# the bundle path and subdirectories need to be writable for RubyGems
|
289
361
|
# to be able to unpack and install gems without exploding
|
290
362
|
path = bundle_path
|
291
363
|
path = path.parent until path.exist?
|
@@ -295,81 +367,102 @@ module Bundler
|
|
295
367
|
bin_dir = bin_dir.parent until bin_dir.exist?
|
296
368
|
|
297
369
|
# if any directory is not writable, we need sudo
|
298
|
-
files = [path, bin_dir] | Dir[
|
299
|
-
|
370
|
+
files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
|
371
|
+
unwritable_files = files.reject {|f| File.writable?(f) }
|
372
|
+
sudo_needed = !unwritable_files.empty?
|
373
|
+
if sudo_needed
|
374
|
+
Bundler.ui.warn "Following files may not be writable, so sudo is needed:\n #{unwritable_files.map(&:to_s).sort.join("\n ")}"
|
375
|
+
end
|
300
376
|
end
|
301
377
|
|
302
378
|
@requires_sudo_ran = true
|
303
379
|
@requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
|
304
380
|
end
|
305
381
|
|
306
|
-
def mkdir_p(path)
|
307
|
-
if requires_sudo?
|
382
|
+
def mkdir_p(path, options = {})
|
383
|
+
if requires_sudo? && !options[:no_sudo]
|
308
384
|
sudo "mkdir -p '#{path}'" unless File.exist?(path)
|
309
385
|
else
|
310
|
-
|
386
|
+
SharedHelpers.filesystem_access(path, :write) do |p|
|
387
|
+
FileUtils.mkdir_p(p)
|
388
|
+
end
|
311
389
|
end
|
312
390
|
end
|
313
391
|
|
314
392
|
def which(executable)
|
315
393
|
if File.file?(executable) && File.executable?(executable)
|
316
394
|
executable
|
317
|
-
elsif ENV[
|
318
|
-
|
319
|
-
|
320
|
-
|
395
|
+
elsif paths = ENV["PATH"]
|
396
|
+
quote = '"'.freeze
|
397
|
+
paths.split(File::PATH_SEPARATOR).find do |path|
|
398
|
+
path = path[1..-2] if path.start_with?(quote) && path.end_with?(quote)
|
399
|
+
executable_path = File.expand_path(executable, path)
|
400
|
+
return executable_path if File.file?(executable_path) && File.executable?(executable_path)
|
321
401
|
end
|
322
|
-
path && File.expand_path(executable, path)
|
323
402
|
end
|
324
403
|
end
|
325
404
|
|
326
405
|
def sudo(str)
|
327
|
-
|
328
|
-
|
329
|
-
|
406
|
+
SUDO_MUTEX.synchronize do
|
407
|
+
prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
|
408
|
+
Your user account isn't allowed to install to the system RubyGems.
|
409
|
+
You can cancel this installation and run:
|
330
410
|
|
331
|
-
|
411
|
+
bundle install --path vendor/bundle
|
332
412
|
|
333
|
-
|
334
|
-
|
413
|
+
to install the gems into ./vendor/bundle/, or you can enter your password
|
414
|
+
and install the bundled gems to RubyGems using sudo.
|
335
415
|
|
336
|
-
|
337
|
-
|
416
|
+
Password:
|
417
|
+
PROMPT
|
338
418
|
|
339
|
-
|
419
|
+
unless @prompted_for_sudo ||= system(%(sudo -k -p "#{prompt}" true))
|
420
|
+
raise SudoNotPermittedError,
|
421
|
+
"Bundler requires sudo access to install at the moment. " \
|
422
|
+
"Try installing again, granting Bundler sudo access when prompted, or installing into a different path."
|
423
|
+
end
|
424
|
+
|
425
|
+
`sudo -p "#{prompt}" #{str}`
|
426
|
+
end
|
340
427
|
end
|
341
428
|
|
342
429
|
def read_file(file)
|
343
|
-
|
430
|
+
SharedHelpers.filesystem_access(file, :read) do
|
431
|
+
File.open(file, "r:UTF-8", &:read)
|
432
|
+
end
|
344
433
|
end
|
345
434
|
|
346
435
|
def load_marshal(data)
|
347
436
|
Marshal.load(data)
|
348
|
-
rescue => e
|
437
|
+
rescue StandardError => e
|
349
438
|
raise MarshalError, "#{e.class}: #{e.message}"
|
350
439
|
end
|
351
440
|
|
352
|
-
def load_gemspec(file)
|
441
|
+
def load_gemspec(file, validate = false)
|
353
442
|
@gemspec_cache ||= {}
|
354
443
|
key = File.expand_path(file)
|
355
|
-
|
444
|
+
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
|
356
445
|
# Protect against caching side-effected gemspecs by returning a
|
357
446
|
# new instance each time.
|
358
|
-
|
447
|
+
@gemspec_cache[key].dup if @gemspec_cache[key]
|
359
448
|
end
|
360
449
|
|
361
|
-
def load_gemspec_uncached(file)
|
450
|
+
def load_gemspec_uncached(file, validate = false)
|
362
451
|
path = Pathname.new(file)
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
452
|
+
contents = read_file(file)
|
453
|
+
spec = if contents.start_with?("---") # YAML header
|
454
|
+
eval_yaml_gemspec(path, contents)
|
455
|
+
else
|
456
|
+
# Eval the gemspec from its parent directory, because some gemspecs
|
457
|
+
# depend on "./" relative paths.
|
458
|
+
SharedHelpers.chdir(path.dirname.to_s) do
|
370
459
|
eval_gemspec(path, contents)
|
371
460
|
end
|
372
461
|
end
|
462
|
+
return unless spec
|
463
|
+
spec.loaded_from = path.expand_path.to_s
|
464
|
+
Bundler.rubygems.validate(spec) if validate
|
465
|
+
spec
|
373
466
|
end
|
374
467
|
|
375
468
|
def clear_gemspec_cache
|
@@ -381,68 +474,94 @@ module Bundler
|
|
381
474
|
@git_present = Bundler.which("git") || Bundler.which("git.exe")
|
382
475
|
end
|
383
476
|
|
384
|
-
def
|
385
|
-
@
|
477
|
+
def feature_flag
|
478
|
+
@feature_flag ||= FeatureFlag.new(VERSION)
|
386
479
|
end
|
387
480
|
|
388
481
|
def reset!
|
482
|
+
reset_paths!
|
483
|
+
Plugin.reset!
|
484
|
+
reset_rubygems!
|
485
|
+
end
|
486
|
+
|
487
|
+
def reset_paths!
|
488
|
+
@bin_path = nil
|
489
|
+
@bundler_major_version = nil
|
490
|
+
@bundle_path = nil
|
491
|
+
@configured = nil
|
492
|
+
@configured_bundle_path = nil
|
389
493
|
@definition = nil
|
494
|
+
@load = nil
|
495
|
+
@locked_gems = nil
|
496
|
+
@root = nil
|
497
|
+
@settings = nil
|
498
|
+
@setup = nil
|
499
|
+
@user_home = nil
|
500
|
+
end
|
501
|
+
|
502
|
+
def reset_rubygems!
|
503
|
+
return unless defined?(@rubygems) && @rubygems
|
504
|
+
rubygems.undo_replacements
|
505
|
+
rubygems.reset
|
506
|
+
@rubygems = nil
|
390
507
|
end
|
391
508
|
|
392
509
|
private
|
393
510
|
|
394
511
|
def eval_yaml_gemspec(path, contents)
|
512
|
+
Kernel.send(:require, "bundler/psyched_yaml")
|
513
|
+
|
395
514
|
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
|
396
515
|
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
|
397
516
|
Gem::Specification.from_yaml(contents)
|
398
|
-
rescue
|
517
|
+
rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
399
518
|
eval_gemspec(path, contents)
|
400
519
|
end
|
401
520
|
|
402
521
|
def eval_gemspec(path, contents)
|
403
|
-
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
|
522
|
+
eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
|
404
523
|
rescue ScriptError, StandardError => e
|
405
|
-
|
406
|
-
msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}"
|
407
|
-
msg << " from\n #{original_line}" if original_line
|
408
|
-
msg << "\n"
|
524
|
+
msg = "There was an error while loading `#{path.basename}`: #{e.message}"
|
409
525
|
|
410
526
|
if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
|
411
|
-
msg
|
527
|
+
msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
|
412
528
|
end
|
413
529
|
|
414
|
-
raise GemspecError, msg
|
530
|
+
raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
|
415
531
|
end
|
416
532
|
|
417
533
|
def configure_gem_home_and_path
|
418
|
-
|
419
|
-
if settings[:disable_shared_gems]
|
420
|
-
ENV['GEM_PATH'] = ''
|
421
|
-
elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
|
422
|
-
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
|
423
|
-
paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
|
424
|
-
ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
|
425
|
-
end
|
426
|
-
|
534
|
+
configure_gem_path
|
427
535
|
configure_gem_home
|
428
536
|
bundle_path
|
429
537
|
end
|
430
538
|
|
431
|
-
def
|
432
|
-
|
433
|
-
|
539
|
+
def configure_gem_path(env = ENV)
|
540
|
+
blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty?
|
541
|
+
if !use_system_gems?
|
542
|
+
# this needs to be empty string to cause
|
543
|
+
# PathSupport.split_gem_path to only load up the
|
544
|
+
# Bundler --path setting as the GEM_PATH.
|
545
|
+
env["GEM_PATH"] = ""
|
546
|
+
elsif blank_home
|
547
|
+
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
|
548
|
+
paths = possibles.flatten.compact.uniq.reject(&:empty?)
|
549
|
+
env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
|
550
|
+
end
|
551
|
+
end
|
434
552
|
|
435
|
-
|
553
|
+
def configure_gem_home
|
554
|
+
Bundler::SharedHelpers.set_env "GEM_HOME", File.expand_path(bundle_path, root)
|
436
555
|
Bundler.rubygems.clear_paths
|
437
556
|
end
|
438
557
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
558
|
+
# @param env [Hash]
|
559
|
+
def with_env(env)
|
560
|
+
backup = ENV.to_hash
|
561
|
+
ENV.replace(env)
|
562
|
+
yield
|
563
|
+
ensure
|
564
|
+
ENV.replace(backup)
|
445
565
|
end
|
446
|
-
|
447
566
|
end
|
448
567
|
end
|