bundler-2.1.4/ 0000755 0000041 0000041 00000000000 13606335352 013207 5 ustar www-data www-data bundler-2.1.4/README.md 0000644 0000041 0000041 00000007326 13606335352 014476 0 ustar www-data www-data [](https://rubygems.org/gems/bundler)
[](https://travis-ci.org/bundler/bundler)
[](https://inch-ci.org/github/bundler/bundler)
[](https://bundler-slackin.herokuapp.com)
# Bundler: a gem to bundle gems
Bundler makes sure Ruby applications run the same code on every machine.
It does this by managing the gems that the application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems.
### Installation and usage
To install (or update to the latest version):
```
gem install bundler
```
To install a prerelease version (if one is available), run `gem install bundler --pre`. To uninstall Bundler, run `gem uninstall bundler`.
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:
```
bundle init
bundle add rspec
bundle install
bundle exec rspec
```
See [bundler.io](https://bundler.io) for the full documentation.
### Troubleshooting
For help with common problems, see [TROUBLESHOOTING](doc/TROUBLESHOOTING.md).
Still stuck? Try [filing an issue](doc/contributing/ISSUES.md).
### Other questions
To see what has changed in recent versions of Bundler, see the [CHANGELOG](CHANGELOG.md).
To get in touch with the Bundler core team and other Bundler users, please see [getting help](doc/contributing/GETTING_HELP.md).
### Contributing
If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/bundler/bundler/blob/master/doc/contributing/README.md) with all of the information you need to get started.
If you'd like to request a substantial change to Bundler or to the Bundler documentation, refer to the [Bundler RFC process](https://github.com/bundler/rfcs) for more information.
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.
### Supporting

Ruby Together 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 as an individual or (better yet) as a company to ensure that Bundler, RubyGems, and other shared tooling is around for years to come.
### Code of Conduct
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).
### License
Bundler is available under an [MIT License](https://github.com/bundler/bundler/blob/master/LICENSE.md).
bundler-2.1.4/LICENSE.md 0000644 0000041 0000041 00000002146 13606335352 014616 0 ustar www-data www-data The MIT License
Portions copyright (c) 2010-2019 André Arko
Portions copyright (c) 2009 Engine Yard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
bundler-2.1.4/CHANGELOG.md 0000644 0000041 0000041 00000522750 13606335352 015033 0 ustar www-data www-data ## 2.1.4 (January 5, 2020)
Bugfixes:
- Fix `net-http-pipeline` no longer being allowed in Gemfiles if already installed in the system due to our vendored version of `net-http-persistent` optionally requiring it [#7529](https://github.com/bundler/bundler/pull/7529)
- Fix inline gems no longer being requirable if no Gemfile is present in the directory hierarchy [#7537](https://github.com/bundler/bundler/pull/7537)
## 2.1.3 (January 2, 2020)
Bugfixes:
- Fix `rake build` when path has spaces on it [#7514](https://github.com/bundler/bundler/pull/7514)
- Fix `rake release` git push tasks when the running shell has `git` as an alias of another command (like `hub`) [#7510](https://github.com/bundler/bundler/pull/7510)
- Fix some circular require warnings [#7520](https://github.com/bundler/bundler/pull/7520)
- Fix `bundle config set deployment true` recommended alternative to `bundle config --deployment` to behave in the same way as the `--deployment` flag [#7519](https://github.com/bundler/bundler/pull/7519)
## 2.1.2 (December 20, 2019)
Bugfixes:
- Restore an explicit `require "rubygems"` on top `rubygems_integration.rb` to avoid some missing constant errors under some convoluted setups [#7505](https://github.com/bundler/bundler/pull/7505)
## 2.1.1 (December 17, 2019)
Bugfixes:
- Fix some cases of shelling out to `rubygems` still being silent [#7493](https://github.com/bundler/bundler/pull/7493)
- Restore compatibility with `rubygems-bundler` so that binstubs work under `RVM` [#7498](https://github.com/bundler/bundler/pull/7498)
## 2.1.0 (December 15, 2019)
Features:
- Add support for new default gems. In particular,
* `open3` [#7455](https://github.com/bundler/bundler/pull/7455)
* `cgi`: [#7456](https://github.com/bundler/bundler/pull/7456)
* `uri` [#7460](https://github.com/bundler/bundler/pull/7460)
plus other PRs removing or lazily loading usages of these gems from other places to not interfere with user's choice, such as [#7471](https://github.com/bundler/bundler/pull/7471) or [#7473](https://github.com/bundler/bundler/pull/7473)
Bugfixes:
- Fix `bundle exec rake install` failing [#7474](https://github.com/bundler/bundler/pull/7474)
- Fix `bundle exec`'ing to rubygems being silent [#7442](https://github.com/bundler/bundler/pull/7442)
- Restore previous `BUNDLE_GEMFILE` in `bundler/inline` [#7418](https://github.com/bundler/bundler/pull/7418)
- Fix error when using `gem` DSL's `:glob` option for selecting gemspecs from a specific source [#7419](https://github.com/bundler/bundler/pull/7419)
Changes:
- `bundle config` no longer warns when using "old interface" (might be deprecated again in the future) [#7475](https://github.com/bundler/bundler/pull/7475)
- `bundle update` no longer warns when used without arguments (might be deprecated again in the future) [#7475](https://github.com/bundler/bundler/pull/7475)
## 2.1.0.pre.3 (November 12, 2019)
Features:
- Add caller information to some deprecation messages to make them easier to fix [#7361](https://github.com/bundler/bundler/pull/7361)
- Reconcile `bundle cache` vs `bundle package` everywhere. Now in docs, CLI help and everywhere else `bundle cache` is the preferred version and `bundle package` remains as an alias [#7389](https://github.com/bundler/bundler/pull/7389)
- Display some basic `bundler` documentation together with ruby's RDoc based documentation [#7394](https://github.com/bundler/bundler/pull/7394)
Bugfixes:
- Fix typos deprecation message and upgrading docs [#7374](https://github.com/bundler/bundler/pull/7374)
- Deprecation warnings about `taint` usage on ruby 2.7 [#7385](https://github.com/bundler/bundler/pull/7385)
- Fix `--help` flag not correctly delegating to `man` when used with command aliases [#7388](https://github.com/bundler/bundler/pull/7388)
- `bundle add` should cache newly added gems if an application cache exists [#7393](https://github.com/bundler/bundler/pull/7393)
- Stop using an insecure folder as a "fallback home" when user home is not defined [#7416](https://github.com/bundler/bundler/pull/7416)
- Fix `bundler/inline` warning about `Bundler.root` redefinition [#7417](https://github.com/bundler/bundler/pull/7417)
## 2.1.0.pre.2 (September 15, 2019)
Bugfixes:
- Fix `bundle clean` trying to delete non-existent directory ([#7340](https://github.com/bundler/bundler/pull/7340))
- Fix warnings about keyword argument separation on ruby 2.7 ([#7337](https://github.com/bundler/bundler/pull/7337))
## 2.1.0.pre.1 (August 28, 2019)
One of the biggest changes in bundler 2.1.0 is that deprecations for upcoming
breaking changes in bundler 3 will be turned on by default. We do this to grab
feedback and communicate early to our users the kind of changes we're intending
to ship with bundler 3. See
[#6965](https://github.com/bundler/bundler/pull/6965).
Another important improvement is a better coexistence between bundler
installations and the default copy of bundler that comes with ruby installed as
a default gem. Since bundler is shipped as a default gem with ruby, a number of
users have been affected by issues where bundler ends up failing due to version
mismatches, because at some point of the execution, bundler switches to run the
default copy instead of the expected version. A number of PRs have been focused
on minimizing (hopefully eliminating) this, such as
[#7100](https://github.com/bundler/bundler/pull/7100),
[#7137](https://github.com/bundler/bundler/pull/7137),
[#6996](https://github.com/bundler/bundler/pull/6996),
[#7056](https://github.com/bundler/bundler/pull/7056),
[#7062](https://github.com/bundler/bundler/pull/7062),
[#7193](https://github.com/bundler/bundler/pull/7193),
[#7216](https://github.com/bundler/bundler/pull/7216),
[#7274](https://github.com/bundler/bundler/pull/7274)
Deprecations:
* See the [the upgrading document](UPGRADING.md) for a detailed explanation of
the deprecations that are getting enabled in bundler 2.1, and the future
breaking changes in bundler 3.
Features:
- Reimplement `config` command using subcommands ([#5981](https://github.com/bundler/bundler/pull/5981))
- Add `bundle plugin list` command ([#6120](https://github.com/bundler/bundler/pull/6120))
- Introduce a `bundle lock --gemfile` flag ([#6748](https://github.com/bundler/bundler/pull/6748))
- Add local git repository source option (`--local_git`) to plugin installation ([#6749](https://github.com/bundler/bundler/pull/6749))
- Add `quiet` flag to inline bundler ([#6828](https://github.com/bundler/bundler/pull/6828))
- Introduce a `prefer_patch` configuration that makes `bundle update` behave like `bundle update --patch` ([#6931](https://github.com/bundler/bundler/pull/6931))
- Introduce `Bundler.original_system` and `Bundler.original_exec` to shell out or exec to external programs using the original environment before bundler was loaded ([#7052](https://github.com/bundler/bundler/pull/7052))
- Add feature parity to `bundle info GEM` with respect to the old deprecated command `bundle show GEM` [#7026](https://github.com/bundler/bundler/pull/7026)
- Introduce `bundle list` to list groups of gems in your Gemfile. This command was actually documented, but was working as an alias to `bundle show` so this could also be considered a bug fix :) [#7072](https://github.com/bundler/bundler/pull/7072)
- Introduce `bundle outdated --filter-strict` as an alias to `bundle outdated --strict` [#6030](https://github.com/bundler/bundler/pull/6030)
- Add `:git` and `:branch` options to `bundle add` ([#7127](https://github.com/bundler/bundler/pull/7127))
- Add `:ruby_26` as a valid value to the `:platform(s)` dsl ([#7155](https://github.com/bundler/bundler/pull/7155))
- Let the `bundle cache` command include all features currently provided by `bundle package` ([#7249](https://github.com/bundler/bundler/pull/7249))
- Several improvements on new gem templates ([#6924](https://github.com/bundler/bundler/pull/6924), [#6968](https://github.com/bundler/bundler/pull/6968), [#7209](https://github.com/bundler/bundler/pull/7209), [#7222](https://github.com/bundler/bundler/pull/7222), [#7238](https://github.com/bundler/bundler/pull/7238))
- Add `--[no-]git` option to `bundle gem` to generate non source control gems. Useful for monorepos, for example ([#7263](https://github.com/bundler/bundler/pull/7263))
Bugfixes:
- Raise when the same gem is available in multiple sources, and show a suggestion to solve it ([#5985](https://github.com/bundler/bundler/pull/5985))
- Validate that bundler has permissions to write to the tmp directory, and raise with a meaningful error otherwise ([#5954](https://github.com/bundler/bundler/pull/5954))
- Remove downloaded `.gem` file from the cache if it's corrupted ([#6010](https://github.com/bundler/bundler/pull/6010))
- Fix generated README in new gems to explicitly suggest running `bundle install`, so that the outcome is independent from the major version of bundler being run ([#6068](https://github.com/bundler/bundler/pull/6068))
- Fix `bundle outdated --group NAME` when the group is listed second in the Gemfile ([#6116](https://github.com/bundler/bundler/pull/6116))
- Improve conflict resolution messages by not calling "ruby" a gem when conflict happens in the `required_ruby_version`, and by filtering out requirements that didn't contribute to the conflict ([#6647](https://github.com/bundler/bundler/pull/6647))
- Avoid fetching and rebuilding git gems whenever any gem is changed in the Gemfile ([#6711](https://github.com/bundler/bundler/pull/6711))
- Include the exact bundler version in the lock file in the suggested command when bundler warns about version mismatches of itself [#6971](https://github.com/bundler/bundler/pull/6971)
- Fix plugins being installed every time a command is run #[#6978](https://github.com/bundler/bundler/pull/6978)
- Fallback to sequentially fetching specs on 429s [#6728](https://github.com/bundler/bundler/pull/6728)
- Make `bundle clean` also clean native extensions for gems with a git source [#7058](https://github.com/bundler/bundler/pull/7058)
- Fix `bundle info bundler` to show the correct path to the bundler gem [#7026](https://github.com/bundler/bundler/pull/7026)
- Fix `bundle config build.` not sending multiple parameters to `extconf.rb` correctly [#7023](https://github.com/bundler/bundler/pull/7023)
- Fix bad error message on Gemfile errors under ruby 2.7 (still unreleased, but it's a bugfix for beta testers after all) [#7038](https://github.com/bundler/bundler/pull/7038)
- Warn about situations where multiple gems provide the same executable ([#7075](https://github.com/bundler/bundler/pull/7075))
- Ignore `frozen` setting in inline mode ([#7125](https://github.com/bundler/bundler/pull/7125))
- Fix incorrect "bundler attempted to update GEM but version stayed the same" message when updating git sourced gems ([#6325](https://github.com/bundler/bundler/pull/6325))
- Don't check for existence of a writable home directory if `BUNDLE_USER_HOME` is set ([#6885](https://github.com/bundler/bundler/pull/6885))
- Fix error message when server would respond to a bad username/password requiest with a 401 ([#6928](https://github.com/bundler/bundler/pull/6928))
- Fix `bundle outdated` pluralization when multiple groups are requested ([#7063](https://github.com/bundler/bundler/pull/7063))
- Fix `bundle install` not updating conservatively when gemspec is changed ([#7143](https://github.com/bundler/bundler/pull/7143))
- Fix `bundle exec` not respecting custom process titles inside scripts ([#7140](https://github.com/bundler/bundler/pull/7140))
- Fix `bundle update` message about exclude groups saying "installed" instead of "updated" ([#7150](https://github.com/bundler/bundler/pull/7150))
- Fix `bundle licenses` not showing correct information about bundler itself ([#7147](https://github.com/bundler/bundler/pull/7147))
- Fix installation path not including ruby scope when `BUNDLE_PATH` was set ([#7163](https://github.com/bundler/bundler/pull/7163))
- Fix `bundle clean` incorrectly removing git depedencies present in the Gemfile when rubygems 3.0+ was used and path involved a symlink ([#7211](https://github.com/bundler/bundler/pull/7211))
- Fix platform specific gems always being re-resolved when bundler was not running under that platform ([#7212](https://github.com/bundler/bundler/pull/7212))
- Fix `bundle package --all-platforms` causing `bundle install` to ignore `--with` and `--without` ([#6113](https://github.com/bundler/bundler/pull/6113))
- Fix `MissingRevision` git errors to include the specific `git` command that failed under the hood ([#7225](https://github.com/bundler/bundler/pull/7225))
- Fix using gemspec & `force_ruby_platform` on Windows ([#6809](https://github.com/bundler/bundler/pull/6809))
- Make bundler's binstub checks on bundler version consistent with rubygems `BundlerVersionFinder` ([#7259](https://github.com/bundler/bundler/pull/7259))
- Fix `bundle install` and `bundle update` generating different lockfiles when `path:` gems with relative paths starting with "./" were used ([#7264](https://github.com/bundler/bundler/pull/7264))
- Give a proper error when user tries to `bundle open` a default gem ([#7288](https://github.com/bundler/bundler/pull/7288))
- Fix `bundle doctor` command ([#7309](https://github.com/bundler/bundler/pull/7309))
- Fix bundler giving an unclear recommendation when duplicated gems are found in the Gemfile ([#7302](https://github.com/bundler/bundler/pull/7302))
Documentation:
- Fix typo on a file extension in `bundle.ronn` [#7146](https://github.com/bundler/bundler/pull/7146)
- Fix incorrect default value for `cache_path` configuration ([#7229](https://github.com/bundler/bundler/pull/7229))
- Binstubs documentation has been improved ([#5889](https://github.com/bundler/bundler/pull/5889))
- Fix incorrect sections when explaining `:git`, `:branch`, and `:ref` options ([#7265](https://github.com/bundler/bundler/pull/7265))
- Fix mentions to remembered options in docs to explain the current state ([#7242](https://github.com/bundler/bundler/pull/7242))
Internally, there's also been a bunch of improvements in our development
environment, test suite, policies, contributing docs, and a bunch of cleanups of
old compatibility code.
## 2.0.2 (2019-06-13)
Changes:
- Fixes for Bundler integration with ruby-src ([#6941](https://github.com/bundler/bundler/pull/6941), [#6973](https://github.com/bundler/bundler/pull/6973), [#6977](https://github.com/bundler/bundler/pull/6977), [#6315](https://github.com/bundler/bundler/pull/6315), [#7061](https://github.com/bundler/bundler/pull/7061))
- Use `__dir__` instead of `__FILE__` when generating a gem with `bundle gem` ([#6503](https://github.com/bundler/bundler/pull/6503))
- Use `https` on externals links in the Bundler gemspec ([#6721](https://github.com/bundler/bundler/pull/6721))
- Removed duplicate gem names from the suggested `did you mean` list for gem typos ([#6739](https://github.com/bundler/bundler/pull/6739))
- Removed Ruby 1.x compatibility code ([#6764](https://github.com/bundler/bundler/pull/6764), [#6806](https://github.com/bundler/bundler/pull/6806))
- Fixed an issue where `bundle remove` would crash with certain Gemfiles ([#6768](https://github.com/bundler/bundler/pull/6769))
- Fixed indentation in the Bundler executable template ([#6773](https://github.com/bundler/bundler/pull/6773))
- Fixed an issue where plugins could register for the same Bundler hook multiple times ([#6775](https://github.com/bundler/bundler/pull/6775))
- Changed the "multiple sources" message in `bundle install` to be a warning instead of an error ([#6790](https://github.com/bundler/bundler/pull/6790))
- Fixed a bug where path gems would break when using `only_update_to_newer_versions` ([#6774](https://github.com/bundler/bundler/pull/6774))
- Fixed a bug where installing plugins with the `--deployment` setting would fail ([#6805](https://github.com/bundler/bundler/pull/6805))
- Fixed an issue where `bundle update` couldn't update & install a gem when `no_install` was set (a `bundle package` config) ([#7078](https://github.com/bundler/bundler/pull/7078))
- Fixed an issue where users could not run `bundle exec` on default gems ([#6963](https://github.com/bundler/bundler/pull/6963))
- Updated vendor libraries to their latest version ([#7076](https://github.com/bundler/bundler/pull/7067), [#7068](https://github.com/bundler/bundler/pull/7068))
- Fixed an issue where the `github` source was not using `https` by default that we mentioned in the 2.0 release ([#7182](https://github.com/bundler/bundler/pull/7182))
- Fixed an issue where `rake release` was not outputting the message to users asking for a 2fa token ([#7199](https://github.com/bundler/bundler/pull/7199))
Documentation:
- Fix incorrect documented `BUNDLE_PATH_RELATIVE_TO_CWD` env var ([#6751](https://github.com/bundler/bundler/pull/6751))
- Update URLs in Bundler's documentation to use `https` ([#6935](https://github.com/bundler/bundler/pull/6935))
## 2.0.1 (2019-01-04)
Changes:
- Relaxed RubyGems requirement to `>= 2.5.0` ([#6867](https://github.com/bundler/bundler/pull/6867))
## 2.0.0 (2019-01-03)
No new changes
## 2.0.0.pre.3 (2018-12-30)
Breaking Changes:
- Bundler 2 now requires RubyGems 3.0.0 at minimum
Changes:
- Ruby 2.6 compatibility fixes (@segiddins)
- Import changes from Bundler 1.17.3 release
Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`
## 2.0.0.pre.2 (2018-11-27)
Breaking Changes:
- `:github` source in the Gemfile now defaults to using HTTPS
Changes
- Add compatibility for Bundler merge into ruby-src
Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`
## 2.0.0.pre.1 (2018-11-09)
Breaking Changes:
- Dropped support for versions of Ruby under 2.3
- Dropped support for version of RubyGems under 2.5
- Moved error messages from STDOUT to STDERR
Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`
## 1.17.3 (2018-12-27)
Bugfixes:
- Fix a Bundler error when installing gems on old versions of RubyGems ([#6839](https://github.com/bundler/bundler/issues/6839), @colby-swandale)
- Fix a rare issue where Bundler was removing itself after a `bundle clean` ([#6829](https://github.com/bundler/bundler/issues/6829), @colby-swandale)
Documentation:
- Add entry for the `bundle remove` command to the main Bundler manual page
## 1.17.2 (2018-12-11)
- Add compatibility for bundler merge with Ruby 2.6
## 1.17.1 (2018-10-25)
- Convert `Pathname`s to `String`s before sorting them, fixing #6760 and #6758 ([#6761](https://github.com/bundler/bundler/pull/6761), @alexggordon)
## 1.17.0 (2018-10-25)
No new changes.
## 1.17.0.pre.2 (2018-10-13)
Features:
- Configure Bundler home, cache, config and plugin directories with `BUNDLE_USER_HOME`, `BUNDLE_USER_CACHE`, `BUNDLE_USER_CONFIG` and `BUNDLE_USER_PLUGIN` env vars ([#4333](https://github.com/bundler/bundler/issues/4333), @gwerbin)
- Add `--all` option to `bundle binstubs` that will generate an executable file for all gems with commands in the bundle
- Add `bundle remove` command to remove gems from the Gemfile via the CLI
- Improve checking file permissions and asking for `sudo` in Bundler when it doesn't need to
- Add error message to `bundle add` to check adding duplicate gems to the Gemfile
- When asking for `sudo`, Bundler will show a list of folders/files that require elevated permissions to write to.
The following new features are available but are not enabled by default. These are intended to be tested by users for the upcoming release of Bundler 2.
- Improve deprecation warning message for `bundle show` command
- Improve deprecation warning message for the `--force` option in `bundle install`
## 1.17.0.pre.1 (2018-09-24)
Features:
- Check folder/file permissions of the Bundle home directory in the `bundle doctor` command ([#5786](https://github.com/bundler/bundler/issues/5786), @ajwann)
- Remove compiled gem extensions when running `bundle clean` ([#5596](https://github.com/bundler/bundler/issues/5596), @akhramov)
- Add `--paths` option to `bundle list` command ([#6172](https://github.com/bundler/bundler/issues/6172), @colby-swandale)
- Add base error class to gems generated from `bundle gem` ([#6260](https://github.com/bundler/bundler/issues/6260), @christhekeele)
- Correctly re-install gem extensions with a git source when running `bundle pristine` ([#6294](https://github.com/bundler/bundler/issues/6294), @wagenet)
- Add config option to disable platform warnings ([#6124](https://github.com/bundler/bundler/issues/6124), @agrim123)
- Add `--skip-install` option to `bundle add` command to add gems to the Gemfile without installation ([#6511](https://github.com/bundler/bundler/issues/6511), @agrim123)
- Add `--only-explicit` option to `bundle outdated` to list only outdated gems in the Gemfile ([#5366](https://github.com/bundler/bundler/issues/5366), @peret)
- Support adding multiple gems to the Gemfile with `bundle add` ([#6543](https://github.com/bundler/bundler/issues/6543), @agrim123)
- Make registered plugin events easier to manage in the Plugin API (@jules2689)
- Add new gem install hooks to the Plugin API (@jules2689)
- Add `--optimistic` and `--strict` options to `bundle add` ([#6553](https://github.com/bundler/bundler/issues/6553), @agrim123)
- Add `--without-group` and `--only-group` options to `bundle list` ([#6564](https://github.com/bundler/bundler/issues/6564), @agrim123)
- Add `--gemfile` option to the `bundle exec` command ([#5924](https://github.com/bundler/bundler/issues/5924), @ankitkataria)
The following new features are available but are not enabled by default. These are intended to be tested by users for the upcoming release of Bundler 2.
- Make `install --path` relative to the current working directory ([#2048](https://github.com/bundler/bundler/issues/2048), @igorbozato)
- Auto-configure job count ([#5808](https://github.com/bundler/bundler/issues/5808), @segiddins)
- Use the Gem Version Promoter for major gem updates ([#5993](https://github.com/bundler/bundler/issues/5993), @segiddins)
- Add config option to add the Ruby scope to `bundle config path` when configured globally (@segiddins)
## 1.16.6 (2018-10-05)
Changes:
- Add an error message when adding a gem with `bundle add` that's already in the bundle ([#6341](https://github.com/bundler/bundler/issues/6341), @agrim123)
- Add Homepage, Source Code and Changelog URI metadata fields to the `bundle gem` gemspec template (@walf443)
Bugfixes:
- Fix issue where updating a gem resulted in the gem's version being downgraded when `BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS` was set ([#6529](https://github.com/bundler/bundler/issues/6529), @theflow)
- Fix some rescue calls that don't specifiy error type (@utilum)
- Fix an issue when the Lockfile would contain platform-specific gems that it didn't need ([#6491](https://github.com/bundler/bundler/issues/6491), @segiddins)
- Improve handling of adding new gems with only a single group to the Gemfile in `bundle add` (@agrim123)
- Refactor check for OpenSSL in `bundle env` (@voxik)
- Remove an unnecessary assignment in Metadata (@voxik)
Documentation:
- Update docs to reflect revised guidance to check in Gemfile.lock into version control for gems ([#5879](https://github.com/bundler/bundler/issues/5879), @arbonap)
- Add documentation for the `--all` flag in `bundle update` (@agrim123)
- Update README to use `bundle add` in usage examples (@hdf1986)
## 1.16.5 (2018-09-18)
Changes:
- Add support for TruffleRuby (@eregon)
Bugfixes:
- Avoid printing git errors when checking the version on incorrectly packaged versions of Bundler ([#6453](https://github.com/bundler/bundler/issues/6453), @greysteil)
- Fix issue where Bundler does not check the given class when comparing equality in DepProxy (@ChrisBr)
- Handle `RangeNotSatisfiable` error in Compact Index (@MaxLap)
- Check for initialized `search` variable in `LazySpecification` (@voxik)
- Fix LoadError occurring in nested bundle exec calls ([#6537](https://github.com/bundler/bundler/issues/6537), @colby-swandale)
- Check that Bundler::Deprecate is not an autoload constant ([#6163](https://github.com/bundler/bundler/issues/6163), @eregon)
- Prefer non-pre-release versions when performing a `bundle update --patch` ([#6684](https://github.com/bundler/bundler/issues/6684), @segiddins)
## 1.16.4 (2018-08-17)
Changes:
- Welcome new members to the Bundler core team (@indirect)
- Don't mutate original error trees when determining version_conflict_message (@greysteil)
- Update vendored Molinillo to 0.6.6 (@segiddins)
Bugfixes:
- Reword bundle update regression message to be more clear to the user when a gem's version is downgraded ([#6584](https://github.com/bundler/bundler/issues/6584), @ralphbolo)
- Respect --conservative flag when updating a dependency group ([#6560](https://github.com/bundler/bundler/issues/6560), @greysteil)
- Fix issue where a pre-release version was not being selected when it's specified in the Gemfile ([#6449](https://github.com/bundler/bundler/issues/6449), @akihiro17)
- Fix issue where `Etc` was not loaded when getting the user's home dir ([#6640](https://github.com/bundler/bundler/issues/6640), @colby-swandale)
- Use UTF-8 for reading files including Gemfile ([#6660](https://github.com/bundler/bundler/issues/6660), @eregon)
- Remove unnecessary `while` loop in path resolver helper (@ojab)
Documentation:
- Document that `bundle show [--paths]` sorts results by name (@kemitchell)
## 1.16.3 (2018-07-17)
Features:
- Support URI::File of Ruby 2.6 (@hsbt)
Bugfixes:
- Expand symlinks during setup to allow Bundler to load correctly when using symlinks in $GEM_HOME ([#6465](https://github.com/bundler/bundler/issues/6465), @ojab, @indirect)
- Dont let Bundler create temporary folders for gem installs which are owned by root ([#6258](https://github.com/bundler/bundler/issues/6258), @colby-swandale)
- Don't fallback to using temporary directories when needed directories already exist ([#6546](https://github.com/bundler/bundler/issues/6546), @brodock)
- Use SharedHelpers.filesystem_access when reading a Gemfile so friendly error messages can be given to the user ([#6541](https://github.com/bundler/bundler/issues/6541), @segiddins)
- Check if source responds to `#remotes` before printing gem install error message ([#6211](https://github.com/bundler/bundler/issues/6211), @colby-swandale)
- Handle Errno::ENOTSUP in the Bundler Process Lock to prevent exceptions when using NFS mounts ([#6566](https://github.com/bundler/bundler/issues/6566), @colby-swandale)
- Respect encodings when reading gemspecs ([#6598](https://github.com/bundler/bundler/issues/6598), @deivid-rodriguez)
Documentation:
- Fix links between manual pages (@BanzaiMan)
- Add warning to Gemfile documentation for the use of the `source` option when declaring gems ([#6280](https://github.com/bundler/bundler/issues/6280), @forestgagnon)
## 1.16.2 (2018-04-20)
Changes:
- Include the gem's source in the gem install error message when available (@papanikge)
- Remove unnecessary executable bit from gem template (@voxik)
- Dont add the timestamp comment with gems added to the Gemfile via `bundle add` ([#6193](https://github.com/bundler/bundler/issues/6193), @cpgo)
- Improve yanked gem error message (@alyssais)
- Use `Bundler.rubygems.inflate` instead of the Gem::Util method directly (@segiddins)
- Remove unused instance variable (@segiddins)
Bugfixes:
- Only trap INT signal and have Ruby's signal default handler be invoked (@shayonj)
- Fix warning about the use of `__FILE__` in RubyGems integration testing (@MSP-Greg)
- Skip the outdated bundler check when MD5 is not available ([#6032](https://github.com/bundler/bundler/issues/6032), @segiddins)
- Fallback to the original error if the friendly message raises (@segiddins)
- Rename Bundler.frozen? to avoid Object method conflict ([#6252](https://github.com/bundler/bundler/issues/6252), @segiddins)
- Ensure the bindir exists before installing gems (@segiddins)
- Handle gzip corruption errors in the compact index client ([#6261](https://github.com/bundler/bundler/issues/6261), @colby-swandale)
- Check if the current directory is writeable when writing files in `bundle gem` ([#6219](https://github.com/bundler/bundler/issues/6219), @nilsding)
- Fix hang when gemspec has incompatible encoding (@deivid-rodriguez)
- Gracefully handle when the lockfile is missing spec entries for the current platform ([#6079](https://github.com/bundler/bundler/issues/6079), @segiddins)
- Use Gem::Util.inflate instead of Gem.inflate (@hsbt)
- Update binstub generator to use new ERB.new arity in Ruby 2.6 (@koic)
- Fix `source_location` call in rubygems integration (@MSP-Greg)
- Use `filesystem_access` when copying files in Compact Index Updater ([#6289](https://github.com/bundler/bundler/issues/6289), @segiddins)
- Fail gracefully when resetting git gems to the given revision fails ([#6324](https://github.com/bundler/bundler/issues/6324), @segiddins)
- Handle exceptions that do not have a backtrace ([#6342](https://github.com/bundler/bundler/issues/6342), @nesaulov)
- Check if stderr was closed before writing to it (@shime)
- Handle updating a specific gem for a non-local platform ([#6350](https://github.com/bundler/bundler/issues/6350), @greysteil)
- Bump the `bundle_binstub` check-length to 300 characters (@tduffield)
- Fix specifying alterntive Lockfile with `bundle lock` when default gemfile is present ([#6460](https://github.com/bundler/bundler/issues/6460), @agrim123)
- Allow installing dependencies when the path is set to `.` ([#6475](https://github.com/bundler/bundler/issues/6475), @segiddins)
- Support Bundler installing on a readonly filesystem without a home directory ([#6461](https://github.com/bundler/bundler/issues/6461), @grosser)
- Filter git uri credentials in source description (@segiddins)
Documentation:
- Correct typos in `bundle binstubs` man page (@erikj, @samueloph)
- Update links in `bundle gem` command documentation to use https (@KrauseFx)
- Fix broken links between bundler man pages (@segiddins)
- Add man page for the `bundle doctor` command ([#6243](https://github.com/bundler/bundler/issues/6243), @nholden)
- Document `# frozen_string_literal` in `bundle init` Gemfile (@315tky)
- Explain the gemspec files attribute in `bundle gem` template and print a link to bundler.io guides when running `bundle gem` ([#6246](https://github.com/bundler/bundler/issues/6246), @nesaulov)
- Small copy tweaks & removed redundant phrasing in the bundler man page (@rubymorillo)
- Improve the documentation of the settings load order in Bundler (@rubymorillo)
- Added license info to main README (@rubymorillo)
- Document parameters and return value of Injector#inject (@tobias-grasse)
## 1.16.1 (2017-12-12)
Bugfixes:
- avoid hanging on complex resolver errors ([#6114](https://github.com/bundler/bundler/issues/6114), @halfbyte)
- avoid an error when running `bundle update --group` ([#6156](https://github.com/bundler/bundler/issues/6156), @mattbrictson)
- ensure the resolver prefers non-pre-release gems when possible ([#6181](https://github.com/bundler/bundler/issues/6181), @greysteil)
- include bundler's gemspec in the built gem ([#6165](https://github.com/bundler/bundler/issues/6165), @dr-itz)
- ensure locally installed specs are not overridden by those in remote sources during dependency resolution ([#6072](https://github.com/bundler/bundler/issues/6072), @indirect)
- ensure custom gemfiles are respected in generated binstubs (@pftg)
- fail gracefully when loading a bundler-generated binstub when `bin/bundle` was not generated by bundler ([#6149](https://github.com/bundler/bundler/issues/6149), @hsbt)
- allow `bundle init` to be run even when a parent directory contains a gemfile ([#6205](https://github.com/bundler/bundler/issues/6205), @colby-swandale)
## 1.16.0 (2017-10-31)
Bugfixes:
- avoid new RubyGems warning about unsafe YAML loading (to keep output consistent) (@segiddins)
- load digest subclasses in a thread-safe manner (@segiddins, @colby-swandale)
- avoid unusued variable warnings under ruby 2.5 (@amatsuda)
- fix printing the same message twice in verbose mode ([#6028](https://github.com/bundler/bundler/issues/6028), @akhramov)
- allow `SignalException`s to bubble up to the interpreter during `bundle exec` ([#6090](https://github.com/bundler/bundler/issues/6090), @dekellum)
- avoid activating stdlib digest under Ruby 2.5 (@segiddins)
- prioritise explicitly requested gems in dependency resolution sort order (@segiddins)
- reduce memory usage during dependency resolution ([#6114](https://github.com/bundler/bundler/issues/6114), @greysteil)
- ensure that the default bundler gem is not accidentally activated on ruby 2.5 when using local git overrides (@segiddins)
## 1.16.0.pre.3 (2017-10-04)
Features:
- the output from `bundle env` includes more information, particularly both the compiled & loaded versions of OpenSSL (@indirect)
Bugfixes:
- fix a bug where installing on FreeBSD would accidentally raise an error ([#6013](https://github.com/bundler/bundler/issues/6013), @olleolleolle)
- fix a regression in 1.16 where pre-release gems could accidentally be resolved even when the gemfile contained no pre-release requirements (@greysteil)
- bundler will avoid making unnecessary network requests to fetch dependency data, fixing a regression introduced in 1.16 (@segiddins)
- the outdated bundler version message is disabled by default until the message has been fine-tuned ([#6004](https://github.com/bundler/bundler/issues/6004), @segiddins)
## 1.16.0.pre.2 (2017-09-06)
Bugfixes:
- handle when a connection is missing a socket when warning about OpenSSL version (@greysteil)
- the description for the `rake release` task now reflects `$RUBYGEMS_HOST` (@wadetandy)
- fix a bug where `bundle update` would regress transitive dependencies (@greysteil)
## 1.16.0.pre.1 (2017-09-04)
Features:
- allow using non-branch symbolic refs in a git source ([#4845](https://github.com/bundler/bundler/issues/4845), @segiddins)
- allow absolute paths in the `cache path` setting ([#5627](https://github.com/bundler/bundler/issues/5627), @mal)
- gems created via `bundle gem` with rspec have `--require spec_helper` in their `.rspec` file (@koic)
- `bundle env` includes `Gem.ruby` and the `bundle` binstub shebang when they don't match ([#5616](https://github.com/bundler/bundler/issues/5616), @segiddins)
- allow passing gem names to `bundle pristine` (@segiddins)
- `bundle version` and `bundle env` include the commit and build date for the bundler gem ([#5049](https://github.com/bundler/bundler/issues/5049), @segiddins)
- add the `--shebang` option to `bundle binstubs` ([#4070](https://github.com/bundler/bundler/issues/4070), @segiddins, @Zorbash)
- gemfiles are `eval`ed one fewer time when running `bundle install` ([#4952](https://github.com/bundler/bundler/issues/4952), [#3096](https://github.com/bundler/bundler/issues/3096), [#4417](https://github.com/bundler/bundler/issues/4417), @segiddins)
- the `fileutils` gem is now vendored so different versions of the gem can be activated (@segiddins)
- speed up no-op installations ([#5842](https://github.com/bundler/bundler/issues/5842), @segiddins)
- default to keeping the lockfile in the default gem template (@deivid-rodriguez)
- add a special bundler binstub that ensures the correct version of bundler is activated ([#5876](https://github.com/bundler/bundler/issues/5876), @segiddins)
- speed up dependency resolution and ensure that all resolvable gemfiles can be installed (@segiddins, @greysteil)
- add a `bundle list` command that prints the gems in use ([#4754](https://github.com/bundler/bundler/issues/4754), @colby-swandale)
- allow adding credentials to a gem source during deployment when `allow_deployment_source_credential_changes` is set (@adrian-gomez)
- making an outdated (and insecure) TLS connection to rubygems.org will print a warning (@segiddins)
Bugfixes:
- allow configuring a mirror fallback timeout without a trailing slash ([#4830](https://github.com/bundler/bundler/issues/4830), @segiddins)
- fix handling of mirrors for file: urls that contain upper-case characters (@segiddins)
- list the correct gem host for `rake release` when `allowed_push_host` has been set (@mdeering)
- ensure `Bundler.original_env` preserves all env keys that bundler sets ([#5700](https://github.com/bundler/bundler/issues/5700), @segiddins)
- ensure `bundle pristine` removes files added to a git gem (@segiddins)
- load plugin files from path gems before gem installation ([#5429](https://github.com/bundler/bundler/issues/5429), @segiddins)
- ensure gems containing manpages are properly set up ([#5730](https://github.com/bundler/bundler/issues/5730), @segiddins)
- avoid fetching remote specs when all effected gems are in groups that are not being installed (@segiddins)
- allow `BUNDLE_GEMFILE` to be a relative path ([#5712](https://github.com/bundler/bundler/issues/5712), @gxespino)
- show a more helpful error message when a gem fails to install due to a corrupted lockfile ([#5846](https://github.com/bundler/bundler/issues/5846), @segiddins)
- add a process lock to allow multiple concurrent `bundle install`s ([#5851](https://github.com/bundler/bundler/issues/5851), @stefansedich)
- ensure that specifications always return an array for `#extensions` (@greysteil)
- print a helpful error message when using a gem in the Gemfile with an empty name (@colby-swandale)
- ensure that all gemfiles are included in `bundle env` (@segiddins)
- use ssl client cert and ca cert settings from gem configuration as fallbacks (@stan3)
- avoid global namespace pollution when loading gems ([#5958](https://github.com/bundler/bundler/issues/5958), @shyouhei)
- avoid running a complete re-resolve on `bundle update --bundler` (@segiddins)
- allow `bundle binstubs --standalone` to work without `path` being set (@colby-swandale)
- fix support for bundle paths that include jars or wars on jruby ([#5975](https://github.com/bundler/bundler/issues/5975), @torcido)
## 1.15.4 (2017-08-19)
Bugfixes:
- handle file conflicts gracefully in `bundle gem` (@rafaelfranca, @segiddins)
- bundler will fail gracefully when the bundle path contains the system path separator ([#5485](https://github.com/bundler/bundler/issues/5485), ajwann)
- failed gem downloads will be retried consistently across different RubyGems versions (@shayonj)
- `bundle pristine` will respect build options while re-building native extensions (@NickLaMuro)
## 1.15.3 (2017-07-21)
Bugfixes:
- ensure that empty strings passed to `bundle config` are serialized & parsed properly ([#5881](https://github.com/bundler/bundler/issues/5881), @segiddins)
- avoid printing an outdated version warning when running a parseable command (@segiddins)
## 1.15.2 (2017-07-17)
Features:
- new gemfiles created by bundler will include an explicit `github` git source that uses `https` (@segiddins)
Bugfixes:
- inline gemfiles work when `BUNDLE_BIN` is set ([#5847](https://github.com/bundler/bundler/issues/5847), @segiddins)
- avoid using the old dependency API when there are no changes to the compact index files ([#5373](https://github.com/bundler/bundler/issues/5373), @greysteil)
- fail gracefully when the full index serves gemspecs with invalid dependencies ([#5797](https://github.com/bundler/bundler/issues/5797), @segiddins)
- support installing gemfiles that use `eval_gemfile`, `:path` gems with relative paths, and `--deployment` simultaneously (@NickLaMuro)
- `bundle config` will print settings as the type they are interpreted as (@segiddins)
- respect the `no_proxy` environment variable when making network requests ([#5781](https://github.com/bundler/bundler/issues/5781), @jakauppila)
- commands invoked with `--verbose` will not have default flags printed (@segiddins)
- allow `bundle viz` to work when another gem has a requirable `grapviz` file ([#5707](https://github.com/bundler/bundler/issues/5707), @segiddins)
- ensure bundler puts activated gems on the `$LOAD_PATH` in a consistent order ([#5696](https://github.com/bundler/bundler/issues/5696), @segiddins)
## 1.15.1 (2017-06-02)
Bugfixes:
- `bundle lock --update GEM` will fail gracefully when the gem is not in the lockfile ([#5693](https://github.com/bundler/bundler/issues/5693), @segiddins)
- `bundle init --gemspec` will fail gracefully when the gemspec is invalid (@colby-swandale)
- `bundle install --force` works when the gemfile contains git gems ([#5678](https://github.com/bundler/bundler/issues/5678), @segiddins)
- `bundle env` will print well-formed markdown when there are no settings ([#5677](https://github.com/bundler/bundler/issues/5677), @segiddins)
## 1.15.0 (2017-05-19)
This space intentionally left blank.
## 1.15.0.pre.4 (2017-05-10)
Bugfixes:
- avoid conflicts when `Gem.finish_resolve` is called after the bundle has been set up (@segiddins)
- ensure that `Gem::Specification.find_by_name` always returns an object that can have `#to_spec` called on it ([#5592](https://github.com/bundler/bundler/issues/5592), @jules2689)
## 1.15.0.pre.3 (2017-04-30)
Bugfixes:
- avoid redundant blank lines in the readme generated by `bundle gem` (@koic)
- ensure that `open-uri` is not loaded after `bundle exec` (@segiddins)
- print a helpful error message when an activated default gem conflicts with
a gem in the gemfile (@segiddins)
- only shorten `ref` option for git gems when it is a SHA ([#5620](https://github.com/bundler/bundler/issues/5620), @segiddins)
## 1.15.0.pre.2 (2017-04-23)
Bugfixes:
- ensure pre-existing fit caches are updated from remote sources ([#5423](https://github.com/bundler/bundler/issues/5423), @alextaylor000)
- avoid duplicating specs in the lockfile after updating with the gem uninstalled ([#5599](https://github.com/bundler/bundler/issues/5599), @segiddins)
- ensure git gems have their extensions available at runtime ([#5594](https://github.com/bundler/bundler/issues/5594), @jules2689, @segiddins)
## 1.15.0.pre.1 (2017-04-16)
Features:
- print a notification when a newer version of bundler is available ([#4683](https://github.com/bundler/bundler/issues/4683), @segiddins)
- add man pages for all bundler commands ([#4988](https://github.com/bundler/bundler/issues/4988), @feministy)
- add the `bundle info` command (@fredrb, @colby-swandale)
- all files created with `bundle gem` comply with the bundler style guide (@zachahn)
- if installing a gem fails, print out the reason the gem needed to be installed ([#5078](https://github.com/bundler/bundler/issues/5078), @segiddins)
- allow setting `gem.push_key` to set the key used when running `rake release` (@DTrierweiler)
- print gem versions that are regressing during `bundle update` in yellow ([#5506](https://github.com/bundler/bundler/issues/5506), @brchristian)
- avoid printing extraneous dependencies when the resolver encounters a conflict (@segiddins)
- add the `bundle issue` command that prints instructions for reporting issues ([#4871](https://github.com/bundler/bundler/issues/4871), @jonathanpike)
- add `--source` and `--group` options to the `bundle inject` command ([#5452](https://github.com/bundler/bundler/issues/5452), @Shekharrajak)
- add the `bundle add` command to add a gem to the gemfile (@denniss)
- add the `bundle pristine` command to re-install gems from cached `.gem` files ([#4509](https://github.com/bundler/bundler/issues/4509), @denniss)
- add a `--parseable` option for `bundle config` (@JuanitoFatas, @colby-swandale)
Performance:
- speed up gemfile initialization by storing locked dependencies as a hash (@jules2689)
- speed up gemfile initialization by making locked dependency comparison lazy, avoiding object allocation (@jules2689)
- only validate git gems when they are downloaded, instead of every time `Bundler.setup` is run (@segiddins)
- avoid regenerating the lockfile when nothing has changed (@segiddins)
- avoid diffing large arrays when no sources in the gemfile have changed (@segiddins)
- avoid evaluating full gemspecs when running with RubyGems 2.5+ (@segiddins)
Bugfixes:
- fix cases where `bundle update` would print a resolver conflict instead of updating the selected gems ([#5031](https://github.com/bundler/bundler/issues/5031), [#5095](https://github.com/bundler/bundler/issues/5095), @segiddins)
- print out a stack trace after an interrupt when running in debug mode (@segiddins)
- print out when bundler starts fetching a gem from a remote server (@segiddins)
- fix `bundle gem` failing when `git` is unavailable ([#5458](https://github.com/bundler/bundler/issues/5458), @Shekharrajak, @colby-swandale)
- suggest the appropriate command to unfreeze a bundle ([#5009](https://github.com/bundler/bundler/issues/5009), @denniss)
- ensure nested calls to `bundle exec` resolve default gems correctly ([#5500](https://github.com/bundler/bundler/issues/5500), @segiddins)
- ensure that a plugin failing to install doesn't uninstall other plugins (@kerrizor, @roseaboveit)
- ensure `socket` is required before being referenced ([#5533](https://github.com/bundler/bundler/issues/5533), @rafaelfranca)
- allow running `bundle outdated` when gems aren't installed locally ([#5553](https://github.com/bundler/bundler/issues/5553), @segiddins)
- print a helpful error when `bundle exec`ing to a gem that isn't included in the bundle ([#5487](https://github.com/bundler/bundler/issues/5487), @segiddins)
- print an error message when a non-git gem is given a `branch` option ([#5530](https://github.com/bundler/bundler/issues/5530), @colby-swandale)
- allow interrupts to exit the process after gems have been installed (@segiddins)
- print the underlying error when downloading gem metadata fails ([#5579](https://github.com/bundler/bundler/issues/5579), @segiddins)
- avoid deadlocking when installing with a lockfile that is missing dependencies ([#5378](https://github.com/bundler/bundler/issues/5378), [#5480](https://github.com/bundler/bundler/issues/5480), [#5519](https://github.com/bundler/bundler/issues/5519), [#5526](https://github.com/bundler/bundler/issues/5526), [#5529](https://github.com/bundler/bundler/issues/5529), [#5549](https://github.com/bundler/bundler/issues/5549), [#5572](https://github.com/bundler/bundler/issues/5572), @segiddins)
## 1.14.6 (2017-03-03)
Bugfixes:
- avoid undefined constant `Bundler::Plugin::API::Source` exception ([#5409](https://github.com/bundler/bundler/issues/5409), @segiddins)
- avoid incorrect warnings about needing to enable `specific_platform` (@segiddins)
- fail gracefully when the compact index does not send an ETag ([#5463](https://github.com/bundler/bundler/issues/5463), @olleolleolle)
- ensure `bundle outdated --local` shows all outdated gems ([#5430](https://github.com/bundler/bundler/issues/5430), @denniss)
- fix a case where ruby version requirements could lead to incorrect resolver conflicts ([#5425](https://github.com/bundler/bundler/issues/5425), @segiddins)
## 1.14.5 (2017-02-22)
Bugfixes:
- avoid loading all unused gemspecs during `bundle exec` on RubyGems 2.3+ (@segiddins)
- improve resolver performance when dependencies have zero or one total possibilities ignoring requirements ([#5444](https://github.com/bundler/bundler/issues/5444), [#5457](https://github.com/bundler/bundler/issues/5457), @segiddins)
- enable compact index when OpenSSL FIPS mode is enabled but not active ([#5433](https://github.com/bundler/bundler/issues/5433), @wjordan)
- use github username instead of git name for the github url in `bundle gem` ([#5438](https://github.com/bundler/bundler/issues/5438), @danielpclark)
- avoid a TypeError on RubyGems 2.6.8 when no build settings are set for native extensions (@okkez)
- fail gracefully when the dependency api is missing runtime dependencies for a gem (@segiddins)
- handle when a platform-specific gem has more dependencies than the ruby platform version ([#5339](https://github.com/bundler/bundler/issues/5339), [#5426](https://github.com/bundler/bundler/issues/5426), @segiddins)
- allow running bundler on a machine with no home directory where the temporary directory is not writable ([#5371](https://github.com/bundler/bundler/issues/5371), @segiddins)
- avoid gem version conflicts on openssl using Ruby 2.5 ([#5235](https://github.com/bundler/bundler/issues/5235), @rhenium)
- fail when installing in frozen mode and the dependencies for `gemspec` gems have changed without the lockfile being updated ([#5264](https://github.com/bundler/bundler/issues/5264), @segiddins)
## 1.14.4 (2017-02-12)
Bugfixes:
- fail gracefully when attempting to overwrite an existing directory with `bundle gem` ([#5358](https://github.com/bundler/bundler/issues/5358), @nodo)
- fix a resolver bug that would cause bundler to report conflicts that it could resolve ([#5359](https://github.com/bundler/bundler/issues/5359), [#5362](https://github.com/bundler/bundler/issues/5362), @segiddins)
- set native extension build arguments for git gems ([#5401](https://github.com/bundler/bundler/issues/5401), @segiddins)
- fix the suggested `bundle lock` command printed when a dependency is unused on any platform (@5t111111)
- ensure the version passed to `ruby` in the Gemfile is valid during Gemfile parsing ([#5380](https://github.com/bundler/bundler/issues/5380), @segiddins)
- show `bundle inject` usage when too many arguments are passed ([#5384](https://github.com/bundler/bundler/issues/5384), @Shekharrajak)
- stop `bundle show --outdated` from implicitly running `bundle update` ([#5375](https://github.com/bundler/bundler/issues/5375), @colby-swandale)
- allow the temporary home directory fallback to work for multiple users (@svoop)
## 1.14.3 (2017-01-24)
Bugfixes:
- fix the resolver attempting to activate ruby-platform gems when the bundle is only for other platforms ([#5349](https://github.com/bundler/bundler/issues/5349), [#5356](https://github.com/bundler/bundler/issues/5356), @segiddins)
- avoid re-resolving a locked gemfile that uses `gemspec` and includes development dependencies ([#5349](https://github.com/bundler/bundler/issues/5349), @segiddins)
## 1.14.2 (2017-01-22)
Bugfixes:
- fix using `force_ruby_platform` on windows ([#5344](https://github.com/bundler/bundler/issues/5344), @segiddins)
- fix an incorrect version conflict error when using `gemspec` on multiple platforms ([#5340](https://github.com/bundler/bundler/issues/5340), @segiddins)
## 1.14.1 (2017-01-21)
Bugfixes:
- work around a ruby 2.2.2 bug that caused a stack consistency error during installation ([#5342](https://github.com/bundler/bundler/issues/5342), @segiddins)
## 1.14.0 (2017-01-20)
Bugfixes:
- ensure `Settings::Mirror` is autoloaded under the `Settings` namespace
([#5238](https://github.com/bundler/bundler/issues/5238), @segiddins)
- fix `bundler/inline` when `BUNDLE_GEMFILE=""` ([#5079](https://github.com/bundler/bundler/issues/5079), @segiddins)
## 1.14.0.pre.2 (2017-01-11)
Bugfixes:
- allow not selecting a gem when running `bundle open` ([#5301](https://github.com/bundler/bundler/issues/5301), @segiddins)
- support installing gems from git branches that contain shell metacharacters ([#5295](https://github.com/bundler/bundler/issues/5295), @segiddins)
- fix a resolver error that could leave dependencies unresolved ([#5294](https://github.com/bundler/bundler/issues/5294), @segiddins)
- fix a stack overflow error when invoking commands ([#5296](https://github.com/bundler/bundler/issues/5296), @segiddins)
## 1.14.0.pre.1 (2016-12-29)
Features:
- `bundle doctor` first runs `bundle check` (@segiddins)
- the bundler trampoline is automatically enabled when the target version is greater than bundler 2 (@segiddins)
- gem checksums returned by rubygems.org are validated when installing gems ([#4464](https://github.com/bundler/bundler/issues/4464), @segiddins)
- use the git username as a github username when running `bundle gem` (@JuanitoFatas)
- show more context when the resolver conflicts on required ruby and rubygems versions (@segiddins)
- improve platform support by allowing bundler to pick the best platform match during dependency resolution, enabled with the `specific_platform` setting ([#4295](https://github.com/bundler/bundler/issues/4295), [#4896](https://github.com/bundler/bundler/issues/4896), @segiddins)
- always prompt the user for a password when using `sudo` ([#3006](https://github.com/bundler/bundler/issues/3006), @segiddins)
- support running without a home directory ([#4778](https://github.com/bundler/bundler/issues/4778), @segiddins)
- print a warning when the gemfile uses a platform conditional that will exclude the gem from all lockfile platforms (@segiddins)
- add the `force_ruby_platform` setting to force bundler to install ruby-platform gems, even on other platforms ([#4813](https://github.com/bundler/bundler/issues/4813), @segiddins)
- add conservative update options to `bundle lock` ([#4912](https://github.com/bundler/bundler/issues/4912), @chrismo)
- improve `bundle outdated` output to group gems by group (@ryanfox1985)
- add conservative update options to `bundle update` ([#5065](https://github.com/bundler/bundler/issues/5065), [#5076](https://github.com/bundler/bundler/issues/5076), @chrismo)
- print the output of `bundle env` as github-flavored markdown, making it easier to preserve formatting when copy-pasting into a new issue (@segiddins)
- configure the persistence file when using `bundle gem` with `rspec` (@segiddins)
- add support for the `ruby_25` gemfile filter (@amatsuda)
- when installing with a lockfile that is missing dependencies, allow installation to proceed (but without parallelism) (@segiddins)
Performance:
- improve `require "bundler"` performance by ~5x (@segiddins)
- allow install gems in parallel when running on rubygems 2+
Bugfixes:
- config files with CRLF line endings can be read ([#4435](https://github.com/bundler/bundler/issues/4435), @segiddins)
- `bundle lock` activates gems for the current platform even if they were activated under a different platform for a separate dependency ([#4896](https://github.com/bundler/bundler/issues/4896), @segiddins)
- running `bundle env` in a directory without a gemfile no longer crashes (@segiddins)
- fail gracefully when attempting to use a source with an unknown URI scheme ([#4953](https://github.com/bundler/bundler/issues/4953), @segiddins)
- store paths in the lockfile relative to the root gemfile directory when using `eval_gemfile` ([#4966](https://github.com/bundler/bundler/issues/4966), @segiddins)
- `bundle lock` will not update without the `--update` flag ([#4957](https://github.com/bundler/bundler/issues/4957), @segiddins)
- the `console` binstub generated by `bundle gem` will load `.irbrc` files (@mattbrictson)
- print friendly filesystem access errors in the new index (@segiddins)
- print a helpful error when running out of memory on jruby ([#4673](https://github.com/bundler/bundler/issues/4673), @segiddins)
- load all rubygems plugins when installing gems ([#2824](https://github.com/bundler/bundler/issues/2824), @segiddins)
- `bundle clean --dry-run` prints the list of gems without the `--force` option when no path is set ([#5027](https://github.com/bundler/bundler/issues/5027), @hmistry)
- local installs no longer print "this gem may have been yanked" ([#5022](https://github.com/bundler/bundler/issues/5022), @hmistry)
- avoid leaking `which` output when running `bundle doctor` (@colby-swandale)
- print a warning when attempting to `bundle exec` an empty program ([#5084](https://github.com/bundler/bundler/issues/5084), @bronzdoc)
- ensure `bundle outdated` lists all outdated gems ([#4979](https://github.com/bundler/bundler/issues/4979), @chrismo)
- fail gracefully when attempting to `bundle gem` with an invalid constant name ([#5185](https://github.com/bundler/bundler/issues/5185), @segiddins)
- allow `bundler/inline` to work in a directory that contains a gemfile ([#5117](https://github.com/bundler/bundler/issues/5117), @colby-swandale)
- ensure that the new index is thread-safe, allowing installation on rbx ([#5142](https://github.com/bundler/bundler/issues/5142), @segiddins)
- remove deprecated `rspec` syntax in `bundle gem` output (@gearnode)
- fail gracefully when any system error is encountered when touching the filesystem ([#5134](https://github.com/bundler/bundler/issues/5134), @segiddins)
- fix compatibility with a machine running with FIPS mode enabled ([#4989](https://github.com/bundler/bundler/issues/4989), @segiddins)
- fix `bundle lock --add-platform ruby` ([#5230](https://github.com/bundler/bundler/issues/5230), @segiddins)
- print gem post-install messages when running `bundle update` (@smathy)
- ensure errors due to a retries are all separated by a newline (@segiddins)
- print out the bundle path in gem not found errors ([#4854](https://github.com/bundler/bundler/issues/4854), @diegosteiner)
- fail gracefully when creating threads fails (@segiddins)
- avoid downloading metadata for gems that are only development dependencies (@Paxa)
## 1.13.7 (2016-12-25)
Features:
- add support for the `ruby_24` gemfile filter ([#5281](https://github.com/bundler/bundler/issues/5281), @amatsuda)
## 1.13.6 (2016-10-22)
Bugfixes:
- make the `gem` method public again, fixing a regression in 1.13.4 ([#5102](https://github.com/bundler/bundler/issues/5102), @segiddins)
## 1.13.5 (2016-10-15)
Bugfixes:
- Ensure a locked pre-release spec can always be re-resolved ([#5089](https://github.com/bundler/bundler/issues/5089), @segiddins)
## 1.13.4 (2016-10-11)
Bugfixes:
- stop printing warning when compact index versions file is rewritten ([#5064](https://github.com/bundler/bundler/issues/5064), @indirect)
- fix `parent directory is world writable but not sticky` error on install ([#5043](https://github.com/bundler/bundler/issues/5043), @indirect)
- fix for `uninitialized constant Bundler::Plugin::API::Source` error ([#5010](https://github.com/bundler/bundler/issues/5010), @hsbt, @aycabta)
- make `update` options for major, minor, and patch updates consistent ([#4934](https://github.com/bundler/bundler/issues/4934), @chrismo)
## 1.13.3 (2016-10-10)
Bugfixes:
- add support for weak etags to the new index (@segiddins)
## 1.13.2 (2016-09-30)
Bugfixes:
- allow `Settings` to be initialized without a root directory (@m1k3)
- allow specifying ruby engines in the gemfile as a symbol ([#4919](https://github.com/bundler/bundler/issues/4919), @JuanitoFatas)
- avoid an exception when using `bundler/deployment` with Vlad (@srbaker)
- ensure redefined methods have the same visibility as the one they're replacing, fixing `Kernel.require` failing on JRuby ([#4975](https://github.com/bundler/bundler/issues/4975), @segiddins)
- ensure that Bundler won't complain about a corrupt lockfile when no lockfile exists when using `gemspec` in the Gemfile ([#5006](https://github.com/bundler/bundler/issues/5006), @segiddins)
- fail gracefully when parsing the metadata for a gemspec from the compact index fails (@segiddins)
- fix system gems not being copied to --path on bundle install (e.g. --deployment) ([#4974](https://github.com/bundler/bundler/issues/4974), @chrismo)
Performance:
- avoid parsing the lockfile twice when evaluating gemfiles (@segiddins)
## 1.13.1 (2016-09-13)
Bugfixes:
- ensure that `Gem::Source` is available, fixing several exceptions ([#4944](https://github.com/bundler/bundler/issues/4944), @dekellum)
- ensure that dependency resolution works when multiple gems have the same dependency ([#4961](https://github.com/bundler/bundler/issues/4961), @segiddins)
## 1.13.0 (2016-09-05)
This space deliberately left blank.
## 1.13.0.rc.2 (2016-08-21)
Features:
- add setting `exec_disable_load` to force `exec` to spawn a new Ruby process (@segiddins)
- add `doctor` command to help with issues like unlinked compiled gems ([#4765](https://github.com/bundler/bundler/issues/4765), @mistydemeo)
- rework the `update` command, providing fine-grained control via flags ([#4676](https://github.com/bundler/bundler/issues/4676), @chrismo)
- add URI to http response output in debug mode ([#4808](https://github.com/bundler/bundler/issues/4808), @NickLaMuro)
- add manpage for `binstubs` command ([#4847](https://github.com/bundler/bundler/issues/4847), @Zorbash)
- support `mirror` settings for sources by hostname, not only full URL (@opiethehokie)
- print gem installation errors after other install output ([#4834](https://github.com/bundler/bundler/issues/4834), @segiddins)
- add `lock --remove-platform` flag to remove platforms from the lock ([#4877](https://github.com/bundler/bundler/issues/4877), @segiddins)
- add `only_update_to_newer_versions` setting to prevent downgrades during `update` (@segiddins)
- expanded experimental plugin support to include hooks and sources (@asutoshpalai)
Bugfixes:
- retry gem downloads ([#4846](https://github.com/bundler/bundler/issues/4846), @jkeiser)
- improve the CompactIndex to handle capitalized legacy gems ([#4867](https://github.com/bundler/bundler/issues/4867), @segiddins)
- re-use persistent HTTP connections for CompactIndex (@NickLaMuro)
- respect `required_ruby_version` when Gemfile contains `ruby` version (@indirect)
- allow `rake release` to sign git tags ([#4743](https://github.com/bundler/bundler/issues/4743), @eagletmt)
- set process titles when using `#load` during `exec` (@yob)
- recognize JRuby shebangs for using `#load` during `exec` (@ojab)
- handle world-writable home directories ([#4726](https://github.com/bundler/bundler/issues/4726), @allenzhao)
- support multi-platform gems via the `gemspec` Gemfile method ([#4798](https://github.com/bundler/bundler/issues/4798), @segiddins)
- print dots correctly for CompactIndex fetcher (@NickLaMuro)
- set an `open_timeout` when requesting gem data via HTTP (@NickLaMuro)
- rename the BUNDLE\_ORIG\_ENV variable so it no longer shows up in `config` (@indirect)
- show help only when `-h` or `--help` is passed to Bundler, not to `exec` ([#4801](https://github.com/bundler/bundler/issues/4801), @segiddins)
- handle symlinks to binstubs created by `--standalone` ([#4782](https://github.com/bundler/bundler/issues/4782), @terinjokes)
## 1.13.0.rc.1 (2016-06-27)
Features:
- when `bundle config major_deprecations` or `BUNDLE_MAJOR_DEPRECATIONS` is set, deprecation warnings for bundler 2 will be printed (@segiddins)
- when running with `--verbose`, bundler will print the reason it is re-resolving a gemfile (@segiddins)
Bugfixes:
- fix support for running RubyGems 1.x on Ruby 2.3 ([#4698](https://github.com/bundler/bundler/issues/4698), @segiddins)
- fix bundle exec'ing to a ruby file when gems are installed into a path ([#4592](https://github.com/bundler/bundler/issues/4592), @chrismo)
- when multiple specs in a bundle have the same executable, prefer activating the one from the requested gem ([#4705](https://github.com/bundler/bundler/issues/4705), @segiddins)
- stop changing the load path to require the vendored postit when trampolining (@segiddins)
- ensure relative paths are properly printed after completing an installation (@jenseng)
- fix re-resolving when there are multiple unchanged path sources (@segiddins)
- de-init submodules when running git 2.9 and requesting a git gem without submodules (@segiddins)
## 1.13.0.pre.1 (2016-06-20)
Performance:
- speed up gemfile resolution during `bundle install` by between 4x-100x ([#4376](https://github.com/bundler/bundler/issues/4376), @segiddins)
- generally reduce object allocations when using bundler (@segiddins)
- speed up bin generation for path gems with many files ([#2846](https://github.com/bundler/bundler/issues/2846), @segiddins)
- fix detecting path spec changes to avoid re-resolving unnecessarily (@jrafanie)
Features:
- automatically trampoline to the bundler version locked in the lockfile, only updating to the running version on `bundle update --bundler` (@segiddins)
- laying the groundwork for plugin support, which is currently unsuppported, undocumented, disabled by default, and liable to change without notice (@asutoshpalai)
- allow `bundle viz --without` to accept multiple `:`-delimited groups (@mobilutz)
- support for RubyGems 2.6.4 ([#4368](https://github.com/bundler/bundler/issues/4368), @segiddins, @RochesterinNYC)
- colorize updated gem versions ([#4334](https://github.com/bundler/bundler/issues/4334), @bronzdoc)
- add the `--standalone` flag to `bundle binstubs` ([#4594](https://github.com/bundler/bundler/issues/4594), @b-ggs)
- update the `bundle gem` CoC to contributor covenant v1.4 (@cllns)
- use a custom YAML serializer to make config file consistent (@segiddins)
- filter credentials from error messages (bundler/bundler-features[#111](https://github.com/bundler/bundler/issues/111), @RochesterinNYC, @sandlerr)
- support relative paths used inside a nested invocation of `eval_gemfile` ([#4584](https://github.com/bundler/bundler/issues/4584), @RochesterinNYC)
- fail gracefully when attempting to install a yanked gem ([#4344](https://github.com/bundler/bundler/issues/4344), @allenzhao)
- automatically install an inline gemfile when gems are missing locally (@segiddins)
- allow conflicts for gems resolved via `gemspec` (@segiddins)
- add `--add-platform` option to `bundle lock` (@segiddins)
- fail gracefully when a resolved spec's `required_ruby_version` or `required_rubygems_version` is incompatible (@segiddins)
Bugfixes:
- implicitly unlock the resolved ruby version when the declared requirements in the gemfile are incompatible with the locked version ([#4595](https://github.com/bundler/bundler/issues/4595), [#4627](https://github.com/bundler/bundler/issues/4627), @segiddins)
- add support for quoted paths in `$PATH` ([#4323](https://github.com/bundler/bundler/issues/4323), @segiddins)
- check out missing git repos that are not being installed ([#3981](https://github.com/bundler/bundler/issues/3981), @asutoshpalai)
- write `bundler/setup.rb` to a consistent path (@glennpratt)
- open editor in `bundle open` with a clean environment (@sj26)
- resolve infinitely recursive copy when running `bundle package --all` with a `gemspec` in the gemfile ([#4392](https://github.com/bundler/bundler/issues/4392), [#4430](https://github.com/bundler/bundler/issues/4430), @RochesterinNYC)
- fail gracefully when encountering an `Errno::ENOTSUP` ([#4394](https://github.com/bundler/bundler/issues/4394), @segiddins)
- fail gracefully when encountering an `Errno::EHOSTUNREACH` ([#4642](https://github.com/bundler/bundler/issues/4642), @allenzhao)
- fix loading config files with very long values ([#4370](https://github.com/bundler/bundler/issues/4370), @segiddins)
- only show potential updates for gemfile platforms in `bundle outdated` ([#4450](https://github.com/bundler/bundler/issues/4450), @RochesterinNYC)
- allow running `bundle install --deployment` after `bundle package --all` with path gems ([#2175](https://github.com/bundler/bundler/issues/2175), @allenzhao)
- add support for patchlevels in ruby versions in the gemfile and gemspecs ([#4593](https://github.com/bundler/bundler/issues/4593), @chalkos)
## 1.12.6 (2016-10-10)
Bugfixes:
- add support for weak etags to the new index (@segiddins)
## 1.12.5 (2016-05-25)
Bugfixes:
- only take over `--help` on `bundle exec` when the first two arguments are `exec` and `--help` ([#4596](https://github.com/bundler/bundler/issues/4596), @segiddins)
- don't require `require: true` dependencies that are excluded via `env` or `install_if` (@BrianHawley)
- reduce the number of threads used simultaneously by bundler ([#4367](https://github.com/bundler/bundler/issues/4367), @will-in-wi)
## 1.12.4 (2016-05-16)
Bugfixes:
- ensure concurrent use of the new index can't corrupt the cache ([#4519](https://github.com/bundler/bundler/issues/4519), @domcleal)
- allow missing rubygems credentials when pushing a gem with a custom host ([#4437](https://github.com/bundler/bundler/issues/4437), @Cohen-Carlisle)
- fix installing built-in specs with `--standalone` ([#4557](https://github.com/bundler/bundler/issues/4557), @segiddins)
- fix `bundle show` when a gem has a prerelease version that includes a `-` ([#4385](https://github.com/bundler/bundler/issues/4385), @segiddins)
## 1.12.3 (2016-05-06)
Bugfixes:
- fix uncoditionally writing `.bundle/config` when running `bundle install` (@segiddins)
- fall back to the dependency API and the full index when the home directory is not writable (@segiddins)
## 1.12.2 (2016-05-04)
Bugfixes:
- fix modifying a frozen string when the resolver conflicts on dependencies with requirements ([#4520](https://github.com/bundler/bundler/issues/4520), @grzuy)
- fix `bundle exec foo --help` not showing the invoked command's help ([#4480](https://github.com/bundler/bundler/issues/4480), @b-ggs)
## 1.12.1 (2016-04-30)
Bugfixes:
- automatically fallback when the new index has a checksum mismatch instead of erroring (@segiddins)
- fix computation of new index file local checksums on Windows ([#4472](https://github.com/bundler/bundler/issues/4472), @mwrock)
- properly handle certain resolver backtracking cases without erroring (@segiddins, [#4484](https://github.com/bundler/bundler/issues/4484))
- ensure the `$LOAD_PATH` contains specs' load paths in the correct order (@segiddins, [#4482](https://github.com/bundler/bundler/issues/4482))
## 1.12.0 (2016-04-28)
This space intentionally left blank.
## 1.12.0.rc.4 (2016-04-21)
Bugfixes:
- don't fail when `bundle outdated` is run with flags and the lockfile contains non-semver versions ([#4438](https://github.com/bundler/bundler/issues/4438), @RochesterinNYC)
## 1.12.0.rc.3 (2016-04-19)
Bugfixes:
- don't allow new attributes to dirty a lockfile when running `bundle exec`, `-rbundler/setup`, or `bundle check` (@segiddins)
## 1.12.0.rc.2 (2016-04-15)
Features:
- `bundle outdated` handles all combinations of `--major`, `--minor`, and `--patch` ([#4396](https://github.com/bundler/bundler/issues/4396), @RochesterinNYC)
Bugfixes:
- prevent endless recursive copy for `bundle package --all` ([#4392](https://github.com/bundler/bundler/issues/4392), @RochesterinNYC)
- allow executables that are `load`ed to exit non-0 via an `at_exit` hook when invoked by `bundle exec` (@segiddins)
- nested invocations of `bundle exec` properly preserve the `$PATH` and `$GEM_PATH` environment variables (@segiddins)
## 1.12.0.rc (2016-03-13)
Performance:
- Download gem metadata from globally distributed CDN endpoints ([#4358](https://github.com/bundler/bundler/issues/4358), @segiddins)
Bugfixes:
- handle Ruby pre-releases built from source ([#4324](https://github.com/bundler/bundler/issues/4324), @RochesterinNYC)
- support binstubs from RubyGems 2.6 ([#4341](https://github.com/bundler/bundler/issues/4341), @segiddins)
- handle quotes present in in PATH ([#4326](https://github.com/bundler/bundler/issues/4326), @segiddins)
## 1.12.0.pre.2 (2016-02-26)
Performance:
- speed up `bundle exec` by `load`ing the executable whenever possible, saving roughly .2 seconds per invocation (@segiddins)
Features:
- add a `--patch` flag for `bundle outdated` (@RochesterinNYC)
- add `Bundler.clean_env` and `Bundler.original_env` ([#4232](https://github.com/bundler/bundler/issues/4232), @njam)
- add `--frozen` support to `bundle package` ([#3356](https://github.com/bundler/bundler/issues/3356), @RochesterinNYC)
Bugfixes:
- place bundler loaded gems after `-I` and `RUBYLIB` (@Elffers)
- give a better error message when filesystem access raises an `EPROTO` error ([#3581](https://github.com/bundler/bundler/issues/3581), [#3932](https://github.com/bundler/bundler/issues/3932), [#4163](https://github.com/bundler/bundler/issues/4163), @RochesterinNYC)
- give a better error message when both `--deployment` and `--system` are used together (@RochesterinNYC)
- fix `$PATH` being preserved for use in `Bundler.with_clean_env` ([#4251](https://github.com/bundler/bundler/issues/4251), @segiddins, @njam)
- give a better error message when running `bundle outdated` in frozen mode ([#4287](https://github.com/bundler/bundler/issues/4287), @RochesterinNYC)
- handle when `http_proxy` is set to `:no_proxy` in the rubygems configuration ([#4294](https://github.com/bundler/bundler/issues/4294), @segiddins)
- give a better error message when authentication details aren't properly escaped ([#4288](https://github.com/bundler/bundler/issues/4288), @RochesterinNYC)
- fix `bundle outdated --minor` to only report updates that match the current minor version (@RochesterinNYC)
- fix extra dependencies being resolved unnecessarily ([#4276](https://github.com/bundler/bundler/issues/4276), @segiddins)
- give a better error message when missing specs due to platform mis-matches ([#4259](https://github.com/bundler/bundler/issues/4259), @RochesterinNYC)
- skip rebuilding extensions for git gems if they are already built ([#4082](https://github.com/bundler/bundler/issues/4082), @csfrancis, @indirect, @segiddins)
- fix `bundle install` not installing when the `no_install` setting is set ([#3966](https://github.com/bundler/bundler/issues/3966), @chulkilee, @segiddins)
## 1.12.0.pre.1 (2016-02-09)
Performance:
- speed up `bundle install` and `bundle update` by using the new compact gem index (@segiddins, @fotanus, @indirect)
- speed up `bundle exec` by avoiding loading the gemfile twice ([#2951](https://github.com/bundler/bundler/issues/2951), [#2952](https://github.com/bundler/bundler/issues/2952), @segiddins)
Features:
- add support for using version operators to specify ruby versions in the Gemfile (@jtarchie)
- redirect `--help` flag for plugins to that plugin's man page (@RochesterinNYC)
- support probing a mirror with a fallback timeout ([#4128](https://github.com/bundler/bundler/issues/4128), @pcarranza)
- add `--full-index` option to `bundle lock` (@segiddins)
- support running with frozen string literals (@deepj, @segiddins)
- add `--major` and `--minor` options to `bundle outdated` ([#3805](https://github.com/bundler/bundler/issues/3805), @cirdes)
- allow passing a custom `ui` to `bundler/inline` (@lamont-granquist)
- add support for ruby 2.4 ([#4266](https://github.com/bundler/bundler/issues/4266), @segiddins)
- add `bundle outdated --parseable` for machine-readable output (@RochesterinNYC)
Bugfixes:
- fix `bundle package --all` recursing endlessly ([#4158](https://github.com/bundler/bundler/issues/4158), @RochesterinNYC)
- fail fast on more errors when fetching remote resources ([#4154](https://github.com/bundler/bundler/issues/4154), @RochesterinNYC)
- give a better error message when a given git commit can't be found ([#4140](https://github.com/bundler/bundler/issues/4140), @doy)
- give a better error message when `bundle clean` doesn't have sufficient permissions ([#4170](https://github.com/bundler/bundler/issues/4170), @RochesterinNYC)
- give a better error message when reading a bundler config file fails (@segiddins)
- restrict platforms when referencing a `gemspec` in the `Gemfile` to those defined in the gemspec ([#4102](https://github.com/bundler/bundler/issues/4102), [#4150](https://github.com/bundler/bundler/issues/4150), @smellsblue)
- fix `bundle gem` with minitest to use the correct rake task (@kotoshenya)
- give a better error message when ssl isn't available ([#4054](https://github.com/bundler/bundler/issues/4054), @RochesterinNYC)
- print the original `require` error when `Bundler.require` fails ([#4182](https://github.com/bundler/bundler/issues/4182), @RochesterinNYC)
- give a better error message when certain resources are temporarily unavailable ([#4183](https://github.com/bundler/bundler/issues/4183), @RochesterinNYC)
- fix returning case-sensitive gem mirror URIs on ruby 2.3 (@segiddins)
- ignore colorized output from `git` when determining the current branch ([#4056](https://github.com/bundler/bundler/issues/4056), @agis-)
- fix storing the shared gems config option as a boolean (@vassilevsky)
- add support for running `bundle gem --exe` instead of using the `--bin` option (@christhekeele)
- fix `exec`-ing with 0 args in a directory with spaces ([#4230](https://github.com/bundler/bundler/issues/4230), @segiddins)
- avoid installing extraneous gems when resolving to an older version of a spec ([#4101](https://github.com/bundler/bundler/issues/4101), [#4198](https://github.com/bundler/bundler/issues/4198), @segiddins)
- ensure paths resolved when parsing a gemfile are relative to that file ([#3349](https://github.com/bundler/bundler/issues/3349), @dtognazzini)
- give a better error message when encountering an invalid gemspec ([#4248](https://github.com/bundler/bundler/issues/4248), [#4275](https://github.com/bundler/bundler/issues/4275), @RochesterinNYC)
- preserve the original `PATH` in `Bundler.with_clean_env` ([#4251](https://github.com/bundler/bundler/issues/4251), @segiddins)
- ensure standalone file paths are relative to the project root ([#4144](https://github.com/bundler/bundler/issues/4144), @glennpratt)
## 1.11.2 (2015-12-15)
Bugfixes:
- _really_ stop calling `required_ruby_version` on nil @specifications ([#4147](https://github.com/bundler/bundler/issues/4147), @indirect)
## 1.11.1 (2015-12-15)
Bugfixes:
- lazy-load Psych, again ([#4149](https://github.com/bundler/bundler/issues/4149), @indirect)
- allow gemspec gems on other platforms ([#4150](https://github.com/bundler/bundler/issues/4150), @indirect)
- fix --no-coc and --no-mit flags on `gem` ([#4148](https://github.com/bundler/bundler/issues/4148), @RochesterinNYC)
- stop calling `required_ruby_version` on nil @specifications ([#4147](https://github.com/bundler/bundler/issues/4147), @indirect)
## 1.11.0 (2015-12-12)
(this space intentionally left blank)
## 1.11.0.pre.2 (2015-12-06)
Bugfixes:
- fail gracefully when trying to execute a non-executable file ([#4081](https://github.com/bundler/bundler/issues/4081), @fotanus)
- fix a crash when pushing a gem via `rake release` (@segiddins)
## 1.11.0.pre.1 (2015-11-29)
Features:
- actual Gemfile and lockfile filenames are used in messages ([#3672](https://github.com/bundler/bundler/issues/3672), @segiddins)
- the git remote for `rake release` is now customizable (@skateman)
- file access permissions errors are now much more friendly ([#3703](https://github.com/bundler/bundler/issues/3703), [#3735](https://github.com/bundler/bundler/issues/3735), [#3858](https://github.com/bundler/bundler/issues/3858), [#3988](https://github.com/bundler/bundler/issues/3988), [#4009](https://github.com/bundler/bundler/issues/4009) @repinel, @Elffers, @segiddins, @agis-)
- add support for showing help for plugin commands (@tf)
- send `X-Gemfile-Source` header to source mirrors (@agis-)
- show what version upstream dependencies were resolved to in conflict messages (@segiddins)
- add support for using bundler setting to add private access credentials for git sources (@frsyuki)
- take into consideration HTTP proxy settings in `.gemrc` (@PG-kura)
- allow specifying a gem host to push to in the `GEM_HOST` environment variable (@pmenglund)
- when gempec `required_ruby_version` is available and the Gemfile specifies a ruby version, resolve for the given ruby version (@segiddins)
- allow setting a `silence_root_warning` setting to silence the warning when `bundle install` is run as root (@blackxored)
- update the `bundle gem` code of conduct template to Contributor Covenant v1.3.0 (@CoralineAda)
- add support for specifying gems to update when running `bundle lock` via `--update gem1 gem2` (@JuanitoFatas)
- added support for MRI 2.3 (@amatsuda)
- show a helpful message when requiring a file in `bundler require` fails ([#3960](https://github.com/bundler/bundler/issues/3960), @agis-)
- include git revision hash when printing a git source ([#3433](https://github.com/bundler/bundler/issues/3433), @agis-)
- improve hint when a resolution conflict occurs (@seanlinsley)
- show a friendly error when a git ref is not found ([#3879](https://github.com/bundler/bundler/issues/3879), @agis-)
- improve error message when sources are not absolute URIs ([#3925](https://github.com/bundler/bundler/issues/3925), @agis-)
- add `pkg` to rake's clobber list ([#3676](https://github.com/bundler/bundler/issues/3676), @jasonkarns)
- retry fetching specs when fetching version metadata fails (@jingweno)
Bugfixes:
- avoid showing bundler version warning messages twice (@fotanus)
- fix running `bundle check` with `--path` when the gems are only installed globally (@akihiro17)
- fix `bin/setup` from `bundle gem` assuming `bash` is in `/bin`
- fail more gracefully when an HTTP remote is unreachable ([#3765](https://github.com/bundler/bundler/issues/3765), @steverob)
- fix a warning running `bundle exec` on jruby 9.0.0.0 (@deivid-rodriguez, @mastfish)
- fix the `bundle gem` readme when no tests are generated (@roseweixel)
- the dependencies on test gems in `bundle gem` are now locked to major versions ([#3811](https://github.com/bundler/bundler/issues/3811), @indirect)
- fix the paths for native extensions generated by `--standalone` ([#3813](https://github.com/bundler/bundler/issues/3813), @AlexanderPavlenko)
- fix trying to cache a gem that has no source (@EduardoBautista)
- fix `--source` option to `bundle update` causing incorrect gem unlocking ([#3759](https://github.com/bundler/bundler/issues/3759), [#3761](https://github.com/bundler/bundler/issues/3761), @neoeno)
- fix handling an empty `BUNDLE_GEMFILE` environment variables ([#3678](https://github.com/bundler/bundler/issues/3678), @agis-)
- avoid cleaning up gem extension directory in `bundle clean` (@Sirupsen)
- fix the `ssl_verify_mode` setting not being treated as a number (@goughy000)
- fix not retrying on zlib errors ([#4047](https://github.com/bundler/bundler/issues/4047), @andremedeiros)
- fix a warning being shown for using `URI.encode` (@EduardoBautista)
- fix handling of fatal HTTP errors ([#3830](https://github.com/bundler/bundler/issues/3830), @indirect)
- ensure all `sudo` access is done in a thread-safe manner ([#3910](https://github.com/bundler/bundler/issues/3910), @agis-)
- fix caching gems with a path with the same prefix as the bundled application (@indirect)
- fix showing gemspec validation errors on `bundle exec` ([#3895](https://github.com/bundler/bundler/issues/3895), @agis-)
- distinguish Gemfile syntax and evaluation errors ([#3783](https://github.com/bundler/bundler/issues/3783), @agis-)
- fix nested Gemfile sources not restoring the previous source ([#3974](https://github.com/bundler/bundler/issues/3974), @agis-)
- fix the `RUBYLIB` environment variable not being cleaned ([#3982](https://github.com/bundler/bundler/issues/3982), @agis-)
- fix handling a dependency missing from `Gemfile.lock` so parallel installation does not deadlock ([#4012](https://github.com/bundler/bundler/issues/4012), @lukaso)
- also print gemspecs in `bundle env` output (@agis-)
- fix handling when a `path` source does not have a gemspec but a lockfile says there is ([#4004](https://github.com/bundler/bundler/issues/4004), @segiddins)
- show a warning when the `RUBYGEMS_GEMDEPS` environment variable is set ([#3656](https://github.com/bundler/bundler/issues/3656), @agis-)
- fix handling invalid RubyGems configuration files ([#4042](https://github.com/bundler/bundler/issues/4042), @agis-)
- fix `bundle console` falling back to `irb` when the preferred console is unavailable (@felixbuenemann)
- restrict platforms when referencing a `gemspec` in the `Gemfile` to those defined in the gemspec ([#4102](https://github.com/bundler/bundler/issues/4102), @smellsblue)
Performance:
- speed up dependency resolution in pathological cases by 25x ([#3803](https://github.com/bundler/bundler/issues/3803), @segiddins)
- drop string allocations when searching for gems (@jrafanie)
## 1.10.6 (2015-07-22)
Workarounds:
- only warn on invalid gemspecs (@indirect)
Bugfixes:
- fix installing dependencies in the correct order ([#3799](https://github.com/bundler/bundler/issues/3799), @pducks32)
- fix sorting of mixed DependencyLists ([#3762](https://github.com/bundler/bundler/issues/3762), @tony-spataro-rs)
- fix `install_if` conditionals when using the block form (@danieltdt)
## 1.10.5 (2015-06-24)
Workarounds:
- don't add or update BUNDLED WITH during `install` with no changes (@segiddins)
Bugfixes:
- fix sorting of mixed DependencyLists with RubyGems >= 2.23 ([#3762](https://github.com/bundler/bundler/issues/3762), @tony-spataro-rs)
- speed up resolver for path and git gems (@segiddins)
- fix `install --force` to not reinstall Bundler ([#3743](https://github.com/bundler/bundler/issues/3743), @karlo57)
## 1.10.4 (2015-06-16)
Workarounds:
- don't add BUNDLED WITH to the lock when Spring runs `check` over and over (@indirect)
Bugfixes:
- display "with native extensions" log output correctly (@ivantsepp)
- alias `i` to `install`, `c` to `check`, and `e` to `exec` (@indirect)
## 1.10.3 (2015-06-03)
Bugfixes:
- allow missing gemspec files when validating path and git gems ([#3686](https://github.com/bundler/bundler/issues/3686), [#3698](https://github.com/bundler/bundler/issues/3698), @segiddins)
- fix regression in `rake install` ([#3701](https://github.com/bundler/bundler/issues/3701), [#3705](https://github.com/bundler/bundler/issues/3705), @segiddins)
- fix regression when calling `gem` with `bundle exec` or `-rbundler/setup` ([#3699](https://github.com/bundler/bundler/issues/3699), @segiddins)
- fix `bundler/inline` requiring a newly-installed gem ([#3693](https://github.com/bundler/bundler/issues/3693), @indirect, @segiddins)
## 1.10.2 (2015-05-29)
Bugfixes:
- fix regression in `bundle update GEM` performance introduced in 1.10.0 ([#3687](https://github.com/bundler/bundler/issues/3687), @segiddins)
## 1.10.1 (2015-05-28)
Bugfixes:
- silence ruby warning when running CLI commands (@segiddins)
- validate gemspecs in non-packaging mode ([#3681](https://github.com/bundler/bundler/issues/3681), @segiddins)
- ensure the same chdir mutex as RubyGems is used ([#3680](https://github.com/bundler/bundler/issues/3680), @segiddins)
## 1.10.0 (2015-05-28)
(this space intentionally left blank)
## 1.10.0.rc (2015-05-16)
Features:
- dramatically speed up resolving some slow Gemfiles ([#3635](https://github.com/bundler/bundler/issues/3635), @segiddins)
- track CI platforms running Bundler ([#3646](https://github.com/bundler/bundler/issues/3646), @fotanus)
Bugfixes:
- allow `viz` to work with prereleases ([#3621](https://github.com/bundler/bundler/issues/3621), [#3217](https://github.com/bundler/bundler/issues/3217), @aprescott)
- validate gemspecs used in path and git gems ([#3639](https://github.com/bundler/bundler/issues/3639), @segiddins, @indirect)
- stop printing config warnings when config is unchanged ([#3649](https://github.com/bundler/bundler/issues/3649), @fotanus, @indirect)
- Without groups saved via `config` are no longer ignored when the `--without` flag is used
## 1.10.0.pre.2 (2015-05-07)
Bugfixes:
- make BUNDLED WITH backwards compatible ([#3623](https://github.com/bundler/bundler/issues/3623), @segiddins)
## 1.10.0.pre.1 (2015-05-05)
Bugfixes:
- always clean up tmp dirs ([#3277](https://github.com/bundler/bundler/issues/3277), @hone, @indirect, @segiddins)
## 1.10.0.pre (2015-05-03)
Features:
- support gem extensions built into any directory on RubyGems 2.2+ ([#3582](https://github.com/bundler/bundler/issues/3582), @voxik)
- add 'bundler/inline' which provides a `gemfile` method ([#3440](https://github.com/bundler/bundler/issues/3440), @segiddins)
- improved error reports for Gemfile errors ([#3480](https://github.com/bundler/bundler/issues/3480), @segiddins)
- `lock` command ([#3437](https://github.com/bundler/bundler/issues/3437), @segiddins)
- add `ignore_messages` config to suppress post-install text ([#3510](https://github.com/bundler/bundler/issues/3510), @pducks32)
- improve `gem` minitest template ([#3513](https://github.com/bundler/bundler/issues/3513), [#3515](https://github.com/bundler/bundler/issues/3515), @arthurnn)
- add `install --force` to re-install installed gems ([#3519](https://github.com/bundler/bundler/issues/3519), @segiddins)
- show more `outdated` information, including groups (@smlance, @indirect)
- add optional groups to the Gemfile ([#3531](https://github.com/bundler/bundler/issues/3531), @jhass)
- accept glob argument to `gemspec` in Gemfile ([#3464](https://github.com/bundler/bundler/issues/3464), @pjump)
- make timeouts and retries configurable via `config` ([#3601](https://github.com/bundler/bundler/issues/3601), @pducks32)
- add `install_if` Gemfile method for conditional installs ([#3611](https://github.com/bundler/bundler/issues/3611), @segiddins)
Bugfixes:
- standalone mode now uses builtin gems correctly ([#3610](https://github.com/bundler/bundler/issues/3610), @segiddins)
- fix `rake spec:deps` on MinGW Ruby 2.0+ ([#3487](https://github.com/bundler/bundler/issues/3487), @marutosi)
- remember all y/n answers when generating gems ([#3579](https://github.com/bundler/bundler/issues/3579), @pducks32)
Performance:
- use RubyGems stub specifications when possible ([#3580](https://github.com/bundler/bundler/issues/3580), @segiddins)
Deprecations:
- deprecated the (never enabled) `bundle_ruby` binary (@smlance)
## 1.9.10 (2015-06-22)
Features:
- the `BUNDLED WITH` section of lockfiles generated by 1.10+ will be preserved (@segiddins)
## 1.9.9 (2015-05-16)
Bugfixes:
- read mirror and credential settings from older versions ([#3557](https://github.com/bundler/bundler/issues/3557), @Strech)
## 1.9.8 (2015-05-12)
Bugfixes:
- fix regression in sudo mode introduced by 1.9.7 ([#3642](https://github.com/bundler/bundler/issues/3642), @segiddins)
## 1.9.7 (2015-05-11)
Bugfixes:
- always clean up tmp dirs ([#3277](https://github.com/bundler/bundler/issues/3277), @hone, @indirect, @segiddins)
## 1.9.6 (2015-05-02)
Bugfixes:
- use RubyGems spec stubs if available (@segiddins)
- allow creating gems with names containing two dashes ([#3483](https://github.com/bundler/bundler/issues/3483), @janlelis)
- allow creating gems with names extending constants ([#3603](https://github.com/bundler/bundler/issues/3603), @amatsuda)
## 1.9.5 (2015-04-29)
Bugfixes:
- respect Gemfile sources when installing a gem present in two sources ([#3585](https://github.com/bundler/bundler/issues/3585), @tmoore)
## 1.9.4 (2015-04-13)
Bugfixes:
- fix regression in installing x86 and universal gems ([#3565](https://github.com/bundler/bundler/issues/3565), @jdmundrawala)
- improve error when gems are missing ([#3564](https://github.com/bundler/bundler/issues/3564), @sealocal)
## 1.9.3 (2015-04-12)
Bugfixes:
- handle removal of `specs` from rubygems/rubygems@620910 ([#3558](https://github.com/bundler/bundler/issues/3558), @indirect)
- install 'universal' gems on Windows ([#3066](https://github.com/bundler/bundler/issues/3066), @jdmundrawala)
- stop passing --local during `rake install` task ([#3236](https://github.com/bundler/bundler/issues/3236), @indirect)
- guard against all possible accidental public gem pushes ([#3533](https://github.com/bundler/bundler/issues/3533), @indirect)
## 1.9.2 (2015-03-30)
Bugfixes:
- ensure gem executables are executable ([#3517](https://github.com/bundler/bundler/issues/3517), [#3511](https://github.com/bundler/bundler/issues/3511), @indirect)
- fix warnings in Molinillo ([#3516](https://github.com/bundler/bundler/issues/3516), @segiddins)
- ensure duplicate dependencies do not propagate ([#3522](https://github.com/bundler/bundler/issues/3522), @segiddins)
- keep gems locked when updating another gem from the same source ([#3520](https://github.com/bundler/bundler/issues/3520), @indirect)
- resolve race that could build gems without saved arguments ([#3404](https://github.com/bundler/bundler/issues/3404), @indirect)
## 1.9.1 (2015-03-21)
Bugfixes:
- avoid exception in 'bundler/gem_tasks' ([#3492](https://github.com/bundler/bundler/issues/3492), @segiddins)
## 1.9.0 (2015-03-20)
## 1.9.0.rc (2015-03-13)
Bugfixes:
- make Bundler.which stop finding directories (@nohoho)
- handle Bundler prereleases correctly ([#3470](https://github.com/bundler/bundler/issues/3470), @segiddins)
- add before_install to .travis.yml template for new gems (@kodnin)
## 1.9.0.pre.1 (2015-03-11)
Bugfixes:
- make `gem` command work again (@arthurnn)
## 1.9.0.pre (2015-03-11)
Features:
- prefer gemspecs closest to the directory root ([#3428](https://github.com/bundler/bundler/issues/3428), @segiddins)
- debug log for API request limits ([#3452](https://github.com/bundler/bundler/issues/3452), @neerfri)
"Features":
- Molinillo resolver, shared with CocoaPods (@segiddins)
- updated Thor to v0.19.1 (@segiddins)
## 1.8.9 (2015-05-02)
Bugfixes:
- Use RubyGems spec stubs if available (@segiddins)
## 1.8.8 (2015-04-29)
Bugfixes:
- Respect Gemfile sources when installing a gem present in two sources ([#3585](https://github.com/bundler/bundler/issues/3585), @tmoore)
## 1.8.7 (2015-04-07)
Bugfixes:
- stop suppressing errors inside gems that get required ([#3549](https://github.com/bundler/bundler/issues/3549), @indirect)
## 1.8.6 (2015-03-30)
Bugfixes:
- keep gems locked when updating another gem from the same source ([#3250](https://github.com/bundler/bundler/issues/3250), @indirect)
- resolve race that could build gems without saved arguments ([#3404](https://github.com/bundler/bundler/issues/3404), @indirect)
## 1.8.5 (2015-03-11)
Bugfixes:
- remove MIT license from gemspec when removing license file (@indirect)
- respect 'no' immediately as well as saving it in `gem` config (@kirs)
## 1.8.4 (2015-03-05)
Bugfixes:
- document --all-platforms option ([#3449](https://github.com/bundler/bundler/issues/3449), @moeffju)
- find gems from all sources on exec after install ([#3450](https://github.com/bundler/bundler/issues/3450), @TimMoore)
## 1.8.3 (2015-02-24)
Bugfixes:
- handle boolean values for gem settings (@EduardoBautista)
- stop always looking for updated `path` gems ([#3414](https://github.com/bundler/bundler/issues/3414), [#3417](https://github.com/bundler/bundler/issues/3417), [#3429](https://github.com/bundler/bundler/issues/3429), @TimMoore)
## 1.8.2 (2015-02-14)
Bugfixes:
- allow config settings for gems with 'http' in the name again ([#3398](https://github.com/bundler/bundler/issues/3398), @TimMoore)
## 1.8.1 (2015-02-13)
Bugfixes:
- synchronize building git gem native extensions ([#3385](https://github.com/bundler/bundler/issues/3385), @antifuchs & @indirect)
- set gemspec bindir correctly ([#3392](https://github.com/bundler/bundler/issues/3392), @TimMoore)
- request lockfile deletion when it is malformed ([#3396](https://github.com/bundler/bundler/issues/3396), @indirect)
- explain problem when mirror config is missing ([#3386](https://github.com/bundler/bundler/issues/3386), @indirect)
- explain problem when caching causes permission error ([#3390](https://github.com/bundler/bundler/issues/3390), @indirect)
- normalize URLs in config keys ([#3391](https://github.com/bundler/bundler/issues/3391), @indirect)
## 1.8.0 (2015-02-10)
Bugfixes:
- gemfile `github` blocks now work ([#3379](https://github.com/bundler/bundler/issues/3379), @indirect)
Bugfixes from v1.7.13:
- look up installed gems in remote sources ([#3300](https://github.com/bundler/bundler/issues/3300), [#3368](https://github.com/bundler/bundler/issues/3368), [#3377](https://github.com/bundler/bundler/issues/3377), [#3380](https://github.com/bundler/bundler/issues/3380), [#3381](https://github.com/bundler/bundler/issues/3381), @indirect)
- look up gems across all sources to satisfy dependencies ([#3365](https://github.com/bundler/bundler/issues/3365), @keiths-osc)
- request dependencies for no more than 100 gems at a time ([#3367](https://github.com/bundler/bundler/issues/3367), @segiddins)
## 1.8.0.rc (2015-01-26)
Features:
- add `config disable_multisource` option to ensure sources can't compete (@indirect)
Bugfixes:
- don't add extra quotes around long, quoted config values (@aroben, [#3338](https://github.com/bundler/bundler/issues/3338))
Security:
- warn when more than one top-level source is present (@indirect)
## 1.8.0.pre (2015-01-26)
Features:
- add metadata allowed_push_host to new gem template ([#3002](https://github.com/bundler/bundler/issues/3002), @juanitofatas)
- adds a `--no-install` flag to `bundle package` (@d-reinhold)
- add `bundle config auto_install true` to install automatically (@smashwilson)
- add `bundle viz --without` to exclude gem groups from resulting graph (@fnichol)
- prevent whitespace in gem declarations with clear messaging (@benlakey)
- tries to find a `bundler-` executable on your path for non-bundler commands (@andremedeiros)
- tries to find `gems.rb` and it's new counterpart, `gems.locked` (@andremedeiros)
- change the initial version of new gems from `0.0.1` to `0.1.0` (@petedmarsh)
- add `package --all-platforms` to cache gems for each known platform (@ccutrer)
- speed up `exec` when running commands on the $PATH (@kirs)
- add gem code of conduct file and option (@kirs)
- add config settings for gem license and tests (@kirs)
- add `bin/setup` and `bin/console` to new gems (@indirect)
- include configured user-agent in network requests (@indirect)
- support `github`, `gist`, and `bitbucket` options on git gems (@indirect)
- add `package --cache-path` and `config cache_path` for cache location (@jnraine)
- allow `config` to work even when a Gemfile is not present (@dholdren)
- add `config gemfile /path` for other Gemfile locations (@dholdren)
- add `github` method alonside the `git` method (@BenMorganIO)
Bugfixes:
- reduce memory usage with threaded parallel workers (@Who828)
- support read-only git gems (@pmahoney)
- various resolver performance improvements (@dubek)
- untaint git gem paths for Rubygems compatibility (@tdtds)
Documentation:
- add missing Gemfile global `path` explanation (@agenteo)
## 1.7.15 (2015-04-29)
Bugfixes:
- Respect Gemfile sources when installing a gem present in two sources ([#3585](https://github.com/bundler/bundler/issues/3585), @tmoore)
## 1.7.14 (2015-03-30)
Bugfixes:
- Keep gems locked when updating another gem from the same source ([#3250](https://github.com/bundler/bundler/issues/3250), @indirect)
- Don't add extra quotes around long, quoted config values (@aroben, [#3338](https://github.com/bundler/bundler/issues/3338))
## 1.7.13 (2015-02-07)
Bugfixes:
- Look up installed gems in remote sources ([#3300](https://github.com/bundler/bundler/issues/3300), [#3368](https://github.com/bundler/bundler/issues/3368), [#3377](https://github.com/bundler/bundler/issues/3377), [#3380](https://github.com/bundler/bundler/issues/3380), [#3381](https://github.com/bundler/bundler/issues/3381), @indirect)
- Look up gems across all sources to satisfy dependencies ([#3365](https://github.com/bundler/bundler/issues/3365), @keiths-osc)
- Request dependencies for no more than 100 gems at a time ([#3367](https://github.com/bundler/bundler/issues/3367), @segiddins)
## 1.7.12 (2015-01-08)
Bugfixes:
- Always send credentials for sources, fixing private Gemfury gems ([#3342](https://github.com/bundler/bundler/issues/3342), @TimMoore)
## 1.7.11 (2015-01-04)
Bugfixes:
- Recognize `:mri_22` and `:mingw_22`, rather than just `:ruby_22` ([#3328](https://github.com/bundler/bundler/issues/3328), @myabc)
## 1.7.10 (2014-12-29)
Bugfixes:
- Fix source blocks sometimes causing deployment mode to fail wrongly ([#3298](https://github.com/bundler/bundler/issues/3298), @TimMoore)
Features(?):
- Support `platform :mri_22` and related version bits ([#3309](https://github.com/bundler/bundler/issues/3309), @thomasfedb)
## 1.7.9 (2014-12-09)
Bugfixes:
- Fix an issue where bundler sometime spams one gem in Gemfile.lock ([#3216](https://github.com/bundler/bundler/issues/3216), @Who828)
- Ensure bundle update installs the newer version of the gem ([#3089](https://github.com/bundler/bundler/issues/3089), @Who828)
- Fix an regression which stopped Bundler from resolving some Gemfiles ([#3059](https://github.com/bundler/bundler/issues/3059), [#3248](https://github.com/bundler/bundler/issues/3248), @Who828)
## 1.7.8 (2014-12-06)
Bugfixes:
- Hide credentials while warning about gems with ambiguous sources ([#3256](https://github.com/bundler/bundler/issues/3256), @TimMoore)
## 1.7.7 (2014-11-19)
Bugfixes:
- Ensure server credentials stored in config or ENV will be used ([#3180](https://github.com/bundler/bundler/issues/3180), @arronmabrey)
- Fix race condition causing errors while installing git-based gems ([#3174](https://github.com/bundler/bundler/issues/3174), @Who828)
- Use single quotes in config so YAML won't add more quotes ([#3261](https://github.com/bundler/bundler/issues/3261), @indirect)
## 1.7.6 (2014-11-11)
Bugfixes:
- CA certificates that work with all OpenSSLs (@luislavena, @indirect)
## 1.7.5 (2014-11-10)
Bugfixes:
- Fix --deployment with source blocks and non-alphabetical gems ([#3224](https://github.com/bundler/bundler/issues/3224), @TimMoore)
- Vendor CA chain to validate new rubygems.org HTTPS certificate (@indirect)
## 1.7.4 (2014-10-19)
Bugfixes:
- Allow --deployment after `pack` while using source blocks ([#3167](https://github.com/bundler/bundler/issues/3167), @TimMoore)
- Use dependency API even when HTTP credentials are in ENV ([#3191](https://github.com/bundler/bundler/issues/3191), @fvaleur)
- Silence warnings (including root warning) in --quiet mode ([#3186](https://github.com/bundler/bundler/issues/3186), @indirect)
- Stop asking gem servers for gems already found locally ([#2909](https://github.com/bundler/bundler/issues/2909), @dubek)
## 1.7.3 (2014-09-14)
Bugfixes:
- `extconf.rb` is now generated with the right path for `create_makefile` (@andremedeiros)
- Fix various Ruby warnings (@piotrsanarki, @indirect)
## 1.7.2 (2014-08-23)
Bugfixes:
- Revert gem source sorting in lock files (@indirect)
## 1.7.1 (2014-08-20)
Bugfixes:
- Install gems from one source needed by gems in another source (@indirect)
- Install the same gem versions even after some are installed (@TimMoore)
- Download specs only when installing from servers (@indirect)
## 1.7.0 (2014-08-13)
Security:
- Fix for CVE-2013-0334, installing gems from an unexpected source (@TimMoore)
Features:
- Gemfile `source` calls now take a block containing gems from that source (@TimMoore)
- Added the `:source` option to `gem` to specify a source (@TimMoore)
Bugfixes:
- Warn on ambiguous gems available from more than one source (@TimMoore)
## 1.6.7 (2014-10-19)
Features:
- warn to upgrade when using useless source blocks (@danfinnie)
Documentation:
- explain how to use gem server credentials via ENV (@hwartig)
## 1.6.6 (2014-08-23)
Bugfixes:
- restore Gemfile credentials to Gemfile.lock (@indirect)
## 1.6.5 (2014-07-23)
Bugfixes:
- require openssl explicitly to fix rare HTTPS request failures (@indirect, [#3107](https://github.com/bundler/bundler/issues/3107))
## 1.6.4 (2014-07-17)
Bugfixes:
- fix undefined constant error when can't find gem during binstubs ([#3095](https://github.com/bundler/bundler/issues/3095), @jetaggart)
- work when installed git gems are not writable ([#3092](https://github.com/bundler/bundler/issues/3092), @pmahoney)
- don't store configured source credentials in Gemfile.lock ([#3045](https://github.com/bundler/bundler/issues/3045), @lhz)
- don't include config source credentials in the lockfile (Lars Haugseth)
- use threads for jobs on Rubinius (@YorickPeterse)
- skip dependencies from other platforms (@mvz)
- work when Rubygems was built without SSL (@andremedeiros)
## 1.6.3 (2014-06-16)
Bugfixes:
- fix regression when resolving many conflicts ([#2994](https://github.com/bundler/bundler/issues/2994), @Who828)
- use local gemspec for builtin gems during install --local ([#3041](https://github.com/bundler/bundler/issues/3041), @Who828)
- don't warn about sudo when installing on Windows ([#2984](https://github.com/bundler/bundler/issues/2984), @indirect)
- shell escape `bundle open` arguments (@indirect)
## 1.6.2 (2014-04-13)
Bugfixes:
- fix an exception when using builtin gems ([#2915](https://github.com/bundler/bundler/issues/2915), [#2963](https://github.com/bundler/bundler/issues/2963), @gnufied)
- cache gems that are built in to the running ruby ([#2975](https://github.com/bundler/bundler/issues/2975), @indirect)
- re-allow deploying cached git gems without git installed ([#2968](https://github.com/bundler/bundler/issues/2968), @aughr)
- keep standalone working even with builtin gems (@indirect)
- don't update vendor/cache in deployment mode ([#2921](https://github.com/bundler/bundler/issues/2921), @indirect)
Features:
- warn informatively when `bundle install` is run as root ([#2936](https://github.com/bundler/bundler/issues/2936), @1337807)
## 1.6.1 (2014-04-02)
Bugfixes:
- update C extensions when git gem versions change ([#2948](https://github.com/bundler/bundler/issues/2948), @dylanahsmith)
Features:
- add support for C extensions in sudo mode on Rubygems 2.2
## 1.6.0 (2014-03-28)
Bugfixes:
- many Gemfiles that caused incorrect errors now resolve correctly (@Who828)
- redirects across hosts now work on rubies without OpenSSL ([#2686](https://github.com/bundler/bundler/issues/2686), @grddev)
- gemspecs now handle filenames with newlines ([#2634](https://github.com/bundler/bundler/issues/2634), @jasonmp85)
- support escaped characters in usernames and passwords (@punkie)
- no more exception on `update GEM` without lock file (@simi)
- allow long config values ([#2823](https://github.com/bundler/bundler/issues/2823), @kgrz)
- cache successfully even locked to gems shipped with Ruby ([#2869](https://github.com/bundler/bundler/issues/2869), @aughr)
- respect NO_PROXY even if a proxy is configured ([#2878](https://github.com/bundler/bundler/issues/2878), @stlay)
- only retry git commands that hit the network ([#2899](https://github.com/bundler/bundler/issues/2899), @timmoore)
- fix NameError regression when OpenSSL is not available ([#2898](https://github.com/bundler/bundler/issues/2898), @timmoore)
- handle exception installing when build_info owned by root (@Who828)
- skip HTTP redirects from rubygems.org, huge speed boost (@Who828)
Features:
- resolver rewritten to avoid recursion (@Who828)
- add `git_source` for custom options like :github and :gist (@strzalek)
- HTTP auth may now be stored in `bundle config` (@smashwilson)
- some complex Gemfiles are resolved up to 10x faster (@Who828)
- add support for IRB alternatives such as Pry and Ripl (@joallard, @postmodern)
- highlight installed or updated gems ([#2722](https://github.com/bundler/bundler/issues/2722), [#2741](https://github.com/bundler/bundler/issues/2741), @yaotti, @simi)
- display the `post_install_message` for gems installed via :git (@phallstrom)
- `bundle outdated --strict` now only reports allowed updates (@davidblondeau)
- `bundle show --verbose` Add gem summary to the output (@lardcanoe)
- `bundle gem GEM --ext` now generates a skeleton for a C extension (@superdealloc)
- Avoid using threequals operator where possible (@as-cii)
- Add `bundle update --group` to update specific group ([#2731](https://github.com/bundler/bundler/issues/2731) @banyan)
Documentation:
- Add missing switches for bundle-install(1) and bundle-update(1) (@as-cii)
## 1.5.3 (2014-02-06)
Bugfixes:
- find "missing" gems that are actually present ([#2780](https://github.com/bundler/bundler/issues/2780), [#2818](https://github.com/bundler/bundler/issues/2818), [#2854](https://github.com/bundler/bundler/issues/2854))
- use n-1 cores when given n jobs for parallel install (@jdickey)
## 1.5.2 (2014-01-10)
Bugfixes:
- fix integration with Rubygems 1.8.0-1.8.19
- handle ENETDOWN exception during network requests
- gracefully shut down after interrupt during parallel install (@Who828)
- allow Rails to run Thor without debug mode (@rafaelfranca)
- set git binstub permissions by umask (@v-yarotsky)
- remove parallel install debug log
## 1.5.1 (2013-12-28)
Bugfixes:
- correctly find gems installed with Ruby by default
## 1.5.0 (2013-12-26)
Features:
- install missing gems if their specs are present (@hone)
Bugfixes:
- use print for "Installing…" so messages are thread-safe (@TimMoore)
## 1.5.0.rc.2 (2013-12-18)
"Features":
- Support threaded installation on Rubygems 2.0.7+
- Debug installation logs in .bundle/install.log
"Bugfixes":
- Try to catch gem installation race conditions
## 1.5.0.rc.1 (2013-11-09)
Features:
- bundle update also accepts --jobs ([#2692](https://github.com/bundler/bundler/issues/2692), @mrkn)
- add fork URL to README for new `bundle gem` ([#2665](https://github.com/bundler/bundler/issues/2665), @zzak)
- add `bundle outdated --strict` ([#2685](https://github.com/bundler/bundler/issues/2685), @davidblondeau)
- warn if same gem/version is added twice ([#2679](https://github.com/bundler/bundler/issues/2679), @jendiamond)
- don't redownload installed specs for `bundle install` ([#2680](https://github.com/bundler/bundler/issues/2680), @cainlevy)
- override gem sources with mirrors ([#2650](https://github.com/bundler/bundler/issues/2650), @danielsdeleo, @mkristian)
Bugfixes:
- fix sharing same SSL socket when forking workers for parallel install ([#2632](https://github.com/bundler/bundler/issues/2632))
- fix msg typo in GitNotAllowedError ([#2654](https://github.com/bundler/bundler/issues/2654), @joyicecloud)
- fix Bundler.which for directories ([#2697](https://github.com/bundler/bundler/issues/2697), @rhysd)
- properly require `Capistrano::Version` ([#2690](https://github.com/bundler/bundler/issues/2690), @steveklabnik)
- search for git.exe and git
- fix the bug that downloads every spec when API fetcher encouters an error
- only retry network requests
## 1.4.0.rc.1 (2013-09-29)
Features:
- add support for the x64-mingw32 platform ([#2356](https://github.com/bundler/bundler/issues/2356), [#2590](https://github.com/bundler/bundler/issues/2590), @larskanis)
- add :patchlevel option to ruby DSL
- add `bundler` bin ([#2598](https://github.com/bundler/bundler/issues/2598), @kirs)
- friendly ambiguous error messages ([#2581](https://github.com/bundler/bundler/issues/2581), [#2550](https://github.com/bundler/bundler/issues/2550), @jlsuttles, @jendiamond, @joyicecloud)
- add `:jruby_18` and `:jruby_19` platform options (@mcfiredrill)
- add X.509 client certificates for auth without passwords (@snackbandit)
- add `exec --keep-file-descriptors` for Ruby 1.9-like behavior on 2.0 (@steved555)
- print a better error when git is not installed (@joyicecloud)
- exit non-zero when `outdated` is run with an unknown gem (@joyicecloud)
- add `:ruby_21` platform option (@brandonblack)
- add `--retry` to retry failed network and git commands (@schneems)
- include command and versions in User-Agent (@indirect, @joyicecloud)
Bugfixes:
- allow passwordless Basic Auth ([#2606](https://github.com/bundler/bundler/issues/2606), @rykov)
- don't suggest `gem install foo` when `foo` is a git gem that fails (@kirs)
- revert [#2569](https://github.com/bundler/bundler/issues/2569), staying compatible with git: instead of https: for :github gems
- handle exceptions while installing gems in parallel (@gnufied)
## 1.4.0.pre.1 (2013-08-04)
Features:
- retry network requests while installing gems ([#2561](https://github.com/bundler/bundler/issues/2561), @ascherger)
- faster installs using gemspecs from the local system cache ([#2497](https://github.com/bundler/bundler/issues/2497), @mipearson)
- add `bundle install -jN` for N parallel gem installations ([#2481](https://github.com/bundler/bundler/issues/2481), @eagletmt)
- add `ENV['DEBUG_RESOLVER_TREE']` outputs resolver tree (@dblock)
- set $MANPATH so `bundle exec man name` works ([#1624](https://github.com/bundler/bundler/issues/1624), @sunaku)
- use `man` instead of `groff` ([#2579](https://github.com/bundler/bundler/issues/2579), @ixti, @simi)
- add Gemfile dependency info to bundle outdated output ([#2487](https://github.com/bundler/bundler/issues/2487), @rahearn)
- allow `require: true` as an alias for `require: ` ([#2538](https://github.com/bundler/bundler/issues/2538), @ndbroadbent)
- rescue and report Thor errors ([#2478](https://github.com/bundler/bundler/issues/2478), @pjvds)
- detect cyclic dependencies ([#2564](https://github.com/bundler/bundler/issues/2564), @gnufied)
- support multiple gems in `binstubs` ([#2576](https://github.com/bundler/bundler/issues/2576), @lucasmazza)
- use https instead of git for :github gems ([#2569](https://github.com/bundler/bundler/issues/2569), @fuadsaud)
- add quiet option to `bundle package` ([#2573](https://github.com/bundler/bundler/issues/2573), @shtirlic)
- use RUBYLIB instead of RUBYOPT for better Windows support ([#2536](https://github.com/bundler/bundler/issues/2536), @equinux)
Bugfixes:
- reduce stack size while resolving to fix JRuby overflow ([#2510](https://github.com/bundler/bundler/issues/2510), @headius)
- display GitErrors while loading specs in --verbose mode ([#2461](https://github.com/bundler/bundler/issues/2461))
- allow the same options hash to be passed to multiple gems ([#2447](https://github.com/bundler/bundler/issues/2447))
- handle missing binaries without an exception ([#2019](https://github.com/bundler/bundler/issues/2019), @luismreis)
## 1.3.6 (8 January 2014)
Bugfixes:
- make gemspec path option preserve relative paths in lock file (@bwillis)
- use umask when creating binstubs ([#1618](https://github.com/bundler/bundler/issues/1618), @v-yarotsky)
- warn if graphviz is not installed ([#2435](https://github.com/bundler/bundler/issues/2435), @Agis-)
- show git errors while loading gemspecs
- don't mutate gem method options hash ([#2447](https://github.com/bundler/bundler/issues/2447))
- print Thor errors ([#2478](https://github.com/bundler/bundler/issues/2478), @pjvds)
- print Rubygems system exit errors (James Cook)
- more Pathnames into Strings for MacRuby (@kml)
- preserve original gemspec path (@bwillis)
- remove warning about deps with :git ([#1651](https://github.com/bundler/bundler/issues/1651), @ixti)
- split git files on null ([#2634](https://github.com/bundler/bundler/issues/2634), @jasonmp85)
- handle cross-host redirects without SSL ([#2686](https://github.com/bundler/bundler/issues/2686), @grddev)
- handle Rubygems 2 security exception (@zzak)
- reinstall gems if they are missing with spec present
- set binstub permissions using umask ([#1618](https://github.com/bundler/bundler/issues/1618), @v-yarotsky)
## 1.3.5 (3 April 2013)
Features:
- progress indicator while resolver is running (@chief)
Bugfixes:
- update local overrides with orphaned revisions (@jamesferguson)
- revert to working quoting of RUBYOPT on Windows (@ogra)
- use basic auth even when SSL is not available (@jayniz)
- installing git gems without dependencies in deployment now works
## 1.3.4 (15 March 2013)
Bugfixes:
- load YAML on Rubygems versions that define module YAML
- fix regression that broke --without on ruby 1.8.7
## 1.3.3 (13 March 2013)
Features:
- compatible with Rubygems 2.0.2 (higher and lower already work)
- mention skipped groups in bundle install and bundle update output (@simi)
- `gem` creates rake tasks for minitest (@coop) and rspec
Bugfixes:
- require rbconfig for standalone mode
## 1.3.2 (7 March 2013)
Features:
- include rubygems.org CA chain
Bugfixes:
- don't store --dry-run as a Bundler setting
## 1.3.1 (3 March 2013)
Bugfixes:
- include manpages in gem, restoring many help pages
- handle more SSL certificate verification failures
- check for the full version of SSL, which we need (@alup)
- gem rake task 'install' now depends on task 'build' (@sunaku)
## 1.3.0 (24 February 2013)
Features:
- raise a useful error when the lockfile contains a merge conflict (@zofrex)
- ensure `rake release` checks for uncommitted as well as unstaged (@benmoss)
- allow environment variables to be negated with 'false' and '0' (@brettporter)
- set $MANPATH inside `exec` for gems with man pages (@sunaku)
- partial gem names for `open` and `update` now return a list (@takkanm)
Bugfixes:
- `update` now (again) finds gems that aren't listed in the Gemfile
- `install` now (again) updates cached gems that aren't in the Gemfile
- install Gemfiles with HTTP sources even without OpenSSL present
- display CerficateFailureError message in full
## 1.3.0.pre.8 (12 February 2013)
Security:
- validate SSL certificate chain during HTTPS network requests
- don't send HTTP Basic Auth creds when redirected to other hosts (@perplexes)
- add `--trust-policy` to `install`, like `gem install -P` (@CosmicCat, [#2293](https://github.com/bundler/bundler/issues/2293))
Features:
- optimize resolver when too new of a gem is already activated (@rykov, [#2248](https://github.com/bundler/bundler/issues/2248))
- update Net::HTTP::Persistent for SSL cert validation and no_proxy ENV
- explain SSL cert validation failures
- generate gemspecs when installing git repos, removing shellouts
- add pager selection (@csgui)
- add `licenses` command (@bryanwoods, [#1898](https://github.com/bundler/bundler/issues/1898))
- sort output from `outdated` (@richardkmichael, [#1896](https://github.com/bundler/bundler/issues/1896))
- add a .travis.yml to `gem -t` (@ndbroadbent, [#2143](https://github.com/bundler/bundler/issues/2143))
- inform users when the resolver starts
- disable reverse DNS to speed up API requests (@raggi)
Bugfixes:
- raise errors while requiring dashed gems ([#1807](https://github.com/bundler/bundler/issues/1807))
- quote the Bundler path on Windows (@jgeiger, [#1862](https://github.com/bundler/bundler/issues/1862), [#1856](https://github.com/bundler/bundler/issues/1856))
- load gemspecs containing unicode (@gaffneyc, [#2301](https://github.com/bundler/bundler/issues/2301))
- support any ruby version in --standalone
- resolve some ruby -w warnings (@chastell, [#2193](https://github.com/bundler/bundler/issues/2193))
- don't scare users with an error message during API fallback
- `install --binstubs` is back to overwriting. thanks, SemVer.
## 1.3.0.pre.7 (22 January 2013)
Bugfixes:
- stubs for gems with dev deps no longer cause exceptions ([#2272](https://github.com/bundler/bundler/issues/2272))
- don't suggest binstubs to --binstubs users
## 1.3.0.pre.6 (22 January 2013)
Features:
- `binstubs` lists child gem bins if a gem has no binstubs
- `bundle gem --edit` will open the new gemspec (@ndbroadbent)
- `bundle gem --test rspec` now makes working tests (@tricknotes)
- `bundle env` prints info about bundler's environment (@peeja)
- add `BUNDLE_IGNORE_CONFIG` environment variable support (@richo)
Bugfixes:
- don't overwrite custom binstubs during `install --binstubs`
- don't throw an exception if `binstubs` gem doesn't exist
- `bundle config` now works in directories without a Gemfile
## 1.3.0.pre.5 (Jan 9, 2013)
Features:
- make `--standalone` require lines ruby engine/version agnostic
- add `--dry-run` to `bundle clean` (@wfarr, [#2237](https://github.com/bundler/bundler/issues/2237))
Bugfixes:
- don't skip writing binstubs when doing `bundle install`
- distinguish between ruby 1.9/2.0 when using :platforms (@spastorino)
## 1.3.0.pre.4 (Jan 3, 2013)
Features:
- `bundle binstubs ` to setup individual binstubs
- `bundle install --binstubs ""` will remove binstubs option
- `bundle clean --dry-run` will print out gems instead of removing them
Bugfixes:
- Avoid stack traces when Ctrl+C during bundle command (@mitchellh)
- fix YAML parsing in in ruby-preview2
## 1.3.0.pre.3 (Dec 21, 2012)
Features:
- pushing gems during `rake release` can be disabled (@trans)
- installing gems with `rake install` is much faster (@utkarshkukreti)
- added platforms :ruby_20 and :mri_20, since the ABI has changed
- added '--edit' option to open generated gemspec in editor
Bugfixes:
- :git gems with extensions now work with Rubygems >= 2.0 (@jeremy)
- revert SemVer breaking change to :github
- `outdated` exits non-zero if outdated gems found (@rohit, [#2021](https://github.com/bundler/bundler/issues/2021))
- https Gist URLs for compatibility with Gist 2.0 (@NARKOZ)
- namespaced gems no longer generate a superfluous directory (@banyan)
## 1.3.0.pre.2 (Dec 9, 2012)
Features:
- `config` expands local overrides like `local.rack .` (@gkop, [#2205](https://github.com/bundler/bundler/issues/2205))
- `gem` generates files correctly for names like `jquery-rails` (@banyan, [#2201](https://github.com/bundler/bundler/issues/2201))
- use gems from gists with the :gist option in the Gemfile (@jgaskins)
Bugfixes:
- Gemfile sources other than rubygems.org work even when .gemrc contains sources
- caching git gems now caches specs, fixing e.g. git ls-files (@bison, [#2039](https://github.com/bundler/bundler/issues/2039))
- `show GEM` now warns if the directory has been deleted (@rohit, [#2070](https://github.com/bundler/bundler/issues/2070))
- git output hidden when running in --quiet mode (@rohit)
## 1.3.0.pre (Nov 29, 2012)
Features:
- compatible with Ruby 2.0.0-preview2
- compatible with Rubygems 2.0.0.preview2 (@drbrain, @evanphx)
- ruby 2.0 added to the `:ruby19` ABI-compatible platform
- lazy load YAML, allowing Psych to be specified in the Gemfile
- significant performance improvements (@cheald, [#2181](https://github.com/bundler/bundler/issues/2181))
- `inject` command for scripted Gemfile additions (Engine Yard)
- :github option uses slashless arguments as repo owner (@rking)
- `open` suggests gem names for typos (@jdelStrother)
- `update` reports non-existent gems (@jdelStrother)
- `gem` option --test can generate rspec stubs (@MafcoCinco)
- `gem` option --test can generate minitest stubs (@kcurtin)
- `gem` command generates MIT license (@BrentWheeldon)
- gem rake task 'release' resuses existing tags (@shtirlic)
Bugfixes:
- JRuby new works with HTTPS gem sources (@davidcelis)
- `install` installs both rake rake-built gems at once (@crowbot, [#2107](https://github.com/bundler/bundler/issues/2107))
- handle Errno::ETIMEDOUT errors (@jmoses)
- handle Errno::EAGAIN errors on JRuby
- disable ANSI coloring when output is redirected (@tomykaira)
- raise LoadErrors correctly during Bundler.require (@Empact)
- do not swallow --verbose on `bundle exec` (@sol, [#2102](https://github.com/bundler/bundler/issues/2102))
- `gem` generates gemspecs that block double-requires
- `gem` generates gemspecs that admit they depend on rake
## 1.2.5 (Feb 24, 2013)
Bugfixes:
- install Gemfiles with HTTP sources even without OpenSSL present
- display CerficateFailureError message in full
## 1.2.4 (Feb 12, 2013)
Features:
- warn about Ruby 2.0 and Rubygems 2.0
- inform users when the resolver starts
- disable reverse DNS to speed up API requests (@raggi)
Bugfixes:
- don't send user/pass when redirected to another host (@perplexes)
- load gemspecs containing unicode (@gaffneyc, [#2301](https://github.com/bundler/bundler/issues/2301))
- support any ruby version in --standalone
- resolve some ruby -w warnings (@chastell, [#2193](https://github.com/bundler/bundler/issues/2193))
- don't scare users with an error message during API fallback
## 1.2.3 (Nov 29, 2012)
Bugfixes:
- fix exceptions while loading some gemspecs
## 1.2.2 (Nov 14, 2012)
Bugfixes:
- support new Psych::SyntaxError for Ruby 2.0.0 (@tenderlove, @sol)
- `bundle viz` works with git gems again (@hirochachacha)
- recognize more cases when OpenSSL is not present
## 1.2.1 (Sep 19, 2012)
Bugfixes:
- `bundle clean` now works with BUNDLE_WITHOUT groups again
- have a net/http read timeout around the Gemcutter API Endpoint
## 1.2.0 (Aug 30, 2012)
Bugfixes:
- raise original error message from LoadError's
Documentation:
- `platform` man pages
## 1.2.0.rc.2 (Aug 8, 2012)
Bugfixes:
- `clean` doesn't remove gems that are included in the lockfile
## 1.2.0.rc (Jul 17, 2012)
Features:
- `check` now has a `--dry-run` option (@svenfuchs, [#1811](https://github.com/bundler/bundler/issues/1811))
- loosen ruby directive for engines
- prune git/path directories inside vendor/cache (@josevalim, [#1988](https://github.com/bundler/bundler/issues/1988))
- update vendored thor to 0.15.2 (@sferik)
- add .txt to LICENSE (@postmodern, [#2001](https://github.com/bundler/bundler/issues/2001))
- add `config disable_local_branch_check` (@josevalim, [#1985](https://github.com/bundler/bundler/issues/1985))
- fall back on the full index when experiencing syck errors ([#1419](https://github.com/bundler/bundler/issues/1419))
- handle syntax errors in Ruby gemspecs ([#1974](https://github.com/bundler/bundler/issues/1974))
Bugfixes:
- fix `pack`/`cache` with `--all` (@josevalim, [#1989](https://github.com/bundler/bundler/issues/1989))
- don't display warning message when `cache_all` is set
- check for `nil` PATH ([#2006](https://github.com/bundler/bundler/issues/2006))
- Always try to keep original GEM_PATH (@drogus, [#1920](https://github.com/bundler/bundler/issues/1920))
## 1.2.0.pre.1 (May 27, 2012)
Features:
- Git gems import submodules of submodules recursively (@nwwatson, [#1935](https://github.com/bundler/bundler/issues/1935))
Bugfixes:
- Exit from `check` with a non-zero status when frozen with no lock
- Use `latest_release` in Capistrano and Vlad integration ([#1264](https://github.com/bundler/bundler/issues/1264))
- Work around a Ruby 1.9.3p194 bug in Psych when config files are empty
Documentation:
- Add instructions for local git repos to the `config` manpage
- Update the `Gemfile` manpage to include ruby versions (@stevenh512)
- When OpenSSL is missing, provide instructions for fixing ([#1776](https://github.com/bundler/bundler/issues/1776) etc.)
- Unknown exceptions now link to ISSUES for help instead of a new ticket
- Correct inline help for `clean --force` (@dougbarth, [#1911](https://github.com/bundler/bundler/issues/1911))
## 1.2.0.pre (May 4, 2012)
Features:
- bundle package now accepts --all to package git and path dependencies
- bundle config now accepts --local, --global and --delete options
- It is possible to override a git repository via configuration.
For instance, if you have a git dependency on rack, you can force
it to use a local repo with `bundle config local.rack ~/path/to/rack`
- Cache gemspec loads for performance (@dekellum, [#1635](https://github.com/bundler/bundler/issues/1635))
- add --full-index flag to `bundle update` (@fluxx, [#1829](https://github.com/bundler/bundler/issues/1829))
- add --quiet flag to `bundle update` (@nashby, [#1654](https://github.com/bundler/bundler/issues/1654))
- Add Bundler::GemHelper.gemspec (@knu, [#1637](https://github.com/bundler/bundler/issues/1637))
- Graceful handling of Gemfile syntax errors (@koraktor, [#1661](https://github.com/bundler/bundler/issues/1661))
- `bundle platform` command
- add ruby to DSL, to specify version of ruby
- error out if the ruby version doesn't match
Performance:
- bundle exec shouldn't run Bundler.setup just setting the right rubyopts options is enough (@spastorino, [#1598](https://github.com/bundler/bundler/issues/1598))
Bugfixes:
- Avoid passing RUBYOPT changes in with_clean_env block (@eric1234, [#1604](https://github.com/bundler/bundler/issues/1604))
- Use the same ruby to run subprocesses as is running rake (@brixen)
Documentation:
- Add :github documentation in DSL (@zofrex, [#1848](https://github.com/bundler/bundler/issues/1848), [#1851](https://github.com/bundler/bundler/issues/1851), [#1852](https://github.com/bundler/bundler/issues/1852))
- Add docs for the --no-cache option (@fluxx, [#1796](https://github.com/bundler/bundler/issues/1796))
- Add basic documentation for bin_path and bundle_path (@radar)
- Add documentation for the run method in Bundler::Installer
## 1.1.5 (Jul 17, 2012)
Features:
- Special case `ruby` directive from 1.2.0, so you can install Gemfiles that use it
## 1.1.4 (May 27, 2012)
Bugfixes:
- Use `latest_release` in Capistrano and Vlad integration ([#1264](https://github.com/bundler/bundler/issues/1264))
- Unknown exceptions now link to ISSUES for help instead of a new ticket
- When OpenSSL is missing, provide instructions for fixing ([#1776](https://github.com/bundler/bundler/issues/1776) etc.)
- Correct inline help for `clean --force` (@dougbarth, [#1911](https://github.com/bundler/bundler/issues/1911))
- Work around a Ruby 1.9.3p194 bug in Psych when config files are empty
## 1.1.3 (March 23, 2012)
Bugfixes:
- escape the bundler root path (@tenderlove, [#1789](https://github.com/bundler/bundler/issues/1789))
## 1.1.2 (March 20, 2012)
Bugfixes:
- Fix --deployment for multiple PATH sections of the same source ([#1782](https://github.com/bundler/bundler/issues/1782))
## 1.1.1 (March 14, 2012)
Bugfixes:
- Rescue EAGAIN so the fetcher works on JRuby on Windows
- Stop asking users to report gem installation errors
- Clarify "no sources" message
- Use $\ so `bundle gem` gemspecs work on Windows (@postmodern)
- URI-encode gem names for dependency API (@rohit, [#1672](https://github.com/bundler/bundler/issues/1672))
- Fix `cache` edge case in rubygems 1.3.7 ([#1202](https://github.com/bundler/bundler/issues/1202))
Performance:
- Reduce invocation of git ls-files in `bundle gem` gemspecs (@knu)
## 1.1.0 (Mar 7, 2012)
Bugfixes:
- Clean up corrupted lockfiles on bundle installs
- Prevent duplicate GIT sources
- Fix post_install_message when uing the endpoint API
## 1.1.rc.8 (Mar 3, 2012)
Performance:
- don't resolve if the Gemfile.lock and Gemfile haven't changed
Bugfixes:
- Load gemspecs from git even when a released gem has the same version ([#1609](https://github.com/bundler/bundler/issues/1609))
- Declare an accurate Ruby version requirement of 1.8.7 or newer ([#1619](https://github.com/bundler/bundler/issues/1619))
- handle gemspec development dependencies correctly (@raggi, [#1639](https://github.com/bundler/bundler/issues/1639))
- Avoid passing RUBYOPT changes in with_clean_env block. (eric1234, [#1604](https://github.com/bundler/bundler/issues/1604))
## 1.1.rc.7 (Dec 29, 2011)
Bugfixes:
- Fix bug where `clean` would break when using :path with no gemspec
## 1.1.rc.6 (Dec 22, 2011)
Bugfixes:
- Fix performance regression from 1.0 (@spastorino, [#1511](https://github.com/bundler/bundler/issues/1511), [#1591](https://github.com/bundler/bundler/issues/1591), [#1592](https://github.com/bundler/bundler/issues/1592))
- Load gems correctly when GEM_HOME is blank
- Refresh gems so Bundler works from inside a bundle
- Handle empty .bundle/config files without an error
## 1.1.rc.5 (Dec 14, 2011)
Bugfixes:
- Fix ASCII encoding errors with gem (rerelease with ruby 1.8)
## 1.1.rc.4 (Dec 14, 2011)
Features:
- `bundle viz` has the option to output a DOT file instead of a PNG (@hirochachacha, [#683](https://github.com/bundler/bundler/issues/683))
Bugfixes:
- Ensure binstubs generated when using --standalone point to the standalonde bundle (@cowboyd, [#1588](https://github.com/bundler/bundler/issues/1588))
- fix `bundle viz` (@hirochachacha, [#1586](https://github.com/bundler/bundler/issues/1586))
## 1.1.rc.3 (Dec 8, 2011)
Bugfixes:
- fix relative_path so it checks Bundler.root is actually in the beginning of the path ([#1582](https://github.com/bundler/bundler/issues/1582))
- fix bundle outdated doesn't list all gems (@joelmoss, [#1521](https://github.com/bundler/bundler/issues/1521))
## 1.1.rc.2 (Dec 6, 2011)
Features:
- Added README.md to `newgem` (@ognevsky, [#1574](https://github.com/bundler/bundler/issues/1574))
- Added LICENSE (MIT) to newgem (@ognevsky, [#1571](https://github.com/bundler/bundler/issues/1571))
Bugfixes:
- only auto-namespace requires for implied requires ([#1531](https://github.com/bundler/bundler/issues/1531))
- fix bundle clean output for git repos ([#1473](https://github.com/bundler/bundler/issues/1473))
- use Gem.bindir for bundle clean ([#1544](https://github.com/bundler/bundler/issues/1544), [#1532](https://github.com/bundler/bundler/issues/1532))
- use `Gem.load_env_plugins` instead of `Gem.load_env_plugins` ([#1500](https://github.com/bundler/bundler/issues/1500), [#1543](https://github.com/bundler/bundler/issues/1543))
- differentiate Ruby 2.0 (trunk) from Ruby 1.9 (@tenderlove, [#1539](https://github.com/bundler/bundler/issues/1539))
- `bundle clean` handles 7 length git hash for bundle clean ([#1490](https://github.com/bundler/bundler/issues/1490), [#1491](https://github.com/bundler/bundler/issues/1491))
- fix Psych loading issues
- Search $PATH for a binary rather than shelling out to `which` (@tenderlove, [#1573](https://github.com/bundler/bundler/issues/1573))
- do not clear RG cache unless we actually modify GEM_PATH and GEM_HOME- use `Gem.load_env_plugins` instead of `Gem.load_env_plugins` ([#1500](https://github.com/bundler/bundler/issues/1500), [#1543](https://github.com/bundler/bundler/issues/1543))
- `newgem` now uses https://rubygems.org ([#1562](https://github.com/bundler/bundler/issues/1562))
- `bundle init` now uses https://rubygems.org (@jjb, [#1522](https://github.com/bundler/bundler/issues/1522))
- `bundle install/update` does not autoclean when using --path for semver
Documentation:
- added documentation for --shebang option for `bundle install` (@lunks, [#1475](https://github.com/bundler/bundler/issues/1475), [#1558](https://github.com/bundler/bundler/issues/1558))
## 1.1.rc (Oct 3, 2011)
Features:
- add `--shebang` option to bundle install (@bensie, [#1467](https://github.com/bundler/bundler/issues/1467))
- build passes on ruby 1.9.3rc1 ([#1458](https://github.com/bundler/bundler/issues/1458), [#1469](https://github.com/bundler/bundler/issues/1469))
- hide basic auth credentials for custom sources ([#1440](https://github.com/bundler/bundler/issues/1440), [#1463](https://github.com/bundler/bundler/issues/1463))
Bugfixes:
- fix index search result caching ([#1446](https://github.com/bundler/bundler/issues/1446), [#1466](https://github.com/bundler/bundler/issues/1466))
- fix fetcher prints multiple times during install ([#1445](https://github.com/bundler/bundler/issues/1445), [#1462](https://github.com/bundler/bundler/issues/1462))
- don't mention API errors from non-rubygems.org sources
- fix autoclean so it doesn't remove bins that are used ([#1459](https://github.com/bundler/bundler/issues/1459), [#1460](https://github.com/bundler/bundler/issues/1460))
Documentation:
- add :require => [...] to the gemfile(5) manpage (@nono, [#1468](https://github.com/bundler/bundler/issues/1468))
## 1.1.pre.10 (Sep 27, 2011)
Features:
- `config system_bindir foo` added, works like "-n foo" in your .gemrc file
## 1.1.pre.9 (Sep 18, 2011)
Features:
- `clean` will now clean up all old .gem and .gemspec files, cleaning up older pres
- `clean` will be automatically run after bundle install and update when using `--path` ([#1420](https://github.com/bundler/bundler/issues/1420), [#1425](https://github.com/bundler/bundler/issues/1425))
- `clean` now takes a `--force` option ([#1247](https://github.com/bundler/bundler/issues/1247), [#1426](https://github.com/bundler/bundler/issues/1426))
- `clean` will clean up cached git dirs in bundle clean ([#1390](https://github.com/bundler/bundler/issues/1390))
- remove deprecations from DSL ([#1119](https://github.com/bundler/bundler/issues/1119))
- autorequire tries directories for gems with dashed names ([#1205](https://github.com/bundler/bundler/issues/1205))
- adds a `--paths` flag to `bundle show` to list all the paths of bundled gems (@tiegz, [#1360](https://github.com/bundler/bundler/issues/1360))
- load rubygems plugins in the bundle binary (@tpope, [#1364](https://github.com/bundler/bundler/issues/1364))
- make `--standalone` respect `--path` (@cowboyd, [#1361](https://github.com/bundler/bundler/issues/1361))
Bugfixes:
- Fix `clean` to handle nested gems in a git repo ([#1329](https://github.com/bundler/bundler/issues/1329))
- Fix conflict from revert of benchmark tool (@boffbowsh, [#1355](https://github.com/bundler/bundler/issues/1355))
- Fix fatal error when unable to connect to gem source ([#1269](https://github.com/bundler/bundler/issues/1269))
- Fix `outdated` to find pre-release gems that are installed. ([#1359](https://github.com/bundler/bundler/issues/1359))
- Fix color for ui. ([#1374](https://github.com/bundler/bundler/issues/1374))
- Fix installing to user-owned system gems on OS X
- Fix caching issue in the resolver ([#1353](https://github.com/bundler/bundler/issues/1353), [#1421](https://github.com/bundler/bundler/issues/1421))
- Fix :github DSL option
## 1.1.pre.8 (Aug 13, 2011)
Bugfixes:
- Fix `bundle check` to not print fatal error message (@cldwalker, [#1347](https://github.com/bundler/bundler/issues/1347))
- Fix require_sudo when Gem.bindir isn't writeable ([#1352](https://github.com/bundler/bundler/issues/1352))
- Fix not asking Gemcutter API for dependency chain of git gems in --deployment ([#1254](https://github.com/bundler/bundler/issues/1254))
- Fix `install --binstubs` when using --path ([#1332](https://github.com/bundler/bundler/issues/1332))
## 1.1.pre.7 (Aug 8, 2011)
Bugfixes:
- Fixed invalid byte sequence error while installing gem on Ruby 1.9 ([#1341](https://github.com/bundler/bundler/issues/1341))
- Fixed exception when sudo was needed to install gems (@spastorino)
## 1.1.pre.6 (Aug 8, 2011)
Bugfixes:
- Fix cross repository dependencies ([#1138](https://github.com/bundler/bundler/issues/1138))
- Fix git dependency fetching from API endpoint ([#1254](https://github.com/bundler/bundler/issues/1254))
- Fixes for bundle outdated (@joelmoss, [#1238](https://github.com/bundler/bundler/issues/1238))
- Fix bundle standalone when using the endpoint ([#1240](https://github.com/bundler/bundler/issues/1240))
Features:
- Implement `to_ary` to avoid calls to method_missing (@tenderlove, [#1274](https://github.com/bundler/bundler/issues/1274))
- bundle clean removes old .gem files (@cldwalker, [#1293](https://github.com/bundler/bundler/issues/1293))
- Correcly identify missing child dependency in error message
- Run pre-install, post-build, and post-install gem hooks for git gems (@warhammerkid, [#1120](https://github.com/bundler/bundler/issues/1120))
- create Gemfile.lock for empty Gemfile ([#1218](https://github.com/bundler/bundler/issues/1218))
## 1.1.pre.5 (June 11, 2011)
Bugfixes:
- Fix LazySpecification on Ruby 1.9 (@dpiddy, [#1232](https://github.com/bundler/bundler/issues/1232))
- Fix HTTP proxy support (@leobessa, [#878](https://github.com/bundler/bundler/issues/878))
Features:
- Speed up `install --deployment` by using the API endpoint
- Support Basic HTTP Auth for the API endpoint (@dpiddy, [#1229](https://github.com/bundler/bundler/issues/1229))
- Add `install --full-index` to disable the API endpoint, just in case
- Significantly speed up install by removing unneeded gemspec fetches
- `outdated` command shows outdated gems (@joelmoss, [#1130](https://github.com/bundler/bundler/issues/1130))
- Print gem post install messages (@csquared, [#1155](https://github.com/bundler/bundler/issues/1155))
- Reduce memory use by removing Specification.new inside method_missing (@tenderlove, [#1222](https://github.com/bundler/bundler/issues/1222))
- Allow `check --path`
## 1.1.pre.4 (May 5, 2011)
Bugfixes:
- Fix bug that could prevent installing new gems
## 1.1.pre.3 (May 4, 2011)
Features:
- Add `bundle outdated` to show outdated gems (@joelmoss)
- Remove BUNDLE_* from `Bundler.with_clean_env` (@wuputah)
- Add Bundler.clean_system, and clean_exec (@wuputah)
- Use git config for gem author name and email (@krekoten)
Bugfixes:
- Fix error calling Bundler.rubygems.gem_path
- Fix error when Gem.path returns Gem::FS instead of String
## 1.1.pre.2 (April 28, 2011)
Features:
- Add :github option to Gemfile DSL for easy git repos
- Merge all fixes from 1.0.12 and 1.0.13
## 1.1.pre.1 (February 2, 2011)
Bugfixes:
- Compatibility with changes made by Rubygems 1.5
## 1.1.pre (January 21, 2011)
Features:
- Add bundle clean. Removes unused gems from --path directory
- Initial Gemcutter Endpoint API work, BAI Fetching source index
- Added bundle install --standalone
- Ignore Gemfile.lock when building new gems
- Make it possible to override a .gemspec dependency's source in the
Gemfile
Removed:
- Removed bundle lock
- Removed bundle install
- Removed bundle install --production
- Removed bundle install --disable-shared-gems
## 1.0.21 (September 30, 2011)
- No changes from RC
## 1.0.21.rc (September 29, 2011)
Bugfixes:
- Load Psych unless Syck is defined, because 1.9.2 defines YAML
## 1.0.20 (September 27, 2011)
Features:
- Add platform :maglev (@timfel, [#1444](https://github.com/bundler/bundler/issues/1444))
Bugfixes:
- Ensure YAML is required even if Psych is found
- Handle directory names that contain invalid regex characters
## 1.0.20.rc (September 18, 2011)
Features:
- Rescue interrupts to `bundle` while loading bundler.rb ([#1395](https://github.com/bundler/bundler/issues/1395))
- Allow clearing without groups by passing `--without ''` ([#1259](https://github.com/bundler/bundler/issues/1259))
Bugfixes:
- Manually sort requirements in the lockfile ([#1375](https://github.com/bundler/bundler/issues/1375))
- Remove several warnings generated by ruby -w (@stephencelis)
- Handle trailing slashes on names passed to `gem` ([#1372](https://github.com/bundler/bundler/issues/1372))
- Name modules for gems like 'test-foo_bar' correctly ([#1303](https://github.com/bundler/bundler/issues/1303))
- Don't require Psych if Syck is already loaded ([#1239](https://github.com/bundler/bundler/issues/1239))
## 1.0.19.rc (September 13, 2011)
Features:
- Compatibility with Rubygems 1.8.10 installer changes
- Report gem installation failures clearly (@rwilcox, [#1380](https://github.com/bundler/bundler/issues/1380))
- Useful error for cap and vlad on first deploy (@nexmat, @kirs)
Bugfixes:
- `exec` now works when the command contains 'exec'
- Only touch lock after changes on Windows (@robertwahler, [#1358](https://github.com/bundler/bundler/issues/1358))
- Keep load paths when #setup is called multiple times (@radsaq, [#1379](https://github.com/bundler/bundler/issues/1379))
## 1.0.18 (August 16, 2011)
Bugfixes:
- Fix typo in DEBUG_RESOLVER (@geemus)
- Fixes rake 0.9.x warning (@mtylty, [#1333](https://github.com/bundler/bundler/issues/1333))
- Fix `bundle cache` again for rubygems 1.3.x
Features:
- Run the bundle install earlier in a Capistrano deployment (@cgriego, [#1300](https://github.com/bundler/bundler/issues/1300))
- Support hidden gemspec (@trans, @cldwalker, [#827](https://github.com/bundler/bundler/issues/827))
- Make fetch_specs faster (@zeha, [#1294](https://github.com/bundler/bundler/issues/1294))
- Allow overriding development deps loaded by #gemspec (@lgierth, [#1245](https://github.com/bundler/bundler/issues/1245))
## 1.0.17 (August 8, 2011)
Bugfixes:
- Fix rake issues with rubygems 1.3.x ([#1342](https://github.com/bundler/bundler/issues/1342))
- Fixed invalid byte sequence error while installing gem on Ruby 1.9 ([#1341](https://github.com/bundler/bundler/issues/1341))
## 1.0.16 (August 8, 2011)
Features:
- Performance fix for MRI 1.9 (@efficientcloud, [#1288](https://github.com/bundler/bundler/issues/1288))
- Shortcuts (like `bundle i`) for all commands (@amatsuda)
- Correcly identify missing child dependency in error message
Bugfixes:
- Allow Windows network share paths with forward slashes (@mtscout6, [#1253](https://github.com/bundler/bundler/issues/1253))
- Check for rubygems.org credentials so `rake release` doesn't hang ([#980](https://github.com/bundler/bundler/issues/980))
- Find cached prerelease gems on rubygems 1.3.x (@dburt, [#1202](https://github.com/bundler/bundler/issues/1202))
- Fix `bundle install --without` on kiji (@tmm1, [#1287](https://github.com/bundler/bundler/issues/1287))
- Get rid of warning in ruby 1.9.3 (@smartinez87, [#1231](https://github.com/bundler/bundler/issues/1231))
Documentation:
- Documentation for `gem ..., :require => false` (@kmayer, [#1292](https://github.com/bundler/bundler/issues/1292))
- Gems provide "executables", they are rarely also binaries (@fxn, [#1242](https://github.com/bundler/bundler/issues/1242))
## 1.0.15 (June 9, 2011)
Features:
- Improved Rubygems integration, removed many deprecation notices
Bugfixes:
- Escape URL arguments to git correctly on Windows (1.0.14 regression)
## 1.0.14 (May 27, 2011)
Features:
- Rubinius platform :rbx (@rkbodenner)
- Include gem rake tasks with "require 'bundler/gem_tasks" (@indirect)
- Include user name and email from git config in new gemspec (@ognevsky)
Bugfixes:
- Set file permissions after checking out git repos (@tissak)
- Remove deprecated call to Gem::SourceIndex#all_gems (@mpj)
- Require the version file in new gemspecs (@rubiii)
- Allow relative paths from the Gemfile in gems with no gemspec (@mbirk)
- Install gems that contain 'bundler', e.g. guard-bundler (@hone)
- Display installed path correctly on Windows (@tadman)
- Escape quotes in git URIs (@mheffner)
- Improve Rake 0.9 support (@quix)
- Handle certain directories already existing (@raggi)
- Escape filenames containing regex characters (@indirect)
## 1.0.13 (May 4, 2011)
Features:
- Compatibility with Rubygems master (soon to be v1.8) (@evanphx)
- Informative error when --path points to a broken symlink
- Support Rake 0.9 and greater (@e2)
- Output full errors for non-TTYs e.g. pow (@josh)
Bugfixes:
- Allow spaces in gem path names for gem tasks (@rslifka)
- Have cap run bundle install from release_path (@martinjagusch)
- Quote git refspec so zsh doesn't expand it (@goneflyin)
## 1.0.12 (April 8, 2011)
Features:
- Add --no-deployment option to `install` for disabling it on dev machines
- Better error message when git fails and cache is present (@parndt)
- Honor :bundle_cmd in cap `rake` command (@voidlock, @cgriego)
Bugfixes:
- Compatibility with Rubygems 1.7 and Rails 2.3 and vendored gems (@evanphx)
- Fix changing gem order in lock (@gucki)
- Remove color escape sequences when displaying man pages (@bgreenlee)
- Fix creating GEM_HOME on both JRuby 1.5 and 1.6 (@nickseiger)
- Fix gems without a gemspec and directories in bin/ (@epall)
- Fix --no-prune option for `bundle install` (@cmeiklejohn)
## 1.0.11 (April 1, 2011)
Features:
- Compatibility with Rubygems 1.6 and 1.7
- Better error messages when a git command fails
Bugfixes:
- Don't always update gemspec gems (@carllerche)
- Remove ivar warnings (@jackdempsey)
- Fix occasional git failures in zsh (@jonah-carbonfive)
- Consistent lock for gems with double deps like Cap (@akahn)
## 1.0.10 (February 1, 2011)
Bugfixes:
- Fix a regression loading YAML gemspecs from :git and :path gems
- Requires, namespaces, etc. to work with changes in Rubygems 1.5
## 1.0.9 (January 19, 2011)
Bugfixes:
- Fix a bug where Bundler.require could remove gems from the load
path. In Rails apps with a default application.rb, this removed
all gems in groups other than :default and Rails.env
## 1.0.8 (January 18, 2011)
Features:
- Allow overriding gemspec() deps with :git deps
- Add --local option to `bundle update`
- Ignore Gemfile.lock in newly generated gems
- Use `less` as help pager instead of `more`
- Run `bundle exec rake` instead of `rake` in Capistrano tasks
Bugfixes:
- Fix --no-cache option for `bundle install`
- Allow Vlad deploys to work without Capistrano gem installed
- Fix group arguments to `bundle console`
- Allow groups to be loaded even if other groups were loaded
- Evaluate gemspec() gemspecs in their directory not the cwd
- Count on Rake to chdir to the right place in GemHelper
- Change Pathnames to Strings for MacRuby
- Check git process exit status correctly
- Fix some warnings in 1.9.3-trunk (thanks tenderlove)
## 1.0.7 (November 17, 2010)
Bugfixes:
- Remove Bundler version from the lockfile because it broke
backwards compatibility with 1.0.0-1.0.5. Sorry. :(
## 1.0.6 (November 16, 2010)
Bugfixes:
- Fix regression in `update` that caused long/wrong results
- Allow git gems on other platforms while installing ([#579](https://github.com/bundler/bundler/issues/579))
Features:
- Speed up `install` command using various optimizations
- Significantly increase performance of resolver
- Use upcoming Rubygems performance improvements (@tmm1)
- Warn if the lockfile was generated by a newer version
- Set generated gems' homepage to "", so Rubygems will warn
## 1.0.5 (November 13, 2010)
Bugfixes:
- Fix regression disabling all operations that employ sudo
## 1.0.4 (November 12, 2010)
Bugfixes:
- Expand relative :paths from Bundler.root (eg ./foogem)
- Allow git gems in --without groups while --frozen
- Allow gem :ref to be a symbol as well as a string
- Fix exception when Gemfile needs a newer Bundler version
- Explanation when the current Bundler version conflicts
- Explicit error message if Gemfile needs newer Bundler
- Ignore an empty string BUNDLE_GEMFILE
- Skeleton gemspec now works with older versions of git
- Fix shell quoting and ref fetching in GemHelper
- Disable colored output in --deployment
- Preserve line endings in lock file
Features:
- Add support for 'mingw32' platform (aka RubyInstaller)
- Large speed increase when Gemfile.lock is already present
- Huge speed increase when many (100+) system gems are present
- Significant expansion of ISSUES, man pages, and docs site
- Remove Open3 from GemHelper (now it works on Windows™®©)
- Allow setting roles in built-in cap and vlad tasks
## 1.0.3 (October 15, 2010)
Bugfixes:
- Use bitwise or in #hash to reduce the chance of overflow
- `bundle update` now works with :git + :tag updates
- Record relative :path options in the Gemfile.lock
- :groups option on gem method in Gemfile now works
- Add #platform method and :platform option to Gemfile DSL
- --without now accepts a quoted, space-separated list
- Installing after --deployment with no lock is now possible
- Binstubs can now be symlinked
- Print warning if cache for --local install is missing gems
- Improve output when installing to a path
- The tests all pass! Yay!
## 1.0.2 (October 2, 2010)
Bugfix:
- Actually include the man pages in the gem, so help works
## 1.0.1 (October 1, 2010)
Features:
- Vlad deployment recipe, `require 'bundler/vlad'`
- Prettier bundle graphs
- Improved gem skeleton for `bundle gem`
- Prompt on file clashes when generating a gem
- Option to generate binary with gem skeleton
- Allow subclassing of GemHelper for custom tasks
- Chdir to gem directory during `bundle open`
Bugfixes:
- Allow gemspec requirements with a list of versions
- Accept lockfiles with windows line endings
- Respect BUNDLE_WITHOUT env var
- Allow `gem "foo", :platform => :jruby`
- Specify loaded_from path in fake gemspec
- Flesh out gem_helper tasks, raise errors correctly
- Respect RBConfig::CONFIG['ruby_install_name'] in binstubs
## 1.0.0 (August 29, 2010)
Features:
- You can now define `:bundle_cmd` in the capistrano task
Bugfixes:
- Various bugfixes to the built-in rake helpers
- Fix a bug where shortrefs weren't unique enough and were
therfore colliding
- Fix a small bug involving checking whether a local git
clone is up to date
- Correctly handle explicit '=' dependencies with gems
pinned to a git source
- Fix an issue with Windows-generated lockfiles by reading
and writing the lockfile in binary mode
- Fix an issue with shelling out to git in Windows by
using double quotes around paths
- Detect new Rubygems sources in the Gemfile and update
the lockfile
## 1.0.0.rc.6 (August 23, 2010)
Features:
- Much better documentation for most of the commands and Gemfile
format
Bugfixes:
- Don't attempt to create directories if they already exist
- Fix the capistrano task so that it actually runs
- Update the Gemfile template to reference rubygems.org instead
of :gemcutter
- bundle exec should exit with a non zero exit code when the gem
binary does not exist or the file is not executable.
- Expand paths in Gemfile relative to the Gemfile and not the current
working directory.
## 1.0.0.rc.5 (August 10, 2010)
Features:
- Make the Capistrano task more concise.
Bugfixes:
- Fix a regression with determining whether or not to use sudo
- Allow using the --gemfile flag with the --deployment flag
## 1.0.0.rc.4 (August 9, 2010)
Features:
- `bundle gem NAME` command to generate a new gem with Gemfile
- Bundle config file location can be specified by BUNDLE_APP_CONFIG
- Add --frozen to disable updating the Gemfile.lock at runtime
(default with --deployment)
- Basic Capistrano task now added as 'bundler/capistrano'
Bugfixes:
- Multiple bundler process no longer share a tmp directory
- `bundle update GEM` always updates dependencies of GEM as well
- Deleting the cache directory no longer causes errors
- Moving the bundle after installation no longer causes git errors
- Bundle path is now correctly remembered on a read-only filesystem
- Gem binaries are installed to Gem.bindir, not #{Gem.dir}/bin
- Fetch gems from vendor/cache, even without --local
- Sort lockfile by platform as well as spec
## 1.0.0.rc.3 (August 3, 2010)
Features:
- Deprecate --production flag for --deployment, since the former
was causing confusion with the :production group
- Add --gemfile option to `bundle check`
- Reduce memory usage of `bundle install` by 2-4x
- Improve message from `bundle check` under various conditions
- Better error when a changed Gemfile conflicts with Gemfile.lock
Bugfixes:
- Create bin/ directory if it is missing, then install binstubs
- Error nicely on the edge case of a pinned gem with no spec
- Do not require gems for other platforms
- Update git sources along with the gems they contain
## 1.0.0.rc.2 (July 29, 2010)
- `bundle install path` was causing confusion, so we now print
a clarifying warning. The preferred way to install to a path
(which will not print the warning) is
`bundle install --path path/to/install`.
- `bundle install --system` installs to the default system
location ($BUNDLE_PATH or $GEM_HOME) even if you previously
used `bundle install --path`
- completely remove `--disable-shared-gems`. If you install to
system, you will not be isolated, while if you install to
another path, you will be isolated from gems installed to
the system. This was mostly an internal option whose naming
and semantics were extremely confusing.
- Add a `--production` option to `bundle install`:
- by default, installs to `vendor/bundle`. This can be
overridden with the `--path` option
- uses `--local` if `vendor/cache` is found. This will
guarantee that Bundler does not attempt to connect to
Rubygems and will use the gems cached in `vendor/cache`
instead
- Raises an exception if a Gemfile.lock is not found
- Raises an exception if you modify your Gemfile in development
but do not check in an updated Gemfile.lock
- Fixes a bug where switching a source from Rubygems to git
would always say "the git source is not checked out" when
running `bundle install`
NOTE: We received several reports of "the git source has not
been checked out. Please run bundle install". As far as we
can tell, these problems have two possible causes:
1. `bundle install ~/.bundle` in one user, but actually running
the application as another user. Never install gems to a
directory scoped to a user (`~` or `$HOME`) in deployment.
2. A bug that happened when changing a gem to a git source.
To mitigate several common causes of `(1)`, please use the
new `--production` flag. This flag is simply a roll-up of
the best practices we have been encouraging people to use
for deployment.
If you want to share gems across deployments, and you use
Capistrano, symlink release_path/current/vendor/bundle to
release_path/shared/bundle. This will keep deployments
snappy while maintaining the benefits of clean, deploy-time
isolation.
## 1.0.0.rc.1 (July 26, 2010)
- Fixed a bug with `bundle install` on multiple machines and git
## 1.0.0.beta.10 (July 25, 2010)
- Last release before 1.0.0.rc.1
- Added :mri as a valid platform (platforms :mri { gem "ruby-debug" })
- Fix `bundle install` immediately after modifying the :submodule option
- Don't write to Gemfile.lock if nothing has changed, fixing situations
where bundle install was run with a different user than the app
itself
- Fix a bug where other platforms were being wiped on `bundle update`
- Don't ask for root password on `bundle install` if not needed
- Avoid setting `$GEM_HOME` where not needed
- First solid pass of `bundle config`
- Add build options
- `bundle config build.mysql --with-mysql-config=/path/to/config`
## 1.0.0.beta.9 (July 21, 2010)
- Fix install failure when switching from a path to git source
- Fix `bundle exec bundle *` in a bundle with --disable-shared-gems
- Fix `bundle *` from inside a bundle with --disable-shared-gem
- Shim Gem.refresh. This is used by Unicorn
- Fix install failure when a path's dependencies changed
## 1.0.0.beta.8 (July 20, 2010)
- Fix a Beta 7 bug involving Ruby 1.9
## 1.0.0.beta.7 (July 20, 2010, yanked)
- Running `bundle install` twice in a row with a git source always crashed
## 1.0.0.beta.6 (July 20, 2010, yanked)
- Create executables with bundle install --binstubs
- You can customize the location (default is app/bin) with --binstubs other/location
- Fix a bug where the Gemfile.lock would be deleted even if the update was exited
- Fix a bug where cached gems for other platforms were sometimes deleted
- Clean up output when nothing was deleted from cache (it previously said
"Removing outdated gems ...")
- Improve performance of bundle install if the git gem was already checked out,
and the revision being used already exists locally
- Fix bundle show bundler in some cases
- Fix bugs with bundle update
- Don't ever run git commands at runtime (fixes a number of common passenger issues)
- Fixes an obscure bug where switching the source of a gem could fail to correctly
change the source of its dependencies
- Support multiple version dependencies in the Gemfile
(`gem "rails", ">= 3.0.0.beta1", "<= 3.0.0"`)
- Raise an exception for ambiguous uses of multiple declarations of the same gem
(for instance, with different versions or sources).
- Fix cases where the same dependency appeared several times in the Gemfile.lock
- Fix a bug where require errors were being swallowed during Bundler.require
## 1.0.0.beta.1
- No `bundle lock` command. Locking happens automatically on install or update
- No .bundle/environment.rb. Require 'bundler/setup' instead.
- $BUNDLE_HOME defaults to $GEM_HOME instead of ~/.bundle
- Remove lockfiles generated by 0.9
## 0.9.26
Features:
- error nicely on incompatible 0.10 lockfiles
## 0.9.25 (May 3, 2010)
Bugfixes:
- explicitly coerce Pathname objects to Strings for Ruby 1.9
- fix some newline weirdness in output from install command
## 0.9.24 (April 22, 2010)
Features:
- fetch submodules for git sources
- limit the bundled version of bundler to the same as the one installing
- force relative paths in git gemspecs to avoid raising Gem::NameTooLong
- serialize GemCache sources correctly, so locking works
- raise Bundler::GemNotFound instead of calling exit! inside library code
- Rubygems 1.3.5 compatibility for the adventurous, not supported by me :)
Bugfixes:
- don't try to regenerate environment.rb if it is read-only
- prune outdated gems with the platform "ruby"
- prune cache without errors when there are directories or non-gem files
- don't re-write environment.rb if running after it has been loaded
- do not monkeypatch Specification#load_paths twice when inside a bundle
## 0.9.23 (April 20, 2010)
Bugfixes:
- cache command no longer prunes gems created by an older rubygems version
- cache command no longer prunes gems that are for other platforms
## 0.9.22 (April 20, 2010)
Features:
- cache command now prunes stale .gem files from vendor/cache
- init --gemspec command now generates development dependencies
- handle Polyglot's changes to Kernel#require with Bundler::ENV_LOADED ([#287](https://github.com/bundler/bundler/issues/287))
- remove .gem files generated after installing a gem from a :path ([#286](https://github.com/bundler/bundler/issues/286))
- improve install/lock messaging ([#284](https://github.com/bundler/bundler/issues/284))
Bugfixes:
- ignore cached gems that are for another platform ([#288](https://github.com/bundler/bundler/issues/288))
- install Windows gems that have no architecture set, like rcov ([#277](https://github.com/bundler/bundler/issues/277))
- exec command while locked now includes the bundler lib in $LOAD_PATH ([#293](https://github.com/bundler/bundler/issues/293))
- fix the `rake install` task
- add GemspecError so it can be raised without (further) error ([#292](https://github.com/bundler/bundler/issues/292))
- create a parent directory before cloning for git 1.5 compatibility ([#285](https://github.com/bundler/bundler/issues/285))
## 0.9.21 (April 16, 2010)
Bugfixes:
- don't raise 'omg wtf' when lockfile is outdated
## 0.9.20 (April 15, 2010)
Features:
- load YAML format gemspecs
- no backtraces when calling Bundler.setup if gems are missing
- no backtraces when trying to exec a file without the executable bit
Bugfixes:
- fix infinite recursion in Bundler.setup after loading a bundled Bundler gem
- request install instead of lock when env.rb is out of sync with Gemfile.lock
## 0.9.19 (April 12, 2010)
Features:
- suggest `bundle install --relock` when the Gemfile has changed ([#272](https://github.com/bundler/bundler/issues/272))
- source support for Rubygems servers without prerelease gem indexes ([#262](https://github.com/bundler/bundler/issues/262))
Bugfixes:
- don't set up all groups every time Bundler.setup is called while locked ([#263](https://github.com/bundler/bundler/issues/263))
- fix #full_gem_path for git gems while locked ([#268](https://github.com/bundler/bundler/issues/268))
- eval gemspecs at the top level, not inside the Bundler class ([#269](https://github.com/bundler/bundler/issues/269))
## 0.9.18 (April 8, 2010)
Features:
- console command that runs irb with bundle (and optional group) already loaded
Bugfixes:
- Bundler.setup now fully disables system gems, even when unlocked ([#266](https://github.com/bundler/bundler/issues/266), [#246](https://github.com/bundler/bundler/issues/246))
- fixes Yard, which found plugins in Gem.source_index that it could not load
- makes behaviour of `Bundler.require` consistent between locked and unlocked loads
## 0.9.17 (April 7, 2010)
Features:
- Bundler.require now calls Bundler.setup automatically
- Gem::Specification#add_bundler_dependencies added for gemspecs
Bugfixes:
- Gem paths are not longer duplicated while loading bundler
- exec no longer duplicates RUBYOPT if it is already set correctly
## 0.9.16 (April 3, 2010)
Features:
- exit gracefully on INT signal
- resolver output now indicates whether remote sources were checked
- print error instead of backtrace when exec cannot find a binary ([#241](https://github.com/bundler/bundler/issues/241))
Bugfixes:
- show, check, and open commands work again while locked (oops)
- show command for git gems
- outputs branch names other than master
- gets the correct sha from the checkout
- doesn't print sha twice if :ref is set
- report errors from bundler/setup.rb without backtraces ([#243](https://github.com/bundler/bundler/issues/243))
- fix Gem::Spec#git_version to not error on unloaded specs
- improve deprecation, Gemfile, and command error messages ([#242](https://github.com/bundler/bundler/issues/242))
## 0.9.15 (April 1, 2010)
Features:
- use the env_file if possible instead of doing a runtime resolve
- huge speedup when calling Bundler.setup while locked
- ensures bundle exec is fast while locked
- regenerates env_file if it was generated by an older version
- update cached/packed gems when you update gems via bundle install
Bugfixes:
- prep for Rubygems 1.3.7 changes
- install command now pulls git branches correctly ([#211](https://github.com/bundler/bundler/issues/211))
- raise errors on invalid options in the Gemfile
## 0.9.14 (March 30, 2010)
Features:
- install command output vastly improved
- installation message now accurate, with 'using' and 'installing'
- bundler gems no longer listed as 'system gems'
- show command output now includes sha and branch name for git gems
- init command now takes --gemspec option for bootstrapping gem Gemfiles
- Bundler.with_clean_env for shelling out to ruby scripts
- show command now aliased as 'list'
- VISUAL env var respected for GUI editors
Bugfixes:
- exec command now finds binaries from gems with no gemspec
- note source of Gemfile resolver errors
- don't blow up if git urls are changed
## 0.9.13 (March 23, 2010)
Bugfixes:
- exec command now finds binaries from gems installed via :path
- gem dependencies are pulled in even if their type is nil
- paths with spaces have double-quotes to work on Windows
- set GEM_PATH in environment.rb so generators work with Rails 2
## 0.9.12 (March 17, 2010)
- refactoring, internal cleanup, more solid specs
Features:
- check command takes a --without option
- check command exits 1 if the check fails
Bugfixes:
- perform a topological sort on resolved gems ([#191](https://github.com/bundler/bundler/issues/191))
- gems from git work even when paths or repos have spaces ([#196](https://github.com/bundler/bundler/issues/196))
- Specification#loaded_from returns a String, like Gem::Specification ([#197](https://github.com/bundler/bundler/issues/197))
- specs eval from inside the gem directory, even when locked
- virtual gemspecs are now saved in environment.rb for use when loading
- unify the Installer's local index and the runtime index ([#204](https://github.com/bundler/bundler/issues/204))
## 0.9.11 (March 9, 2010)
- added roadmap with future development plans
Features:
- install command can take the path to the gemfile with --gemfile ([#125](https://github.com/bundler/bundler/issues/125))
- unknown command line options are now rejected ([#163](https://github.com/bundler/bundler/issues/163))
- exec command hugely sped up while locked ([#177](https://github.com/bundler/bundler/issues/177))
- show command prints the install path if you pass it a gem name ([#148](https://github.com/bundler/bundler/issues/148))
- open command edits an installed gem with $EDITOR ([#148](https://github.com/bundler/bundler/issues/148))
- Gemfile allows assigning an array of groups to a gem ([#114](https://github.com/bundler/bundler/issues/114))
- Gemfile allows :tag option on :git sources
- improve backtraces when a gemspec is invalid
- improve performance by installing gems from the cache if present
Bugfixes:
- normalize parameters to Bundler.require ([#153](https://github.com/bundler/bundler/issues/153))
- check now checks installed gems rather than cached gems ([#162](https://github.com/bundler/bundler/issues/162))
- don't update the gem index when installing after locking ([#169](https://github.com/bundler/bundler/issues/169))
- bundle parenthesises arguments for 1.8.6 ([#179](https://github.com/bundler/bundler/issues/179))
- gems can now be assigned to multiple groups without problems ([#135](https://github.com/bundler/bundler/issues/135))
- fix the warning when building extensions for a gem from git with Rubygems 1.3.6
- fix a Dependency.to_yaml error due to accidentally including sources and groups
- don't reinstall packed gems
- fix gems with git sources that are private repositories
## 0.9.10 (March 1, 2010)
- depends on Rubygems 1.3.6
Bugfixes:
- support locking after install --without
- don't reinstall gems from the cache if they're already in the bundle
- fixes for Ruby 1.8.7 and 1.9
## 0.9.9 (February 25, 2010)
Bugfixes:
- don't die if GEM_HOME is an empty string
- fixes for Ruby 1.8.6 and 1.9
## 0.9.8 (February 23, 2010)
Features:
- pack command which both caches and locks
- descriptive error if a cached gem is missing
- remember the --without option after installing
- expand paths given in the Gemfile via the :path option
- add block syntax to the git and group options in the Gemfile
- support gems with extensions that don't admit they depend on rake
- generate gems using gem build gemspec so git gems can have native extensions
- print a useful warning if building a gem fails
- allow manual configuration via BUNDLE_PATH
Bugfixes:
- eval gemspecs in the gem directory so relative paths work
- make default spec for git sources valid
- don't reinstall gems that are already packed
## 0.9.7 (February 17, 2010)
Bugfixes:
- don't say that a gem from an excluded group is "installing"
- improve crippling rubygems in locked scenarios
## 0.9.6 (February 16, 2010)
Features:
- allow String group names
- a number of improvements in the documentation and error messages
Bugfixes:
- set SourceIndex#spec_dirs to solve a problem involving Rails 2.3 in unlocked mode
- ensure Rubygems is fully loaded in Ruby 1.9 before patching it
- fix `bundle install` for a locked app without a .bundle directory
- require gems in the order that the resolver determines
- make the tests platform agnostic so we can confirm that they're green on JRuby
- fixes for Ruby 1.9
## 0.9.5 (February 12, 2010)
Features:
- added support for :path => "relative/path"
- added support for older versions of git
- added `bundle install --disable-shared-gems`
- Bundler.require fails silently if a library does not have a file on the load path with its name
- Basic support for multiple rubies by namespacing the default bundle path using the version and engine
Bugfixes:
- if the bundle is locked and .bundle/environment.rb is not present when Bundler.setup is called, generate it
- same if it's not present with `bundle check`
- same if it's not present with `bundle install`
bundler-2.1.4/man/ 0000755 0000041 0000041 00000000000 13606335352 013762 5 ustar www-data www-data bundler-2.1.4/man/bundle-inject.ronn 0000644 0000041 0000041 00000001125 13606335352 017402 0 ustar www-data www-data bundle-inject(1) -- Add named gem(s) with version requirements to Gemfile
=========================================================================
## SYNOPSIS
`bundle inject` [GEM] [VERSION]
## DESCRIPTION
Adds the named gem(s) with their version requirements to the resolved
[`Gemfile(5)`][Gemfile(5)].
This command will add the gem to both your [`Gemfile(5)`][Gemfile(5)] and Gemfile.lock if it
isn't listed yet.
Example:
bundle install
bundle inject 'rack' '> 0'
This will inject the 'rack' gem with a version greater than 0 in your
[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock
bundler-2.1.4/man/bundle-clean.1.txt 0000644 0000041 0000041 00000001051 13606335352 017210 0 ustar www-data www-data BUNDLE-CLEAN(1) BUNDLE-CLEAN(1)
NAME
bundle-clean - Cleans up unused gems in your bundler directory
SYNOPSIS
bundle clean [--dry-run] [--force]
DESCRIPTION
This command will remove all unused gems in your bundler directory.
This is useful when you have made many changes to your gem dependen-
cies.
OPTIONS
--dry-run
Print the changes, but do not clean the unused gems.
--force
Force a clean even if --path is not set.
January 2020 BUNDLE-CLEAN(1)
bundler-2.1.4/man/bundle-remove.1 0000644 0000041 0000041 00000001520 13606335352 016606 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-REMOVE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile
.
.SH "SYNOPSIS"
\fBbundle remove [GEM [GEM \.\.\.]] [\-\-install]\fR
.
.SH "DESCRIPTION"
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid\. If a gem cannot be removed, a warning is printed\. If a gem is already absent from the Gemfile, and error is raised\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-install\fR
Runs \fBbundle install\fR after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s)\.
.
.P
Example:
.
.P
bundle remove rails
.
.P
bundle remove rails rack
.
.P
bundle remove rails rack \-\-install
bundler-2.1.4/man/bundle-clean.ronn 0000644 0000041 0000041 00000000744 13606335352 017216 0 ustar www-data www-data bundle-clean(1) -- Cleans up unused gems in your bundler directory
==================================================================
## SYNOPSIS
`bundle clean` [--dry-run] [--force]
## DESCRIPTION
This command will remove all unused gems in your bundler directory. This is
useful when you have made many changes to your gem dependencies.
## OPTIONS
* `--dry-run`:
Print the changes, but do not clean the unused gems.
* `--force`:
Force a clean even if `--path` is not set.
bundler-2.1.4/man/bundle-remove.1.txt 0000644 0000041 0000041 00000001521 13606335352 017425 0 ustar www-data www-data BUNDLE-REMOVE(1) BUNDLE-REMOVE(1)
NAME
bundle-remove - Removes gems from the Gemfile
SYNOPSIS
bundle remove [GEM [GEM ...]] [--install]
DESCRIPTION
Removes the given gems from the Gemfile while ensuring that the result-
ing Gemfile is still valid. If a gem cannot be removed, a warning is
printed. If a gem is already absent from the Gemfile, and error is
raised.
OPTIONS
--install
Runs bundle install after the given gems have been removed from
the Gemfile, which ensures that both the lockfile and the
installed gems on disk are also updated to remove the given
gem(s).
Example:
bundle remove rails
bundle remove rails rack
bundle remove rails rack --install
January 2020 BUNDLE-REMOVE(1)
bundler-2.1.4/man/bundle-platform.1 0000644 0000041 0000041 00000002473 13606335352 017145 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-PLATFORM" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information
.
.SH "SYNOPSIS"
\fBbundle platform\fR [\-\-ruby]
.
.SH "DESCRIPTION"
\fBplatform\fR will display information from your Gemfile, Gemfile\.lock, and Ruby VM about your platform\.
.
.P
For instance, using this Gemfile(5):
.
.IP "" 4
.
.nf
source "https://rubygems\.org"
ruby "1\.9\.3"
gem "rack"
.
.fi
.
.IP "" 0
.
.P
If you run \fBbundle platform\fR on Ruby 1\.9\.3, it will display the following output:
.
.IP "" 4
.
.nf
Your platform is: x86_64\-linux
Your app has gems that work on these platforms:
* ruby
Your Gemfile specifies a Ruby version requirement:
* ruby 1\.9\.3
Your current platform satisfies the Ruby version requirement\.
.
.fi
.
.IP "" 0
.
.P
\fBplatform\fR will list all the platforms in your \fBGemfile\.lock\fR as well as the \fBruby\fR directive if applicable from your Gemfile(5)\. It will also let you know if the \fBruby\fR directive requirement has been met\. If \fBruby\fR directive doesn\'t match the running Ruby VM, it will tell you what part does not\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-ruby\fR
It will display the ruby directive information, so you don\'t have to parse it from the Gemfile(5)\.
bundler-2.1.4/man/bundle-outdated.1 0000644 0000041 0000041 00000007345 13606335352 017135 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-OUTDATED" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available
.
.SH "SYNOPSIS"
\fBbundle outdated\fR [GEM] [\-\-local] [\-\-pre] [\-\-source] [\-\-strict] [\-\-parseable | \-\-porcelain] [\-\-group=GROUP] [\-\-groups] [\-\-update\-strict] [\-\-patch|\-\-minor|\-\-major] [\-\-filter\-major] [\-\-filter\-minor] [\-\-filter\-patch] [\-\-only\-explicit]
.
.SH "DESCRIPTION"
Outdated lists the names and versions of gems that have a newer version available in the given source\. Calling outdated with [GEM [GEM]] will only check for newer versions of the given gems\. Prerelease gems are ignored by default\. If your gems are up to date, Bundler will exit with a status of 0\. Otherwise, it will exit 1\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-local\fR
Do not attempt to fetch gems remotely and use the gem cache instead\.
.
.TP
\fB\-\-pre\fR
Check for newer pre\-release gems\.
.
.TP
\fB\-\-source\fR
Check against a specific source\.
.
.TP
\fB\-\-strict\fR
Only list newer versions allowed by your Gemfile requirements\.
.
.TP
\fB\-\-parseable\fR, \fB\-\-porcelain\fR
Use minimal formatting for more parseable output\.
.
.TP
\fB\-\-group\fR
List gems from a specific group\.
.
.TP
\fB\-\-groups\fR
List gems organized by groups\.
.
.TP
\fB\-\-update\-strict\fR
Strict conservative resolution, do not allow any gem to be updated past latest \-\-patch | \-\-minor| \-\-major\.
.
.TP
\fB\-\-minor\fR
Prefer updating only to next minor version\.
.
.TP
\fB\-\-major\fR
Prefer updating to next major version (default)\.
.
.TP
\fB\-\-patch\fR
Prefer updating only to next patch version\.
.
.TP
\fB\-\-filter\-major\fR
Only list major newer versions\.
.
.TP
\fB\-\-filter\-minor\fR
Only list minor newer versions\.
.
.TP
\fB\-\-filter\-patch\fR
Only list patch newer versions\.
.
.TP
\fB\-\-only\-explicit\fR
Only list gems specified in your Gemfile, not their dependencies\.
.
.SH "PATCH LEVEL OPTIONS"
See bundle update(1) \fIbundle\-update\.1\.html\fR for details\.
.
.P
One difference between the patch level options in \fBbundle update\fR and here is the \fB\-\-strict\fR option\. \fB\-\-strict\fR was already an option on outdated before the patch level options were added\. \fB\-\-strict\fR wasn\'t altered, and the \fB\-\-update\-strict\fR option on \fBoutdated\fR reflects what \fB\-\-strict\fR does on \fBbundle update\fR\.
.
.SH "FILTERING OUTPUT"
The 3 filtering options do not affect the resolution of versions, merely what versions are shown in the output\.
.
.P
If the regular output shows the following:
.
.IP "" 4
.
.nf
* faker (newest 1\.6\.6, installed 1\.6\.5, requested ~> 1\.4) in groups "development, test"
* hashie (newest 3\.4\.6, installed 1\.2\.0, requested = 1\.2\.0) in groups "default"
* headless (newest 2\.3\.1, installed 2\.2\.3) in groups "test"
.
.fi
.
.IP "" 0
.
.P
\fB\-\-filter\-major\fR would only show:
.
.IP "" 4
.
.nf
* hashie (newest 3\.4\.6, installed 1\.2\.0, requested = 1\.2\.0) in groups "default"
.
.fi
.
.IP "" 0
.
.P
\fB\-\-filter\-minor\fR would only show:
.
.IP "" 4
.
.nf
* headless (newest 2\.3\.1, installed 2\.2\.3) in groups "test"
.
.fi
.
.IP "" 0
.
.P
\fB\-\-filter\-patch\fR would only show:
.
.IP "" 4
.
.nf
* faker (newest 1\.6\.6, installed 1\.6\.5, requested ~> 1\.4) in groups "development, test"
.
.fi
.
.IP "" 0
.
.P
Filter options can be combined\. \fB\-\-filter\-minor\fR and \fB\-\-filter\-patch\fR would show:
.
.IP "" 4
.
.nf
* faker (newest 1\.6\.6, installed 1\.6\.5, requested ~> 1\.4) in groups "development, test"
* headless (newest 2\.3\.1, installed 2\.2\.3) in groups "test"
.
.fi
.
.IP "" 0
.
.P
Combining all three \fBfilter\fR options would be the same result as providing none of them\.
bundler-2.1.4/man/bundle-cache.1.txt 0000644 0000041 0000041 00000006271 13606335352 017202 0 ustar www-data www-data BUNDLE-CACHE(1) BUNDLE-CACHE(1)
NAME
bundle-cache - Package your needed .gem files into your application
SYNOPSIS
bundle cache
DESCRIPTION
Copy all of the .gem files needed to run the application into the ven-
dor/cache directory. In the future, when running [bundle
install(1)][bundle-install], use the gems in the cache in preference to
the ones on rubygems.org.
GIT AND PATH GEMS
The bundle cache command can also package :git and :path dependencies
besides .gem files. This needs to be explicitly enabled via the --all
option. Once used, the --all option will be remembered.
SUPPORT FOR MULTIPLE PLATFORMS
When using gems that have different packages for different platforms,
Bundler supports caching of gems for other platforms where the Gemfile
has been resolved (i.e. present in the lockfile) in vendor/cache. This
needs to be enabled via the --all-platforms option. This setting will
be remembered in your local bundler configuration.
REMOTE FETCHING
By default, if you run bundle install(1)](bundle-install.1.html) after
running bundle cache(1) bundle-cache.1.html, bundler will still connect
to rubygems.org to check whether a platform-specific gem exists for any
of the gems in vendor/cache.
For instance, consider this Gemfile(5):
source "https://rubygems.org"
gem "nokogiri"
If you run bundle cache under C Ruby, bundler will retrieve the version
of nokogiri for the "ruby" platform. If you deploy to JRuby and run
bundle install, bundler is forced to check to see whether a "java"
platformed nokogiri exists.
Even though the nokogiri gem for the Ruby platform is technically
acceptable on JRuby, it has a C extension that does not run on JRuby.
As a result, bundler will, by default, still connect to rubygems.org to
check whether it has a version of one of your gems more specific to
your platform.
This problem is also not limited to the "java" platform. A similar
(common) problem can happen when developing on Windows and deploying to
Linux, or even when developing on OSX and deploying to Linux.
If you know for sure that the gems packaged in vendor/cache are appro-
priate for the platform you are on, you can run bundle install --local
to skip checking for more appropriate gems, and use the ones in ven-
dor/cache.
One way to be sure that you have the right platformed versions of all
your gems is to run bundle cache on an identical machine and check in
the gems. For instance, you can run bundle cache on an identical stag-
ing box during your staging process, and check in the vendor/cache
before deploying to production.
By default, bundle cache(1) bundle-cache.1.html fetches and also
installs the gems to the default location. To package the dependencies
to vendor/cache without installing them to the local install location,
you can run bundle cache --no-install.
January 2020 BUNDLE-CACHE(1)
bundler-2.1.4/man/bundle-info.1 0000644 0000041 0000041 00000000700 13606335352 016243 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INFO" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle
.
.SH "SYNOPSIS"
\fBbundle info\fR [GEM] [\-\-path]
.
.SH "DESCRIPTION"
Print the basic information about the provided GEM such as homepage, version, path and summary\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-path\fR
Print the path of the given gem
bundler-2.1.4/man/bundle.1 0000644 0000041 0000041 00000007012 13606335352 015315 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\fR \- Ruby Dependency Management
.
.SH "SYNOPSIS"
\fBbundle\fR COMMAND [\-\-no\-color] [\-\-verbose] [ARGS]
.
.SH "DESCRIPTION"
Bundler manages an \fBapplication\'s dependencies\fR through its entire life across many machines systematically and repeatably\.
.
.P
See the bundler website \fIhttps://bundler\.io\fR for information on getting started, and Gemfile(5) for more information on the \fBGemfile\fR format\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-no\-color\fR
Print all output without color
.
.TP
\fB\-\-retry\fR, \fB\-r\fR
Specify the number of times you wish to attempt network commands
.
.TP
\fB\-\-verbose\fR, \fB\-V\fR
Print out additional logging information
.
.SH "BUNDLE COMMANDS"
We divide \fBbundle\fR subcommands into primary commands and utilities:
.
.SH "PRIMARY COMMANDS"
.
.TP
\fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR
Install the gems specified by the \fBGemfile\fR or \fBGemfile\.lock\fR
.
.TP
\fBbundle update(1)\fR \fIbundle\-update\.1\.html\fR
Update dependencies to their latest versions
.
.TP
\fBbundle package(1)\fR \fIbundle\-package\.1\.html\fR
Package the \.gem files required by your application into the \fBvendor/cache\fR directory
.
.TP
\fBbundle exec(1)\fR \fIbundle\-exec\.1\.html\fR
Execute a script in the current bundle
.
.TP
\fBbundle config(1)\fR \fIbundle\-config\.1\.html\fR
Specify and read configuration options for Bundler
.
.TP
\fBbundle help(1)\fR
Display detailed help for each subcommand
.
.SH "UTILITIES"
.
.TP
\fBbundle add(1)\fR \fIbundle\-add\.1\.html\fR
Add the named gem to the Gemfile and run \fBbundle install\fR
.
.TP
\fBbundle binstubs(1)\fR \fIbundle\-binstubs\.1\.html\fR
Generate binstubs for executables in a gem
.
.TP
\fBbundle check(1)\fR \fIbundle\-check\.1\.html\fR
Determine whether the requirements for your application are installed and available to Bundler
.
.TP
\fBbundle show(1)\fR \fIbundle\-show\.1\.html\fR
Show the source location of a particular gem in the bundle
.
.TP
\fBbundle outdated(1)\fR \fIbundle\-outdated\.1\.html\fR
Show all of the outdated gems in the current bundle
.
.TP
\fBbundle console(1)\fR
Start an IRB session in the current bundle
.
.TP
\fBbundle open(1)\fR \fIbundle\-open\.1\.html\fR
Open an installed gem in the editor
.
.TP
\fBbundle lock(1)\fR \fIbundle\-lock\.1\.html\fR
Generate a lockfile for your dependencies
.
.TP
\fBbundle viz(1)\fR \fIbundle\-viz\.1\.html\fR
Generate a visual representation of your dependencies
.
.TP
\fBbundle init(1)\fR \fIbundle\-init\.1\.html\fR
Generate a simple \fBGemfile\fR, placed in the current directory
.
.TP
\fBbundle gem(1)\fR \fIbundle\-gem\.1\.html\fR
Create a simple gem, suitable for development with Bundler
.
.TP
\fBbundle platform(1)\fR \fIbundle\-platform\.1\.html\fR
Display platform compatibility information
.
.TP
\fBbundle clean(1)\fR \fIbundle\-clean\.1\.html\fR
Clean up unused gems in your Bundler directory
.
.TP
\fBbundle doctor(1)\fR \fIbundle\-doctor\.1\.html\fR
Display warnings about common problems
.
.TP
\fBbundle remove(1)\fR \fIbundle\-remove\.1\.html\fR
Removes gems from the Gemfile
.
.SH "PLUGINS"
When running a command that isn\'t listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named \fBbundler\-\fR and execute it, passing down any extra arguments to it\.
.
.SH "OBSOLETE"
These commands are obsolete and should no longer be used:
.
.IP "\(bu" 4
\fBbundle cache(1)\fR
.
.IP "\(bu" 4
\fBbundle show(1)\fR
.
.IP "" 0
bundler-2.1.4/man/bundle-exec.1 0000644 0000041 0000041 00000015151 13606335352 016242 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-EXEC" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle
.
.SH "SYNOPSIS"
\fBbundle exec\fR [\-\-keep\-file\-descriptors] \fIcommand\fR
.
.SH "DESCRIPTION"
This command executes the command, making all gems specified in the [\fBGemfile(5)\fR][Gemfile(5)] available to \fBrequire\fR in Ruby programs\.
.
.P
Essentially, if you would normally have run something like \fBrspec spec/my_spec\.rb\fR, and you want to use the gems specified in the [\fBGemfile(5)\fR][Gemfile(5)] and installed via bundle install(1) \fIbundle\-install\.1\.html\fR, you should run \fBbundle exec rspec spec/my_spec\.rb\fR\.
.
.P
Note that \fBbundle exec\fR does not require that an executable is available on your shell\'s \fB$PATH\fR\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-keep\-file\-descriptors\fR
Exec in Ruby 2\.0 began discarding non\-standard file descriptors\. When this flag is passed, exec will revert to the 1\.9 behaviour of passing all file descriptors to the new process\.
.
.SH "BUNDLE INSTALL \-\-BINSTUBS"
If you use the \fB\-\-binstubs\fR flag in bundle install(1) \fIbundle\-install\.1\.html\fR, Bundler will automatically create a directory (which defaults to \fBapp_root/bin\fR) containing all of the executables available from gems in the bundle\.
.
.P
After using \fB\-\-binstubs\fR, \fBbin/rspec spec/my_spec\.rb\fR is identical to \fBbundle exec rspec spec/my_spec\.rb\fR\.
.
.SH "ENVIRONMENT MODIFICATIONS"
\fBbundle exec\fR makes a number of changes to the shell environment, then executes the command you specify in full\.
.
.IP "\(bu" 4
make sure that it\'s still possible to shell out to \fBbundle\fR from inside a command invoked by \fBbundle exec\fR (using \fB$BUNDLE_BIN_PATH\fR)
.
.IP "\(bu" 4
put the directory containing executables (like \fBrails\fR, \fBrspec\fR, \fBrackup\fR) for your bundle on \fB$PATH\fR
.
.IP "\(bu" 4
make sure that if bundler is invoked in the subshell, it uses the same \fBGemfile\fR (by setting \fBBUNDLE_GEMFILE\fR)
.
.IP "\(bu" 4
add \fB\-rbundler/setup\fR to \fB$RUBYOPT\fR, which makes sure that Ruby programs invoked in the subshell can see the gems in the bundle
.
.IP "" 0
.
.P
It also modifies Rubygems:
.
.IP "\(bu" 4
disallow loading additional gems not in the bundle
.
.IP "\(bu" 4
modify the \fBgem\fR method to be a no\-op if a gem matching the requirements is in the bundle, and to raise a \fBGem::LoadError\fR if it\'s not
.
.IP "\(bu" 4
Define \fBGem\.refresh\fR to be a no\-op, since the source index is always frozen when using bundler, and to prevent gems from the system leaking into the environment
.
.IP "\(bu" 4
Override \fBGem\.bin_path\fR to use the gems in the bundle, making system executables work
.
.IP "\(bu" 4
Add all gems in the bundle into Gem\.loaded_specs
.
.IP "" 0
.
.P
Finally, \fBbundle exec\fR also implicitly modifies \fBGemfile\.lock\fR if the lockfile and the Gemfile do not match\. Bundler needs the Gemfile to determine things such as a gem\'s groups, \fBautorequire\fR, and platforms, etc\., and that information isn\'t stored in the lockfile\. The Gemfile and lockfile must be synced in order to \fBbundle exec\fR successfully, so \fBbundle exec\fR updates the lockfile beforehand\.
.
.SS "Loading"
By default, when attempting to \fBbundle exec\fR to a file with a ruby shebang, Bundler will \fBKernel\.load\fR that file instead of using \fBKernel\.exec\fR\. For the vast majority of cases, this is a performance improvement\. In a rare few cases, this could cause some subtle side\-effects (such as dependence on the exact contents of \fB$0\fR or \fB__FILE__\fR) and the optimization can be disabled by enabling the \fBdisable_exec_load\fR setting\.
.
.SS "Shelling out"
Any Ruby code that opens a subshell (like \fBsystem\fR, backticks, or \fB%x{}\fR) will automatically use the current Bundler environment\. If you need to shell out to a Ruby command that is not part of your current bundle, use the \fBwith_clean_env\fR method with a block\. Any subshells created inside the block will be given the environment present before Bundler was activated\. For example, Homebrew commands run Ruby, but don\'t work inside a bundle:
.
.IP "" 4
.
.nf
Bundler\.with_clean_env do
`brew install wget`
end
.
.fi
.
.IP "" 0
.
.P
Using \fBwith_clean_env\fR is also necessary if you are shelling out to a different bundle\. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use \fBwith_clean_env\fR\.
.
.IP "" 4
.
.nf
Bundler\.with_clean_env do
Dir\.chdir "/other/bundler/project" do
`bundle exec \./script`
end
end
.
.fi
.
.IP "" 0
.
.P
Bundler provides convenience helpers that wrap \fBsystem\fR and \fBexec\fR, and they can be used like this:
.
.IP "" 4
.
.nf
Bundler\.clean_system(\'brew install wget\')
Bundler\.clean_exec(\'brew install wget\')
.
.fi
.
.IP "" 0
.
.SH "RUBYGEMS PLUGINS"
At present, the Rubygems plugin system requires all files named \fBrubygems_plugin\.rb\fR on the load path of \fIany\fR installed gem when any Ruby code requires \fBrubygems\.rb\fR\. This includes executables installed into the system, like \fBrails\fR, \fBrackup\fR, and \fBrspec\fR\.
.
.P
Since Rubygems plugins can contain arbitrary Ruby code, they commonly end up activating themselves or their dependencies\.
.
.P
For instance, the \fBgemcutter 0\.5\fR gem depended on \fBjson_pure\fR\. If you had that version of gemcutter installed (even if you \fIalso\fR had a newer version without this problem), Rubygems would activate \fBgemcutter 0\.5\fR and \fBjson_pure \fR\.
.
.P
If your Gemfile(5) also contained \fBjson_pure\fR (or a gem with a dependency on \fBjson_pure\fR), the latest version on your system might conflict with the version in your Gemfile(5), or the snapshot version in your \fBGemfile\.lock\fR\.
.
.P
If this happens, bundler will say:
.
.IP "" 4
.
.nf
You have already activated json_pure 1\.4\.6 but your Gemfile
requires json_pure 1\.4\.3\. Consider using bundle exec\.
.
.fi
.
.IP "" 0
.
.P
In this situation, you almost certainly want to remove the underlying gem with the problematic gem plugin\. In general, the authors of these plugins (in this case, the \fBgemcutter\fR gem) have released newer versions that are more careful in their plugins\.
.
.P
You can find a list of all the gems containing gem plugins by running
.
.IP "" 4
.
.nf
ruby \-rrubygems \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')"
.
.fi
.
.IP "" 0
.
.P
At the very least, you should remove all but the newest version of each gem plugin, and also remove all gem plugins that you aren\'t using (\fBgem uninstall gem_name\fR)\.
bundler-2.1.4/man/bundle-outdated.1.txt 0000644 0000041 0000041 00000007023 13606335352 017744 0 ustar www-data www-data BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
NAME
bundle-outdated - List installed gems with newer versions available
SYNOPSIS
bundle outdated [GEM] [--local] [--pre] [--source] [--strict]
[--parseable | --porcelain] [--group=GROUP] [--groups]
[--update-strict] [--patch|--minor|--major] [--filter-major] [--fil-
ter-minor] [--filter-patch] [--only-explicit]
DESCRIPTION
Outdated lists the names and versions of gems that have a newer version
available in the given source. Calling outdated with [GEM [GEM]] will
only check for newer versions of the given gems. Prerelease gems are
ignored by default. If your gems are up to date, Bundler will exit with
a status of 0. Otherwise, it will exit 1.
OPTIONS
--local
Do not attempt to fetch gems remotely and use the gem cache
instead.
--pre Check for newer pre-release gems.
--source
Check against a specific source.
--strict
Only list newer versions allowed by your Gemfile requirements.
--parseable, --porcelain
Use minimal formatting for more parseable output.
--group
List gems from a specific group.
--groups
List gems organized by groups.
--update-strict
Strict conservative resolution, do not allow any gem to be
updated past latest --patch | --minor| --major.
--minor
Prefer updating only to next minor version.
--major
Prefer updating to next major version (default).
--patch
Prefer updating only to next patch version.
--filter-major
Only list major newer versions.
--filter-minor
Only list minor newer versions.
--filter-patch
Only list patch newer versions.
--only-explicit
Only list gems specified in your Gemfile, not their dependen-
cies.
PATCH LEVEL OPTIONS
See bundle update(1) bundle-update.1.html for details.
One difference between the patch level options in bundle update and
here is the --strict option. --strict was already an option on outdated
before the patch level options were added. --strict wasn't altered, and
the --update-strict option on outdated reflects what --strict does on
bundle update.
FILTERING OUTPUT
The 3 filtering options do not affect the resolution of versions,
merely what versions are shown in the output.
If the regular output shows the following:
* faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
* hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
* headless (newest 2.3.1, installed 2.2.3) in groups "test"
--filter-major would only show:
* hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
--filter-minor would only show:
* headless (newest 2.3.1, installed 2.2.3) in groups "test"
--filter-patch would only show:
* faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
Filter options can be combined. --filter-minor and --filter-patch would
show:
* faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
* headless (newest 2.3.1, installed 2.2.3) in groups "test"
Combining all three filter options would be the same result as provid-
ing none of them.
January 2020 BUNDLE-OUTDATED(1)
bundler-2.1.4/man/bundle-cache.ronn 0000644 0000041 0000041 00000005577 13606335352 017210 0 ustar www-data www-data bundle-cache(1) -- Package your needed `.gem` files into your application
===========================================================================
## SYNOPSIS
`bundle cache`
## DESCRIPTION
Copy all of the `.gem` files needed to run the application into the
`vendor/cache` directory. In the future, when running [bundle install(1)][bundle-install],
use the gems in the cache in preference to the ones on `rubygems.org`.
## GIT AND PATH GEMS
The `bundle cache` command can also package `:git` and `:path` dependencies
besides .gem files. This needs to be explicitly enabled via the `--all` option.
Once used, the `--all` option will be remembered.
## SUPPORT FOR MULTIPLE PLATFORMS
When using gems that have different packages for different platforms, Bundler
supports caching of gems for other platforms where the Gemfile has been resolved
(i.e. present in the lockfile) in `vendor/cache`. This needs to be enabled via
the `--all-platforms` option. This setting will be remembered in your local
bundler configuration.
## REMOTE FETCHING
By default, if you run `bundle install(1)`](bundle-install.1.html) after running
[bundle cache(1)](bundle-cache.1.html), bundler will still connect to `rubygems.org`
to check whether a platform-specific gem exists for any of the gems
in `vendor/cache`.
For instance, consider this Gemfile(5):
source "https://rubygems.org"
gem "nokogiri"
If you run `bundle cache` under C Ruby, bundler will retrieve
the version of `nokogiri` for the `"ruby"` platform. If you deploy
to JRuby and run `bundle install`, bundler is forced to check to
see whether a `"java"` platformed `nokogiri` exists.
Even though the `nokogiri` gem for the Ruby platform is
_technically_ acceptable on JRuby, it has a C extension
that does not run on JRuby. As a result, bundler will, by default,
still connect to `rubygems.org` to check whether it has a version
of one of your gems more specific to your platform.
This problem is also not limited to the `"java"` platform.
A similar (common) problem can happen when developing on Windows
and deploying to Linux, or even when developing on OSX and
deploying to Linux.
If you know for sure that the gems packaged in `vendor/cache`
are appropriate for the platform you are on, you can run
`bundle install --local` to skip checking for more appropriate
gems, and use the ones in `vendor/cache`.
One way to be sure that you have the right platformed versions
of all your gems is to run `bundle cache` on an identical
machine and check in the gems. For instance, you can run
`bundle cache` on an identical staging box during your
staging process, and check in the `vendor/cache` before
deploying to production.
By default, [bundle cache(1)](bundle-cache.1.html) fetches and also
installs the gems to the default location. To package the
dependencies to `vendor/cache` without installing them to the
local install location, you can run `bundle cache --no-install`.
bundler-2.1.4/man/bundle-platform.ronn 0000644 0000041 0000041 00000002175 13606335352 017760 0 ustar www-data www-data bundle-platform(1) -- Displays platform compatibility information
=================================================================
## SYNOPSIS
`bundle platform` [--ruby]
## DESCRIPTION
`platform` will display information from your Gemfile, Gemfile.lock, and Ruby
VM about your platform.
For instance, using this Gemfile(5):
source "https://rubygems.org"
ruby "1.9.3"
gem "rack"
If you run `bundle platform` on Ruby 1.9.3, it will display the following output:
Your platform is: x86_64-linux
Your app has gems that work on these platforms:
* ruby
Your Gemfile specifies a Ruby version requirement:
* ruby 1.9.3
Your current platform satisfies the Ruby version requirement.
`platform` will list all the platforms in your `Gemfile.lock` as well as the
`ruby` directive if applicable from your Gemfile(5). It will also let you know
if the `ruby` directive requirement has been met. If `ruby` directive doesn't
match the running Ruby VM, it will tell you what part does not.
## OPTIONS
* `--ruby`:
It will display the ruby directive information, so you don't have to
parse it from the Gemfile(5).
bundler-2.1.4/man/bundle-update.ronn 0000644 0000041 0000041 00000030733 13606335352 017417 0 ustar www-data www-data bundle-update(1) -- Update your gems to the latest available versions
=====================================================================
## SYNOPSIS
`bundle update` <*gems> [--all]
[--group=NAME]
[--source=NAME]
[--local]
[--ruby]
[--bundler[=VERSION]]
[--full-index]
[--jobs=JOBS]
[--quiet]
[--patch|--minor|--major]
[--redownload]
[--strict]
[--conservative]
## DESCRIPTION
Update the gems specified (all gems, if `--all` flag is used), ignoring
the previously installed gems specified in the `Gemfile.lock`. In
general, you should use [bundle install(1)](bundle-install.1.html) to install the same exact
gems and versions across machines.
You would use `bundle update` to explicitly update the version of a
gem.
## OPTIONS
* `--all`:
Update all gems specified in Gemfile.
* `--group=`, `-g=[]`:
Only update the gems in the specified group. For instance, you can update all gems
in the development group with `bundle update --group development`. You can also
call `bundle update rails --group test` to update the rails gem and all gems in
the test group, for example.
* `--source=`:
The name of a `:git` or `:path` source used in the Gemfile(5). For
instance, with a `:git` source of `http://github.com/rails/rails.git`,
you would call `bundle update --source rails`
* `--local`:
Do not attempt to fetch gems remotely and use the gem cache instead.
* `--ruby`:
Update the locked version of Ruby to the current version of Ruby.
* `--bundler`:
Update the locked version of bundler to the invoked bundler version.
* `--full-index`:
Fall back to using the single-file index of all gems.
* `--jobs=[]`, `-j[]`:
Specify the number of jobs to run in parallel. The default is `1`.
* `--retry=[]`:
Retry failed network or git requests for times.
* `--quiet`:
Only output warnings and errors.
* `--redownload`:
Force downloading every gem.
* `--patch`:
Prefer updating only to next patch version.
* `--minor`:
Prefer updating only to next minor version.
* `--major`:
Prefer updating to next major version (default).
* `--strict`:
Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`.
* `--conservative`:
Use bundle install conservative update behavior and do not allow shared dependencies to be updated.
## UPDATING ALL GEMS
If you run `bundle update --all`, bundler will ignore
any previously installed gems and resolve all dependencies again
based on the latest versions of all gems available in the sources.
Consider the following Gemfile(5):
source "https://rubygems.org"
gem "rails", "3.0.0.rc"
gem "nokogiri"
When you run [bundle install(1)](bundle-install.1.html) the first time, bundler will resolve
all of the dependencies, all the way down, and install what you need:
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing builder 2.1.2
Installing abstract 1.0.0
Installing rack 1.2.8
Using bundler 1.7.6
Installing rake 10.4.0
Installing polyglot 0.3.5
Installing mime-types 1.25.1
Installing i18n 0.4.2
Installing mini_portile 0.6.1
Installing tzinfo 0.3.42
Installing rack-mount 0.6.14
Installing rack-test 0.5.7
Installing treetop 1.4.15
Installing thor 0.14.6
Installing activesupport 3.0.0.rc
Installing erubis 2.6.6
Installing activemodel 3.0.0.rc
Installing arel 0.4.0
Installing mail 2.2.20
Installing activeresource 3.0.0.rc
Installing actionpack 3.0.0.rc
Installing activerecord 3.0.0.rc
Installing actionmailer 3.0.0.rc
Installing railties 3.0.0.rc
Installing rails 3.0.0.rc
Installing nokogiri 1.6.5
Bundle complete! 2 Gemfile dependencies, 26 gems total.
Use `bundle show [gemname]` to see where a bundled gem is installed.
As you can see, even though you have two gems in the Gemfile(5), your application
needs 26 different gems in order to run. Bundler remembers the exact versions
it installed in `Gemfile.lock`. The next time you run [bundle install(1)](bundle-install.1.html), bundler skips
the dependency resolution and installs the same gems as it installed last time.
After checking in the `Gemfile.lock` into version control and cloning it on another
machine, running [bundle install(1)](bundle-install.1.html) will _still_ install the gems that you installed
last time. You don't need to worry that a new release of `erubis` or `mail` changes
the gems you use.
However, from time to time, you might want to update the gems you are using to the
newest versions that still match the gems in your Gemfile(5).
To do this, run `bundle update --all`, which will ignore the `Gemfile.lock`, and resolve
all the dependencies again. Keep in mind that this process can result in a significantly
different set of the 25 gems, based on the requirements of new gems that the gem
authors released since the last time you ran `bundle update --all`.
## UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the
gems that you specified locked to the versions in the `Gemfile.lock`.
For instance, in the scenario above, imagine that `nokogiri` releases version `1.4.4`, and
you want to update it _without_ updating Rails and all of its dependencies. To do this,
run `bundle update nokogiri`.
Bundler will update `nokogiri` and any of its dependencies, but leave alone Rails and
its dependencies.
## OVERLAPPING DEPENDENCIES
Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same
second-level dependency. For instance, consider the case of `thin` and
`rack-perftools-profiler`.
source "https://rubygems.org"
gem "thin"
gem "rack-perftools-profiler"
The `thin` gem depends on `rack >= 1.0`, while `rack-perftools-profiler` depends
on `rack ~> 1.0`. If you run bundle install, you get:
Fetching source index for https://rubygems.org/
Installing daemons (1.1.0)
Installing eventmachine (0.12.10) with native extensions
Installing open4 (1.0.1)
Installing perftools.rb (0.4.7) with native extensions
Installing rack (1.2.1)
Installing rack-perftools_profiler (0.0.2)
Installing thin (1.2.7) with native extensions
Using bundler (1.0.0.rc.3)
In this case, the two gems have their own set of dependencies, but they share
`rack` in common. If you run `bundle update thin`, bundler will update `daemons`,
`eventmachine` and `rack`, which are dependencies of `thin`, but not `open4` or
`perftools.rb`, which are dependencies of `rack-perftools_profiler`. Note that
`bundle update thin` will update `rack` even though it's _also_ a dependency of
`rack-perftools_profiler`.
In short, by default, when you update a gem using `bundle update`, bundler will
update all dependencies of that gem, including those that are also dependencies
of another gem.
To prevent updating shared dependencies, prior to version 1.14 the only option
was the `CONSERVATIVE UPDATING` behavior in [bundle install(1)](bundle-install.1.html):
In this scenario, updating the `thin` version manually in the Gemfile(5),
and then running [bundle install(1)](bundle-install.1.html) will only update `daemons` and `eventmachine`,
but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section
of [bundle install(1)](bundle-install.1.html).
Starting with 1.14, specifying the `--conservative` option will also prevent shared
dependencies from being updated.
## PATCH LEVEL OPTIONS
Version 1.14 introduced 4 patch-level options that will influence how gem
versions are resolved. One of the following options can be used: `--patch`,
`--minor` or `--major`. `--strict` can be added to further influence resolution.
* `--patch`:
Prefer updating only to next patch version.
* `--minor`:
Prefer updating only to next minor version.
* `--major`:
Prefer updating to next major version (default).
* `--strict`:
Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`.
When Bundler is resolving what versions to use to satisfy declared
requirements in the Gemfile or in parent gems, it looks up all
available versions, filters out any versions that don't satisfy
the requirement, and then, by default, sorts them from newest to
oldest, considering them in that order.
Providing one of the patch level options (e.g. `--patch`) changes the
sort order of the satisfying versions, causing Bundler to consider the
latest `--patch` or `--minor` version available before other versions.
Note that versions outside the stated patch level could still be
resolved to if necessary to find a suitable dependency graph.
For example, if gem 'foo' is locked at 1.0.2, with no gem requirement
defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0
all exist, the default order of preference by default (`--major`) will
be "2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2".
If the `--patch` option is used, the order of preference will change to
"1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0".
If the `--minor` option is used, the order of preference will change to
"1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0".
Combining the `--strict` option with any of the patch level options
will remove any versions beyond the scope of the patch level option,
to ensure that no gem is updated that far.
To continue the previous example, if both `--patch` and `--strict`
options are used, the available versions for resolution would be
"1.0.4, 1.0.3, 1.0.2". If `--minor` and `--strict` are used, it would
be "1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2".
Gem requirements as defined in the Gemfile will still be the first
determining factor for what versions are available. If the gem
requirement for `foo` in the Gemfile is '~> 1.0', that will accomplish
the same thing as providing the `--minor` and `--strict` options.
## PATCH LEVEL EXAMPLES
Given the following gem specifications:
foo 1.4.3, requires: ~> bar 2.0
foo 1.4.4, requires: ~> bar 2.0
foo 1.4.5, requires: ~> bar 2.1
foo 1.5.0, requires: ~> bar 2.1
foo 1.5.1, requires: ~> bar 3.0
bar with versions 2.0.3, 2.0.4, 2.1.0, 2.1.1, 3.0.0
Gemfile:
gem 'foo'
Gemfile.lock:
foo (1.4.3)
bar (~> 2.0)
bar (2.0.3)
Cases:
# Command Line Result
------------------------------------------------------------
1 bundle update --patch 'foo 1.4.5', 'bar 2.1.1'
2 bundle update --patch foo 'foo 1.4.5', 'bar 2.1.1'
3 bundle update --minor 'foo 1.5.1', 'bar 3.0.0'
4 bundle update --minor --strict 'foo 1.5.0', 'bar 2.1.1'
5 bundle update --patch --strict 'foo 1.4.4', 'bar 2.0.4'
In case 1, bar is upgraded to 2.1.1, a minor version increase, because
the dependency from foo 1.4.5 required it.
In case 2, only foo is requested to be unlocked, but bar is also
allowed to move because it's not a declared dependency in the Gemfile.
In case 3, bar goes up a whole major release, because a minor increase
is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0
of bar.
In case 4, foo is preferred up to a minor version, but 1.5.1 won't work
because the --strict flag removes bar 3.0.0 from consideration since
it's a major increment.
In case 5, both foo and bar have any minor or major increments removed
from consideration because of the --strict flag, so the most they can
move is up to 1.4.4 and 2.0.4.
## RECOMMENDED WORKFLOW
In general, when working with an application managed with bundler, you should
use the following workflow:
* After you create your Gemfile(5) for the first time, run
$ bundle install
* Check the resulting `Gemfile.lock` into version control
$ git add Gemfile.lock
* When checking out this repository on another development machine, run
$ bundle install
* When checking out this repository on a deployment machine, run
$ bundle install --deployment
* After changing the Gemfile(5) to reflect a new or update dependency, run
$ bundle install
* Make sure to check the updated `Gemfile.lock` into version control
$ git add Gemfile.lock
* If [bundle install(1)](bundle-install.1.html) reports a conflict, manually update the specific
gems that you changed in the Gemfile(5)
$ bundle update rails thin
* If you want to update all the gems to the latest possible versions that
still match the gems listed in the Gemfile(5), run
$ bundle update --all
bundler-2.1.4/man/bundle-binstubs.ronn 0000644 0000041 0000041 00000002762 13606335352 017767 0 ustar www-data www-data bundle-binstubs(1) -- Install the binstubs of the listed gems
=============================================================
## SYNOPSIS
`bundle binstubs` [--force] [--path PATH] [--standalone]
## DESCRIPTION
Binstubs are scripts that wrap around executables. Bundler creates a
small Ruby file (a binstub) that loads Bundler, runs the command,
and puts it into `bin/`. Binstubs are a shortcut-or alternative-
to always using `bundle exec`. This gives you a file that can be run
directly, and one that will always run the correct gem version
used by the application.
For example, if you run `bundle binstubs rspec-core`, Bundler will create
the file `bin/rspec`. That file will contain enough code to load Bundler,
tell it to load the bundled gems, and then run rspec.
This command generates binstubs for executables in `GEM_NAME`.
Binstubs are put into `bin`, or the `--path` directory if one has been set.
Calling binstubs with [GEM [GEM]] will create binstubs for all given gems.
## OPTIONS
* `--force`:
Overwrite existing binstubs if they exist.
* `--path`:
The location to install the specified binstubs to. This defaults to `bin`.
* `--standalone`:
Makes binstubs that can work without depending on Rubygems or Bundler at
runtime.
* `--shebang`:
Specify a different shebang executable name than the default (default 'ruby')
## BUNDLE INSTALL --BINSTUBS
To create binstubs for all the gems in the bundle you can use the `--binstubs`
flag in [bundle install(1)](bundle-install.1.html).
bundler-2.1.4/man/bundle-info.ronn 0000644 0000041 0000041 00000000561 13606335352 017064 0 ustar www-data www-data bundle-info(1) -- Show information for the given gem in your bundle
=========================================================================
## SYNOPSIS
`bundle info` [GEM]
[--path]
## DESCRIPTION
Print the basic information about the provided GEM such as homepage, version,
path and summary.
## OPTIONS
* `--path`:
Print the path of the given gem
bundler-2.1.4/man/bundle-check.1.txt 0000644 0000041 0000041 00000001622 13606335352 017207 0 ustar www-data www-data BUNDLE-CHECK(1) BUNDLE-CHECK(1)
NAME
bundle-check - Verifies if dependencies are satisfied by installed gems
SYNOPSIS
bundle check [--dry-run] [--gemfile=FILE] [--path=PATH]
DESCRIPTION
check searches the local machine for each of the gems requested in the
Gemfile. If all gems are found, Bundler prints a success message and
exits with a status of 0.
If not, the first missing gem is listed and Bundler exits status 1.
OPTIONS
--dry-run
Locks the [Gemfile(5)][Gemfile(5)] before running the command.
--gemfile
Use the specified gemfile instead of the [Gemfile(5)][Gem-
file(5)].
--path Specify a different path than the system default ($BUNDLE_PATH
or $GEM_HOME). Bundler will remember this value for future
installs on this machine.
January 2020 BUNDLE-CHECK(1)
bundler-2.1.4/man/bundle-config.ronn 0000644 0000041 0000041 00000045205 13606335352 017402 0 ustar www-data www-data bundle-config(1) -- Set bundler configuration options
=====================================================
## SYNOPSIS
`bundle config` [list|get|set|unset] [ []]
## DESCRIPTION
This command allows you to interact with Bundler's configuration system.
Bundler loads configuration settings in this order:
1. Local config (`app/.bundle/config`)
2. Environmental variables (`ENV`)
3. Global config (`~/.bundle/config`)
4. Bundler default config
Executing `bundle config list` with will print a list of all bundler
configuration for the current bundle, and where that configuration
was set.
Executing `bundle config get ` will print the value of that configuration
setting, and where it was set.
Executing `bundle config set ` will set that configuration to the
value specified for all bundles executed as the current user. The configuration
will be stored in `~/.bundle/config`. If already is set, will be
overridden and user will be warned.
Executing `bundle config set --global ` works the same as above.
Executing `bundle config set --local ` will set that configuration to
the local application. The configuration will be stored in `app/.bundle/config`.
Executing `bundle config unset ` will delete the configuration in both
local and global sources.
Executing `bundle config unset --global ` will delete the configuration
only from the user configuration.
Executing `bundle config unset --local ` will delete the
configuration only from the local application.
Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will
cause it to ignore all configuration.
Executing `bundle config set disable_multisource true` upgrades the warning about
the Gemfile containing multiple primary sources to an error. Executing `bundle
config unset disable_multisource` downgrades this error to a warning.
## REMEMBERING OPTIONS
Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or
`--without production`, are remembered between commands and saved to your local
application's configuration (normally, `./.bundle/config`).
However, this will be changed in bundler 3, so it's better not to rely on this
behavior. If these options must be remembered, it's better to set them using
`bundle config` (e.g., `bundle config set path foo`).
The options that can be configured are:
* `bin`:
Creates a directory (defaults to `~/bin`) and place any executables from the
gem there. These executables run in Bundler's context. If used, you might add
this directory to your environment's `PATH` variable. For instance, if the
`rails` gem comes with a `rails` executable, this flag will create a
`bin/rails` executable that ensures that all referred dependencies will be
resolved using the bundled gems.
* `deployment`:
In deployment mode, Bundler will 'roll-out' the bundle for
`production` use. Please check carefully if you want to have this option
enabled in `development` or `test` environments.
* `path`:
The location to install the specified gems to. This defaults to Rubygems'
setting. Bundler shares this location with Rubygems, `gem install ...` will
have gem installed there, too. Therefore, gems installed without a
`--path ...` setting will show up by calling `gem list`. Accordingly, gems
installed to other locations will not get listed.
* `without`:
A space-separated list of groups referencing gems to skip during installation.
* `with`:
A space-separated list of groups referencing gems to include during installation.
## BUILD OPTIONS
You can use `bundle config` to give Bundler the flags to pass to the gem
installer every time bundler tries to install a particular gem.
A very common example, the `mysql` gem, requires Snow Leopard users to
pass configuration flags to `gem install` to specify where to find the
`mysql_config` executable.
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Since the specific location of that executable can change from machine
to machine, you can specify these flags on a per-machine basis.
bundle config set build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
After running this command, every time bundler needs to install the
`mysql` gem, it will pass along the flags you specified.
## CONFIGURATION KEYS
Configuration keys in bundler have two forms: the canonical form and the
environment variable form.
For instance, passing the `--without` flag to [bundle install(1)](bundle-install.1.html)
prevents Bundler from installing certain groups specified in the Gemfile(5). Bundler
persists this value in `app/.bundle/config` so that calls to `Bundler.setup`
do not try to find gems from the `Gemfile` that you didn't install. Additionally,
subsequent calls to [bundle install(1)](bundle-install.1.html) remember this setting
and skip those groups.
The canonical form of this configuration is `"without"`. To convert the canonical
form to the environment variable form, capitalize it, and prepend `BUNDLE_`. The
environment variable form of `"without"` is `BUNDLE_WITHOUT`.
Any periods in the configuration keys must be replaced with two underscores when
setting it via environment variables. The configuration key `local.rack` becomes
the environment variable `BUNDLE_LOCAL__RACK`.
## LIST OF AVAILABLE KEYS
The following is a list of all configuration keys and their purpose. You can
learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `allow_bundler_dependency_conflicts` (`BUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS`):
Allow resolving to specifications that have dependencies on `bundler` that
are incompatible with the running Bundler version.
* `allow_deployment_source_credential_changes` (`BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES`):
When in deployment mode, allow changing the credentials to a gem's source.
Ex: `https://some.host.com/gems/path/` -> `https://user_name:password@some.host.com/gems/path`
* `allow_offline_install` (`BUNDLE_ALLOW_OFFLINE_INSTALL`):
Allow Bundler to use cached data when installing without network access.
* `auto_clean_without_path` (`BUNDLE_AUTO_CLEAN_WITHOUT_PATH`):
Automatically run `bundle clean` after installing when an explicit `path`
has not been set and Bundler is not installing into the system gems.
* `auto_install` (`BUNDLE_AUTO_INSTALL`):
Automatically run `bundle install` when gems are missing.
* `bin` (`BUNDLE_BIN`):
Install executables from gems in the bundle to the specified directory.
Defaults to `false`.
* `cache_all` (`BUNDLE_CACHE_ALL`):
Cache all gems, including path and git gems.
* `cache_all_platforms` (`BUNDLE_CACHE_ALL_PLATFORMS`):
Cache gems for all platforms.
* `cache_path` (`BUNDLE_CACHE_PATH`):
The directory that bundler will place cached gems in when running
bundle package
, and that bundler will look in when installing gems.
Defaults to `vendor/cache`.
* `clean` (`BUNDLE_CLEAN`):
Whether Bundler should run `bundle clean` automatically after
`bundle install`.
* `console` (`BUNDLE_CONSOLE`):
The console that `bundle console` starts. Defaults to `irb`.
* `default_install_uses_path` (`BUNDLE_DEFAULT_INSTALL_USES_PATH`):
Whether a `bundle install` without an explicit `--path` argument defaults
to installing gems in `.bundle`.
* `deployment` (`BUNDLE_DEPLOYMENT`):
Disallow changes to the `Gemfile`. When the `Gemfile` is changed and the
lockfile has not been updated, running Bundler commands will be blocked.
* `disable_checksum_validation` (`BUNDLE_DISABLE_CHECKSUM_VALIDATION`):
Allow installing gems even if they do not match the checksum provided by
RubyGems.
* `disable_exec_load` (`BUNDLE_DISABLE_EXEC_LOAD`):
Stop Bundler from using `load` to launch an executable in-process in
`bundle exec`.
* `disable_local_branch_check` (`BUNDLE_DISABLE_LOCAL_BRANCH_CHECK`):
Allow Bundler to use a local git override without a branch specified in the
Gemfile.
* `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`):
When set, Gemfiles containing multiple sources will produce errors
instead of warnings.
Use `bundle config unset disable_multisource` to unset.
* `disable_platform_warnings` (`BUNDLE_DISABLE_PLATFORM_WARNINGS`):
Disable warnings during bundle install when a dependency is unused on the current platform.
* `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`):
Stop Bundler from accessing gems installed to RubyGems' normal location.
* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
Stop Bundler from checking if a newer Bundler version is available on
rubygems.org.
* `force_ruby_platform` (`BUNDLE_FORCE_RUBY_PLATFORM`):
Ignore the current machine's platform and install only `ruby` platform gems.
As a result, gems with native extensions will be compiled from source.
* `frozen` (`BUNDLE_FROZEN`):
Disallow changes to the `Gemfile`. When the `Gemfile` is changed and the
lockfile has not been updated, running Bundler commands will be blocked.
Defaults to `true` when `--deployment` is used.
* `gem.push_key` (`BUNDLE_GEM__PUSH_KEY`):
Sets the `--key` parameter for `gem push` when using the `rake release`
command with a private gemstash server.
* `gemfile` (`BUNDLE_GEMFILE`):
The name of the file that bundler should use as the `Gemfile`. This location
of this file also sets the root of the project, which is used to resolve
relative paths in the `Gemfile`, among other things. By default, bundler
will search up from the current working directory until it finds a
`Gemfile`.
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
Whether Bundler should cache all gems globally, rather than locally to the
installing Ruby installation.
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): When set, no post install
messages will be printed. To silence a single gem, use dot notation like
`ignore_messages.httparty true`.
* `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`)
Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
* `jobs` (`BUNDLE_JOBS`):
The number of gems Bundler can install in parallel. Defaults to 1.
* `no_install` (`BUNDLE_NO_INSTALL`):
Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`):
Whether Bundler should leave outdated gems unpruned when caching.
* `only_update_to_newer_versions` (`BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS`):
During `bundle update`, only resolve to newer versions of the gems in the
lockfile.
* `path` (`BUNDLE_PATH`):
The location on disk where all gems in your bundle will be located regardless
of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location
will be installed by `bundle install`. Defaults to `Gem.dir`. When --deployment
is used, defaults to vendor/bundle.
* `path.system` (`BUNDLE_PATH__SYSTEM`):
Whether Bundler will install gems into the default system path (`Gem.dir`).
* `path_relative_to_cwd` (`BUNDLE_PATH_RELATIVE_TO_CWD`)
Makes `--path` relative to the CWD instead of the `Gemfile`.
* `plugins` (`BUNDLE_PLUGINS`):
Enable Bundler's experimental plugin system.
* `prefer_patch` (BUNDLE_PREFER_PATCH):
Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`.
* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`)
Print only version number from `bundler --version`.
* `redirect` (`BUNDLE_REDIRECT`):
The number of redirects allowed for network requests. Defaults to `5`.
* `retry` (`BUNDLE_RETRY`):
The number of times to retry failed network requests. Defaults to `3`.
* `setup_makes_kernel_gem_public` (`BUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC`):
Have `Bundler.setup` make the `Kernel#gem` method public, even though
RubyGems declares it as private.
* `shebang` (`BUNDLE_SHEBANG`):
The program name that should be invoked for generated binstubs. Defaults to
the ruby install name used to generate the binstub.
* `silence_deprecations` (`BUNDLE_SILENCE_DEPRECATIONS`):
Whether Bundler should silence deprecation warnings for behavior that will
be changed in the next major version.
* `silence_root_warning` (`BUNDLE_SILENCE_ROOT_WARNING`):
Silence the warning Bundler prints when installing gems as root.
* `skip_default_git_sources` (`BUNDLE_SKIP_DEFAULT_GIT_SOURCES`):
Whether Bundler should skip adding default git source shortcuts to the
Gemfile DSL.
* `specific_platform` (`BUNDLE_SPECIFIC_PLATFORM`):
Allow bundler to resolve for the specific running platform and store it in
the lockfile, instead of only using a generic platform.
A specific platform is the exact platform triple reported by
`Gem::Platform.local`, such as `x86_64-darwin-16` or `universal-java-1.8`.
On the other hand, generic platforms are those such as `ruby`, `mswin`, or
`java`. In this example, `x86_64-darwin-16` would map to `ruby` and
`universal-java-1.8` to `java`.
* `ssl_ca_cert` (`BUNDLE_SSL_CA_CERT`):
Path to a designated CA certificate file or folder containing multiple
certificates for trusted CAs in PEM format.
* `ssl_client_cert` (`BUNDLE_SSL_CLIENT_CERT`):
Path to a designated file containing a X.509 client certificate
and key in PEM format.
* `ssl_verify_mode` (`BUNDLE_SSL_VERIFY_MODE`):
The SSL verification mode Bundler uses when making HTTPS requests.
Defaults to verify peer.
* `suppress_install_using_messages` (`BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES`):
Avoid printing `Using ...` messages during installation when the version of
a gem has not changed.
* `system_bindir` (`BUNDLE_SYSTEM_BINDIR`):
The location where RubyGems installs binstubs. Defaults to `Gem.bindir`.
* `timeout` (`BUNDLE_TIMEOUT`):
The seconds allowed before timing out for network requests. Defaults to `10`.
* `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`):
Whether running `bundle update --source NAME` unlocks a gem with the given
name. Defaults to `true`.
* `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`)
Require passing `--all` to `bundle update` when everything should be updated,
and disallow passing no options to `bundle update`.
* `user_agent` (`BUNDLE_USER_AGENT`):
The custom user agent fragment Bundler includes in API requests.
* `with` (`BUNDLE_WITH`):
A `:`-separated list of groups whose gems bundler should install.
* `without` (`BUNDLE_WITHOUT`):
A `:`-separated list of groups whose gems bundler should not install.
In general, you should set these settings per-application by using the applicable
flag to the [bundle install(1)](bundle-install.1.html) or [bundle package(1)](bundle-package.1.html) command.
You can set them globally either via environment variables or `bundle config`,
whichever is preferable for your setup. If you use both, environment variables
will take preference over global settings.
## LOCAL GIT REPOS
Bundler also allows you to work against a git repository locally
instead of using the remote version. This can be achieved by setting
up a local override:
bundle config set local.GEM_NAME /path/to/local/git/repository
For example, in order to use a local Rack repository, a developer could call:
bundle config set local.rack ~/Work/git/rack
Now instead of checking out the remote git repository, the local
override will be used. Similar to a path source, every time the local
git repository change, changes will be automatically picked up by
Bundler. This means a commit in the local git repo will update the
revision in the `Gemfile.lock` to the local git repo revision. This
requires the same attention as git submodules. Before pushing to
the remote, you need to ensure the local override was pushed, otherwise
you may point to a commit that only exists in your local machine.
You'll also need to CGI escape your usernames and passwords as well.
Bundler does many checks to ensure a developer won't work with
invalid references. Particularly, we force a developer to specify
a branch in the `Gemfile` in order to use this feature. If the branch
specified in the `Gemfile` and the current branch in the local git
repository do not match, Bundler will abort. This ensures that
a developer is always working against the correct branches, and prevents
accidental locking to a different branch.
Finally, Bundler also ensures that the current revision in the
`Gemfile.lock` exists in the local git repository. By doing this, Bundler
forces you to fetch the latest changes in the remotes.
## MIRRORS OF GEM SOURCES
Bundler supports overriding gem sources with mirrors. This allows you to
configure rubygems.org as the gem source in your Gemfile while still using your
mirror to fetch gems.
bundle config set mirror.SOURCE_URL MIRROR_URL
For example, to use a mirror of rubygems.org hosted at rubygems-mirror.org:
bundle config set mirror.http://rubygems.org http://rubygems-mirror.org
Each mirror also provides a fallback timeout setting. If the mirror does not
respond within the fallback timeout, Bundler will try to use the original
server instead of the mirror.
bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
For example, to fall back to rubygems.org after 3 seconds:
bundle config set mirror.https://rubygems.org.fallback_timeout 3
The default fallback timeout is 0.1 seconds, but the setting can currently
only accept whole seconds (for example, 1, 15, or 30).
## CREDENTIALS FOR GEM SOURCES
Bundler allows you to configure credentials for any gem source, which allows
you to avoid putting secrets into your Gemfile.
bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
For example, to save the credentials of user `claudette` for the gem source at
`gems.longerous.com`, you would run:
bundle config set gems.longerous.com claudette:s00pers3krit
Or you can set the credentials as an environment variable like this:
export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
For gems with a git source with HTTP(S) URL you can specify credentials like so:
bundle config set https://github.com/bundler/bundler.git username:password
Or you can set the credentials as an environment variable like so:
export BUNDLE_GITHUB__COM=username:password
This is especially useful for private repositories on hosts such as Github,
where you can use personal OAuth tokens:
export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
## CONFIGURE BUNDLER DIRECTORIES
Bundler's home, config, cache and plugin directories are able to be configured
through environment variables. The default location for Bundler's home directory is
`~/.bundle`, which all directories inherit from by default. The following
outlines the available environment variables and their default values
BUNDLE_USER_HOME : $HOME/.bundle
BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
bundler-2.1.4/man/bundle-open.1.txt 0000644 0000041 0000041 00000000752 13606335352 017076 0 ustar www-data www-data BUNDLE-OPEN(1) BUNDLE-OPEN(1)
NAME
bundle-open - Opens the source directory for a gem in your bundle
SYNOPSIS
bundle open [GEM]
DESCRIPTION
Opens the source directory of the provided GEM in your editor.
For this to work the EDITOR or BUNDLER_EDITOR environment variable has
to be set.
Example:
bundle open 'rack'
Will open the source directory for the 'rack' gem in your bundle.
January 2020 BUNDLE-OPEN(1)
bundler-2.1.4/man/bundle-show.ronn 0000644 0000041 0000041 00000001124 13606335352 017105 0 ustar www-data www-data bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem
=========================================================================
## SYNOPSIS
`bundle show` [GEM]
[--paths]
## DESCRIPTION
Without the [GEM] option, `show` will print a list of the names and versions of
all gems that are required by your [`Gemfile(5)`][Gemfile(5)], sorted by name.
Calling show with [GEM] will list the exact location of that gem on your
machine.
## OPTIONS
* `--paths`:
List the paths of all gems that are required by your [`Gemfile(5)`][Gemfile(5)],
sorted by gem name.
bundler-2.1.4/man/bundle.1.txt 0000644 0000041 0000041 00000006445 13606335352 016144 0 ustar www-data www-data BUNDLE(1) BUNDLE(1)
NAME
bundle - Ruby Dependency Management
SYNOPSIS
bundle COMMAND [--no-color] [--verbose] [ARGS]
DESCRIPTION
Bundler manages an application's dependencies through its entire life
across many machines systematically and repeatably.
See the bundler website https://bundler.io for information on getting
started, and Gemfile(5) for more information on the Gemfile format.
OPTIONS
--no-color
Print all output without color
--retry, -r
Specify the number of times you wish to attempt network commands
--verbose, -V
Print out additional logging information
BUNDLE COMMANDS
We divide bundle subcommands into primary commands and utilities:
PRIMARY COMMANDS
bundle install(1) bundle-install.1.html
Install the gems specified by the Gemfile or Gemfile.lock
bundle update(1) bundle-update.1.html
Update dependencies to their latest versions
bundle package(1) bundle-package.1.html
Package the .gem files required by your application into the
vendor/cache directory
bundle exec(1) bundle-exec.1.html
Execute a script in the current bundle
bundle config(1) bundle-config.1.html
Specify and read configuration options for Bundler
bundle help(1)
Display detailed help for each subcommand
UTILITIES
bundle add(1) bundle-add.1.html
Add the named gem to the Gemfile and run bundle install
bundle binstubs(1) bundle-binstubs.1.html
Generate binstubs for executables in a gem
bundle check(1) bundle-check.1.html
Determine whether the requirements for your application are
installed and available to Bundler
bundle show(1) bundle-show.1.html
Show the source location of a particular gem in the bundle
bundle outdated(1) bundle-outdated.1.html
Show all of the outdated gems in the current bundle
bundle console(1)
Start an IRB session in the current bundle
bundle open(1) bundle-open.1.html
Open an installed gem in the editor
bundle lock(1) bundle-lock.1.html
Generate a lockfile for your dependencies
bundle viz(1) bundle-viz.1.html
Generate a visual representation of your dependencies
bundle init(1) bundle-init.1.html
Generate a simple Gemfile, placed in the current directory
bundle gem(1) bundle-gem.1.html
Create a simple gem, suitable for development with Bundler
bundle platform(1) bundle-platform.1.html
Display platform compatibility information
bundle clean(1) bundle-clean.1.html
Clean up unused gems in your Bundler directory
bundle doctor(1) bundle-doctor.1.html
Display warnings about common problems
bundle remove(1) bundle-remove.1.html
Removes gems from the Gemfile
PLUGINS
When running a command that isn't listed in PRIMARY COMMANDS or UTILI-
TIES, Bundler will try to find an executable on your path named
bundler- and execute it, passing down any extra arguments to
it.
OBSOLETE
These commands are obsolete and should no longer be used:
o bundle cache(1)
o bundle show(1)
January 2020 BUNDLE(1)
bundler-2.1.4/man/bundle-list.ronn 0000644 0000041 0000041 00000001276 13606335352 017110 0 ustar www-data www-data bundle-list(1) -- List all the gems in the bundle
=========================================================================
## SYNOPSIS
`bundle list` [--name-only] [--paths] [--without-group=GROUP] [--only-group=GROUP]
## DESCRIPTION
Prints a list of all the gems in the bundle including their version.
Example:
bundle list --name-only
bundle list --paths
bundle list --without-group test
bundle list --only-group dev
bundle list --only-group dev --paths
## OPTIONS
* `--name-only`:
Print only the name of each gem.
* `--paths`:
Print the path to each gem in the bundle.
* `--without-group`:
Print all gems expect from a group.
* `--only-group`:
Print gems from a particular group.
bundler-2.1.4/man/bundle-init.1.txt 0000644 0000041 0000041 00000002010 13606335352 017065 0 ustar www-data www-data BUNDLE-INIT(1) BUNDLE-INIT(1)
NAME
bundle-init - Generates a Gemfile into the current working directory
SYNOPSIS
bundle init [--gemspec=FILE]
DESCRIPTION
Init generates a default [Gemfile(5)][Gemfile(5)] in the current work-
ing directory. When adding a [Gemfile(5)][Gemfile(5)] to a gem with a
gemspec, the --gemspec option will automatically add each dependency
listed in the gemspec file to the newly created [Gemfile(5)][Gem-
file(5)].
OPTIONS
--gemspec
Use the specified .gemspec to create the [Gemfile(5)][Gem-
file(5)]
FILES
Included in the default [Gemfile(5)][Gemfile(5)] generated is the line
# frozen_string_literal: true. This is a magic comment supported for
the first time in Ruby 2.3. The presence of this line results in all
string literals in the file being implicitly frozen.
SEE ALSO
Gemfile(5) https://bundler.io/man/gemfile.5.html
January 2020 BUNDLE-INIT(1)
bundler-2.1.4/man/bundle-platform.1.txt 0000644 0000041 0000041 00000002351 13606335352 017756 0 ustar www-data www-data BUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1)
NAME
bundle-platform - Displays platform compatibility information
SYNOPSIS
bundle platform [--ruby]
DESCRIPTION
platform will display information from your Gemfile, Gemfile.lock, and
Ruby VM about your platform.
For instance, using this Gemfile(5):
source "https://rubygems.org"
ruby "1.9.3"
gem "rack"
If you run bundle platform on Ruby 1.9.3, it will display the following
output:
Your platform is: x86_64-linux
Your app has gems that work on these platforms:
* ruby
Your Gemfile specifies a Ruby version requirement:
* ruby 1.9.3
Your current platform satisfies the Ruby version requirement.
platform will list all the platforms in your Gemfile.lock as well as
the ruby directive if applicable from your Gemfile(5). It will also let
you know if the ruby directive requirement has been met. If ruby direc-
tive doesn't match the running Ruby VM, it will tell you what part does
not.
OPTIONS
--ruby It will display the ruby directive information, so you don't
have to parse it from the Gemfile(5).
January 2020 BUNDLE-PLATFORM(1)
bundler-2.1.4/man/bundle-check.1 0000644 0000041 0000041 00000001705 13606335352 016373 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CHECK" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
.
.SH "SYNOPSIS"
\fBbundle check\fR [\-\-dry\-run] [\-\-gemfile=FILE] [\-\-path=PATH]
.
.SH "DESCRIPTION"
\fBcheck\fR searches the local machine for each of the gems requested in the Gemfile\. If all gems are found, Bundler prints a success message and exits with a status of 0\.
.
.P
If not, the first missing gem is listed and Bundler exits status 1\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-dry\-run\fR
Locks the [\fBGemfile(5)\fR][Gemfile(5)] before running the command\.
.
.TP
\fB\-\-gemfile\fR
Use the specified gemfile instead of the [\fBGemfile(5)\fR][Gemfile(5)]\.
.
.TP
\fB\-\-path\fR
Specify a different path than the system default (\fB$BUNDLE_PATH\fR or \fB$GEM_HOME\fR)\. Bundler will remember this value for future installs on this machine\.
bundler-2.1.4/man/bundle-doctor.ronn 0000644 0000041 0000041 00000001717 13606335352 017427 0 ustar www-data www-data bundle-doctor(1) -- Checks the bundle for common problems
=========================================================
## SYNOPSIS
`bundle doctor` [--quiet]
[--gemfile=GEMFILE]
## DESCRIPTION
Checks your Gemfile and gem environment for common problems. If issues
are detected, Bundler prints them and exits status 1. Otherwise,
Bundler prints a success message and exits status 0.
Examples of common problems caught by bundle-doctor include:
* Invalid Bundler settings
* Mismatched Ruby versions
* Mismatched platforms
* Uninstalled gems
* Missing dependencies
## OPTIONS
* `--quiet`:
Only output warnings and errors.
* `--gemfile=`:
The location of the Gemfile(5) which Bundler should use. This defaults
to a Gemfile(5) in the current working directory. In general, Bundler
will assume that the location of the Gemfile(5) is also the project's
root and will try to find `Gemfile.lock` and `vendor/cache` relative
to this location.
bundler-2.1.4/man/bundle-install.1 0000644 0000041 0000041 00000041161 13606335352 016764 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INSTALL" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
.
.SH "SYNOPSIS"
\fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-quiet] [\-\-redownload] [\-\-retry=NUMBER] [\-\-shebang] [\-\-standalone[=GROUP[ GROUP\.\.\.]]] [\-\-system] [\-\-trust\-policy=POLICY] [\-\-with=GROUP[ GROUP\.\.\.]] [\-\-without=GROUP[ GROUP\.\.\.]]
.
.SH "DESCRIPTION"
Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\.
.
.P
If a \fBGemfile\.lock\fR does exist, and you have not updated your Gemfile(5), Bundler will fetch all remote sources, but use the dependencies specified in the \fBGemfile\.lock\fR instead of resolving dependencies\.
.
.P
If a \fBGemfile\.lock\fR does exist, and you have updated your Gemfile(5), Bundler will use the dependencies in the \fBGemfile\.lock\fR for all gems that you did not update, but will re\-resolve the dependencies of gems that you did update\. You can find more information about this update process below under \fICONSERVATIVE UPDATING\fR\.
.
.SH "OPTIONS"
To apply any of \fB\-\-binstubs\fR, \fB\-\-deployment\fR, \fB\-\-path\fR, or \fB\-\-without\fR every time \fBbundle install\fR is run, use \fBbundle config\fR (see bundle\-config(1))\.
.
.TP
\fB\-\-binstubs[=]\fR
Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it in \fBbin/\fR\. This lets you link the binstub inside of an application to the exact gem version the application needs\.
.
.IP
Creates a directory (defaults to \fB~/bin\fR) and places any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\.
.
.TP
\fB\-\-clean\fR
On finishing the installation Bundler is going to remove any gems not present in the current Gemfile(5)\. Don\'t worry, gems currently in use will not be removed\.
.
.TP
\fB\-\-deployment\fR
In \fIdeployment mode\fR, Bundler will \'roll\-out\' the bundle for production or CI use\. Please check carefully if you want to have this option enabled in your development environment\.
.
.TP
\fB\-\-redownload\fR
Force download every gem, even if the required versions are already available locally\.
.
.TP
\fB\-\-frozen\fR
Do not allow the Gemfile\.lock to be updated after this install\. Exits non\-zero if there are going to be changes to the Gemfile\.lock\.
.
.TP
\fB\-\-full\-index\fR
Bundler will not call Rubygems\' API endpoint (default) but download and cache a (currently big) index file of all gems\. Performance can be improved for large bundles that seldom change by enabling this option\.
.
.TP
\fB\-\-gemfile=\fR
The location of the Gemfile(5) which Bundler should use\. This defaults to a Gemfile(5) in the current working directory\. In general, Bundler will assume that the location of the Gemfile(5) is also the project\'s root and will try to find \fBGemfile\.lock\fR and \fBvendor/cache\fR relative to this location\.
.
.TP
\fB\-\-jobs=[]\fR, \fB\-j[]\fR
The maximum number of parallel download and install jobs\. The default is \fB1\fR\.
.
.TP
\fB\-\-local\fR
Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\.
.
.TP
\fB\-\-no\-cache\fR
Do not update the cache in \fBvendor/cache\fR with the newly bundled gems\. This does not remove any gems in the cache but keeps the newly bundled gems from being cached during the install\.
.
.TP
\fB\-\-no\-prune\fR
Don\'t remove stale gems from the cache when the installation finishes\.
.
.TP
\fB\-\-path=\fR
The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accordingly, gems installed to other locations will not get listed\.
.
.TP
\fB\-\-quiet\fR
Do not print progress information to the standard output\. Instead, Bundler will exit using a status code (\fB$?\fR)\.
.
.TP
\fB\-\-retry=[]\fR
Retry failed network or git requests for \fInumber\fR times\.
.
.TP
\fB\-\-shebang=\fR
Uses the specified ruby executable (usually \fBruby\fR) to execute the scripts created with \fB\-\-binstubs\fR\. In addition, if you use \fB\-\-binstubs\fR together with \fB\-\-shebang jruby\fR these executables will be changed to execute \fBjruby\fR instead\.
.
.TP
\fB\-\-standalone[=]\fR
Makes a bundle that can work without depending on Rubygems or Bundler at runtime\. A space separated list of groups to install has to be specified\. Bundler creates a directory named \fBbundle\fR and installs the bundle there\. It also generates a \fBbundle/bundler/setup\.rb\fR file to replace Bundler\'s own setup in the manner required\. Using this option implicitly sets \fBpath\fR, which is a [remembered option][REMEMBERED OPTIONS]\.
.
.TP
\fB\-\-system\fR
Installs the gems specified in the bundle to the system\'s Rubygems location\. This overrides any previous configuration of \fB\-\-path\fR\.
.
.TP
\fB\-\-trust\-policy=[]\fR
Apply the Rubygems security policy \fIpolicy\fR, where policy is one of \fBHighSecurity\fR, \fBMediumSecurity\fR, \fBLowSecurity\fR, \fBAlmostNoSecurity\fR, or \fBNoSecurity\fR\. For more details, please see the Rubygems signing documentation linked below in \fISEE ALSO\fR\.
.
.TP
\fB\-\-with=\fR
A space\-separated list of groups referencing gems to install\. If an optional group is given it is installed\. If a group is given that is in the remembered list of groups given to \-\-without, it is removed from that list\.
.
.TP
\fB\-\-without=\fR
A space\-separated list of groups referencing gems to skip during installation\. If a group is given that is in the remembered list of groups given to \-\-with, it is removed from that list\.
.
.SH "DEPLOYMENT MODE"
Bundler\'s defaults are optimized for development\. To switch to defaults optimized for deployment and for CI, use the \fB\-\-deployment\fR flag\. Do not activate deployment mode on development machines, as it will cause an error when the Gemfile(5) is modified\.
.
.IP "1." 4
A \fBGemfile\.lock\fR is required\.
.
.IP
To ensure that the same versions of the gems you developed with and tested with are also used in deployments, a \fBGemfile\.lock\fR is required\.
.
.IP
This is mainly to ensure that you remember to check your \fBGemfile\.lock\fR into version control\.
.
.IP "2." 4
The \fBGemfile\.lock\fR must be up to date
.
.IP
In development, you can modify your Gemfile(5) and re\-run \fBbundle install\fR to \fIconservatively update\fR your \fBGemfile\.lock\fR snapshot\.
.
.IP
In deployment, your \fBGemfile\.lock\fR should be up\-to\-date with changes made in your Gemfile(5)\.
.
.IP "3." 4
Gems are installed to \fBvendor/bundle\fR not your default system location
.
.IP
In development, it\'s convenient to share the gems used in your application with other applications and other scripts that run on the system\.
.
.IP
In deployment, isolation is a more important default\. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them\.
.
.IP
As a result, \fBbundle install \-\-deployment\fR installs gems to the \fBvendor/bundle\fR directory in the application\. This may be overridden using the \fB\-\-path\fR option\.
.
.IP "" 0
.
.SH "SUDO USAGE"
By default, Bundler installs gems to the same location as \fBgem install\fR\.
.
.P
In some cases, that location may not be writable by your Unix user\. In that case, Bundler will stage everything in a temporary directory, then ask you for your \fBsudo\fR password in order to copy the gems into their system location\.
.
.P
From your perspective, this is identical to installing the gems directly into the system\.
.
.P
You should never use \fBsudo bundle install\fR\. This is because several other steps in \fBbundle install\fR must be performed as the current user:
.
.IP "\(bu" 4
Updating your \fBGemfile\.lock\fR
.
.IP "\(bu" 4
Updating your \fBvendor/cache\fR, if necessary
.
.IP "\(bu" 4
Checking out private git repositories using your user\'s SSH keys
.
.IP "" 0
.
.P
Of these three, the first two could theoretically be performed by \fBchown\fRing the resulting files to \fB$SUDO_USER\fR\. The third, however, can only be performed by invoking the \fBgit\fR command as the current user\. Therefore, git gems are downloaded and installed into \fB~/\.bundle\fR rather than $GEM_HOME or $BUNDLE_PATH\.
.
.P
As a result, you should run \fBbundle install\fR as the current user, and Bundler will ask for your password if it is needed to put the gems into their final location\.
.
.SH "INSTALLING GROUPS"
By default, \fBbundle install\fR will install all gems in all groups in your Gemfile(5), except those declared for a different platform\.
.
.P
However, you can explicitly tell Bundler to skip installing certain groups with the \fB\-\-without\fR option\. This option takes a space\-separated list of groups\.
.
.P
While the \fB\-\-without\fR option will skip \fIinstalling\fR the gems in the specified groups, it will still \fIdownload\fR those gems and use them to resolve the dependencies of every gem in your Gemfile(5)\.
.
.P
This is so that installing a different set of groups on another machine (such as a production server) will not change the gems and versions that you have already developed and tested against\.
.
.P
\fBBundler offers a rock\-solid guarantee that the third\-party code you are running in development and testing is also the third\-party code you are running in production\. You can choose to exclude some of that code in different environments, but you will never be caught flat\-footed by different versions of third\-party code being used in different environments\.\fR
.
.P
For a simple illustration, consider the following Gemfile(5):
.
.IP "" 4
.
.nf
source \'https://rubygems\.org\'
gem \'sinatra\'
group :production do
gem \'rack\-perftools\-profiler\'
end
.
.fi
.
.IP "" 0
.
.P
In this case, \fBsinatra\fR depends on any version of Rack (\fB>= 1\.0\fR), while \fBrack\-perftools\-profiler\fR depends on 1\.x (\fB~> 1\.0\fR)\.
.
.P
When you run \fBbundle install \-\-without production\fR in development, we look at the dependencies of \fBrack\-perftools\-profiler\fR as well\. That way, you do not spend all your time developing against Rack 2\.0, using new APIs unavailable in Rack 1\.x, only to have Bundler switch to Rack 1\.2 when the \fBproduction\fR group \fIis\fR used\.
.
.P
This should not cause any problems in practice, because we do not attempt to \fBinstall\fR the gems in the excluded groups, and only evaluate as part of the dependency resolution process\.
.
.P
This also means that you cannot include different versions of the same gem in different groups, because doing so would result in different sets of dependencies used in development and production\. Because of the vagaries of the dependency resolution process, this usually affects more than the gems you list in your Gemfile(5), and can (surprisingly) radically change the gems you are using\.
.
.SH "THE GEMFILE\.LOCK"
When you run \fBbundle install\fR, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called \fBGemfile\.lock\fR\.
.
.P
Bundler uses this file in all subsequent calls to \fBbundle install\fR, which guarantees that you always use the same exact code, even as your application moves across machines\.
.
.P
Because of the way dependency resolution works, even a seemingly small change (for instance, an update to a point\-release of a dependency of a gem in your Gemfile(5)) can result in radically different gems being needed to satisfy all dependencies\.
.
.P
As a result, you \fBSHOULD\fR check your \fBGemfile\.lock\fR into version control, in both applications and gems\. If you do not, every machine that checks out your repository (including your production server) will resolve all dependencies again, which will result in different versions of third\-party code being used if \fBany\fR of the gems in the Gemfile(5) or any of their dependencies have been updated\.
.
.P
When Bundler first shipped, the \fBGemfile\.lock\fR was included in the \fB\.gitignore\fR file included with generated gems\. Over time, however, it became clear that this practice forces the pain of broken dependencies onto new contributors, while leaving existing contributors potentially unaware of the problem\. Since \fBbundle install\fR is usually the first step towards a contribution, the pain of broken dependencies would discourage new contributors from contributing\. As a result, we have revised our guidance for gem authors to now recommend checking in the lock for gems\.
.
.SH "CONSERVATIVE UPDATING"
When you make a change to the Gemfile(5) and then run \fBbundle install\fR, Bundler will update only the gems that you modified\.
.
.P
In other words, if a gem that you \fBdid not modify\fR worked before you called \fBbundle install\fR, it will continue to use the exact same versions of all dependencies as it used before the update\.
.
.P
Let\'s take a look at an example\. Here\'s your original Gemfile(5):
.
.IP "" 4
.
.nf
source \'https://rubygems\.org\'
gem \'actionpack\', \'2\.3\.8\'
gem \'activemerchant\'
.
.fi
.
.IP "" 0
.
.P
In this case, both \fBactionpack\fR and \fBactivemerchant\fR depend on \fBactivesupport\fR\. The \fBactionpack\fR gem depends on \fBactivesupport 2\.3\.8\fR and \fBrack ~> 1\.1\.0\fR, while the \fBactivemerchant\fR gem depends on \fBactivesupport >= 2\.3\.2\fR, \fBbraintree >= 2\.0\.0\fR, and \fBbuilder >= 2\.0\.0\fR\.
.
.P
When the dependencies are first resolved, Bundler will select \fBactivesupport 2\.3\.8\fR, which satisfies the requirements of both gems in your Gemfile(5)\.
.
.P
Next, you modify your Gemfile(5) to:
.
.IP "" 4
.
.nf
source \'https://rubygems\.org\'
gem \'actionpack\', \'3\.0\.0\.rc\'
gem \'activemerchant\'
.
.fi
.
.IP "" 0
.
.P
The \fBactionpack 3\.0\.0\.rc\fR gem has a number of new dependencies, and updates the \fBactivesupport\fR dependency to \fB= 3\.0\.0\.rc\fR and the \fBrack\fR dependency to \fB~> 1\.2\.1\fR\.
.
.P
When you run \fBbundle install\fR, Bundler notices that you changed the \fBactionpack\fR gem, but not the \fBactivemerchant\fR gem\. It evaluates the gems currently being used to satisfy its requirements:
.
.TP
\fBactivesupport 2\.3\.8\fR
also used to satisfy a dependency in \fBactivemerchant\fR, which is not being updated
.
.TP
\fBrack ~> 1\.1\.0\fR
not currently being used to satisfy another dependency
.
.P
Because you did not explicitly ask to update \fBactivemerchant\fR, you would not expect it to suddenly stop working after updating \fBactionpack\fR\. However, satisfying the new \fBactivesupport 3\.0\.0\.rc\fR dependency of actionpack requires updating one of its dependencies\.
.
.P
Even though \fBactivemerchant\fR declares a very loose dependency that theoretically matches \fBactivesupport 3\.0\.0\.rc\fR, Bundler treats gems in your Gemfile(5) that have not changed as an atomic unit together with their dependencies\. In this case, the \fBactivemerchant\fR dependency is treated as \fBactivemerchant 1\.7\.1 + activesupport 2\.3\.8\fR, so \fBbundle install\fR will report that it cannot update \fBactionpack\fR\.
.
.P
To explicitly update \fBactionpack\fR, including its dependencies which other gems in the Gemfile(5) still depend on, run \fBbundle update actionpack\fR (see \fBbundle update(1)\fR)\.
.
.P
\fBSummary\fR: In general, after making a change to the Gemfile(5) , you should first try to run \fBbundle install\fR, which will guarantee that no other gem in the Gemfile(5) is impacted by the change\. If that does not work, run bundle update(1) \fIbundle\-update\.1\.html\fR\.
.
.SH "SEE ALSO"
.
.IP "\(bu" 4
Gem install docs \fIhttp://guides\.rubygems\.org/rubygems\-basics/#installing\-gems\fR
.
.IP "\(bu" 4
Rubygems signing docs \fIhttp://guides\.rubygems\.org/security/\fR
.
.IP "" 0
bundler-2.1.4/man/bundle-init.1 0000644 0000041 0000041 00000002066 13606335352 016262 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INIT" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
.
.SH "SYNOPSIS"
\fBbundle init\fR [\-\-gemspec=FILE]
.
.SH "DESCRIPTION"
Init generates a default [\fBGemfile(5)\fR][Gemfile(5)] in the current working directory\. When adding a [\fBGemfile(5)\fR][Gemfile(5)] to a gem with a gemspec, the \fB\-\-gemspec\fR option will automatically add each dependency listed in the gemspec file to the newly created [\fBGemfile(5)\fR][Gemfile(5)]\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-gemspec\fR
Use the specified \.gemspec to create the [\fBGemfile(5)\fR][Gemfile(5)]
.
.SH "FILES"
Included in the default [\fBGemfile(5)\fR][Gemfile(5)] generated is the line \fB# frozen_string_literal: true\fR\. This is a magic comment supported for the first time in Ruby 2\.3\. The presence of this line results in all string literals in the file being implicitly frozen\.
.
.SH "SEE ALSO"
Gemfile(5) \fIhttps://bundler\.io/man/gemfile\.5\.html\fR
bundler-2.1.4/man/bundle-viz.ronn 0000644 0000041 0000041 00000001676 13606335352 016751 0 ustar www-data www-data bundle-viz(1) -- Generates a visual dependency graph for your Gemfile
=====================================================================
## SYNOPSIS
`bundle viz` [--file=FILE]
[--format=FORMAT]
[--requirements]
[--version]
[--without=GROUP GROUP]
## DESCRIPTION
`viz` generates a PNG file of the current `Gemfile(5)` as a dependency graph.
`viz` requires the ruby-graphviz gem (and its dependencies).
The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html).
## OPTIONS
* `--file`, `-f`:
The name to use for the generated file. See `--format` option
* `--format`, `-F`:
This is output format option. Supported format is png, jpg, svg, dot ...
* `--requirements`, `-R`:
Set to show the version of each required dependency.
* `--version`, `-v`:
Set to show each gem version.
* `--without`, `-W`:
Exclude gems that are part of the specified named group.
bundler-2.1.4/man/gemfile.5.txt 0000644 0000041 0000041 00000052107 13606335352 016303 0 ustar www-data www-data GEMFILE(5) GEMFILE(5)
NAME
Gemfile - A format for describing gem dependencies for Ruby programs
SYNOPSIS
A Gemfile describes the gem dependencies required to execute associated
Ruby code.
Place the Gemfile in the root of the directory containing the associ-
ated code. For instance, in a Rails application, place the Gemfile in
the same directory as the Rakefile.
SYNTAX
A Gemfile is evaluated as Ruby code, in a context which makes available
a number of methods used to describe the gem requirements.
GLOBAL SOURCES
At the top of the Gemfile, add a line for the Rubygems source that con-
tains the gems listed in the Gemfile.
source "https://rubygems.org"
It is possible, but not recommended as of Bundler 1.7, to add multiple
global source lines. Each of these sources MUST be a valid Rubygems
repository.
Sources are checked for gems following the heuristics described in
SOURCE PRIORITY. If a gem is found in more than one global source,
Bundler will print a warning after installing the gem indicating which
source was used, and listing the other sources where the gem is avail-
able. A specific source can be selected for gems that need to use a
non-standard repository, suppressing this warning, by using the :source
option or a source block.
CREDENTIALS
Some gem sources require a username and password. Use bundle config(1)
bundle-config.1.html to set the username and password for any of the
sources that need it. The command must be run once on each computer
that will install the Gemfile, but this keeps the credentials from
being stored in plain text in version control.
bundle config gems.example.com user:password
For some sources, like a company Gemfury account, it may be easier to
include the credentials in the Gemfile as part of the source URL.
source "https://user:password@gems.example.com"
Credentials in the source URL will take precedence over credentials set
using config.
RUBY
If your application requires a specific Ruby version or engine, specify
your requirements using the ruby method, with the following arguments.
All parameters are OPTIONAL unless otherwise specified.
VERSION (required)
The version of Ruby that your application requires. If your application
requires an alternate Ruby engine, such as JRuby, Rubinius or Truf-
fleRuby, this should be the Ruby version that the engine is compatible
with.
ruby "1.9.3"
ENGINE
Each application may specify a Ruby engine. If an engine is specified,
an engine version must also be specified.
What exactly is an Engine? - A Ruby engine is an implementation of the
Ruby language.
o For background: the reference or original implementation of the
Ruby programming language is called Matz's Ruby Interpreter
https://en.wikipedia.org/wiki/Ruby_MRI, or MRI for short. This is
named after Ruby creator Yukihiro Matsumoto, also known as Matz.
MRI is also known as CRuby, because it is written in C. MRI is the
most widely used Ruby engine.
o Other implementations https://www.ruby-lang.org/en/about/ of Ruby
exist. Some of the more well-known implementations include Rubinius
https://rubinius.com/, and JRuby http://jruby.org/. Rubinius is an
alternative implementation of Ruby written in Ruby. JRuby is an
implementation of Ruby on the JVM, short for Java Virtual Machine.
ENGINE VERSION
Each application may specify a Ruby engine version. If an engine ver-
sion is specified, an engine must also be specified. If the engine is
"ruby" the engine version specified must match the Ruby version.
ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
PATCHLEVEL
Each application may specify a Ruby patchlevel.
ruby "2.0.0", :patchlevel => "247"
GEMS
Specify gem requirements using the gem method, with the following argu-
ments. All parameters are OPTIONAL unless otherwise specified.
NAME (required)
For each gem requirement, list a single gem line.
gem "nokogiri"
VERSION
Each gem MAY have one or more version specifiers.
gem "nokogiri", ">= 1.4.2"
gem "RedCloth", ">= 4.1.0", "< 4.2.0"
REQUIRE AS
Each gem MAY specify files that should be used when autorequiring via
Bundler.require. You may pass an array with multiple files or true if
file you want required has same name as gem or false to prevent any
file from being autorequired.
gem "redis", :require => ["redis/connection/hiredis", "redis"]
gem "webmock", :require => false
gem "byebug", :require => true
The argument defaults to the name of the gem. For example, these are
identical:
gem "nokogiri"
gem "nokogiri", :require => "nokogiri"
gem "nokogiri", :require => true
GROUPS
Each gem MAY specify membership in one or more groups. Any gem that
does not specify membership in any group is placed in the default
group.
gem "rspec", :group => :test
gem "wirble", :groups => [:development, :test]
The Bundler runtime allows its two main methods, Bundler.setup and
Bundler.require, to limit their impact to particular groups.
# setup adds gems to Ruby's load path
Bundler.setup # defaults to all groups
require "bundler/setup" # same as Bundler.setup
Bundler.setup(:default) # only set up the _default_ group
Bundler.setup(:test) # only set up the _test_ group (but `not` _default_)
Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
# require requires all of the gems in the specified groups
Bundler.require # defaults to the _default_ group
Bundler.require(:default) # identical
Bundler.require(:default, :test) # requires the _default_ and _test_ groups
Bundler.require(:test) # requires the _test_ group
The Bundler CLI allows you to specify a list of groups whose gems bun-
dle install should not install with the without configuration.
To specify multiple groups to ignore, specify a list of groups sepa-
rated by spaces.
bundle config set without test
bundle config set without development test
Also, calling Bundler.setup with no parameters, or calling require
"bundler/setup" will setup all groups except for the ones you excluded
via --without (since they are not available).
Note that on bundle install, bundler downloads and evaluates all gems,
in order to create a single canonical list of all of the required gems
and their dependencies. This means that you cannot list different ver-
sions of the same gems in different groups. For more details, see
Understanding Bundler https://bundler.io/rationale.html.
PLATFORMS
If a gem should only be used in a particular platform or set of plat-
forms, you can specify them. Platforms are essentially identical to
groups, except that you do not need to use the --without install-time
flag to exclude groups of gems for other platforms.
There are a number of Gemfile platforms:
ruby C Ruby (MRI), Rubinius or TruffleRuby, but NOT Windows
mri Same as ruby, but only C Ruby (MRI)
mingw Windows 32 bit 'mingw32' platform (aka RubyInstaller)
x64_mingw
Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
rbx Rubinius
jruby JRuby
truffleruby
TruffleRuby
mswin Windows
You can restrict further by platform and version for all platforms
except for rbx, jruby, truffleruby and mswin.
To specify a version in addition to a platform, append the version num-
ber without the delimiter to the platform. For example, to specify that
a gem should only be used on platforms with Ruby 2.3, use:
ruby_23
The full list of platforms and supported versions includes:
ruby 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
mri 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
mingw 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
x64_mingw
2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
As with groups, you can specify one or more platforms:
gem "weakling", :platforms => :jruby
gem "ruby-debug", :platforms => :mri_18
gem "nokogiri", :platforms => [:mri_18, :jruby]
All operations involving groups (bundle install bundle-install.1.html,
Bundler.setup, Bundler.require) behave exactly the same as if any
groups not matching the current platform were explicitly excluded.
SOURCE
You can select an alternate Rubygems repository for a gem using the
':source' option.
gem "some_internal_gem", :source => "https://gems.example.com"
This forces the gem to be loaded from this source and ignores any
global sources declared at the top level of the file. If the gem does
not exist in this source, it will not be installed.
Bundler will search for child dependencies of this gem by first looking
in the source selected for the parent, but if they are not found there,
it will fall back on global sources using the ordering described in
SOURCE PRIORITY.
Selecting a specific source repository this way also suppresses the
ambiguous gem warning described above in GLOBAL SOURCES (#source).
Using the :source option for an individual gem will also make that
source available as a possible global source for any other gems which
do not specify explicit sources. Thus, when adding gems with explicit
sources, it is recommended that you also ensure all other gems in the
Gemfile are using explicit sources.
GIT
If necessary, you can specify that a gem is located at a particular git
repository using the :git parameter. The repository can be accessed via
several protocols:
HTTP(S)
gem "rails", :git => "https://github.com/rails/rails.git"
SSH gem "rails", :git => "git@github.com:rails/rails.git"
git gem "rails", :git => "git://github.com/rails/rails.git"
If using SSH, the user that you use to run bundle install MUST have the
appropriate keys available in their $HOME/.ssh.
NOTE: http:// and git:// URLs should be avoided if at all possible.
These protocols are unauthenticated, so a man-in-the-middle attacker
can deliver malicious code and compromise your system. HTTPS and SSH
are strongly preferred.
The group, platforms, and require options are available and behave
exactly the same as they would for a normal gem.
A git repository SHOULD have at least one file, at the root of the
directory containing the gem, with the extension .gemspec. This file
MUST contain a valid gem specification, as expected by the gem build
command.
If a git repository does not have a .gemspec, bundler will attempt to
create one, but it will not contain any dependencies, executables, or C
extension compilation instructions. As a result, it may fail to prop-
erly integrate into your application.
If a git repository does have a .gemspec for the gem you attached it
to, a version specifier, if provided, means that the git repository is
only valid if the .gemspec specifies a version matching the version
specifier. If not, bundler will print a warning.
gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git"
# bundle install will fail, because the .gemspec in the rails
# repository's master branch specifies version 3.0.0
If a git repository does not have a .gemspec for the gem you attached
it to, a version specifier MUST be provided. Bundler will use this ver-
sion in the simple .gemspec it creates.
Git repositories support a number of additional options.
branch, tag, and ref
You MUST only specify at most one of these options. The default
is :branch => "master". For example:
gem "rails", :git => "https://github.com/rails/rails.git",
:branch => "5-0-stable"
gem "rails", :git => "https://github.com/rails/rails.git", :tag
=> "v5.0.0"
gem "rails", :git => "https://github.com/rails/rails.git", :ref
=> "4aded"
submodules
For reference, a git submodule
https://git-scm.com/book/en/v2/Git-Tools-Submodules lets you
have another git repository within a subfolder of your reposi-
tory. Specify :submodules => true to cause bundler to expand any
submodules included in the git repository
If a git repository contains multiple .gemspecs, each .gemspec repre-
sents a gem located at the same place in the file system as the .gem-
spec.
|~rails [git root]
| |-rails.gemspec [rails gem located here]
|~actionpack
| |-actionpack.gemspec [actionpack gem located here]
|~activesupport
| |-activesupport.gemspec [activesupport gem located here]
|...
To install a gem located in a git repository, bundler changes to the
directory containing the gemspec, runs gem build name.gemspec and then
installs the resulting gem. The gem build command, which comes standard
with Rubygems, evaluates the .gemspec in the context of the directory
in which it is located.
GIT SOURCE
A custom git source can be defined via the git_source method. Provide
the source's name as an argument, and a block which receives a single
argument and interpolates it into a string to return the full repo
address:
git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
gem 'rails', :stash => 'forks/rails'
In addition, if you wish to choose a specific branch:
gem "rails", :stash => "forks/rails", :branch => "branch_name"
GITHUB
NOTE: This shorthand should be avoided until Bundler 2.0, since it cur-
rently expands to an insecure git:// URL. This allows a man-in-the-mid-
dle attacker to compromise your system.
If the git repository you want to use is hosted on GitHub and is pub-
lic, you can use the :github shorthand to specify the github username
and repository name (without the trailing ".git"), separated by a
slash. If both the username and repository name are the same, you can
omit one.
gem "rails", :github => "rails/rails"
gem "rails", :github => "rails"
Are both equivalent to
gem "rails", :git => "git://github.com/rails/rails.git"
Since the github method is a specialization of git_source, it accepts a
:branch named argument.
GIST
If the git repository you want to use is hosted as a Github Gist and is
public, you can use the :gist shorthand to specify the gist identifier
(without the trailing ".git").
gem "the_hatch", :gist => "4815162342"
Is equivalent to:
gem "the_hatch", :git => "https://gist.github.com/4815162342.git"
Since the gist method is a specialization of git_source, it accepts a
:branch named argument.
BITBUCKET
If the git repository you want to use is hosted on Bitbucket and is
public, you can use the :bitbucket shorthand to specify the bitbucket
username and repository name (without the trailing ".git"), separated
by a slash. If both the username and repository name are the same, you
can omit one.
gem "rails", :bitbucket => "rails/rails"
gem "rails", :bitbucket => "rails"
Are both equivalent to
gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git"
Since the bitbucket method is a specialization of git_source, it
accepts a :branch named argument.
PATH
You can specify that a gem is located in a particular location on the
file system. Relative paths are resolved relative to the directory con-
taining the Gemfile.
Similar to the semantics of the :git option, the :path option requires
that the directory in question either contains a .gemspec for the gem,
or that you specify an explicit version that bundler should use.
Unlike :git, bundler does not compile C extensions for gems specified
as paths.
gem "rails", :path => "vendor/rails"
If you would like to use multiple local gems directly from the filesys-
tem, you can set a global path option to the path containing the gem's
files. This will automatically load gemspec files from subdirectories.
path 'components' do
gem 'admin_ui'
gem 'public_ui'
end
BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS
The :source, :git, :path, :group, and :platforms options may be applied
to a group of gems by using block form.
source "https://gems.example.com" do
gem "some_internal_gem"
gem "another_internal_gem"
end
git "https://github.com/rails/rails.git" do
gem "activesupport"
gem "actionpack"
end
platforms :ruby do
gem "ruby-debug"
gem "sqlite3"
end
group :development, :optional => true do
gem "wirble"
gem "faker"
end
In the case of the group block form the :optional option can be given
to prevent a group from being installed unless listed in the --with
option given to the bundle install command.
In the case of the git block form, the :ref, :branch, :tag, and :sub-
modules options may be passed to the git method, and all gems in the
block will inherit those options.
The presence of a source block in a Gemfile also makes that source
available as a possible global source for any other gems which do not
specify explicit sources. Thus, when defining source blocks, it is rec-
ommended that you also ensure all other gems in the Gemfile are using
explicit sources, either via source blocks or :source directives on
individual gems.
INSTALL_IF
The install_if method allows gems to be installed based on a proc or
lambda. This is especially useful for optional gems that can only be
used if certain software is installed or some other conditions are met.
install_if -> { RUBY_PLATFORM =~ /darwin/ } do
gem "pasteboard"
end
GEMSPEC
The .gemspec http://guides.rubygems.org/specification-reference/ file
is where you provide metadata about your gem to Rubygems. Some required
Gemspec attributes include the name, description, and homepage of your
gem. This is also where you specify the dependencies your gem needs to
run.
If you wish to use Bundler to help install dependencies for a gem while
it is being developed, use the gemspec method to pull in the dependen-
cies listed in the .gemspec file.
The gemspec method adds any runtime dependencies as gem requirements in
the default group. It also adds development dependencies as gem
requirements in the development group. Finally, it adds a gem require-
ment on your project (:path => '.'). In conjunction with Bundler.setup,
this allows you to require project files in your test code as you would
if the project were installed as a gem; you need not manipulate the
load path manually or require project files via relative paths.
The gemspec method supports optional :path, :glob, :name, and :develop-
ment_group options, which control where bundler looks for the .gemspec,
the glob it uses to look for the gemspec (defaults to: "{,,/*}.gem-
spec"), what named .gemspec it uses (if more than one is present), and
which group development dependencies are included in.
When a gemspec dependency encounters version conflicts during resolu-
tion, the local version under development will always be selected --
even if there are remote versions that better match other requirements
for the gemspec gem.
SOURCE PRIORITY
When attempting to locate a gem to satisfy a gem requirement, bundler
uses the following priority order:
1. The source explicitly attached to the gem (using :source, :path, or
:git)
2. For implicit gems (dependencies of explicit gems), any source, git,
or path repository declared on the parent. This results in bundler
prioritizing the ActiveSupport gem from the Rails git repository
over ones from rubygems.org
3. The sources specified via global source lines, searching each
source in your Gemfile from last added to first added.
January 2020 GEMFILE(5)
bundler-2.1.4/man/bundle-init.ronn 0000644 0000041 0000041 00000001653 13606335352 017077 0 ustar www-data www-data bundle-init(1) -- Generates a Gemfile into the current working directory
========================================================================
## SYNOPSIS
`bundle init` [--gemspec=FILE]
## DESCRIPTION
Init generates a default [`Gemfile(5)`][Gemfile(5)] in the current working directory. When
adding a [`Gemfile(5)`][Gemfile(5)] to a gem with a gemspec, the `--gemspec` option will
automatically add each dependency listed in the gemspec file to the newly
created [`Gemfile(5)`][Gemfile(5)].
## OPTIONS
* `--gemspec`:
Use the specified .gemspec to create the [`Gemfile(5)`][Gemfile(5)]
## FILES
Included in the default [`Gemfile(5)`][Gemfile(5)]
generated is the line `# frozen_string_literal: true`. This is a magic comment
supported for the first time in Ruby 2.3. The presence of this line
results in all string literals in the file being implicitly frozen.
## SEE ALSO
[Gemfile(5)](https://bundler.io/man/gemfile.5.html)
bundler-2.1.4/man/bundle-remove.ronn 0000644 0000041 0000041 00000001332 13606335352 017423 0 ustar www-data www-data bundle-remove(1) -- Removes gems from the Gemfile
===========================================================================
## SYNOPSIS
`bundle remove [GEM [GEM ...]] [--install]`
## DESCRIPTION
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised.
## OPTIONS
* `--install`:
Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s).
Example:
bundle remove rails
bundle remove rails rack
bundle remove rails rack --install
bundler-2.1.4/man/bundle-gem.ronn 0000644 0000041 0000041 00000005445 13606335352 016707 0 ustar www-data www-data bundle-gem(1) -- Generate a project skeleton for creating a rubygem
====================================================================
## SYNOPSIS
`bundle gem` [OPTIONS]
## DESCRIPTION
Generates a directory named `GEM_NAME` with a `Rakefile`, `GEM_NAME.gemspec`,
and other supporting files and directories that can be used to develop a
rubygem with that name.
Run `rake -T` in the resulting project for a list of Rake tasks that can be used
to test and publish the gem to rubygems.org.
The generated project skeleton can be customized with OPTIONS, as explained
below. Note that these options can also be specified via Bundler's global
configuration file using the following names:
* `gem.coc`
* `gem.mit`
* `gem.test`
## OPTIONS
* `--exe` or `-b` or `--bin`:
Specify that Bundler should create a binary executable (as `exe/GEM_NAME`)
in the generated rubygem project. This binary will also be added to the
`GEM_NAME.gemspec` manifest. This behavior is disabled by default.
* `--no-exe`:
Do not create a binary (overrides `--exe` specified in the global config).
* `--coc`:
Add a `CODE_OF_CONDUCT.md` file to the root of the generated project. If
this option is unspecified, an interactive prompt will be displayed and the
answer will be saved in Bundler's global config for future `bundle gem` use.
* `--no-coc`:
Do not create a `CODE_OF_CONDUCT.md` (overrides `--coc` specified in the
global config).
* `--ext`:
Add boilerplate for C extension code to the generated project. This behavior
is disabled by default.
* `--no-ext`:
Do not add C extension code (overrides `--ext` specified in the global
config).
* `--mit`:
Add an MIT license to a `LICENSE.txt` file in the root of the generated
project. Your name from the global git config is used for the copyright
statement. If this option is unspecified, an interactive prompt will be
displayed and the answer will be saved in Bundler's global config for future
`bundle gem` use.
* `--no-mit`:
Do not create a `LICENSE.txt` (overrides `--mit` specified in the global
config).
* `-t`, `--test=minitest`, `--test=rspec`:
Specify the test framework that Bundler should use when generating the
project. Acceptable values are `minitest` and `rspec`. The `GEM_NAME.gemspec`
will be configured and a skeleton test/spec directory will be created based
on this option. If this option is unspecified, an interactive prompt will be
displayed and the answer will be saved in Bundler's global config for future
`bundle gem` use.
If no option is specified, the default testing framework is RSpec.
* `-e`, `--edit[=EDITOR]`:
Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not
specified. The default is `$BUNDLER_EDITOR`, `$VISUAL`, or `$EDITOR`.
## SEE ALSO
* [bundle config(1)](bundle-config.1.html)
bundler-2.1.4/man/bundle-outdated.ronn 0000644 0000041 0000041 00000006727 13606335352 017754 0 ustar www-data www-data bundle-outdated(1) -- List installed gems with newer versions available
=======================================================================
## SYNOPSIS
`bundle outdated` [GEM] [--local]
[--pre]
[--source]
[--strict]
[--parseable | --porcelain]
[--group=GROUP]
[--groups]
[--update-strict]
[--patch|--minor|--major]
[--filter-major]
[--filter-minor]
[--filter-patch]
[--only-explicit]
## DESCRIPTION
Outdated lists the names and versions of gems that have a newer version available
in the given source. Calling outdated with [GEM [GEM]] will only check for newer
versions of the given gems. Prerelease gems are ignored by default. If your gems
are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
## OPTIONS
* `--local`:
Do not attempt to fetch gems remotely and use the gem cache instead.
* `--pre`:
Check for newer pre-release gems.
* `--source`:
Check against a specific source.
* `--strict`:
Only list newer versions allowed by your Gemfile requirements.
* `--parseable`, `--porcelain`:
Use minimal formatting for more parseable output.
* `--group`:
List gems from a specific group.
* `--groups`:
List gems organized by groups.
* `--update-strict`:
Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor| --major.
* `--minor`:
Prefer updating only to next minor version.
* `--major`:
Prefer updating to next major version (default).
* `--patch`:
Prefer updating only to next patch version.
* `--filter-major`:
Only list major newer versions.
* `--filter-minor`:
Only list minor newer versions.
* `--filter-patch`:
Only list patch newer versions.
* `--only-explicit`:
Only list gems specified in your Gemfile, not their dependencies.
## PATCH LEVEL OPTIONS
See [bundle update(1)](bundle-update.1.html) for details.
One difference between the patch level options in `bundle update` and here is the `--strict` option.
`--strict` was already an option on outdated before the patch level options were added. `--strict`
wasn't altered, and the `--update-strict` option on `outdated` reflects what `--strict` does on
`bundle update`.
## FILTERING OUTPUT
The 3 filtering options do not affect the resolution of versions, merely what versions are shown
in the output.
If the regular output shows the following:
* faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
* hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
* headless (newest 2.3.1, installed 2.2.3) in groups "test"
`--filter-major` would only show:
* hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
`--filter-minor` would only show:
* headless (newest 2.3.1, installed 2.2.3) in groups "test"
`--filter-patch` would only show:
* faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
Filter options can be combined. `--filter-minor` and `--filter-patch` would show:
* faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
* headless (newest 2.3.1, installed 2.2.3) in groups "test"
Combining all three `filter` options would be the same result as providing none of them.
bundler-2.1.4/man/bundle-lock.1 0000644 0000041 0000041 00000006166 13606335352 016254 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-LOCK" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
.
.SH "SYNOPSIS"
\fBbundle lock\fR [\-\-update] [\-\-local] [\-\-print] [\-\-lockfile=PATH] [\-\-full\-index] [\-\-add\-platform] [\-\-remove\-platform] [\-\-patch] [\-\-minor] [\-\-major] [\-\-strict] [\-\-conservative]
.
.SH "DESCRIPTION"
Lock the gems specified in Gemfile\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-update=<*gems>\fR
Ignores the existing lockfile\. Resolve then updates lockfile\. Taking a list of gems or updating all gems if no list is given\.
.
.TP
\fB\-\-local\fR
Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\.
.
.TP
\fB\-\-print\fR
Prints the lockfile to STDOUT instead of writing to the file system\.
.
.TP
\fB\-\-lockfile=\fR
The path where the lockfile should be written to\.
.
.TP
\fB\-\-full\-index\fR
Fall back to using the single\-file index of all gems\.
.
.TP
\fB\-\-add\-platform\fR
Add a new platform to the lockfile, re\-resolving for the addition of that platform\.
.
.TP
\fB\-\-remove\-platform\fR
Remove a platform from the lockfile\.
.
.TP
\fB\-\-patch\fR
If updating, prefer updating only to next patch version\.
.
.TP
\fB\-\-minor\fR
If updating, prefer updating only to next minor version\.
.
.TP
\fB\-\-major\fR
If updating, prefer updating to next major version (default)\.
.
.TP
\fB\-\-strict\fR
If updating, do not allow any gem to be updated past latest \-\-patch | \-\-minor | \-\-major\.
.
.TP
\fB\-\-conservative\fR
If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated\.
.
.SH "UPDATING ALL GEMS"
If you run \fBbundle lock\fR with \fB\-\-update\fR option without list of gems, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources\.
.
.SH "UPDATING A LIST OF GEMS"
Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the \fBGemfile\.lock\fR\.
.
.P
For instance, you only want to update \fBnokogiri\fR, run \fBbundle lock \-\-update nokogiri\fR\.
.
.P
Bundler will update \fBnokogiri\fR and any of its dependencies, but leave the rest of the gems that you specified locked to the versions in the \fBGemfile\.lock\fR\.
.
.SH "SUPPORTING OTHER PLATFORMS"
If you want your bundle to support platforms other than the one you\'re running locally, you can run \fBbundle lock \-\-add\-platform PLATFORM\fR to add PLATFORM to the lockfile, force bundler to re\-resolve and consider the new platform when picking gems, all without needing to have a machine that matches PLATFORM handy to install those platform\-specific gems on\.
.
.P
For a full explanation of gem platforms, see \fBgem help platform\fR\.
.
.SH "PATCH LEVEL OPTIONS"
See bundle update(1) \fIbundle\-update\.1\.html\fR for details\.
bundler-2.1.4/man/bundle-binstubs.1 0000644 0000041 0000041 00000003301 13606335352 017141 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-BINSTUBS" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
.
.SH "SYNOPSIS"
\fBbundle binstubs\fR \fIGEM_NAME\fR [\-\-force] [\-\-path PATH] [\-\-standalone]
.
.SH "DESCRIPTION"
Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it into \fBbin/\fR\. Binstubs are a shortcut\-or alternative\- to always using \fBbundle exec\fR\. This gives you a file that can be run directly, and one that will always run the correct gem version used by the application\.
.
.P
For example, if you run \fBbundle binstubs rspec\-core\fR, Bundler will create the file \fBbin/rspec\fR\. That file will contain enough code to load Bundler, tell it to load the bundled gems, and then run rspec\.
.
.P
This command generates binstubs for executables in \fBGEM_NAME\fR\. Binstubs are put into \fBbin\fR, or the \fB\-\-path\fR directory if one has been set\. Calling binstubs with [GEM [GEM]] will create binstubs for all given gems\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-force\fR
Overwrite existing binstubs if they exist\.
.
.TP
\fB\-\-path\fR
The location to install the specified binstubs to\. This defaults to \fBbin\fR\.
.
.TP
\fB\-\-standalone\fR
Makes binstubs that can work without depending on Rubygems or Bundler at runtime\.
.
.TP
\fB\-\-shebang\fR
Specify a different shebang executable name than the default (default \'ruby\')
.
.SH "BUNDLE INSTALL \-\-BINSTUBS"
To create binstubs for all the gems in the bundle you can use the \fB\-\-binstubs\fR flag in bundle install(1) \fIbundle\-install\.1\.html\fR\.
bundler-2.1.4/man/bundle-gem.1 0000644 0000041 0000041 00000006253 13606335352 016071 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-GEM" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
.
.SH "SYNOPSIS"
\fBbundle gem\fR \fIGEM_NAME\fR \fIOPTIONS\fR
.
.SH "DESCRIPTION"
Generates a directory named \fBGEM_NAME\fR with a \fBRakefile\fR, \fBGEM_NAME\.gemspec\fR, and other supporting files and directories that can be used to develop a rubygem with that name\.
.
.P
Run \fBrake \-T\fR in the resulting project for a list of Rake tasks that can be used to test and publish the gem to rubygems\.org\.
.
.P
The generated project skeleton can be customized with OPTIONS, as explained below\. Note that these options can also be specified via Bundler\'s global configuration file using the following names:
.
.IP "\(bu" 4
\fBgem\.coc\fR
.
.IP "\(bu" 4
\fBgem\.mit\fR
.
.IP "\(bu" 4
\fBgem\.test\fR
.
.IP "" 0
.
.SH "OPTIONS"
.
.TP
\fB\-\-exe\fR or \fB\-b\fR or \fB\-\-bin\fR
Specify that Bundler should create a binary executable (as \fBexe/GEM_NAME\fR) in the generated rubygem project\. This binary will also be added to the \fBGEM_NAME\.gemspec\fR manifest\. This behavior is disabled by default\.
.
.TP
\fB\-\-no\-exe\fR
Do not create a binary (overrides \fB\-\-exe\fR specified in the global config)\.
.
.TP
\fB\-\-coc\fR
Add a \fBCODE_OF_CONDUCT\.md\fR file to the root of the generated project\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\.
.
.TP
\fB\-\-no\-coc\fR
Do not create a \fBCODE_OF_CONDUCT\.md\fR (overrides \fB\-\-coc\fR specified in the global config)\.
.
.TP
\fB\-\-ext\fR
Add boilerplate for C extension code to the generated project\. This behavior is disabled by default\.
.
.TP
\fB\-\-no\-ext\fR
Do not add C extension code (overrides \fB\-\-ext\fR specified in the global config)\.
.
.TP
\fB\-\-mit\fR
Add an MIT license to a \fBLICENSE\.txt\fR file in the root of the generated project\. Your name from the global git config is used for the copyright statement\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\.
.
.TP
\fB\-\-no\-mit\fR
Do not create a \fBLICENSE\.txt\fR (overrides \fB\-\-mit\fR specified in the global config)\.
.
.TP
\fB\-t\fR, \fB\-\-test=minitest\fR, \fB\-\-test=rspec\fR
Specify the test framework that Bundler should use when generating the project\. Acceptable values are \fBminitest\fR and \fBrspec\fR\. The \fBGEM_NAME\.gemspec\fR will be configured and a skeleton test/spec directory will be created based on this option\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. If no option is specified, the default testing framework is RSpec\.
.
.TP
\fB\-e\fR, \fB\-\-edit[=EDITOR]\fR
Open the resulting GEM_NAME\.gemspec in EDITOR, or the default editor if not specified\. The default is \fB$BUNDLER_EDITOR\fR, \fB$VISUAL\fR, or \fB$EDITOR\fR\.
.
.SH "SEE ALSO"
.
.IP "\(bu" 4
bundle config(1) \fIbundle\-config\.1\.html\fR
.
.IP "" 0
bundler-2.1.4/man/bundle-pristine.1 0000644 0000041 0000041 00000003215 13606335352 017151 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-PRISTINE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
.
.SH "SYNOPSIS"
\fBbundle pristine\fR
.
.SH "DESCRIPTION"
\fBpristine\fR restores the installed gems in the bundle to their pristine condition using the local gem cache from RubyGems\. For git gems, a forced checkout will be performed\.
.
.P
For further explanation, \fBbundle pristine\fR ignores unpacked files on disk\. In other words, this command utilizes the local \fB\.gem\fR cache or the gem\'s git repository as if one were installing from scratch\.
.
.P
Note: the Bundler gem cannot be restored to its original state with \fBpristine\fR\. One also cannot use \fBbundle pristine\fR on gems with a \'path\' option in the Gemfile, because bundler has no original copy it can restore from\.
.
.P
When is it practical to use \fBbundle pristine\fR?
.
.P
It comes in handy when a developer is debugging a gem\. \fBbundle pristine\fR is a great way to get rid of experimental changes to a gem that one may not want\.
.
.P
Why use \fBbundle pristine\fR over \fBgem pristine \-\-all\fR?
.
.P
Both commands are very similar\. For context: \fBbundle pristine\fR, without arguments, cleans all gems from the lockfile\. Meanwhile, \fBgem pristine \-\-all\fR cleans all installed gems for that Ruby version\.
.
.P
If a developer forgets which gems in their project they might have been debugging, the Rubygems \fBgem pristine [GEMNAME]\fR command may be inconvenient\. One can avoid waiting for \fBgem pristine \-\-all\fR, and instead run \fBbundle pristine\fR\.
bundler-2.1.4/man/bundle-inject.1 0000644 0000041 0000041 00000001341 13606335352 016566 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INJECT" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
.
.SH "SYNOPSIS"
\fBbundle inject\fR [GEM] [VERSION]
.
.SH "DESCRIPTION"
Adds the named gem(s) with their version requirements to the resolved [\fBGemfile(5)\fR][Gemfile(5)]\.
.
.P
This command will add the gem to both your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock if it isn\'t listed yet\.
.
.P
Example:
.
.IP "" 4
.
.nf
bundle install
bundle inject \'rack\' \'> 0\'
.
.fi
.
.IP "" 0
.
.P
This will inject the \'rack\' gem with a version greater than 0 in your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock
bundler-2.1.4/man/bundle-config.1 0000644 0000041 0000041 00000052034 13606335352 016564 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CONFIG" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options
.
.SH "SYNOPSIS"
\fBbundle config\fR [list|get|set|unset] [\fIname\fR [\fIvalue\fR]]
.
.SH "DESCRIPTION"
This command allows you to interact with Bundler\'s configuration system\.
.
.P
Bundler loads configuration settings in this order:
.
.IP "1." 4
Local config (\fBapp/\.bundle/config\fR)
.
.IP "2." 4
Environmental variables (\fBENV\fR)
.
.IP "3." 4
Global config (\fB~/\.bundle/config\fR)
.
.IP "4." 4
Bundler default config
.
.IP "" 0
.
.P
Executing \fBbundle config list\fR with will print a list of all bundler configuration for the current bundle, and where that configuration was set\.
.
.P
Executing \fBbundle config get \fR will print the value of that configuration setting, and where it was set\.
.
.P
Executing \fBbundle config set \fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\.
.
.P
Executing \fBbundle config set \-\-global \fR works the same as above\.
.
.P
Executing \fBbundle config set \-\-local \fR will set that configuration to the local application\. The configuration will be stored in \fBapp/\.bundle/config\fR\.
.
.P
Executing \fBbundle config unset \fR will delete the configuration in both local and global sources\.
.
.P
Executing \fBbundle config unset \-\-global \fR will delete the configuration only from the user configuration\.
.
.P
Executing \fBbundle config unset \-\-local \fR will delete the configuration only from the local application\.
.
.P
Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
.
.P
Executing \fBbundle config set disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
.
.SH "REMEMBERING OPTIONS"
Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are remembered between commands and saved to your local application\'s configuration (normally, \fB\./\.bundle/config\fR)\.
.
.P
However, this will be changed in bundler 3, so it\'s better not to rely on this behavior\. If these options must be remembered, it\'s better to set them using \fBbundle config\fR (e\.g\., \fBbundle config set path foo\fR)\.
.
.P
The options that can be configured are:
.
.TP
\fBbin\fR
Creates a directory (defaults to \fB~/bin\fR) and place any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\.
.
.TP
\fBdeployment\fR
In deployment mode, Bundler will \'roll\-out\' the bundle for \fBproduction\fR use\. Please check carefully if you want to have this option enabled in \fBdevelopment\fR or \fBtest\fR environments\.
.
.TP
\fBpath\fR
The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accordingly, gems installed to other locations will not get listed\.
.
.TP
\fBwithout\fR
A space\-separated list of groups referencing gems to skip during installation\.
.
.TP
\fBwith\fR
A space\-separated list of groups referencing gems to include during installation\.
.
.SH "BUILD OPTIONS"
You can use \fBbundle config\fR to give Bundler the flags to pass to the gem installer every time bundler tries to install a particular gem\.
.
.P
A very common example, the \fBmysql\fR gem, requires Snow Leopard users to pass configuration flags to \fBgem install\fR to specify where to find the \fBmysql_config\fR executable\.
.
.IP "" 4
.
.nf
gem install mysql \-\- \-\-with\-mysql\-config=/usr/local/mysql/bin/mysql_config
.
.fi
.
.IP "" 0
.
.P
Since the specific location of that executable can change from machine to machine, you can specify these flags on a per\-machine basis\.
.
.IP "" 4
.
.nf
bundle config set build\.mysql \-\-with\-mysql\-config=/usr/local/mysql/bin/mysql_config
.
.fi
.
.IP "" 0
.
.P
After running this command, every time bundler needs to install the \fBmysql\fR gem, it will pass along the flags you specified\.
.
.SH "CONFIGURATION KEYS"
Configuration keys in bundler have two forms: the canonical form and the environment variable form\.
.
.P
For instance, passing the \fB\-\-without\fR flag to bundle install(1) \fIbundle\-install\.1\.html\fR prevents Bundler from installing certain groups specified in the Gemfile(5)\. Bundler persists this value in \fBapp/\.bundle/config\fR so that calls to \fBBundler\.setup\fR do not try to find gems from the \fBGemfile\fR that you didn\'t install\. Additionally, subsequent calls to bundle install(1) \fIbundle\-install\.1\.html\fR remember this setting and skip those groups\.
.
.P
The canonical form of this configuration is \fB"without"\fR\. To convert the canonical form to the environment variable form, capitalize it, and prepend \fBBUNDLE_\fR\. The environment variable form of \fB"without"\fR is \fBBUNDLE_WITHOUT\fR\.
.
.P
Any periods in the configuration keys must be replaced with two underscores when setting it via environment variables\. The configuration key \fBlocal\.rack\fR becomes the environment variable \fBBUNDLE_LOCAL__RACK\fR\.
.
.SH "LIST OF AVAILABLE KEYS"
The following is a list of all configuration keys and their purpose\. You can learn more about their operation in bundle install(1) \fIbundle\-install\.1\.html\fR\.
.
.IP "\(bu" 4
\fBallow_bundler_dependency_conflicts\fR (\fBBUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS\fR): Allow resolving to specifications that have dependencies on \fBbundler\fR that are incompatible with the running Bundler version\.
.
.IP "\(bu" 4
\fBallow_deployment_source_credential_changes\fR (\fBBUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES\fR): When in deployment mode, allow changing the credentials to a gem\'s source\. Ex: \fBhttps://some\.host\.com/gems/path/\fR \-> \fBhttps://user_name:password@some\.host\.com/gems/path\fR
.
.IP "\(bu" 4
\fBallow_offline_install\fR (\fBBUNDLE_ALLOW_OFFLINE_INSTALL\fR): Allow Bundler to use cached data when installing without network access\.
.
.IP "\(bu" 4
\fBauto_clean_without_path\fR (\fBBUNDLE_AUTO_CLEAN_WITHOUT_PATH\fR): Automatically run \fBbundle clean\fR after installing when an explicit \fBpath\fR has not been set and Bundler is not installing into the system gems\.
.
.IP "\(bu" 4
\fBauto_install\fR (\fBBUNDLE_AUTO_INSTALL\fR): Automatically run \fBbundle install\fR when gems are missing\.
.
.IP "\(bu" 4
\fBbin\fR (\fBBUNDLE_BIN\fR): Install executables from gems in the bundle to the specified directory\. Defaults to \fBfalse\fR\.
.
.IP "\(bu" 4
\fBcache_all\fR (\fBBUNDLE_CACHE_ALL\fR): Cache all gems, including path and git gems\.
.
.IP "\(bu" 4
\fBcache_all_platforms\fR (\fBBUNDLE_CACHE_ALL_PLATFORMS\fR): Cache gems for all platforms\.
.
.IP "\(bu" 4
\fBcache_path\fR (\fBBUNDLE_CACHE_PATH\fR): The directory that bundler will place cached gems in when running \fBbundle package\fR, and that bundler will look in when installing gems\. Defaults to \fBvendor/cache\fR\.
.
.IP "\(bu" 4
\fBclean\fR (\fBBUNDLE_CLEAN\fR): Whether Bundler should run \fBbundle clean\fR automatically after \fBbundle install\fR\.
.
.IP "\(bu" 4
\fBconsole\fR (\fBBUNDLE_CONSOLE\fR): The console that \fBbundle console\fR starts\. Defaults to \fBirb\fR\.
.
.IP "\(bu" 4
\fBdefault_install_uses_path\fR (\fBBUNDLE_DEFAULT_INSTALL_USES_PATH\fR): Whether a \fBbundle install\fR without an explicit \fB\-\-path\fR argument defaults to installing gems in \fB\.bundle\fR\.
.
.IP "\(bu" 4
\fBdeployment\fR (\fBBUNDLE_DEPLOYMENT\fR): Disallow changes to the \fBGemfile\fR\. When the \fBGemfile\fR is changed and the lockfile has not been updated, running Bundler commands will be blocked\.
.
.IP "\(bu" 4
\fBdisable_checksum_validation\fR (\fBBUNDLE_DISABLE_CHECKSUM_VALIDATION\fR): Allow installing gems even if they do not match the checksum provided by RubyGems\.
.
.IP "\(bu" 4
\fBdisable_exec_load\fR (\fBBUNDLE_DISABLE_EXEC_LOAD\fR): Stop Bundler from using \fBload\fR to launch an executable in\-process in \fBbundle exec\fR\.
.
.IP "\(bu" 4
\fBdisable_local_branch_check\fR (\fBBUNDLE_DISABLE_LOCAL_BRANCH_CHECK\fR): Allow Bundler to use a local git override without a branch specified in the Gemfile\.
.
.IP "\(bu" 4
\fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\.
.
.IP "\(bu" 4
\fBdisable_platform_warnings\fR (\fBBUNDLE_DISABLE_PLATFORM_WARNINGS\fR): Disable warnings during bundle install when a dependency is unused on the current platform\.
.
.IP "\(bu" 4
\fBdisable_shared_gems\fR (\fBBUNDLE_DISABLE_SHARED_GEMS\fR): Stop Bundler from accessing gems installed to RubyGems\' normal location\.
.
.IP "\(bu" 4
\fBdisable_version_check\fR (\fBBUNDLE_DISABLE_VERSION_CHECK\fR): Stop Bundler from checking if a newer Bundler version is available on rubygems\.org\.
.
.IP "\(bu" 4
\fBforce_ruby_platform\fR (\fBBUNDLE_FORCE_RUBY_PLATFORM\fR): Ignore the current machine\'s platform and install only \fBruby\fR platform gems\. As a result, gems with native extensions will be compiled from source\.
.
.IP "\(bu" 4
\fBfrozen\fR (\fBBUNDLE_FROZEN\fR): Disallow changes to the \fBGemfile\fR\. When the \fBGemfile\fR is changed and the lockfile has not been updated, running Bundler commands will be blocked\. Defaults to \fBtrue\fR when \fB\-\-deployment\fR is used\.
.
.IP "\(bu" 4
\fBgem\.push_key\fR (\fBBUNDLE_GEM__PUSH_KEY\fR): Sets the \fB\-\-key\fR parameter for \fBgem push\fR when using the \fBrake release\fR command with a private gemstash server\.
.
.IP "\(bu" 4
\fBgemfile\fR (\fBBUNDLE_GEMFILE\fR): The name of the file that bundler should use as the \fBGemfile\fR\. This location of this file also sets the root of the project, which is used to resolve relative paths in the \fBGemfile\fR, among other things\. By default, bundler will search up from the current working directory until it finds a \fBGemfile\fR\.
.
.IP "\(bu" 4
\fBglobal_gem_cache\fR (\fBBUNDLE_GLOBAL_GEM_CACHE\fR): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation\.
.
.IP "\(bu" 4
\fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
.
.IP "\(bu" 4
\fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR) Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
.
.IP "\(bu" 4
\fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1\.
.
.IP "\(bu" 4
\fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\.
.
.IP "\(bu" 4
\fBno_prune\fR (\fBBUNDLE_NO_PRUNE\fR): Whether Bundler should leave outdated gems unpruned when caching\.
.
.IP "\(bu" 4
\fBonly_update_to_newer_versions\fR (\fBBUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS\fR): During \fBbundle update\fR, only resolve to newer versions of the gems in the lockfile\.
.
.IP "\(bu" 4
\fBpath\fR (\fBBUNDLE_PATH\fR): The location on disk where all gems in your bundle will be located regardless of \fB$GEM_HOME\fR or \fB$GEM_PATH\fR values\. Bundle gems not found in this location will be installed by \fBbundle install\fR\. Defaults to \fBGem\.dir\fR\. When \-\-deployment is used, defaults to vendor/bundle\.
.
.IP "\(bu" 4
\fBpath\.system\fR (\fBBUNDLE_PATH__SYSTEM\fR): Whether Bundler will install gems into the default system path (\fBGem\.dir\fR)\.
.
.IP "\(bu" 4
\fBpath_relative_to_cwd\fR (\fBBUNDLE_PATH_RELATIVE_TO_CWD\fR) Makes \fB\-\-path\fR relative to the CWD instead of the \fBGemfile\fR\.
.
.IP "\(bu" 4
\fBplugins\fR (\fBBUNDLE_PLUGINS\fR): Enable Bundler\'s experimental plugin system\.
.
.IP "\(bu" 4
\fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\.
.
.IP "\(bu" 4
\fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR) Print only version number from \fBbundler \-\-version\fR\.
.
.IP "\(bu" 4
\fBredirect\fR (\fBBUNDLE_REDIRECT\fR): The number of redirects allowed for network requests\. Defaults to \fB5\fR\.
.
.IP "\(bu" 4
\fBretry\fR (\fBBUNDLE_RETRY\fR): The number of times to retry failed network requests\. Defaults to \fB3\fR\.
.
.IP "\(bu" 4
\fBsetup_makes_kernel_gem_public\fR (\fBBUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC\fR): Have \fBBundler\.setup\fR make the \fBKernel#gem\fR method public, even though RubyGems declares it as private\.
.
.IP "\(bu" 4
\fBshebang\fR (\fBBUNDLE_SHEBANG\fR): The program name that should be invoked for generated binstubs\. Defaults to the ruby install name used to generate the binstub\.
.
.IP "\(bu" 4
\fBsilence_deprecations\fR (\fBBUNDLE_SILENCE_DEPRECATIONS\fR): Whether Bundler should silence deprecation warnings for behavior that will be changed in the next major version\.
.
.IP "\(bu" 4
\fBsilence_root_warning\fR (\fBBUNDLE_SILENCE_ROOT_WARNING\fR): Silence the warning Bundler prints when installing gems as root\.
.
.IP "\(bu" 4
\fBskip_default_git_sources\fR (\fBBUNDLE_SKIP_DEFAULT_GIT_SOURCES\fR): Whether Bundler should skip adding default git source shortcuts to the Gemfile DSL\.
.
.IP "\(bu" 4
\fBspecific_platform\fR (\fBBUNDLE_SPECIFIC_PLATFORM\fR): Allow bundler to resolve for the specific running platform and store it in the lockfile, instead of only using a generic platform\. A specific platform is the exact platform triple reported by \fBGem::Platform\.local\fR, such as \fBx86_64\-darwin\-16\fR or \fBuniversal\-java\-1\.8\fR\. On the other hand, generic platforms are those such as \fBruby\fR, \fBmswin\fR, or \fBjava\fR\. In this example, \fBx86_64\-darwin\-16\fR would map to \fBruby\fR and \fBuniversal\-java\-1\.8\fR to \fBjava\fR\.
.
.IP "\(bu" 4
\fBssl_ca_cert\fR (\fBBUNDLE_SSL_CA_CERT\fR): Path to a designated CA certificate file or folder containing multiple certificates for trusted CAs in PEM format\.
.
.IP "\(bu" 4
\fBssl_client_cert\fR (\fBBUNDLE_SSL_CLIENT_CERT\fR): Path to a designated file containing a X\.509 client certificate and key in PEM format\.
.
.IP "\(bu" 4
\fBssl_verify_mode\fR (\fBBUNDLE_SSL_VERIFY_MODE\fR): The SSL verification mode Bundler uses when making HTTPS requests\. Defaults to verify peer\.
.
.IP "\(bu" 4
\fBsuppress_install_using_messages\fR (\fBBUNDLE_SUPPRESS_INSTALL_USING_MESSAGES\fR): Avoid printing \fBUsing \.\.\.\fR messages during installation when the version of a gem has not changed\.
.
.IP "\(bu" 4
\fBsystem_bindir\fR (\fBBUNDLE_SYSTEM_BINDIR\fR): The location where RubyGems installs binstubs\. Defaults to \fBGem\.bindir\fR\.
.
.IP "\(bu" 4
\fBtimeout\fR (\fBBUNDLE_TIMEOUT\fR): The seconds allowed before timing out for network requests\. Defaults to \fB10\fR\.
.
.IP "\(bu" 4
\fBunlock_source_unlocks_spec\fR (\fBBUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC\fR): Whether running \fBbundle update \-\-source NAME\fR unlocks a gem with the given name\. Defaults to \fBtrue\fR\.
.
.IP "\(bu" 4
\fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR) Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\.
.
.IP "\(bu" 4
\fBuser_agent\fR (\fBBUNDLE_USER_AGENT\fR): The custom user agent fragment Bundler includes in API requests\.
.
.IP "\(bu" 4
\fBwith\fR (\fBBUNDLE_WITH\fR): A \fB:\fR\-separated list of groups whose gems bundler should install\.
.
.IP "\(bu" 4
\fBwithout\fR (\fBBUNDLE_WITHOUT\fR): A \fB:\fR\-separated list of groups whose gems bundler should not install\.
.
.IP "" 0
.
.P
In general, you should set these settings per\-application by using the applicable flag to the bundle install(1) \fIbundle\-install\.1\.html\fR or bundle package(1) \fIbundle\-package\.1\.html\fR command\.
.
.P
You can set them globally either via environment variables or \fBbundle config\fR, whichever is preferable for your setup\. If you use both, environment variables will take preference over global settings\.
.
.SH "LOCAL GIT REPOS"
Bundler also allows you to work against a git repository locally instead of using the remote version\. This can be achieved by setting up a local override:
.
.IP "" 4
.
.nf
bundle config set local\.GEM_NAME /path/to/local/git/repository
.
.fi
.
.IP "" 0
.
.P
For example, in order to use a local Rack repository, a developer could call:
.
.IP "" 4
.
.nf
bundle config set local\.rack ~/Work/git/rack
.
.fi
.
.IP "" 0
.
.P
Now instead of checking out the remote git repository, the local override will be used\. Similar to a path source, every time the local git repository change, changes will be automatically picked up by Bundler\. This means a commit in the local git repo will update the revision in the \fBGemfile\.lock\fR to the local git repo revision\. This requires the same attention as git submodules\. Before pushing to the remote, you need to ensure the local override was pushed, otherwise you may point to a commit that only exists in your local machine\. You\'ll also need to CGI escape your usernames and passwords as well\.
.
.P
Bundler does many checks to ensure a developer won\'t work with invalid references\. Particularly, we force a developer to specify a branch in the \fBGemfile\fR in order to use this feature\. If the branch specified in the \fBGemfile\fR and the current branch in the local git repository do not match, Bundler will abort\. This ensures that a developer is always working against the correct branches, and prevents accidental locking to a different branch\.
.
.P
Finally, Bundler also ensures that the current revision in the \fBGemfile\.lock\fR exists in the local git repository\. By doing this, Bundler forces you to fetch the latest changes in the remotes\.
.
.SH "MIRRORS OF GEM SOURCES"
Bundler supports overriding gem sources with mirrors\. This allows you to configure rubygems\.org as the gem source in your Gemfile while still using your mirror to fetch gems\.
.
.IP "" 4
.
.nf
bundle config set mirror\.SOURCE_URL MIRROR_URL
.
.fi
.
.IP "" 0
.
.P
For example, to use a mirror of rubygems\.org hosted at rubygems\-mirror\.org:
.
.IP "" 4
.
.nf
bundle config set mirror\.http://rubygems\.org http://rubygems\-mirror\.org
.
.fi
.
.IP "" 0
.
.P
Each mirror also provides a fallback timeout setting\. If the mirror does not respond within the fallback timeout, Bundler will try to use the original server instead of the mirror\.
.
.IP "" 4
.
.nf
bundle config set mirror\.SOURCE_URL\.fallback_timeout TIMEOUT
.
.fi
.
.IP "" 0
.
.P
For example, to fall back to rubygems\.org after 3 seconds:
.
.IP "" 4
.
.nf
bundle config set mirror\.https://rubygems\.org\.fallback_timeout 3
.
.fi
.
.IP "" 0
.
.P
The default fallback timeout is 0\.1 seconds, but the setting can currently only accept whole seconds (for example, 1, 15, or 30)\.
.
.SH "CREDENTIALS FOR GEM SOURCES"
Bundler allows you to configure credentials for any gem source, which allows you to avoid putting secrets into your Gemfile\.
.
.IP "" 4
.
.nf
bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
.
.fi
.
.IP "" 0
.
.P
For example, to save the credentials of user \fBclaudette\fR for the gem source at \fBgems\.longerous\.com\fR, you would run:
.
.IP "" 4
.
.nf
bundle config set gems\.longerous\.com claudette:s00pers3krit
.
.fi
.
.IP "" 0
.
.P
Or you can set the credentials as an environment variable like this:
.
.IP "" 4
.
.nf
export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
.
.fi
.
.IP "" 0
.
.P
For gems with a git source with HTTP(S) URL you can specify credentials like so:
.
.IP "" 4
.
.nf
bundle config set https://github\.com/bundler/bundler\.git username:password
.
.fi
.
.IP "" 0
.
.P
Or you can set the credentials as an environment variable like so:
.
.IP "" 4
.
.nf
export BUNDLE_GITHUB__COM=username:password
.
.fi
.
.IP "" 0
.
.P
This is especially useful for private repositories on hosts such as Github, where you can use personal OAuth tokens:
.
.IP "" 4
.
.nf
export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x\-oauth\-basic
.
.fi
.
.IP "" 0
.
.SH "CONFIGURE BUNDLER DIRECTORIES"
Bundler\'s home, config, cache and plugin directories are able to be configured through environment variables\. The default location for Bundler\'s home directory is \fB~/\.bundle\fR, which all directories inherit from by default\. The following outlines the available environment variables and their default values
.
.IP "" 4
.
.nf
BUNDLE_USER_HOME : $HOME/\.bundle
BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
.
.fi
.
.IP "" 0
bundler-2.1.4/man/bundle-config.1.txt 0000644 0000041 0000041 00000050330 13606335352 017377 0 ustar www-data www-data BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
NAME
bundle-config - Set bundler configuration options
SYNOPSIS
bundle config [list|get|set|unset] [name [value]]
DESCRIPTION
This command allows you to interact with Bundler's configuration sys-
tem.
Bundler loads configuration settings in this order:
1. Local config (app/.bundle/config)
2. Environmental variables (ENV)
3. Global config (~/.bundle/config)
4. Bundler default config
Executing bundle config list with will print a list of all bundler con-
figuration for the current bundle, and where that configuration was
set.
Executing bundle config get will print the value of that config-
uration setting, and where it was set.
Executing bundle config set will set that configuration
to the value specified for all bundles executed as the current user.
The configuration will be stored in ~/.bundle/config. If name already
is set, name will be overridden and user will be warned.
Executing bundle config set --global works the same as
above.
Executing bundle config set --local will set that con-
figuration to the local application. The configuration will be stored
in app/.bundle/config.
Executing bundle config unset will delete the configuration in
both local and global sources.
Executing bundle config unset --global will delete the configu-
ration only from the user configuration.
Executing bundle config unset --local will delete the
configuration only from the local application.
Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set
will cause it to ignore all configuration.
Executing bundle config set disable_multisource true upgrades the warn-
ing about the Gemfile containing multiple primary sources to an error.
Executing bundle config unset disable_multisource downgrades this error
to a warning.
REMEMBERING OPTIONS
Flags passed to bundle install or the Bundler runtime, such as --path
foo or --without production, are remembered between commands and saved
to your local application's configuration (normally, ./.bundle/config).
However, this will be changed in bundler 3, so it's better not to rely
on this behavior. If these options must be remembered, it's better to
set them using bundle config (e.g., bundle config set path foo).
The options that can be configured are:
bin Creates a directory (defaults to ~/bin) and place any executa-
bles from the gem there. These executables run in Bundler's con-
text. If used, you might add this directory to your environ-
ment's PATH variable. For instance, if the rails gem comes with
a rails executable, this flag will create a bin/rails executable
that ensures that all referred dependencies will be resolved
using the bundled gems.
deployment
In deployment mode, Bundler will 'roll-out' the bundle for pro-
duction use. Please check carefully if you want to have this
option enabled in development or test environments.
path The location to install the specified gems to. This defaults to
Rubygems' setting. Bundler shares this location with Rubygems,
gem install ... will have gem installed there, too. Therefore,
gems installed without a --path ... setting will show up by
calling gem list. Accordingly, gems installed to other locations
will not get listed.
without
A space-separated list of groups referencing gems to skip during
installation.
with A space-separated list of groups referencing gems to include
during installation.
BUILD OPTIONS
You can use bundle config to give Bundler the flags to pass to the gem
installer every time bundler tries to install a particular gem.
A very common example, the mysql gem, requires Snow Leopard users to
pass configuration flags to gem install to specify where to find the
mysql_config executable.
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Since the specific location of that executable can change from machine
to machine, you can specify these flags on a per-machine basis.
bundle config set build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
After running this command, every time bundler needs to install the
mysql gem, it will pass along the flags you specified.
CONFIGURATION KEYS
Configuration keys in bundler have two forms: the canonical form and
the environment variable form.
For instance, passing the --without flag to bundle install(1) bun-
dle-install.1.html prevents Bundler from installing certain groups
specified in the Gemfile(5). Bundler persists this value in app/.bun-
dle/config so that calls to Bundler.setup do not try to find gems from
the Gemfile that you didn't install. Additionally, subsequent calls to
bundle install(1) bundle-install.1.html remember this setting and skip
those groups.
The canonical form of this configuration is "without". To convert the
canonical form to the environment variable form, capitalize it, and
prepend BUNDLE_. The environment variable form of "without" is BUN-
DLE_WITHOUT.
Any periods in the configuration keys must be replaced with two under-
scores when setting it via environment variables. The configuration key
local.rack becomes the environment variable BUNDLE_LOCAL__RACK.
LIST OF AVAILABLE KEYS
The following is a list of all configuration keys and their purpose.
You can learn more about their operation in bundle install(1) bun-
dle-install.1.html.
o allow_bundler_dependency_conflicts (BUNDLE_ALLOW_BUNDLER_DEPEN-
DENCY_CONFLICTS): Allow resolving to specifications that have
dependencies on bundler that are incompatible with the running
Bundler version.
o allow_deployment_source_credential_changes (BUNDLE_ALLOW_DEPLOY-
MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow
changing the credentials to a gem's source. Ex:
https://some.host.com/gems/path/ -> https://user_name:pass-
word@some.host.com/gems/path
o allow_offline_install (BUNDLE_ALLOW_OFFLINE_INSTALL): Allow Bundler
to use cached data when installing without network access.
o auto_clean_without_path (BUNDLE_AUTO_CLEAN_WITHOUT_PATH): Automati-
cally run bundle clean after installing when an explicit path has
not been set and Bundler is not installing into the system gems.
o auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle
install when gems are missing.
o bin (BUNDLE_BIN): Install executables from gems in the bundle to
the specified directory. Defaults to false.
o cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and
git gems.
o cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for
all platforms.
o cache_path (BUNDLE_CACHE_PATH): The directory that bundler will
place cached gems in when running bundle package, and that bundler
will look in when installing gems. Defaults to vendor/cache.
o clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean auto-
matically after bundle install.
o console (BUNDLE_CONSOLE): The console that bundle console starts.
Defaults to irb.
o default_install_uses_path (BUNDLE_DEFAULT_INSTALL_USES_PATH):
Whether a bundle install without an explicit --path argument
defaults to installing gems in .bundle.
o deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile.
When the Gemfile is changed and the lockfile has not been updated,
running Bundler commands will be blocked.
o disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION):
Allow installing gems even if they do not match the checksum pro-
vided by RubyGems.
o disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from
using load to launch an executable in-process in bundle exec.
o disable_local_branch_check (BUNDLE_DISABLE_LOCAL_BRANCH_CHECK):
Allow Bundler to use a local git override without a branch speci-
fied in the Gemfile.
o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem-
files containing multiple sources will produce errors instead of
warnings. Use bundle config unset disable_multisource to unset.
o disable_platform_warnings (BUNDLE_DISABLE_PLATFORM_WARNINGS): Dis-
able warnings during bundle install when a dependency is unused on
the current platform.
o disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from
accessing gems installed to RubyGems' normal location.
o disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler
from checking if a newer Bundler version is available on
rubygems.org.
o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur-
rent machine's platform and install only ruby platform gems. As a
result, gems with native extensions will be compiled from source.
o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
Gemfile is changed and the lockfile has not been updated, running
Bundler commands will be blocked. Defaults to true when --deploy-
ment is used.
o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
gem push when using the rake release command with a private gem-
stash server.
o gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
use as the Gemfile. This location of this file also sets the root
of the project, which is used to resolve relative paths in the Gem-
file, among other things. By default, bundler will search up from
the current working directory until it finds a Gemfile.
o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
cache all gems globally, rather than locally to the installing Ruby
installation.
o ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install
messages will be printed. To silence a single gem, use dot notation
like ignore_messages.httparty true.
o init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a
Gemfile when running bundle init.
o jobs (BUNDLE_JOBS): The number of gems Bundler can install in par-
allel. Defaults to 1.
o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
installing gems.
o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
gems unpruned when caching.
o only_update_to_newer_versions (BUNDLE_ONLY_UPDATE_TO_NEWER_VER-
SIONS): During bundle update, only resolve to newer versions of the
gems in the lockfile.
o path (BUNDLE_PATH): The location on disk where all gems in your
bundle will be located regardless of $GEM_HOME or $GEM_PATH values.
Bundle gems not found in this location will be installed by bundle
install. Defaults to Gem.dir. When --deployment is used, defaults
to vendor/bundle.
o path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
gems into the default system path (Gem.dir).
o path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path
relative to the CWD instead of the Gemfile.
o plugins (BUNDLE_PLUGINS): Enable Bundler's experimental plugin sys-
tem.
o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
patch version during updates. Makes bundle update calls equivalent
to bundler update --patch.
o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print
only version number from bundler --version.
o redirect (BUNDLE_REDIRECT): The number of redirects allowed for
network requests. Defaults to 5.
o retry (BUNDLE_RETRY): The number of times to retry failed network
requests. Defaults to 3.
o setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB-
LIC): Have Bundler.setup make the Kernel#gem method public, even
though RubyGems declares it as private.
o shebang (BUNDLE_SHEBANG): The program name that should be invoked
for generated binstubs. Defaults to the ruby install name used to
generate the binstub.
o silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler
should silence deprecation warnings for behavior that will be
changed in the next major version.
o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
warning Bundler prints when installing gems as root.
o skip_default_git_sources (BUNDLE_SKIP_DEFAULT_GIT_SOURCES): Whether
Bundler should skip adding default git source shortcuts to the Gem-
file DSL.
o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to
resolve for the specific running platform and store it in the lock-
file, instead of only using a generic platform. A specific platform
is the exact platform triple reported by Gem::Platform.local, such
as x86_64-darwin-16 or universal-java-1.8. On the other hand,
generic platforms are those such as ruby, mswin, or java. In this
example, x86_64-darwin-16 would map to ruby and universal-java-1.8
to java.
o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi-
cate file or folder containing multiple certificates for trusted
CAs in PEM format.
o ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file
containing a X.509 client certificate and key in PEM format.
o ssl_verify_mode (BUNDLE_SSL_VERIFY_MODE): The SSL verification mode
Bundler uses when making HTTPS requests. Defaults to verify peer.
o suppress_install_using_messages (BUNDLE_SUPPRESS_INSTALL_USING_MES-
SAGES): Avoid printing Using ... messages during installation when
the version of a gem has not changed.
o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
installs binstubs. Defaults to Gem.bindir.
o timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for
network requests. Defaults to 10.
o unlock_source_unlocks_spec (BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC):
Whether running bundle update --source NAME unlocks a gem with the
given name. Defaults to true.
o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require
passing --all to bundle update when everything should be updated,
and disallow passing no options to bundle update.
o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
Bundler includes in API requests.
o with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
should install.
o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
bundler should not install.
In general, you should set these settings per-application by using the
applicable flag to the bundle install(1) bundle-install.1.html or bun-
dle package(1) bundle-package.1.html command.
You can set them globally either via environment variables or bundle
config, whichever is preferable for your setup. If you use both, envi-
ronment variables will take preference over global settings.
LOCAL GIT REPOS
Bundler also allows you to work against a git repository locally
instead of using the remote version. This can be achieved by setting up
a local override:
bundle config set local.GEM_NAME /path/to/local/git/repository
For example, in order to use a local Rack repository, a developer could
call:
bundle config set local.rack ~/Work/git/rack
Now instead of checking out the remote git repository, the local over-
ride will be used. Similar to a path source, every time the local git
repository change, changes will be automatically picked up by Bundler.
This means a commit in the local git repo will update the revision in
the Gemfile.lock to the local git repo revision. This requires the same
attention as git submodules. Before pushing to the remote, you need to
ensure the local override was pushed, otherwise you may point to a com-
mit that only exists in your local machine. You'll also need to CGI
escape your usernames and passwords as well.
Bundler does many checks to ensure a developer won't work with invalid
references. Particularly, we force a developer to specify a branch in
the Gemfile in order to use this feature. If the branch specified in
the Gemfile and the current branch in the local git repository do not
match, Bundler will abort. This ensures that a developer is always
working against the correct branches, and prevents accidental locking
to a different branch.
Finally, Bundler also ensures that the current revision in the Gem-
file.lock exists in the local git repository. By doing this, Bundler
forces you to fetch the latest changes in the remotes.
MIRRORS OF GEM SOURCES
Bundler supports overriding gem sources with mirrors. This allows you
to configure rubygems.org as the gem source in your Gemfile while still
using your mirror to fetch gems.
bundle config set mirror.SOURCE_URL MIRROR_URL
For example, to use a mirror of rubygems.org hosted at rubygems-mir-
ror.org:
bundle config set mirror.http://rubygems.org http://rubygems-mirror.org
Each mirror also provides a fallback timeout setting. If the mirror
does not respond within the fallback timeout, Bundler will try to use
the original server instead of the mirror.
bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
For example, to fall back to rubygems.org after 3 seconds:
bundle config set mirror.https://rubygems.org.fallback_timeout 3
The default fallback timeout is 0.1 seconds, but the setting can cur-
rently only accept whole seconds (for example, 1, 15, or 30).
CREDENTIALS FOR GEM SOURCES
Bundler allows you to configure credentials for any gem source, which
allows you to avoid putting secrets into your Gemfile.
bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
For example, to save the credentials of user claudette for the gem
source at gems.longerous.com, you would run:
bundle config set gems.longerous.com claudette:s00pers3krit
Or you can set the credentials as an environment variable like this:
export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
For gems with a git source with HTTP(S) URL you can specify credentials
like so:
bundle config set https://github.com/bundler/bundler.git username:password
Or you can set the credentials as an environment variable like so:
export BUNDLE_GITHUB__COM=username:password
This is especially useful for private repositories on hosts such as
Github, where you can use personal OAuth tokens:
export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
CONFIGURE BUNDLER DIRECTORIES
Bundler's home, config, cache and plugin directories are able to be
configured through environment variables. The default location for
Bundler's home directory is ~/.bundle, which all directories inherit
from by default. The following outlines the available environment vari-
ables and their default values
BUNDLE_USER_HOME : $HOME/.bundle
BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
January 2020 BUNDLE-CONFIG(1)
bundler-2.1.4/man/bundle-add.ronn 0000644 0000041 0000041 00000002335 13606335352 016662 0 ustar www-data www-data bundle-add(1) -- Add gem to the Gemfile and run bundle install
================================================================
## SYNOPSIS
`bundle add` [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install] [--strict] [--optimistic]
## DESCRIPTION
Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`.
Example:
bundle add rails
bundle add rails --version "< 3.0, > 1.1"
bundle add rails --version "~> 5.0.0" --source "https://gems.example.com" --group "development"
bundle add rails --skip-install
bundle add rails --group "development, test"
## OPTIONS
* `--version`, `-v`:
Specify version requirements(s) for the added gem.
* `--group`, `-g`:
Specify the group(s) for the added gem. Multiple groups should be separated by commas.
* `--source`, , `-s`:
Specify the source for the added gem.
* `--git`:
Specify the git source for the added gem.
* `--branch`:
Specify the git branch for the added gem.
* `--skip-install`:
Adds the gem to the Gemfile but does not install it.
* `--optimistic`:
Adds optimistic declaration of version
* `--strict`:
Adds strict declaration of version
bundler-2.1.4/man/bundle-inject.1.txt 0000644 0000041 0000041 00000001237 13606335352 017410 0 ustar www-data www-data BUNDLE-INJECT(1) BUNDLE-INJECT(1)
NAME
bundle-inject - Add named gem(s) with version requirements to Gemfile
SYNOPSIS
bundle inject [GEM] [VERSION]
DESCRIPTION
Adds the named gem(s) with their version requirements to the resolved
[Gemfile(5)][Gemfile(5)].
This command will add the gem to both your [Gemfile(5)][Gemfile(5)] and
Gemfile.lock if it isn't listed yet.
Example:
bundle install
bundle inject 'rack' '> 0'
This will inject the 'rack' gem with a version greater than 0 in your
[Gemfile(5)][Gemfile(5)] and Gemfile.lock
January 2020 BUNDLE-INJECT(1)
bundler-2.1.4/man/gemfile.5.ronn 0000644 0000041 0000041 00000047025 13606335352 016443 0 ustar www-data www-data Gemfile(5) -- A format for describing gem dependencies for Ruby programs
========================================================================
## SYNOPSIS
A `Gemfile` describes the gem dependencies required to execute associated
Ruby code.
Place the `Gemfile` in the root of the directory containing the associated
code. For instance, in a Rails application, place the `Gemfile` in the same
directory as the `Rakefile`.
## SYNTAX
A `Gemfile` is evaluated as Ruby code, in a context which makes available
a number of methods used to describe the gem requirements.
## GLOBAL SOURCES
At the top of the `Gemfile`, add a line for the `Rubygems` source that contains
the gems listed in the `Gemfile`.
source "https://rubygems.org"
It is possible, but not recommended as of Bundler 1.7, to add multiple global
`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository.
Sources are checked for gems following the heuristics described in
[SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler
will print a warning after installing the gem indicating which source was used,
and listing the other sources where the gem is available. A specific source can
be selected for gems that need to use a non-standard repository, suppressing
this warning, by using the [`:source` option](#SOURCE) or a
[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
### CREDENTIALS
Some gem sources require a username and password. Use [bundle config(1)](bundle-config.1.html) to set
the username and password for any of the sources that need it. The command must
be run once on each computer that will install the Gemfile, but this keeps the
credentials from being stored in plain text in version control.
bundle config gems.example.com user:password
For some sources, like a company Gemfury account, it may be easier to
include the credentials in the Gemfile as part of the source URL.
source "https://user:password@gems.example.com"
Credentials in the source URL will take precedence over credentials set using
`config`.
## RUBY
If your application requires a specific Ruby version or engine, specify your
requirements using the `ruby` method, with the following arguments.
All parameters are `OPTIONAL` unless otherwise specified.
### VERSION (required)
The version of Ruby that your application requires. If your application
requires an alternate Ruby engine, such as JRuby, Rubinius or TruffleRuby, this
should be the Ruby version that the engine is compatible with.
ruby "1.9.3"
### ENGINE
Each application _may_ specify a Ruby engine. If an engine is specified, an
engine version _must_ also be specified.
What exactly is an Engine?
- A Ruby engine is an implementation of the Ruby language.
- For background: the reference or original implementation of the Ruby
programming language is called
[Matz's Ruby Interpreter](https://en.wikipedia.org/wiki/Ruby_MRI), or MRI
for short. This is named after Ruby creator Yukihiro Matsumoto,
also known as Matz. MRI is also known as CRuby, because it is written in C.
MRI is the most widely used Ruby engine.
- [Other implementations](https://www.ruby-lang.org/en/about/) of Ruby exist.
Some of the more well-known implementations include
[Rubinius](https://rubinius.com/), and [JRuby](http://jruby.org/).
Rubinius is an alternative implementation of Ruby written in Ruby.
JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine.
### ENGINE VERSION
Each application _may_ specify a Ruby engine version. If an engine version is
specified, an engine _must_ also be specified. If the engine is "ruby" the
engine version specified _must_ match the Ruby version.
ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
### PATCHLEVEL
Each application _may_ specify a Ruby patchlevel.
ruby "2.0.0", :patchlevel => "247"
## GEMS
Specify gem requirements using the `gem` method, with the following arguments.
All parameters are `OPTIONAL` unless otherwise specified.
### NAME (required)
For each gem requirement, list a single _gem_ line.
gem "nokogiri"
### VERSION
Each _gem_ `MAY` have one or more version specifiers.
gem "nokogiri", ">= 1.4.2"
gem "RedCloth", ">= 4.1.0", "< 4.2.0"
### REQUIRE AS
Each _gem_ `MAY` specify files that should be used when autorequiring via
`Bundler.require`. You may pass an array with multiple files or `true` if file
you want `required` has same name as _gem_ or `false` to
prevent any file from being autorequired.
gem "redis", :require => ["redis/connection/hiredis", "redis"]
gem "webmock", :require => false
gem "byebug", :require => true
The argument defaults to the name of the gem. For example, these are identical:
gem "nokogiri"
gem "nokogiri", :require => "nokogiri"
gem "nokogiri", :require => true
### GROUPS
Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
not specify membership in any group is placed in the `default` group.
gem "rspec", :group => :test
gem "wirble", :groups => [:development, :test]
The Bundler runtime allows its two main methods, `Bundler.setup` and
`Bundler.require`, to limit their impact to particular groups.
# setup adds gems to Ruby's load path
Bundler.setup # defaults to all groups
require "bundler/setup" # same as Bundler.setup
Bundler.setup(:default) # only set up the _default_ group
Bundler.setup(:test) # only set up the _test_ group (but `not` _default_)
Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
# require requires all of the gems in the specified groups
Bundler.require # defaults to the _default_ group
Bundler.require(:default) # identical
Bundler.require(:default, :test) # requires the _default_ and _test_ groups
Bundler.require(:test) # requires the _test_ group
The Bundler CLI allows you to specify a list of groups whose gems `bundle install` should
not install with the `without` configuration.
To specify multiple groups to ignore, specify a list of groups separated by spaces.
bundle config set without test
bundle config set without development test
Also, calling `Bundler.setup` with no parameters, or calling `require "bundler/setup"`
will setup all groups except for the ones you excluded via `--without` (since they
are not available).
Note that on `bundle install`, bundler downloads and evaluates all gems, in order to
create a single canonical list of all of the required gems and their dependencies.
This means that you cannot list different versions of the same gems in different
groups. For more details, see [Understanding Bundler](https://bundler.io/rationale.html).
### PLATFORMS
If a gem should only be used in a particular platform or set of platforms, you can
specify them. Platforms are essentially identical to groups, except that you do not
need to use the `--without` install-time flag to exclude groups of gems for other
platforms.
There are a number of `Gemfile` platforms:
* `ruby`:
C Ruby (MRI), Rubinius or TruffleRuby, but `NOT` Windows
* `mri`:
Same as _ruby_, but only C Ruby (MRI)
* `mingw`:
Windows 32 bit 'mingw32' platform (aka RubyInstaller)
* `x64_mingw`:
Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
* `rbx`:
Rubinius
* `jruby`:
JRuby
* `truffleruby`:
TruffleRuby
* `mswin`:
Windows
You can restrict further by platform and version for all platforms *except* for
`rbx`, `jruby`, `truffleruby` and `mswin`.
To specify a version in addition to a platform, append the version number without
the delimiter to the platform. For example, to specify that a gem should only be
used on platforms with Ruby 2.3, use:
ruby_23
The full list of platforms and supported versions includes:
* `ruby`:
1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
* `mri`:
1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
* `mingw`:
1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
* `x64_mingw`:
2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
As with groups, you can specify one or more platforms:
gem "weakling", :platforms => :jruby
gem "ruby-debug", :platforms => :mri_18
gem "nokogiri", :platforms => [:mri_18, :jruby]
All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`,
`Bundler.require`) behave exactly the same as if any groups not
matching the current platform were explicitly excluded.
### SOURCE
You can select an alternate Rubygems repository for a gem using the ':source'
option.
gem "some_internal_gem", :source => "https://gems.example.com"
This forces the gem to be loaded from this source and ignores any global sources
declared at the top level of the file. If the gem does not exist in this source,
it will not be installed.
Bundler will search for child dependencies of this gem by first looking in the
source selected for the parent, but if they are not found there, it will fall
back on global sources using the ordering described in [SOURCE PRIORITY][].
Selecting a specific source repository this way also suppresses the ambiguous
gem warning described above in
[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES).
Using the `:source` option for an individual gem will also make that source
available as a possible global source for any other gems which do not specify
explicit sources. Thus, when adding gems with explicit sources, it is
recommended that you also ensure all other gems in the Gemfile are using
explicit sources.
### GIT
If necessary, you can specify that a gem is located at a particular
git repository using the `:git` parameter. The repository can be accessed via
several protocols:
* `HTTP(S)`:
gem "rails", :git => "https://github.com/rails/rails.git"
* `SSH`:
gem "rails", :git => "git@github.com:rails/rails.git"
* `git`:
gem "rails", :git => "git://github.com/rails/rails.git"
If using SSH, the user that you use to run `bundle install` `MUST` have the
appropriate keys available in their `$HOME/.ssh`.
`NOTE`: `http://` and `git://` URLs should be avoided if at all possible. These
protocols are unauthenticated, so a man-in-the-middle attacker can deliver
malicious code and compromise your system. HTTPS and SSH are strongly
preferred.
The `group`, `platforms`, and `require` options are available and behave
exactly the same as they would for a normal gem.
A git repository `SHOULD` have at least one file, at the root of the
directory containing the gem, with the extension `.gemspec`. This file
`MUST` contain a valid gem specification, as expected by the `gem build`
command.
If a git repository does not have a `.gemspec`, bundler will attempt to
create one, but it will not contain any dependencies, executables, or
C extension compilation instructions. As a result, it may fail to properly
integrate into your application.
If a git repository does have a `.gemspec` for the gem you attached it
to, a version specifier, if provided, means that the git repository is
only valid if the `.gemspec` specifies a version matching the version
specifier. If not, bundler will print a warning.
gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git"
# bundle install will fail, because the .gemspec in the rails
# repository's master branch specifies version 3.0.0
If a git repository does `not` have a `.gemspec` for the gem you attached
it to, a version specifier `MUST` be provided. Bundler will use this
version in the simple `.gemspec` it creates.
Git repositories support a number of additional options.
* `branch`, `tag`, and `ref`:
You `MUST` only specify at most one of these options. The default
is `:branch => "master"`. For example:
gem "rails", :git => "https://github.com/rails/rails.git", :branch => "5-0-stable"
gem "rails", :git => "https://github.com/rails/rails.git", :tag => "v5.0.0"
gem "rails", :git => "https://github.com/rails/rails.git", :ref => "4aded"
* `submodules`:
For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
lets you have another git repository within a subfolder of your repository.
Specify `:submodules => true` to cause bundler to expand any
submodules included in the git repository
If a git repository contains multiple `.gemspecs`, each `.gemspec`
represents a gem located at the same place in the file system as
the `.gemspec`.
|~rails [git root]
| |-rails.gemspec [rails gem located here]
|~actionpack
| |-actionpack.gemspec [actionpack gem located here]
|~activesupport
| |-activesupport.gemspec [activesupport gem located here]
|...
To install a gem located in a git repository, bundler changes to
the directory containing the gemspec, runs `gem build name.gemspec`
and then installs the resulting gem. The `gem build` command,
which comes standard with Rubygems, evaluates the `.gemspec` in
the context of the directory in which it is located.
### GIT SOURCE
A custom git source can be defined via the `git_source` method. Provide the source's name
as an argument, and a block which receives a single argument and interpolates it into a
string to return the full repo address:
git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
gem 'rails', :stash => 'forks/rails'
In addition, if you wish to choose a specific branch:
gem "rails", :stash => "forks/rails", :branch => "branch_name"
### GITHUB
`NOTE`: This shorthand should be avoided until Bundler 2.0, since it
currently expands to an insecure `git://` URL. This allows a
man-in-the-middle attacker to compromise your system.
If the git repository you want to use is hosted on GitHub and is public, you can use the
:github shorthand to specify the github username and repository name (without the
trailing ".git"), separated by a slash. If both the username and repository name are the
same, you can omit one.
gem "rails", :github => "rails/rails"
gem "rails", :github => "rails"
Are both equivalent to
gem "rails", :git => "git://github.com/rails/rails.git"
Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
### GIST
If the git repository you want to use is hosted as a Github Gist and is public, you can use
the :gist shorthand to specify the gist identifier (without the trailing ".git").
gem "the_hatch", :gist => "4815162342"
Is equivalent to:
gem "the_hatch", :git => "https://gist.github.com/4815162342.git"
Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument.
### BITBUCKET
If the git repository you want to use is hosted on Bitbucket and is public, you can use the
:bitbucket shorthand to specify the bitbucket username and repository name (without the
trailing ".git"), separated by a slash. If both the username and repository name are the
same, you can omit one.
gem "rails", :bitbucket => "rails/rails"
gem "rails", :bitbucket => "rails"
Are both equivalent to
gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git"
Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument.
### PATH
You can specify that a gem is located in a particular location
on the file system. Relative paths are resolved relative to the
directory containing the `Gemfile`.
Similar to the semantics of the `:git` option, the `:path`
option requires that the directory in question either contains
a `.gemspec` for the gem, or that you specify an explicit
version that bundler should use.
Unlike `:git`, bundler does not compile C extensions for
gems specified as paths.
gem "rails", :path => "vendor/rails"
If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories.
path 'components' do
gem 'admin_ui'
gem 'public_ui'
end
## BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS
The `:source`, `:git`, `:path`, `:group`, and `:platforms` options may be
applied to a group of gems by using block form.
source "https://gems.example.com" do
gem "some_internal_gem"
gem "another_internal_gem"
end
git "https://github.com/rails/rails.git" do
gem "activesupport"
gem "actionpack"
end
platforms :ruby do
gem "ruby-debug"
gem "sqlite3"
end
group :development, :optional => true do
gem "wirble"
gem "faker"
end
In the case of the group block form the :optional option can be given
to prevent a group from being installed unless listed in the `--with`
option given to the `bundle install` command.
In the case of the `git` block form, the `:ref`, `:branch`, `:tag`,
and `:submodules` options may be passed to the `git` method, and
all gems in the block will inherit those options.
The presence of a `source` block in a Gemfile also makes that source
available as a possible global source for any other gems which do not specify
explicit sources. Thus, when defining source blocks, it is
recommended that you also ensure all other gems in the Gemfile are using
explicit sources, either via source blocks or `:source` directives on
individual gems.
## INSTALL_IF
The `install_if` method allows gems to be installed based on a proc or lambda.
This is especially useful for optional gems that can only be used if certain
software is installed or some other conditions are met.
install_if -> { RUBY_PLATFORM =~ /darwin/ } do
gem "pasteboard"
end
## GEMSPEC
The [`.gemspec`](http://guides.rubygems.org/specification-reference/) file is where
you provide metadata about your gem to Rubygems. Some required Gemspec
attributes include the name, description, and homepage of your gem. This is
also where you specify the dependencies your gem needs to run.
If you wish to use Bundler to help install dependencies for a gem while it is
being developed, use the `gemspec` method to pull in the dependencies listed in
the `.gemspec` file.
The `gemspec` method adds any runtime dependencies as gem requirements in the
default group. It also adds development dependencies as gem requirements in the
`development` group. Finally, it adds a gem requirement on your project (`:path
=> '.'`). In conjunction with `Bundler.setup`, this allows you to require project
files in your test code as you would if the project were installed as a gem; you
need not manipulate the load path manually or require project files via relative
paths.
The `gemspec` method supports optional `:path`, `:glob`, `:name`, and `:development_group`
options, which control where bundler looks for the `.gemspec`, the glob it uses to look
for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses
(if more than one is present), and which group development dependencies are included in.
When a `gemspec` dependency encounters version conflicts during resolution, the
local version under development will always be selected -- even if there are
remote versions that better match other requirements for the `gemspec` gem.
## SOURCE PRIORITY
When attempting to locate a gem to satisfy a gem requirement,
bundler uses the following priority order:
1. The source explicitly attached to the gem (using `:source`, `:path`, or
`:git`)
2. For implicit gems (dependencies of explicit gems), any source, git, or path
repository declared on the parent. This results in bundler prioritizing the
ActiveSupport gem from the Rails git repository over ones from
`rubygems.org`
3. The sources specified via global `source` lines, searching each source in
your `Gemfile` from last added to first added.
bundler-2.1.4/man/bundle-check.ronn 0000644 0000041 0000041 00000001531 13606335352 017204 0 ustar www-data www-data bundle-check(1) -- Verifies if dependencies are satisfied by installed gems
===========================================================================
## SYNOPSIS
`bundle check` [--dry-run]
[--gemfile=FILE]
[--path=PATH]
## DESCRIPTION
`check` searches the local machine for each of the gems requested in the
Gemfile. If all gems are found, Bundler prints a success message and exits with
a status of 0.
If not, the first missing gem is listed and Bundler exits status 1.
## OPTIONS
* `--dry-run`:
Locks the [`Gemfile(5)`][Gemfile(5)] before running the command.
* `--gemfile`:
Use the specified gemfile instead of the [`Gemfile(5)`][Gemfile(5)].
* `--path`:
Specify a different path than the system default (`$BUNDLE_PATH` or `$GEM_HOME`).
Bundler will remember this value for future installs on this machine.
bundler-2.1.4/man/bundle-clean.1 0000644 0000041 0000041 00000001133 13606335352 016373 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CLEAN" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
.
.SH "SYNOPSIS"
\fBbundle clean\fR [\-\-dry\-run] [\-\-force]
.
.SH "DESCRIPTION"
This command will remove all unused gems in your bundler directory\. This is useful when you have made many changes to your gem dependencies\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-dry\-run\fR
Print the changes, but do not clean the unused gems\.
.
.TP
\fB\-\-force\fR
Force a clean even if \fB\-\-path\fR is not set\.
bundler-2.1.4/man/bundle-open.1 0000644 0000041 0000041 00000001104 13606335352 016250 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-OPEN" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
.
.SH "SYNOPSIS"
\fBbundle open\fR [GEM]
.
.SH "DESCRIPTION"
Opens the source directory of the provided GEM in your editor\.
.
.P
For this to work the \fBEDITOR\fR or \fBBUNDLER_EDITOR\fR environment variable has to be set\.
.
.P
Example:
.
.IP "" 4
.
.nf
bundle open \'rack\'
.
.fi
.
.IP "" 0
.
.P
Will open the source directory for the \'rack\' gem in your bundle\.
bundler-2.1.4/man/bundle-open.ronn 0000644 0000041 0000041 00000000672 13606335352 017075 0 ustar www-data www-data bundle-open(1) -- Opens the source directory for a gem in your bundle
=====================================================================
## SYNOPSIS
`bundle open` [GEM]
## DESCRIPTION
Opens the source directory of the provided GEM in your editor.
For this to work the `EDITOR` or `BUNDLER_EDITOR` environment variable has to
be set.
Example:
bundle open 'rack'
Will open the source directory for the 'rack' gem in your bundle.
bundler-2.1.4/man/bundle-show.1.txt 0000644 0000041 0000041 00000001202 13606335352 017104 0 ustar www-data www-data BUNDLE-SHOW(1) BUNDLE-SHOW(1)
NAME
bundle-show - Shows all the gems in your bundle, or the path to a gem
SYNOPSIS
bundle show [GEM] [--paths]
DESCRIPTION
Without the [GEM] option, show will print a list of the names and ver-
sions of all gems that are required by your [Gemfile(5)][Gemfile(5)],
sorted by name.
Calling show with [GEM] will list the exact location of that gem on
your machine.
OPTIONS
--paths
List the paths of all gems that are required by your [Gem-
file(5)][Gemfile(5)], sorted by gem name.
January 2020 BUNDLE-SHOW(1)
bundler-2.1.4/man/bundle-list.1.txt 0000644 0000041 0000041 00000001441 13606335352 017104 0 ustar www-data www-data BUNDLE-LIST(1) BUNDLE-LIST(1)
NAME
bundle-list - List all the gems in the bundle
SYNOPSIS
bundle list [--name-only] [--paths] [--without-group=GROUP]
[--only-group=GROUP]
DESCRIPTION
Prints a list of all the gems in the bundle including their version.
Example:
bundle list --name-only
bundle list --paths
bundle list --without-group test
bundle list --only-group dev
bundle list --only-group dev --paths
OPTIONS
--name-only
Print only the name of each gem.
--paths
Print the path to each gem in the bundle.
--without-group
Print all gems expect from a group.
--only-group
Print gems from a particular group.
January 2020 BUNDLE-LIST(1)
bundler-2.1.4/man/bundle-install.1.txt 0000644 0000041 0000041 00000041713 13606335352 017605 0 ustar www-data www-data BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
NAME
bundle-install - Install the dependencies specified in your Gemfile
SYNOPSIS
bundle install [--binstubs[=DIRECTORY]] [--clean] [--deployment]
[--frozen] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER] [--local]
[--no-cache] [--no-prune] [--path PATH] [--quiet] [--redownload]
[--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--sys-
tem] [--trust-policy=POLICY] [--with=GROUP[ GROUP...]] [--with-
out=GROUP[ GROUP...]]
DESCRIPTION
Install the gems specified in your Gemfile(5). If this is the first
time you run bundle install (and a Gemfile.lock does not exist),
Bundler will fetch all remote sources, resolve dependencies and install
all needed gems.
If a Gemfile.lock does exist, and you have not updated your Gemfile(5),
Bundler will fetch all remote sources, but use the dependencies speci-
fied in the Gemfile.lock instead of resolving dependencies.
If a Gemfile.lock does exist, and you have updated your Gemfile(5),
Bundler will use the dependencies in the Gemfile.lock for all gems that
you did not update, but will re-resolve the dependencies of gems that
you did update. You can find more information about this update process
below under CONSERVATIVE UPDATING.
OPTIONS
To apply any of --binstubs, --deployment, --path, or --without every
time bundle install is run, use bundle config (see bundle-config(1)).
--binstubs[=]
Binstubs are scripts that wrap around executables. Bundler cre-
ates a small Ruby file (a binstub) that loads Bundler, runs the
command, and puts it in bin/. This lets you link the binstub
inside of an application to the exact gem version the applica-
tion needs.
Creates a directory (defaults to ~/bin) and places any executa-
bles from the gem there. These executables run in Bundler's con-
text. If used, you might add this directory to your environ-
ment's PATH variable. For instance, if the rails gem comes with
a rails executable, this flag will create a bin/rails executable
that ensures that all referred dependencies will be resolved
using the bundled gems.
--clean
On finishing the installation Bundler is going to remove any
gems not present in the current Gemfile(5). Don't worry, gems
currently in use will not be removed.
--deployment
In deployment mode, Bundler will 'roll-out' the bundle for pro-
duction or CI use. Please check carefully if you want to have
this option enabled in your development environment.
--redownload
Force download every gem, even if the required versions are
already available locally.
--frozen
Do not allow the Gemfile.lock to be updated after this install.
Exits non-zero if there are going to be changes to the Gem-
file.lock.
--full-index
Bundler will not call Rubygems' API endpoint (default) but down-
load and cache a (currently big) index file of all gems. Perfor-
mance can be improved for large bundles that seldom change by
enabling this option.
--gemfile=
The location of the Gemfile(5) which Bundler should use. This
defaults to a Gemfile(5) in the current working directory. In
general, Bundler will assume that the location of the Gemfile(5)
is also the project's root and will try to find Gemfile.lock and
vendor/cache relative to this location.
--jobs=[], -j[]
The maximum number of parallel download and install jobs. The
default is 1.
--local
Do not attempt to connect to rubygems.org. Instead, Bundler will
use the gems already present in Rubygems' cache or in ven-
dor/cache. Note that if a appropriate platform-specific gem
exists on rubygems.org it will not be found.
--no-cache
Do not update the cache in vendor/cache with the newly bundled
gems. This does not remove any gems in the cache but keeps the
newly bundled gems from being cached during the install.
--no-prune
Don't remove stale gems from the cache when the installation
finishes.
--path=
The location to install the specified gems to. This defaults to
Rubygems' setting. Bundler shares this location with Rubygems,
gem install ... will have gem installed there, too. Therefore,
gems installed without a --path ... setting will show up by
calling gem list. Accordingly, gems installed to other locations
will not get listed.
--quiet
Do not print progress information to the standard output.
Instead, Bundler will exit using a status code ($?).
--retry=[]
Retry failed network or git requests for number times.
--shebang=
Uses the specified ruby executable (usually ruby) to execute the
scripts created with --binstubs. In addition, if you use --bin-
stubs together with --shebang jruby these executables will be
changed to execute jruby instead.
--standalone[=]
Makes a bundle that can work without depending on Rubygems or
Bundler at runtime. A space separated list of groups to install
has to be specified. Bundler creates a directory named bundle
and installs the bundle there. It also generates a bun-
dle/bundler/setup.rb file to replace Bundler's own setup in the
manner required. Using this option implicitly sets path, which
is a [remembered option][REMEMBERED OPTIONS].
--system
Installs the gems specified in the bundle to the system's
Rubygems location. This overrides any previous configuration of
--path.
--trust-policy=[]
Apply the Rubygems security policy policy, where policy is one
of HighSecurity, MediumSecurity, LowSecurity, AlmostNoSecurity,
or NoSecurity. For more details, please see the Rubygems signing
documentation linked below in SEE ALSO.
--with=
A space-separated list of groups referencing gems to install. If
an optional group is given it is installed. If a group is given
that is in the remembered list of groups given to --without, it
is removed from that list.
--without=
A space-separated list of groups referencing gems to skip during
installation. If a group is given that is in the remembered list
of groups given to --with, it is removed from that list.
DEPLOYMENT MODE
Bundler's defaults are optimized for development. To switch to defaults
optimized for deployment and for CI, use the --deployment flag. Do not
activate deployment mode on development machines, as it will cause an
error when the Gemfile(5) is modified.
1. A Gemfile.lock is required.
To ensure that the same versions of the gems you developed with and
tested with are also used in deployments, a Gemfile.lock is
required.
This is mainly to ensure that you remember to check your Gem-
file.lock into version control.
2. The Gemfile.lock must be up to date
In development, you can modify your Gemfile(5) and re-run bundle
install to conservatively update your Gemfile.lock snapshot.
In deployment, your Gemfile.lock should be up-to-date with changes
made in your Gemfile(5).
3. Gems are installed to vendor/bundle not your default system loca-
tion
In development, it's convenient to share the gems used in your
application with other applications and other scripts that run on
the system.
In deployment, isolation is a more important default. In addition,
the user deploying the application may not have permission to
install gems to the system, or the web server may not have permis-
sion to read them.
As a result, bundle install --deployment installs gems to the ven-
dor/bundle directory in the application. This may be overridden
using the --path option.
SUDO USAGE
By default, Bundler installs gems to the same location as gem install.
In some cases, that location may not be writable by your Unix user. In
that case, Bundler will stage everything in a temporary directory, then
ask you for your sudo password in order to copy the gems into their
system location.
From your perspective, this is identical to installing the gems
directly into the system.
You should never use sudo bundle install. This is because several other
steps in bundle install must be performed as the current user:
o Updating your Gemfile.lock
o Updating your vendor/cache, if necessary
o Checking out private git repositories using your user's SSH keys
Of these three, the first two could theoretically be performed by
chowning the resulting files to $SUDO_USER. The third, however, can
only be performed by invoking the git command as the current user.
Therefore, git gems are downloaded and installed into ~/.bundle rather
than $GEM_HOME or $BUNDLE_PATH.
As a result, you should run bundle install as the current user, and
Bundler will ask for your password if it is needed to put the gems into
their final location.
INSTALLING GROUPS
By default, bundle install will install all gems in all groups in your
Gemfile(5), except those declared for a different platform.
However, you can explicitly tell Bundler to skip installing certain
groups with the --without option. This option takes a space-separated
list of groups.
While the --without option will skip installing the gems in the speci-
fied groups, it will still download those gems and use them to resolve
the dependencies of every gem in your Gemfile(5).
This is so that installing a different set of groups on another machine
(such as a production server) will not change the gems and versions
that you have already developed and tested against.
Bundler offers a rock-solid guarantee that the third-party code you are
running in development and testing is also the third-party code you are
running in production. You can choose to exclude some of that code in
different environments, but you will never be caught flat-footed by
different versions of third-party code being used in different environ-
ments.
For a simple illustration, consider the following Gemfile(5):
source 'https://rubygems.org'
gem 'sinatra'
group :production do
gem 'rack-perftools-profiler'
end
In this case, sinatra depends on any version of Rack (>= 1.0), while
rack-perftools-profiler depends on 1.x (~> 1.0).
When you run bundle install --without production in development, we
look at the dependencies of rack-perftools-profiler as well. That way,
you do not spend all your time developing against Rack 2.0, using new
APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2
when the production group is used.
This should not cause any problems in practice, because we do not
attempt to install the gems in the excluded groups, and only evaluate
as part of the dependency resolution process.
This also means that you cannot include different versions of the same
gem in different groups, because doing so would result in different
sets of dependencies used in development and production. Because of the
vagaries of the dependency resolution process, this usually affects
more than the gems you list in your Gemfile(5), and can (surprisingly)
radically change the gems you are using.
THE GEMFILE.LOCK
When you run bundle install, Bundler will persist the full names and
versions of all gems that you used (including dependencies of the gems
specified in the Gemfile(5)) into a file called Gemfile.lock.
Bundler uses this file in all subsequent calls to bundle install, which
guarantees that you always use the same exact code, even as your appli-
cation moves across machines.
Because of the way dependency resolution works, even a seemingly small
change (for instance, an update to a point-release of a dependency of a
gem in your Gemfile(5)) can result in radically different gems being
needed to satisfy all dependencies.
As a result, you SHOULD check your Gemfile.lock into version control,
in both applications and gems. If you do not, every machine that checks
out your repository (including your production server) will resolve all
dependencies again, which will result in different versions of
third-party code being used if any of the gems in the Gemfile(5) or any
of their dependencies have been updated.
When Bundler first shipped, the Gemfile.lock was included in the .git-
ignore file included with generated gems. Over time, however, it became
clear that this practice forces the pain of broken dependencies onto
new contributors, while leaving existing contributors potentially
unaware of the problem. Since bundle install is usually the first step
towards a contribution, the pain of broken dependencies would discour-
age new contributors from contributing. As a result, we have revised
our guidance for gem authors to now recommend checking in the lock for
gems.
CONSERVATIVE UPDATING
When you make a change to the Gemfile(5) and then run bundle install,
Bundler will update only the gems that you modified.
In other words, if a gem that you did not modify worked before you
called bundle install, it will continue to use the exact same versions
of all dependencies as it used before the update.
Let's take a look at an example. Here's your original Gemfile(5):
source 'https://rubygems.org'
gem 'actionpack', '2.3.8'
gem 'activemerchant'
In this case, both actionpack and activemerchant depend on activesup-
port. The actionpack gem depends on activesupport 2.3.8 and rack ~>
1.1.0, while the activemerchant gem depends on activesupport >= 2.3.2,
braintree >= 2.0.0, and builder >= 2.0.0.
When the dependencies are first resolved, Bundler will select
activesupport 2.3.8, which satisfies the requirements of both gems in
your Gemfile(5).
Next, you modify your Gemfile(5) to:
source 'https://rubygems.org'
gem 'actionpack', '3.0.0.rc'
gem 'activemerchant'
The actionpack 3.0.0.rc gem has a number of new dependencies, and
updates the activesupport dependency to = 3.0.0.rc and the rack depen-
dency to ~> 1.2.1.
When you run bundle install, Bundler notices that you changed the
actionpack gem, but not the activemerchant gem. It evaluates the gems
currently being used to satisfy its requirements:
activesupport 2.3.8
also used to satisfy a dependency in activemerchant, which is
not being updated
rack ~> 1.1.0
not currently being used to satisfy another dependency
Because you did not explicitly ask to update activemerchant, you would
not expect it to suddenly stop working after updating actionpack. How-
ever, satisfying the new activesupport 3.0.0.rc dependency of action-
pack requires updating one of its dependencies.
Even though activemerchant declares a very loose dependency that theo-
retically matches activesupport 3.0.0.rc, Bundler treats gems in your
Gemfile(5) that have not changed as an atomic unit together with their
dependencies. In this case, the activemerchant dependency is treated as
activemerchant 1.7.1 + activesupport 2.3.8, so bundle install will
report that it cannot update actionpack.
To explicitly update actionpack, including its dependencies which other
gems in the Gemfile(5) still depend on, run bundle update actionpack
(see bundle update(1)).
Summary: In general, after making a change to the Gemfile(5) , you
should first try to run bundle install, which will guarantee that no
other gem in the Gemfile(5) is impacted by the change. If that does not
work, run bundle update(1) bundle-update.1.html.
SEE ALSO
o Gem install docs
http://guides.rubygems.org/rubygems-basics/#installing-gems
o Rubygems signing docs http://guides.rubygems.org/security/
January 2020 BUNDLE-INSTALL(1)
bundler-2.1.4/man/bundle-lock.1.txt 0000644 0000041 0000041 00000006173 13606335352 017070 0 ustar www-data www-data BUNDLE-LOCK(1) BUNDLE-LOCK(1)
NAME
bundle-lock - Creates / Updates a lockfile without installing
SYNOPSIS
bundle lock [--update] [--local] [--print] [--lockfile=PATH]
[--full-index] [--add-platform] [--remove-platform] [--patch] [--minor]
[--major] [--strict] [--conservative]
DESCRIPTION
Lock the gems specified in Gemfile.
OPTIONS
--update=<*gems>
Ignores the existing lockfile. Resolve then updates lockfile.
Taking a list of gems or updating all gems if no list is given.
--local
Do not attempt to connect to rubygems.org. Instead, Bundler will
use the gems already present in Rubygems' cache or in ven-
dor/cache. Note that if a appropriate platform-specific gem
exists on rubygems.org it will not be found.
--print
Prints the lockfile to STDOUT instead of writing to the file
system.
--lockfile=
The path where the lockfile should be written to.
--full-index
Fall back to using the single-file index of all gems.
--add-platform
Add a new platform to the lockfile, re-resolving for the addi-
tion of that platform.
--remove-platform
Remove a platform from the lockfile.
--patch
If updating, prefer updating only to next patch version.
--minor
If updating, prefer updating only to next minor version.
--major
If updating, prefer updating to next major version (default).
--strict
If updating, do not allow any gem to be updated past latest
--patch | --minor | --major.
--conservative
If updating, use bundle install conservative update behavior and
do not allow shared dependencies to be updated.
UPDATING ALL GEMS
If you run bundle lock with --update option without list of gems,
bundler will ignore any previously installed gems and resolve all
dependencies again based on the latest versions of all gems available
in the sources.
UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave
the rest of the gems that you specified locked to the versions in the
Gemfile.lock.
For instance, you only want to update nokogiri, run bundle lock
--update nokogiri.
Bundler will update nokogiri and any of its dependencies, but leave the
rest of the gems that you specified locked to the versions in the Gem-
file.lock.
SUPPORTING OTHER PLATFORMS
If you want your bundle to support platforms other than the one you're
running locally, you can run bundle lock --add-platform PLATFORM to add
PLATFORM to the lockfile, force bundler to re-resolve and consider the
new platform when picking gems, all without needing to have a machine
that matches PLATFORM handy to install those platform-specific gems on.
For a full explanation of gem platforms, see gem help platform.
PATCH LEVEL OPTIONS
See bundle update(1) bundle-update.1.html for details.
January 2020 BUNDLE-LOCK(1)
bundler-2.1.4/man/index.txt 0000644 0000041 0000041 00000001630 13606335352 015632 0 ustar www-data www-data Gemfile(5) gemfile.5
bundle(1) bundle.1
bundle-add(1) bundle-add.1
bundle-binstubs(1) bundle-binstubs.1
bundle-cache(1) bundle-cache.1
bundle-check(1) bundle-check.1
bundle-clean(1) bundle-clean.1
bundle-config(1) bundle-config.1
bundle-doctor(1) bundle-doctor.1
bundle-exec(1) bundle-exec.1
bundle-gem(1) bundle-gem.1
bundle-info(1) bundle-info.1
bundle-init(1) bundle-init.1
bundle-inject(1) bundle-inject.1
bundle-install(1) bundle-install.1
bundle-list(1) bundle-list.1
bundle-lock(1) bundle-lock.1
bundle-open(1) bundle-open.1
bundle-outdated(1) bundle-outdated.1
bundle-platform(1) bundle-platform.1
bundle-pristine(1) bundle-pristine.1
bundle-remove(1) bundle-remove.1
bundle-show(1) bundle-show.1
bundle-update(1) bundle-update.1
bundle-viz(1) bundle-viz.1
bundler-2.1.4/man/bundle-list.1 0000644 0000041 0000041 00000001546 13606335352 016274 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-LIST" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle
.
.SH "SYNOPSIS"
\fBbundle list\fR [\-\-name\-only] [\-\-paths] [\-\-without\-group=GROUP] [\-\-only\-group=GROUP]
.
.SH "DESCRIPTION"
Prints a list of all the gems in the bundle including their version\.
.
.P
Example:
.
.P
bundle list \-\-name\-only
.
.P
bundle list \-\-paths
.
.P
bundle list \-\-without\-group test
.
.P
bundle list \-\-only\-group dev
.
.P
bundle list \-\-only\-group dev \-\-paths
.
.SH "OPTIONS"
.
.TP
\fB\-\-name\-only\fR
Print only the name of each gem\.
.
.TP
\fB\-\-paths\fR
Print the path to each gem in the bundle\.
.
.TP
\fB\-\-without\-group\fR
Print all gems expect from a group\.
.
.TP
\fB\-\-only\-group\fR
Print gems from a particular group\.
bundler-2.1.4/man/bundle-pristine.1.txt 0000644 0000041 0000041 00000003212 13606335352 017764 0 ustar www-data www-data BUNDLE-PRISTINE(1) BUNDLE-PRISTINE(1)
NAME
bundle-pristine - Restores installed gems to their pristine condition
SYNOPSIS
bundle pristine
DESCRIPTION
pristine restores the installed gems in the bundle to their pristine
condition using the local gem cache from RubyGems. For git gems, a
forced checkout will be performed.
For further explanation, bundle pristine ignores unpacked files on
disk. In other words, this command utilizes the local .gem cache or the
gem's git repository as if one were installing from scratch.
Note: the Bundler gem cannot be restored to its original state with
pristine. One also cannot use bundle pristine on gems with a 'path'
option in the Gemfile, because bundler has no original copy it can
restore from.
When is it practical to use bundle pristine?
It comes in handy when a developer is debugging a gem. bundle pristine
is a great way to get rid of experimental changes to a gem that one may
not want.
Why use bundle pristine over gem pristine --all?
Both commands are very similar. For context: bundle pristine, without
arguments, cleans all gems from the lockfile. Meanwhile, gem pristine
--all cleans all installed gems for that Ruby version.
If a developer forgets which gems in their project they might have been
debugging, the Rubygems gem pristine [GEMNAME] command may be inconve-
nient. One can avoid waiting for gem pristine --all, and instead run
bundle pristine.
January 2020 BUNDLE-PRISTINE(1)
bundler-2.1.4/man/bundle-install.ronn 0000644 0000041 0000041 00000037305 13606335352 017605 0 ustar www-data www-data bundle-install(1) -- Install the dependencies specified in your Gemfile
=======================================================================
## SYNOPSIS
`bundle install` [--binstubs[=DIRECTORY]]
[--clean]
[--deployment]
[--frozen]
[--full-index]
[--gemfile=GEMFILE]
[--jobs=NUMBER]
[--local]
[--no-cache]
[--no-prune]
[--path PATH]
[--quiet]
[--redownload]
[--retry=NUMBER]
[--shebang]
[--standalone[=GROUP[ GROUP...]]]
[--system]
[--trust-policy=POLICY]
[--with=GROUP[ GROUP...]]
[--without=GROUP[ GROUP...]]
## DESCRIPTION
Install the gems specified in your Gemfile(5). If this is the first
time you run bundle install (and a `Gemfile.lock` does not exist),
Bundler will fetch all remote sources, resolve dependencies and
install all needed gems.
If a `Gemfile.lock` does exist, and you have not updated your Gemfile(5),
Bundler will fetch all remote sources, but use the dependencies
specified in the `Gemfile.lock` instead of resolving dependencies.
If a `Gemfile.lock` does exist, and you have updated your Gemfile(5),
Bundler will use the dependencies in the `Gemfile.lock` for all gems
that you did not update, but will re-resolve the dependencies of
gems that you did update. You can find more information about this
update process below under [CONSERVATIVE UPDATING][].
## OPTIONS
To apply any of `--binstubs`, `--deployment`, `--path`, or `--without` every
time `bundle install` is run, use `bundle config` (see bundle-config(1)).
* `--binstubs[=]`:
Binstubs are scripts that wrap around executables. Bundler creates a small Ruby
file (a binstub) that loads Bundler, runs the command, and puts it in `bin/`.
This lets you link the binstub inside of an application to the exact gem
version the application needs.
Creates a directory (defaults to `~/bin`) and places any executables from the
gem there. These executables run in Bundler's context. If used, you might add
this directory to your environment's `PATH` variable. For instance, if the
`rails` gem comes with a `rails` executable, this flag will create a
`bin/rails` executable that ensures that all referred dependencies will be
resolved using the bundled gems.
* `--clean`:
On finishing the installation Bundler is going to remove any gems not present
in the current Gemfile(5). Don't worry, gems currently in use will not be
removed.
* `--deployment`:
In [deployment mode][DEPLOYMENT MODE], Bundler will 'roll-out' the bundle for
production or CI use. Please check carefully if you want to have this option
enabled in your development environment.
* `--redownload`:
Force download every gem, even if the required versions are already available
locally.
* `--frozen`:
Do not allow the Gemfile.lock to be updated after this install. Exits
non-zero if there are going to be changes to the Gemfile.lock.
* `--full-index`:
Bundler will not call Rubygems' API endpoint (default) but download and cache
a (currently big) index file of all gems. Performance can be improved for
large bundles that seldom change by enabling this option.
* `--gemfile=`:
The location of the Gemfile(5) which Bundler should use. This defaults
to a Gemfile(5) in the current working directory. In general, Bundler
will assume that the location of the Gemfile(5) is also the project's
root and will try to find `Gemfile.lock` and `vendor/cache` relative
to this location.
* `--jobs=[]`, `-j[]`:
The maximum number of parallel download and install jobs. The default
is `1`.
* `--local`:
Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the
gems already present in Rubygems' cache or in `vendor/cache`. Note that if a
appropriate platform-specific gem exists on `rubygems.org` it will not be
found.
* `--no-cache`:
Do not update the cache in `vendor/cache` with the newly bundled gems. This
does not remove any gems in the cache but keeps the newly bundled gems from
being cached during the install.
* `--no-prune`:
Don't remove stale gems from the cache when the installation finishes.
* `--path=`:
The location to install the specified gems to. This defaults to Rubygems'
setting. Bundler shares this location with Rubygems, `gem install ...` will
have gem installed there, too. Therefore, gems installed without a
`--path ...` setting will show up by calling `gem list`. Accordingly, gems
installed to other locations will not get listed.
* `--quiet`:
Do not print progress information to the standard output. Instead, Bundler
will exit using a status code (`$?`).
* `--retry=[]`:
Retry failed network or git requests for times.
* `--shebang=`:
Uses the specified ruby executable (usually `ruby`) to execute the scripts
created with `--binstubs`. In addition, if you use `--binstubs` together with
`--shebang jruby` these executables will be changed to execute `jruby`
instead.
* `--standalone[=]`:
Makes a bundle that can work without depending on Rubygems or Bundler at
runtime. A space separated list of groups to install has to be specified.
Bundler creates a directory named `bundle` and installs the bundle there. It
also generates a `bundle/bundler/setup.rb` file to replace Bundler's own setup
in the manner required. Using this option implicitly sets `path`, which is a
[remembered option][REMEMBERED OPTIONS].
* `--system`:
Installs the gems specified in the bundle to the system's Rubygems location.
This overrides any previous configuration of `--path`.
* `--trust-policy=[]`:
Apply the Rubygems security policy , where policy is one of
`HighSecurity`, `MediumSecurity`, `LowSecurity`, `AlmostNoSecurity`, or
`NoSecurity`. For more details, please see the Rubygems signing documentation
linked below in [SEE ALSO][].
* `--with=`:
A space-separated list of groups referencing gems to install. If an
optional group is given it is installed. If a group is given that is
in the remembered list of groups given to --without, it is removed
from that list.
* `--without=`:
A space-separated list of groups referencing gems to skip during installation.
If a group is given that is in the remembered list of groups given
to --with, it is removed from that list.
## DEPLOYMENT MODE
Bundler's defaults are optimized for development. To switch to
defaults optimized for deployment and for CI, use the `--deployment`
flag. Do not activate deployment mode on development machines, as it
will cause an error when the Gemfile(5) is modified.
1. A `Gemfile.lock` is required.
To ensure that the same versions of the gems you developed with
and tested with are also used in deployments, a `Gemfile.lock`
is required.
This is mainly to ensure that you remember to check your
`Gemfile.lock` into version control.
2. The `Gemfile.lock` must be up to date
In development, you can modify your Gemfile(5) and re-run
`bundle install` to [conservatively update][CONSERVATIVE UPDATING]
your `Gemfile.lock` snapshot.
In deployment, your `Gemfile.lock` should be up-to-date with
changes made in your Gemfile(5).
3. Gems are installed to `vendor/bundle` not your default system location
In development, it's convenient to share the gems used in your
application with other applications and other scripts that run on
the system.
In deployment, isolation is a more important default. In addition,
the user deploying the application may not have permission to install
gems to the system, or the web server may not have permission to
read them.
As a result, `bundle install --deployment` installs gems to
the `vendor/bundle` directory in the application. This may be
overridden using the `--path` option.
## SUDO USAGE
By default, Bundler installs gems to the same location as `gem install`.
In some cases, that location may not be writable by your Unix user. In
that case, Bundler will stage everything in a temporary directory,
then ask you for your `sudo` password in order to copy the gems into
their system location.
From your perspective, this is identical to installing the gems
directly into the system.
You should never use `sudo bundle install`. This is because several
other steps in `bundle install` must be performed as the current user:
* Updating your `Gemfile.lock`
* Updating your `vendor/cache`, if necessary
* Checking out private git repositories using your user's SSH keys
Of these three, the first two could theoretically be performed by
`chown`ing the resulting files to `$SUDO_USER`. The third, however,
can only be performed by invoking the `git` command as
the current user. Therefore, git gems are downloaded and installed
into `~/.bundle` rather than $GEM_HOME or $BUNDLE_PATH.
As a result, you should run `bundle install` as the current user,
and Bundler will ask for your password if it is needed to put the
gems into their final location.
## INSTALLING GROUPS
By default, `bundle install` will install all gems in all groups
in your Gemfile(5), except those declared for a different platform.
However, you can explicitly tell Bundler to skip installing
certain groups with the `--without` option. This option takes
a space-separated list of groups.
While the `--without` option will skip _installing_ the gems in the
specified groups, it will still _download_ those gems and use them to
resolve the dependencies of every gem in your Gemfile(5).
This is so that installing a different set of groups on another
machine (such as a production server) will not change the
gems and versions that you have already developed and tested against.
`Bundler offers a rock-solid guarantee that the third-party
code you are running in development and testing is also the
third-party code you are running in production. You can choose
to exclude some of that code in different environments, but you
will never be caught flat-footed by different versions of
third-party code being used in different environments.`
For a simple illustration, consider the following Gemfile(5):
source 'https://rubygems.org'
gem 'sinatra'
group :production do
gem 'rack-perftools-profiler'
end
In this case, `sinatra` depends on any version of Rack (`>= 1.0`), while
`rack-perftools-profiler` depends on 1.x (`~> 1.0`).
When you run `bundle install --without production` in development, we
look at the dependencies of `rack-perftools-profiler` as well. That way,
you do not spend all your time developing against Rack 2.0, using new
APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2
when the `production` group _is_ used.
This should not cause any problems in practice, because we do not
attempt to `install` the gems in the excluded groups, and only evaluate
as part of the dependency resolution process.
This also means that you cannot include different versions of the same
gem in different groups, because doing so would result in different
sets of dependencies used in development and production. Because of
the vagaries of the dependency resolution process, this usually
affects more than the gems you list in your Gemfile(5), and can
(surprisingly) radically change the gems you are using.
## THE GEMFILE.LOCK
When you run `bundle install`, Bundler will persist the full names
and versions of all gems that you used (including dependencies of
the gems specified in the Gemfile(5)) into a file called `Gemfile.lock`.
Bundler uses this file in all subsequent calls to `bundle install`,
which guarantees that you always use the same exact code, even
as your application moves across machines.
Because of the way dependency resolution works, even a
seemingly small change (for instance, an update to a point-release
of a dependency of a gem in your Gemfile(5)) can result in radically
different gems being needed to satisfy all dependencies.
As a result, you `SHOULD` check your `Gemfile.lock` into version
control, in both applications and gems. If you do not, every machine that
checks out your repository (including your production server) will resolve all
dependencies again, which will result in different versions of
third-party code being used if `any` of the gems in the Gemfile(5)
or any of their dependencies have been updated.
When Bundler first shipped, the `Gemfile.lock` was included in the `.gitignore`
file included with generated gems. Over time, however, it became clear that
this practice forces the pain of broken dependencies onto new contributors,
while leaving existing contributors potentially unaware of the problem. Since
`bundle install` is usually the first step towards a contribution, the pain of
broken dependencies would discourage new contributors from contributing. As a
result, we have revised our guidance for gem authors to now recommend checking
in the lock for gems.
## CONSERVATIVE UPDATING
When you make a change to the Gemfile(5) and then run `bundle install`,
Bundler will update only the gems that you modified.
In other words, if a gem that you `did not modify` worked before
you called `bundle install`, it will continue to use the exact
same versions of all dependencies as it used before the update.
Let's take a look at an example. Here's your original Gemfile(5):
source 'https://rubygems.org'
gem 'actionpack', '2.3.8'
gem 'activemerchant'
In this case, both `actionpack` and `activemerchant` depend on
`activesupport`. The `actionpack` gem depends on `activesupport 2.3.8`
and `rack ~> 1.1.0`, while the `activemerchant` gem depends on
`activesupport >= 2.3.2`, `braintree >= 2.0.0`, and `builder >= 2.0.0`.
When the dependencies are first resolved, Bundler will select
`activesupport 2.3.8`, which satisfies the requirements of both
gems in your Gemfile(5).
Next, you modify your Gemfile(5) to:
source 'https://rubygems.org'
gem 'actionpack', '3.0.0.rc'
gem 'activemerchant'
The `actionpack 3.0.0.rc` gem has a number of new dependencies,
and updates the `activesupport` dependency to `= 3.0.0.rc` and
the `rack` dependency to `~> 1.2.1`.
When you run `bundle install`, Bundler notices that you changed
the `actionpack` gem, but not the `activemerchant` gem. It
evaluates the gems currently being used to satisfy its requirements:
* `activesupport 2.3.8`:
also used to satisfy a dependency in `activemerchant`,
which is not being updated
* `rack ~> 1.1.0`:
not currently being used to satisfy another dependency
Because you did not explicitly ask to update `activemerchant`,
you would not expect it to suddenly stop working after updating
`actionpack`. However, satisfying the new `activesupport 3.0.0.rc`
dependency of actionpack requires updating one of its dependencies.
Even though `activemerchant` declares a very loose dependency
that theoretically matches `activesupport 3.0.0.rc`, Bundler treats
gems in your Gemfile(5) that have not changed as an atomic unit
together with their dependencies. In this case, the `activemerchant`
dependency is treated as `activemerchant 1.7.1 + activesupport 2.3.8`,
so `bundle install` will report that it cannot update `actionpack`.
To explicitly update `actionpack`, including its dependencies
which other gems in the Gemfile(5) still depend on, run
`bundle update actionpack` (see `bundle update(1)`).
`Summary`: In general, after making a change to the Gemfile(5) , you
should first try to run `bundle install`, which will guarantee that no
other gem in the Gemfile(5) is impacted by the change. If that
does not work, run [bundle update(1)](bundle-update.1.html).
## SEE ALSO
* [Gem install docs](http://guides.rubygems.org/rubygems-basics/#installing-gems)
* [Rubygems signing docs](http://guides.rubygems.org/security/)
bundler-2.1.4/man/bundle-doctor.1 0000644 0000041 0000041 00000002214 13606335352 016604 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-DOCTOR" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems
.
.SH "SYNOPSIS"
\fBbundle doctor\fR [\-\-quiet] [\-\-gemfile=GEMFILE]
.
.SH "DESCRIPTION"
Checks your Gemfile and gem environment for common problems\. If issues are detected, Bundler prints them and exits status 1\. Otherwise, Bundler prints a success message and exits status 0\.
.
.P
Examples of common problems caught by bundle\-doctor include:
.
.IP "\(bu" 4
Invalid Bundler settings
.
.IP "\(bu" 4
Mismatched Ruby versions
.
.IP "\(bu" 4
Mismatched platforms
.
.IP "\(bu" 4
Uninstalled gems
.
.IP "\(bu" 4
Missing dependencies
.
.IP "" 0
.
.SH "OPTIONS"
.
.TP
\fB\-\-quiet\fR
Only output warnings and errors\.
.
.TP
\fB\-\-gemfile=\fR
The location of the Gemfile(5) which Bundler should use\. This defaults to a Gemfile(5) in the current working directory\. In general, Bundler will assume that the location of the Gemfile(5) is also the project\'s root and will try to find \fBGemfile\.lock\fR and \fBvendor/cache\fR relative to this location\.
bundler-2.1.4/man/bundle-update.1 0000644 0000041 0000041 00000033064 13606335352 016603 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-UPDATE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions
.
.SH "SYNOPSIS"
\fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-full\-index] [\-\-jobs=JOBS] [\-\-quiet] [\-\-patch|\-\-minor|\-\-major] [\-\-redownload] [\-\-strict] [\-\-conservative]
.
.SH "DESCRIPTION"
Update the gems specified (all gems, if \fB\-\-all\fR flag is used), ignoring the previously installed gems specified in the \fBGemfile\.lock\fR\. In general, you should use bundle install(1) \fIbundle\-install\.1\.html\fR to install the same exact gems and versions across machines\.
.
.P
You would use \fBbundle update\fR to explicitly update the version of a gem\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-all\fR
Update all gems specified in Gemfile\.
.
.TP
\fB\-\-group=\fR, \fB\-g=[]\fR
Only update the gems in the specified group\. For instance, you can update all gems in the development group with \fBbundle update \-\-group development\fR\. You can also call \fBbundle update rails \-\-group test\fR to update the rails gem and all gems in the test group, for example\.
.
.TP
\fB\-\-source=\fR
The name of a \fB:git\fR or \fB:path\fR source used in the Gemfile(5)\. For instance, with a \fB:git\fR source of \fBhttp://github\.com/rails/rails\.git\fR, you would call \fBbundle update \-\-source rails\fR
.
.TP
\fB\-\-local\fR
Do not attempt to fetch gems remotely and use the gem cache instead\.
.
.TP
\fB\-\-ruby\fR
Update the locked version of Ruby to the current version of Ruby\.
.
.TP
\fB\-\-bundler\fR
Update the locked version of bundler to the invoked bundler version\.
.
.TP
\fB\-\-full\-index\fR
Fall back to using the single\-file index of all gems\.
.
.TP
\fB\-\-jobs=[]\fR, \fB\-j[]\fR
Specify the number of jobs to run in parallel\. The default is \fB1\fR\.
.
.TP
\fB\-\-retry=[]\fR
Retry failed network or git requests for \fInumber\fR times\.
.
.TP
\fB\-\-quiet\fR
Only output warnings and errors\.
.
.TP
\fB\-\-redownload\fR
Force downloading every gem\.
.
.TP
\fB\-\-patch\fR
Prefer updating only to next patch version\.
.
.TP
\fB\-\-minor\fR
Prefer updating only to next minor version\.
.
.TP
\fB\-\-major\fR
Prefer updating to next major version (default)\.
.
.TP
\fB\-\-strict\fR
Do not allow any gem to be updated past latest \fB\-\-patch\fR | \fB\-\-minor\fR | \fB\-\-major\fR\.
.
.TP
\fB\-\-conservative\fR
Use bundle install conservative update behavior and do not allow shared dependencies to be updated\.
.
.SH "UPDATING ALL GEMS"
If you run \fBbundle update \-\-all\fR, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources\.
.
.P
Consider the following Gemfile(5):
.
.IP "" 4
.
.nf
source "https://rubygems\.org"
gem "rails", "3\.0\.0\.rc"
gem "nokogiri"
.
.fi
.
.IP "" 0
.
.P
When you run bundle install(1) \fIbundle\-install\.1\.html\fR the first time, bundler will resolve all of the dependencies, all the way down, and install what you need:
.
.IP "" 4
.
.nf
Fetching gem metadata from https://rubygems\.org/\.\.\.\.\.\.\.\.\.
Resolving dependencies\.\.\.
Installing builder 2\.1\.2
Installing abstract 1\.0\.0
Installing rack 1\.2\.8
Using bundler 1\.7\.6
Installing rake 10\.4\.0
Installing polyglot 0\.3\.5
Installing mime\-types 1\.25\.1
Installing i18n 0\.4\.2
Installing mini_portile 0\.6\.1
Installing tzinfo 0\.3\.42
Installing rack\-mount 0\.6\.14
Installing rack\-test 0\.5\.7
Installing treetop 1\.4\.15
Installing thor 0\.14\.6
Installing activesupport 3\.0\.0\.rc
Installing erubis 2\.6\.6
Installing activemodel 3\.0\.0\.rc
Installing arel 0\.4\.0
Installing mail 2\.2\.20
Installing activeresource 3\.0\.0\.rc
Installing actionpack 3\.0\.0\.rc
Installing activerecord 3\.0\.0\.rc
Installing actionmailer 3\.0\.0\.rc
Installing railties 3\.0\.0\.rc
Installing rails 3\.0\.0\.rc
Installing nokogiri 1\.6\.5
Bundle complete! 2 Gemfile dependencies, 26 gems total\.
Use `bundle show [gemname]` to see where a bundled gem is installed\.
.
.fi
.
.IP "" 0
.
.P
As you can see, even though you have two gems in the Gemfile(5), your application needs 26 different gems in order to run\. Bundler remembers the exact versions it installed in \fBGemfile\.lock\fR\. The next time you run bundle install(1) \fIbundle\-install\.1\.html\fR, bundler skips the dependency resolution and installs the same gems as it installed last time\.
.
.P
After checking in the \fBGemfile\.lock\fR into version control and cloning it on another machine, running bundle install(1) \fIbundle\-install\.1\.html\fR will \fIstill\fR install the gems that you installed last time\. You don\'t need to worry that a new release of \fBerubis\fR or \fBmail\fR changes the gems you use\.
.
.P
However, from time to time, you might want to update the gems you are using to the newest versions that still match the gems in your Gemfile(5)\.
.
.P
To do this, run \fBbundle update \-\-all\fR, which will ignore the \fBGemfile\.lock\fR, and resolve all the dependencies again\. Keep in mind that this process can result in a significantly different set of the 25 gems, based on the requirements of new gems that the gem authors released since the last time you ran \fBbundle update \-\-all\fR\.
.
.SH "UPDATING A LIST OF GEMS"
Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the \fBGemfile\.lock\fR\.
.
.P
For instance, in the scenario above, imagine that \fBnokogiri\fR releases version \fB1\.4\.4\fR, and you want to update it \fIwithout\fR updating Rails and all of its dependencies\. To do this, run \fBbundle update nokogiri\fR\.
.
.P
Bundler will update \fBnokogiri\fR and any of its dependencies, but leave alone Rails and its dependencies\.
.
.SH "OVERLAPPING DEPENDENCIES"
Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same second\-level dependency\. For instance, consider the case of \fBthin\fR and \fBrack\-perftools\-profiler\fR\.
.
.IP "" 4
.
.nf
source "https://rubygems\.org"
gem "thin"
gem "rack\-perftools\-profiler"
.
.fi
.
.IP "" 0
.
.P
The \fBthin\fR gem depends on \fBrack >= 1\.0\fR, while \fBrack\-perftools\-profiler\fR depends on \fBrack ~> 1\.0\fR\. If you run bundle install, you get:
.
.IP "" 4
.
.nf
Fetching source index for https://rubygems\.org/
Installing daemons (1\.1\.0)
Installing eventmachine (0\.12\.10) with native extensions
Installing open4 (1\.0\.1)
Installing perftools\.rb (0\.4\.7) with native extensions
Installing rack (1\.2\.1)
Installing rack\-perftools_profiler (0\.0\.2)
Installing thin (1\.2\.7) with native extensions
Using bundler (1\.0\.0\.rc\.3)
.
.fi
.
.IP "" 0
.
.P
In this case, the two gems have their own set of dependencies, but they share \fBrack\fR in common\. If you run \fBbundle update thin\fR, bundler will update \fBdaemons\fR, \fBeventmachine\fR and \fBrack\fR, which are dependencies of \fBthin\fR, but not \fBopen4\fR or \fBperftools\.rb\fR, which are dependencies of \fBrack\-perftools_profiler\fR\. Note that \fBbundle update thin\fR will update \fBrack\fR even though it\'s \fIalso\fR a dependency of \fBrack\-perftools_profiler\fR\.
.
.P
In short, by default, when you update a gem using \fBbundle update\fR, bundler will update all dependencies of that gem, including those that are also dependencies of another gem\.
.
.P
To prevent updating shared dependencies, prior to version 1\.14 the only option was the \fBCONSERVATIVE UPDATING\fR behavior in bundle install(1) \fIbundle\-install\.1\.html\fR:
.
.P
In this scenario, updating the \fBthin\fR version manually in the Gemfile(5), and then running bundle install(1) \fIbundle\-install\.1\.html\fR will only update \fBdaemons\fR and \fBeventmachine\fR, but not \fBrack\fR\. For more information, see the \fBCONSERVATIVE UPDATING\fR section of bundle install(1) \fIbundle\-install\.1\.html\fR\.
.
.P
Starting with 1\.14, specifying the \fB\-\-conservative\fR option will also prevent shared dependencies from being updated\.
.
.SH "PATCH LEVEL OPTIONS"
Version 1\.14 introduced 4 patch\-level options that will influence how gem versions are resolved\. One of the following options can be used: \fB\-\-patch\fR, \fB\-\-minor\fR or \fB\-\-major\fR\. \fB\-\-strict\fR can be added to further influence resolution\.
.
.TP
\fB\-\-patch\fR
Prefer updating only to next patch version\.
.
.TP
\fB\-\-minor\fR
Prefer updating only to next minor version\.
.
.TP
\fB\-\-major\fR
Prefer updating to next major version (default)\.
.
.TP
\fB\-\-strict\fR
Do not allow any gem to be updated past latest \fB\-\-patch\fR | \fB\-\-minor\fR | \fB\-\-major\fR\.
.
.P
When Bundler is resolving what versions to use to satisfy declared requirements in the Gemfile or in parent gems, it looks up all available versions, filters out any versions that don\'t satisfy the requirement, and then, by default, sorts them from newest to oldest, considering them in that order\.
.
.P
Providing one of the patch level options (e\.g\. \fB\-\-patch\fR) changes the sort order of the satisfying versions, causing Bundler to consider the latest \fB\-\-patch\fR or \fB\-\-minor\fR version available before other versions\. Note that versions outside the stated patch level could still be resolved to if necessary to find a suitable dependency graph\.
.
.P
For example, if gem \'foo\' is locked at 1\.0\.2, with no gem requirement defined in the Gemfile, and versions 1\.0\.3, 1\.0\.4, 1\.1\.0, 1\.1\.1, 2\.0\.0 all exist, the default order of preference by default (\fB\-\-major\fR) will be "2\.0\.0, 1\.1\.1, 1\.1\.0, 1\.0\.4, 1\.0\.3, 1\.0\.2"\.
.
.P
If the \fB\-\-patch\fR option is used, the order of preference will change to "1\.0\.4, 1\.0\.3, 1\.0\.2, 1\.1\.1, 1\.1\.0, 2\.0\.0"\.
.
.P
If the \fB\-\-minor\fR option is used, the order of preference will change to "1\.1\.1, 1\.1\.0, 1\.0\.4, 1\.0\.3, 1\.0\.2, 2\.0\.0"\.
.
.P
Combining the \fB\-\-strict\fR option with any of the patch level options will remove any versions beyond the scope of the patch level option, to ensure that no gem is updated that far\.
.
.P
To continue the previous example, if both \fB\-\-patch\fR and \fB\-\-strict\fR options are used, the available versions for resolution would be "1\.0\.4, 1\.0\.3, 1\.0\.2"\. If \fB\-\-minor\fR and \fB\-\-strict\fR are used, it would be "1\.1\.1, 1\.1\.0, 1\.0\.4, 1\.0\.3, 1\.0\.2"\.
.
.P
Gem requirements as defined in the Gemfile will still be the first determining factor for what versions are available\. If the gem requirement for \fBfoo\fR in the Gemfile is \'~> 1\.0\', that will accomplish the same thing as providing the \fB\-\-minor\fR and \fB\-\-strict\fR options\.
.
.SH "PATCH LEVEL EXAMPLES"
Given the following gem specifications:
.
.IP "" 4
.
.nf
foo 1\.4\.3, requires: ~> bar 2\.0
foo 1\.4\.4, requires: ~> bar 2\.0
foo 1\.4\.5, requires: ~> bar 2\.1
foo 1\.5\.0, requires: ~> bar 2\.1
foo 1\.5\.1, requires: ~> bar 3\.0
bar with versions 2\.0\.3, 2\.0\.4, 2\.1\.0, 2\.1\.1, 3\.0\.0
.
.fi
.
.IP "" 0
.
.P
Gemfile:
.
.IP "" 4
.
.nf
gem \'foo\'
.
.fi
.
.IP "" 0
.
.P
Gemfile\.lock:
.
.IP "" 4
.
.nf
foo (1\.4\.3)
bar (~> 2\.0)
bar (2\.0\.3)
.
.fi
.
.IP "" 0
.
.P
Cases:
.
.IP "" 4
.
.nf
# Command Line Result
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1 bundle update \-\-patch \'foo 1\.4\.5\', \'bar 2\.1\.1\'
2 bundle update \-\-patch foo \'foo 1\.4\.5\', \'bar 2\.1\.1\'
3 bundle update \-\-minor \'foo 1\.5\.1\', \'bar 3\.0\.0\'
4 bundle update \-\-minor \-\-strict \'foo 1\.5\.0\', \'bar 2\.1\.1\'
5 bundle update \-\-patch \-\-strict \'foo 1\.4\.4\', \'bar 2\.0\.4\'
.
.fi
.
.IP "" 0
.
.P
In case 1, bar is upgraded to 2\.1\.1, a minor version increase, because the dependency from foo 1\.4\.5 required it\.
.
.P
In case 2, only foo is requested to be unlocked, but bar is also allowed to move because it\'s not a declared dependency in the Gemfile\.
.
.P
In case 3, bar goes up a whole major release, because a minor increase is preferred now for foo, and when it goes to 1\.5\.1, it requires 3\.0\.0 of bar\.
.
.P
In case 4, foo is preferred up to a minor version, but 1\.5\.1 won\'t work because the \-\-strict flag removes bar 3\.0\.0 from consideration since it\'s a major increment\.
.
.P
In case 5, both foo and bar have any minor or major increments removed from consideration because of the \-\-strict flag, so the most they can move is up to 1\.4\.4 and 2\.0\.4\.
.
.SH "RECOMMENDED WORKFLOW"
In general, when working with an application managed with bundler, you should use the following workflow:
.
.IP "\(bu" 4
After you create your Gemfile(5) for the first time, run
.
.IP
$ bundle install
.
.IP "\(bu" 4
Check the resulting \fBGemfile\.lock\fR into version control
.
.IP
$ git add Gemfile\.lock
.
.IP "\(bu" 4
When checking out this repository on another development machine, run
.
.IP
$ bundle install
.
.IP "\(bu" 4
When checking out this repository on a deployment machine, run
.
.IP
$ bundle install \-\-deployment
.
.IP "\(bu" 4
After changing the Gemfile(5) to reflect a new or update dependency, run
.
.IP
$ bundle install
.
.IP "\(bu" 4
Make sure to check the updated \fBGemfile\.lock\fR into version control
.
.IP
$ git add Gemfile\.lock
.
.IP "\(bu" 4
If bundle install(1) \fIbundle\-install\.1\.html\fR reports a conflict, manually update the specific gems that you changed in the Gemfile(5)
.
.IP
$ bundle update rails thin
.
.IP "\(bu" 4
If you want to update all the gems to the latest possible versions that still match the gems listed in the Gemfile(5), run
.
.IP
$ bundle update \-\-all
.
.IP "" 0
bundler-2.1.4/man/bundle-add.1 0000644 0000041 0000041 00000002721 13606335352 016045 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-ADD" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
.
.SH "SYNOPSIS"
\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-branch=BRANCH] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
.
.SH "DESCRIPTION"
Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
.
.P
Example:
.
.P
bundle add rails
.
.P
bundle add rails \-\-version "< 3\.0, > 1\.1"
.
.P
bundle add rails \-\-version "~> 5\.0\.0" \-\-source "https://gems\.example\.com" \-\-group "development"
.
.P
bundle add rails \-\-skip\-install
.
.P
bundle add rails \-\-group "development, test"
.
.SH "OPTIONS"
.
.TP
\fB\-\-version\fR, \fB\-v\fR
Specify version requirements(s) for the added gem\.
.
.TP
\fB\-\-group\fR, \fB\-g\fR
Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
.
.TP
\fB\-\-source\fR, , \fB\-s\fR
Specify the source for the added gem\.
.
.TP
\fB\-\-git\fR
Specify the git source for the added gem\.
.
.TP
\fB\-\-branch\fR
Specify the git branch for the added gem\.
.
.TP
\fB\-\-skip\-install\fR
Adds the gem to the Gemfile but does not install it\.
.
.TP
\fB\-\-optimistic\fR
Adds optimistic declaration of version
.
.TP
\fB\-\-strict\fR
Adds strict declaration of version
bundler-2.1.4/man/bundle-binstubs.1.txt 0000644 0000041 0000041 00000003237 13606335352 017767 0 ustar www-data www-data BUNDLE-BINSTUBS(1) BUNDLE-BINSTUBS(1)
NAME
bundle-binstubs - Install the binstubs of the listed gems
SYNOPSIS
bundle binstubs GEM_NAME [--force] [--path PATH] [--standalone]
DESCRIPTION
Binstubs are scripts that wrap around executables. Bundler creates a
small Ruby file (a binstub) that loads Bundler, runs the command, and
puts it into bin/. Binstubs are a shortcut-or alternative- to always
using bundle exec. This gives you a file that can be run directly, and
one that will always run the correct gem version used by the applica-
tion.
For example, if you run bundle binstubs rspec-core, Bundler will create
the file bin/rspec. That file will contain enough code to load Bundler,
tell it to load the bundled gems, and then run rspec.
This command generates binstubs for executables in GEM_NAME. Binstubs
are put into bin, or the --path directory if one has been set. Calling
binstubs with [GEM [GEM]] will create binstubs for all given gems.
OPTIONS
--force
Overwrite existing binstubs if they exist.
--path The location to install the specified binstubs to. This defaults
to bin.
--standalone
Makes binstubs that can work without depending on Rubygems or
Bundler at runtime.
--shebang
Specify a different shebang executable name than the default
(default 'ruby')
BUNDLE INSTALL --BINSTUBS
To create binstubs for all the gems in the bundle you can use the
--binstubs flag in bundle install(1) bundle-install.1.html.
January 2020 BUNDLE-BINSTUBS(1)
bundler-2.1.4/man/bundle-add.1.txt 0000644 0000041 0000041 00000002604 13606335352 016663 0 ustar www-data www-data BUNDLE-ADD(1) BUNDLE-ADD(1)
NAME
bundle-add - Add gem to the Gemfile and run bundle install
SYNOPSIS
bundle add GEM_NAME [--group=GROUP] [--version=VERSION]
[--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install]
[--strict] [--optimistic]
DESCRIPTION
Adds the named gem to the Gemfile and run bundle install. bundle
install can be avoided by using the flag --skip-install.
Example:
bundle add rails
bundle add rails --version "< 3.0, > 1.1"
bundle add rails --version "~> 5.0.0" --source "https://gems.exam-
ple.com" --group "development"
bundle add rails --skip-install
bundle add rails --group "development, test"
OPTIONS
--version, -v
Specify version requirements(s) for the added gem.
--group, -g
Specify the group(s) for the added gem. Multiple groups should
be separated by commas.
--source, , -s
Specify the source for the added gem.
--git Specify the git source for the added gem.
--branch
Specify the git branch for the added gem.
--skip-install
Adds the gem to the Gemfile but does not install it.
--optimistic
Adds optimistic declaration of version
--strict
Adds strict declaration of version
January 2020 BUNDLE-ADD(1)
bundler-2.1.4/man/bundle-exec.ronn 0000644 0000041 0000041 00000013574 13606335352 017065 0 ustar www-data www-data bundle-exec(1) -- Execute a command in the context of the bundle
================================================================
## SYNOPSIS
`bundle exec` [--keep-file-descriptors]
## DESCRIPTION
This command executes the command, making all gems specified in the
[`Gemfile(5)`][Gemfile(5)] available to `require` in Ruby programs.
Essentially, if you would normally have run something like
`rspec spec/my_spec.rb`, and you want to use the gems specified
in the [`Gemfile(5)`][Gemfile(5)] and installed via [bundle install(1)](bundle-install.1.html), you
should run `bundle exec rspec spec/my_spec.rb`.
Note that `bundle exec` does not require that an executable is
available on your shell's `$PATH`.
## OPTIONS
* `--keep-file-descriptors`:
Exec in Ruby 2.0 began discarding non-standard file descriptors. When this
flag is passed, exec will revert to the 1.9 behaviour of passing all file
descriptors to the new process.
## BUNDLE INSTALL --BINSTUBS
If you use the `--binstubs` flag in [bundle install(1)](bundle-install.1.html), Bundler will
automatically create a directory (which defaults to `app_root/bin`)
containing all of the executables available from gems in the bundle.
After using `--binstubs`, `bin/rspec spec/my_spec.rb` is identical
to `bundle exec rspec spec/my_spec.rb`.
## ENVIRONMENT MODIFICATIONS
`bundle exec` makes a number of changes to the shell environment,
then executes the command you specify in full.
* make sure that it's still possible to shell out to `bundle`
from inside a command invoked by `bundle exec` (using
`$BUNDLE_BIN_PATH`)
* put the directory containing executables (like `rails`, `rspec`,
`rackup`) for your bundle on `$PATH`
* make sure that if bundler is invoked in the subshell, it uses
the same `Gemfile` (by setting `BUNDLE_GEMFILE`)
* add `-rbundler/setup` to `$RUBYOPT`, which makes sure that
Ruby programs invoked in the subshell can see the gems in
the bundle
It also modifies Rubygems:
* disallow loading additional gems not in the bundle
* modify the `gem` method to be a no-op if a gem matching
the requirements is in the bundle, and to raise a
`Gem::LoadError` if it's not
* Define `Gem.refresh` to be a no-op, since the source
index is always frozen when using bundler, and to
prevent gems from the system leaking into the environment
* Override `Gem.bin_path` to use the gems in the bundle,
making system executables work
* Add all gems in the bundle into Gem.loaded_specs
Finally, `bundle exec` also implicitly modifies `Gemfile.lock` if the lockfile
and the Gemfile do not match. Bundler needs the Gemfile to determine things
such as a gem's groups, `autorequire`, and platforms, etc., and that
information isn't stored in the lockfile. The Gemfile and lockfile must be
synced in order to `bundle exec` successfully, so `bundle exec`
updates the lockfile beforehand.
### Loading
By default, when attempting to `bundle exec` to a file with a ruby shebang,
Bundler will `Kernel.load` that file instead of using `Kernel.exec`. For the
vast majority of cases, this is a performance improvement. In a rare few cases,
this could cause some subtle side-effects (such as dependence on the exact
contents of `$0` or `__FILE__`) and the optimization can be disabled by enabling
the `disable_exec_load` setting.
### Shelling out
Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will
automatically use the current Bundler environment. If you need to shell out to
a Ruby command that is not part of your current bundle, use the
`with_clean_env` method with a block. Any subshells created inside the block
will be given the environment present before Bundler was activated. For
example, Homebrew commands run Ruby, but don't work inside a bundle:
Bundler.with_clean_env do
`brew install wget`
end
Using `with_clean_env` is also necessary if you are shelling out to a different
bundle. Any Bundler commands run in a subshell will inherit the current
Gemfile, so commands that need to run in the context of a different bundle also
need to use `with_clean_env`.
Bundler.with_clean_env do
Dir.chdir "/other/bundler/project" do
`bundle exec ./script`
end
end
Bundler provides convenience helpers that wrap `system` and `exec`, and they
can be used like this:
Bundler.clean_system('brew install wget')
Bundler.clean_exec('brew install wget')
## RUBYGEMS PLUGINS
At present, the Rubygems plugin system requires all files
named `rubygems_plugin.rb` on the load path of _any_ installed
gem when any Ruby code requires `rubygems.rb`. This includes
executables installed into the system, like `rails`, `rackup`,
and `rspec`.
Since Rubygems plugins can contain arbitrary Ruby code, they
commonly end up activating themselves or their dependencies.
For instance, the `gemcutter 0.5` gem depended on `json_pure`.
If you had that version of gemcutter installed (even if
you _also_ had a newer version without this problem), Rubygems
would activate `gemcutter 0.5` and `json_pure `.
If your Gemfile(5) also contained `json_pure` (or a gem
with a dependency on `json_pure`), the latest version on
your system might conflict with the version in your
Gemfile(5), or the snapshot version in your `Gemfile.lock`.
If this happens, bundler will say:
You have already activated json_pure 1.4.6 but your Gemfile
requires json_pure 1.4.3. Consider using bundle exec.
In this situation, you almost certainly want to remove the
underlying gem with the problematic gem plugin. In general,
the authors of these plugins (in this case, the `gemcutter`
gem) have released newer versions that are more careful in
their plugins.
You can find a list of all the gems containing gem plugins
by running
ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest
version of each gem plugin, and also remove all gem plugins
that you aren't using (`gem uninstall gem_name`).
bundler-2.1.4/man/bundle-pristine.ronn 0000644 0000041 0000041 00000002723 13606335352 017770 0 ustar www-data www-data bundle-pristine(1) -- Restores installed gems to their pristine condition
===========================================================================
## SYNOPSIS
`bundle pristine`
## DESCRIPTION
`pristine` restores the installed gems in the bundle to their pristine condition
using the local gem cache from RubyGems. For git gems, a forced checkout will be performed.
For further explanation, `bundle pristine` ignores unpacked files on disk. In other
words, this command utilizes the local `.gem` cache or the gem's git repository
as if one were installing from scratch.
Note: the Bundler gem cannot be restored to its original state with `pristine`.
One also cannot use `bundle pristine` on gems with a 'path' option in the Gemfile,
because bundler has no original copy it can restore from.
When is it practical to use `bundle pristine`?
It comes in handy when a developer is debugging a gem. `bundle pristine` is a
great way to get rid of experimental changes to a gem that one may not want.
Why use `bundle pristine` over `gem pristine --all`?
Both commands are very similar.
For context: `bundle pristine`, without arguments, cleans all gems from the lockfile.
Meanwhile, `gem pristine --all` cleans all installed gems for that Ruby version.
If a developer forgets which gems in their project they might
have been debugging, the Rubygems `gem pristine [GEMNAME]` command may be inconvenient.
One can avoid waiting for `gem pristine --all`, and instead run `bundle pristine`.
bundler-2.1.4/man/gemfile.5 0000644 0000041 0000041 00000052601 13606335352 015464 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GEMFILE" "5" "January 2020" "" ""
.
.SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
.
.SH "SYNOPSIS"
A \fBGemfile\fR describes the gem dependencies required to execute associated Ruby code\.
.
.P
Place the \fBGemfile\fR in the root of the directory containing the associated code\. For instance, in a Rails application, place the \fBGemfile\fR in the same directory as the \fBRakefile\fR\.
.
.SH "SYNTAX"
A \fBGemfile\fR is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements\.
.
.SH "GLOBAL SOURCES"
At the top of the \fBGemfile\fR, add a line for the \fBRubygems\fR source that contains the gems listed in the \fBGemfile\fR\.
.
.IP "" 4
.
.nf
source "https://rubygems\.org"
.
.fi
.
.IP "" 0
.
.P
It is possible, but not recommended as of Bundler 1\.7, to add multiple global \fBsource\fR lines\. Each of these \fBsource\fRs \fBMUST\fR be a valid Rubygems repository\.
.
.P
Sources are checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\. If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or a \fI\fBsource\fR block\fR\.
.
.SS "CREDENTIALS"
Some gem sources require a username and password\. Use bundle config(1) \fIbundle\-config\.1\.html\fR to set the username and password for any of the sources that need it\. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control\.
.
.IP "" 4
.
.nf
bundle config gems\.example\.com user:password
.
.fi
.
.IP "" 0
.
.P
For some sources, like a company Gemfury account, it may be easier to include the credentials in the Gemfile as part of the source URL\.
.
.IP "" 4
.
.nf
source "https://user:password@gems\.example\.com"
.
.fi
.
.IP "" 0
.
.P
Credentials in the source URL will take precedence over credentials set using \fBconfig\fR\.
.
.SH "RUBY"
If your application requires a specific Ruby version or engine, specify your requirements using the \fBruby\fR method, with the following arguments\. All parameters are \fBOPTIONAL\fR unless otherwise specified\.
.
.SS "VERSION (required)"
The version of Ruby that your application requires\. If your application requires an alternate Ruby engine, such as JRuby, Rubinius or TruffleRuby, this should be the Ruby version that the engine is compatible with\.
.
.IP "" 4
.
.nf
ruby "1\.9\.3"
.
.fi
.
.IP "" 0
.
.SS "ENGINE"
Each application \fImay\fR specify a Ruby engine\. If an engine is specified, an engine version \fImust\fR also be specified\.
.
.P
What exactly is an Engine? \- A Ruby engine is an implementation of the Ruby language\.
.
.IP "\(bu" 4
For background: the reference or original implementation of the Ruby programming language is called Matz\'s Ruby Interpreter \fIhttps://en\.wikipedia\.org/wiki/Ruby_MRI\fR, or MRI for short\. This is named after Ruby creator Yukihiro Matsumoto, also known as Matz\. MRI is also known as CRuby, because it is written in C\. MRI is the most widely used Ruby engine\.
.
.IP "\(bu" 4
Other implementations \fIhttps://www\.ruby\-lang\.org/en/about/\fR of Ruby exist\. Some of the more well\-known implementations include Rubinius \fIhttps://rubinius\.com/\fR, and JRuby \fIhttp://jruby\.org/\fR\. Rubinius is an alternative implementation of Ruby written in Ruby\. JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine\.
.
.IP "" 0
.
.SS "ENGINE VERSION"
Each application \fImay\fR specify a Ruby engine version\. If an engine version is specified, an engine \fImust\fR also be specified\. If the engine is "ruby" the engine version specified \fImust\fR match the Ruby version\.
.
.IP "" 4
.
.nf
ruby "1\.8\.7", :engine => "jruby", :engine_version => "1\.6\.7"
.
.fi
.
.IP "" 0
.
.SS "PATCHLEVEL"
Each application \fImay\fR specify a Ruby patchlevel\.
.
.IP "" 4
.
.nf
ruby "2\.0\.0", :patchlevel => "247"
.
.fi
.
.IP "" 0
.
.SH "GEMS"
Specify gem requirements using the \fBgem\fR method, with the following arguments\. All parameters are \fBOPTIONAL\fR unless otherwise specified\.
.
.SS "NAME (required)"
For each gem requirement, list a single \fIgem\fR line\.
.
.IP "" 4
.
.nf
gem "nokogiri"
.
.fi
.
.IP "" 0
.
.SS "VERSION"
Each \fIgem\fR \fBMAY\fR have one or more version specifiers\.
.
.IP "" 4
.
.nf
gem "nokogiri", ">= 1\.4\.2"
gem "RedCloth", ">= 4\.1\.0", "< 4\.2\.0"
.
.fi
.
.IP "" 0
.
.SS "REQUIRE AS"
Each \fIgem\fR \fBMAY\fR specify files that should be used when autorequiring via \fBBundler\.require\fR\. You may pass an array with multiple files or \fBtrue\fR if file you want \fBrequired\fR has same name as \fIgem\fR or \fBfalse\fR to prevent any file from being autorequired\.
.
.IP "" 4
.
.nf
gem "redis", :require => ["redis/connection/hiredis", "redis"]
gem "webmock", :require => false
gem "byebug", :require => true
.
.fi
.
.IP "" 0
.
.P
The argument defaults to the name of the gem\. For example, these are identical:
.
.IP "" 4
.
.nf
gem "nokogiri"
gem "nokogiri", :require => "nokogiri"
gem "nokogiri", :require => true
.
.fi
.
.IP "" 0
.
.SS "GROUPS"
Each \fIgem\fR \fBMAY\fR specify membership in one or more groups\. Any \fIgem\fR that does not specify membership in any group is placed in the \fBdefault\fR group\.
.
.IP "" 4
.
.nf
gem "rspec", :group => :test
gem "wirble", :groups => [:development, :test]
.
.fi
.
.IP "" 0
.
.P
The Bundler runtime allows its two main methods, \fBBundler\.setup\fR and \fBBundler\.require\fR, to limit their impact to particular groups\.
.
.IP "" 4
.
.nf
# setup adds gems to Ruby\'s load path
Bundler\.setup # defaults to all groups
require "bundler/setup" # same as Bundler\.setup
Bundler\.setup(:default) # only set up the _default_ group
Bundler\.setup(:test) # only set up the _test_ group (but `not` _default_)
Bundler\.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
# require requires all of the gems in the specified groups
Bundler\.require # defaults to the _default_ group
Bundler\.require(:default) # identical
Bundler\.require(:default, :test) # requires the _default_ and _test_ groups
Bundler\.require(:test) # requires the _test_ group
.
.fi
.
.IP "" 0
.
.P
The Bundler CLI allows you to specify a list of groups whose gems \fBbundle install\fR should not install with the \fBwithout\fR configuration\.
.
.P
To specify multiple groups to ignore, specify a list of groups separated by spaces\.
.
.IP "" 4
.
.nf
bundle config set without test
bundle config set without development test
.
.fi
.
.IP "" 0
.
.P
Also, calling \fBBundler\.setup\fR with no parameters, or calling \fBrequire "bundler/setup"\fR will setup all groups except for the ones you excluded via \fB\-\-without\fR (since they are not available)\.
.
.P
Note that on \fBbundle install\fR, bundler downloads and evaluates all gems, in order to create a single canonical list of all of the required gems and their dependencies\. This means that you cannot list different versions of the same gems in different groups\. For more details, see Understanding Bundler \fIhttps://bundler\.io/rationale\.html\fR\.
.
.SS "PLATFORMS"
If a gem should only be used in a particular platform or set of platforms, you can specify them\. Platforms are essentially identical to groups, except that you do not need to use the \fB\-\-without\fR install\-time flag to exclude groups of gems for other platforms\.
.
.P
There are a number of \fBGemfile\fR platforms:
.
.TP
\fBruby\fR
C Ruby (MRI), Rubinius or TruffleRuby, but \fBNOT\fR Windows
.
.TP
\fBmri\fR
Same as \fIruby\fR, but only C Ruby (MRI)
.
.TP
\fBmingw\fR
Windows 32 bit \'mingw32\' platform (aka RubyInstaller)
.
.TP
\fBx64_mingw\fR
Windows 64 bit \'mingw32\' platform (aka RubyInstaller x64)
.
.TP
\fBrbx\fR
Rubinius
.
.TP
\fBjruby\fR
JRuby
.
.TP
\fBtruffleruby\fR
TruffleRuby
.
.TP
\fBmswin\fR
Windows
.
.P
You can restrict further by platform and version for all platforms \fIexcept\fR for \fBrbx\fR, \fBjruby\fR, \fBtruffleruby\fR and \fBmswin\fR\.
.
.P
To specify a version in addition to a platform, append the version number without the delimiter to the platform\. For example, to specify that a gem should only be used on platforms with Ruby 2\.3, use:
.
.IP "" 4
.
.nf
ruby_23
.
.fi
.
.IP "" 0
.
.P
The full list of platforms and supported versions includes:
.
.TP
\fBruby\fR
1\.8, 1\.9, 2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.TP
\fBmri\fR
1\.8, 1\.9, 2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.TP
\fBmingw\fR
1\.8, 1\.9, 2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.TP
\fBx64_mingw\fR
2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.P
As with groups, you can specify one or more platforms:
.
.IP "" 4
.
.nf
gem "weakling", :platforms => :jruby
gem "ruby\-debug", :platforms => :mri_18
gem "nokogiri", :platforms => [:mri_18, :jruby]
.
.fi
.
.IP "" 0
.
.P
All operations involving groups (\fBbundle install\fR \fIbundle\-install\.1\.html\fR, \fBBundler\.setup\fR, \fBBundler\.require\fR) behave exactly the same as if any groups not matching the current platform were explicitly excluded\.
.
.SS "SOURCE"
You can select an alternate Rubygems repository for a gem using the \':source\' option\.
.
.IP "" 4
.
.nf
gem "some_internal_gem", :source => "https://gems\.example\.com"
.
.fi
.
.IP "" 0
.
.P
This forces the gem to be loaded from this source and ignores any global sources declared at the top level of the file\. If the gem does not exist in this source, it will not be installed\.
.
.P
Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on global sources using the ordering described in \fISOURCE PRIORITY\fR\.
.
.P
Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCES (#source)\fR\.
.
.P
Using the \fB:source\fR option for an individual gem will also make that source available as a possible global source for any other gems which do not specify explicit sources\. Thus, when adding gems with explicit sources, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources\.
.
.SS "GIT"
If necessary, you can specify that a gem is located at a particular git repository using the \fB:git\fR parameter\. The repository can be accessed via several protocols:
.
.TP
\fBHTTP(S)\fR
gem "rails", :git => "https://github\.com/rails/rails\.git"
.
.TP
\fBSSH\fR
gem "rails", :git => "git@github\.com:rails/rails\.git"
.
.TP
\fBgit\fR
gem "rails", :git => "git://github\.com/rails/rails\.git"
.
.P
If using SSH, the user that you use to run \fBbundle install\fR \fBMUST\fR have the appropriate keys available in their \fB$HOME/\.ssh\fR\.
.
.P
\fBNOTE\fR: \fBhttp://\fR and \fBgit://\fR URLs should be avoided if at all possible\. These protocols are unauthenticated, so a man\-in\-the\-middle attacker can deliver malicious code and compromise your system\. HTTPS and SSH are strongly preferred\.
.
.P
The \fBgroup\fR, \fBplatforms\fR, and \fBrequire\fR options are available and behave exactly the same as they would for a normal gem\.
.
.P
A git repository \fBSHOULD\fR have at least one file, at the root of the directory containing the gem, with the extension \fB\.gemspec\fR\. This file \fBMUST\fR contain a valid gem specification, as expected by the \fBgem build\fR command\.
.
.P
If a git repository does not have a \fB\.gemspec\fR, bundler will attempt to create one, but it will not contain any dependencies, executables, or C extension compilation instructions\. As a result, it may fail to properly integrate into your application\.
.
.P
If a git repository does have a \fB\.gemspec\fR for the gem you attached it to, a version specifier, if provided, means that the git repository is only valid if the \fB\.gemspec\fR specifies a version matching the version specifier\. If not, bundler will print a warning\.
.
.IP "" 4
.
.nf
gem "rails", "2\.3\.8", :git => "https://github\.com/rails/rails\.git"
# bundle install will fail, because the \.gemspec in the rails
# repository\'s master branch specifies version 3\.0\.0
.
.fi
.
.IP "" 0
.
.P
If a git repository does \fBnot\fR have a \fB\.gemspec\fR for the gem you attached it to, a version specifier \fBMUST\fR be provided\. Bundler will use this version in the simple \fB\.gemspec\fR it creates\.
.
.P
Git repositories support a number of additional options\.
.
.TP
\fBbranch\fR, \fBtag\fR, and \fBref\fR
You \fBMUST\fR only specify at most one of these options\. The default is \fB:branch => "master"\fR\. For example:
.
.IP
gem "rails", :git => "https://github\.com/rails/rails\.git", :branch => "5\-0\-stable"
.
.IP
gem "rails", :git => "https://github\.com/rails/rails\.git", :tag => "v5\.0\.0"
.
.IP
gem "rails", :git => "https://github\.com/rails/rails\.git", :ref => "4aded"
.
.TP
\fBsubmodules\fR
For reference, a git submodule \fIhttps://git\-scm\.com/book/en/v2/Git\-Tools\-Submodules\fR lets you have another git repository within a subfolder of your repository\. Specify \fB:submodules => true\fR to cause bundler to expand any submodules included in the git repository
.
.P
If a git repository contains multiple \fB\.gemspecs\fR, each \fB\.gemspec\fR represents a gem located at the same place in the file system as the \fB\.gemspec\fR\.
.
.IP "" 4
.
.nf
|~rails [git root]
| |\-rails\.gemspec [rails gem located here]
|~actionpack
| |\-actionpack\.gemspec [actionpack gem located here]
|~activesupport
| |\-activesupport\.gemspec [activesupport gem located here]
|\.\.\.
.
.fi
.
.IP "" 0
.
.P
To install a gem located in a git repository, bundler changes to the directory containing the gemspec, runs \fBgem build name\.gemspec\fR and then installs the resulting gem\. The \fBgem build\fR command, which comes standard with Rubygems, evaluates the \fB\.gemspec\fR in the context of the directory in which it is located\.
.
.SS "GIT SOURCE"
A custom git source can be defined via the \fBgit_source\fR method\. Provide the source\'s name as an argument, and a block which receives a single argument and interpolates it into a string to return the full repo address:
.
.IP "" 4
.
.nf
git_source(:stash){ |repo_name| "https://stash\.corp\.acme\.pl/#{repo_name}\.git" }
gem \'rails\', :stash => \'forks/rails\'
.
.fi
.
.IP "" 0
.
.P
In addition, if you wish to choose a specific branch:
.
.IP "" 4
.
.nf
gem "rails", :stash => "forks/rails", :branch => "branch_name"
.
.fi
.
.IP "" 0
.
.SS "GITHUB"
\fBNOTE\fR: This shorthand should be avoided until Bundler 2\.0, since it currently expands to an insecure \fBgit://\fR URL\. This allows a man\-in\-the\-middle attacker to compromise your system\.
.
.P
If the git repository you want to use is hosted on GitHub and is public, you can use the :github shorthand to specify the github username and repository name (without the trailing "\.git"), separated by a slash\. If both the username and repository name are the same, you can omit one\.
.
.IP "" 4
.
.nf
gem "rails", :github => "rails/rails"
gem "rails", :github => "rails"
.
.fi
.
.IP "" 0
.
.P
Are both equivalent to
.
.IP "" 4
.
.nf
gem "rails", :git => "git://github\.com/rails/rails\.git"
.
.fi
.
.IP "" 0
.
.P
Since the \fBgithub\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
.
.SS "GIST"
If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\.
.
.IP "" 4
.
.nf
gem "the_hatch", :gist => "4815162342"
.
.fi
.
.IP "" 0
.
.P
Is equivalent to:
.
.IP "" 4
.
.nf
gem "the_hatch", :git => "https://gist\.github\.com/4815162342\.git"
.
.fi
.
.IP "" 0
.
.P
Since the \fBgist\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
.
.SS "BITBUCKET"
If the git repository you want to use is hosted on Bitbucket and is public, you can use the :bitbucket shorthand to specify the bitbucket username and repository name (without the trailing "\.git"), separated by a slash\. If both the username and repository name are the same, you can omit one\.
.
.IP "" 4
.
.nf
gem "rails", :bitbucket => "rails/rails"
gem "rails", :bitbucket => "rails"
.
.fi
.
.IP "" 0
.
.P
Are both equivalent to
.
.IP "" 4
.
.nf
gem "rails", :git => "https://rails@bitbucket\.org/rails/rails\.git"
.
.fi
.
.IP "" 0
.
.P
Since the \fBbitbucket\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
.
.SS "PATH"
You can specify that a gem is located in a particular location on the file system\. Relative paths are resolved relative to the directory containing the \fBGemfile\fR\.
.
.P
Similar to the semantics of the \fB:git\fR option, the \fB:path\fR option requires that the directory in question either contains a \fB\.gemspec\fR for the gem, or that you specify an explicit version that bundler should use\.
.
.P
Unlike \fB:git\fR, bundler does not compile C extensions for gems specified as paths\.
.
.IP "" 4
.
.nf
gem "rails", :path => "vendor/rails"
.
.fi
.
.IP "" 0
.
.P
If you would like to use multiple local gems directly from the filesystem, you can set a global \fBpath\fR option to the path containing the gem\'s files\. This will automatically load gemspec files from subdirectories\.
.
.IP "" 4
.
.nf
path \'components\' do
gem \'admin_ui\'
gem \'public_ui\'
end
.
.fi
.
.IP "" 0
.
.SH "BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS"
The \fB:source\fR, \fB:git\fR, \fB:path\fR, \fB:group\fR, and \fB:platforms\fR options may be applied to a group of gems by using block form\.
.
.IP "" 4
.
.nf
source "https://gems\.example\.com" do
gem "some_internal_gem"
gem "another_internal_gem"
end
git "https://github\.com/rails/rails\.git" do
gem "activesupport"
gem "actionpack"
end
platforms :ruby do
gem "ruby\-debug"
gem "sqlite3"
end
group :development, :optional => true do
gem "wirble"
gem "faker"
end
.
.fi
.
.IP "" 0
.
.P
In the case of the group block form the :optional option can be given to prevent a group from being installed unless listed in the \fB\-\-with\fR option given to the \fBbundle install\fR command\.
.
.P
In the case of the \fBgit\fR block form, the \fB:ref\fR, \fB:branch\fR, \fB:tag\fR, and \fB:submodules\fR options may be passed to the \fBgit\fR method, and all gems in the block will inherit those options\.
.
.P
The presence of a \fBsource\fR block in a Gemfile also makes that source available as a possible global source for any other gems which do not specify explicit sources\. Thus, when defining source blocks, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources, either via source blocks or \fB:source\fR directives on individual gems\.
.
.SH "INSTALL_IF"
The \fBinstall_if\fR method allows gems to be installed based on a proc or lambda\. This is especially useful for optional gems that can only be used if certain software is installed or some other conditions are met\.
.
.IP "" 4
.
.nf
install_if \-> { RUBY_PLATFORM =~ /darwin/ } do
gem "pasteboard"
end
.
.fi
.
.IP "" 0
.
.SH "GEMSPEC"
The \fB\.gemspec\fR \fIhttp://guides\.rubygems\.org/specification\-reference/\fR file is where you provide metadata about your gem to Rubygems\. Some required Gemspec attributes include the name, description, and homepage of your gem\. This is also where you specify the dependencies your gem needs to run\.
.
.P
If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the \fBgemspec\fR method to pull in the dependencies listed in the \fB\.gemspec\fR file\.
.
.P
The \fBgemspec\fR method adds any runtime dependencies as gem requirements in the default group\. It also adds development dependencies as gem requirements in the \fBdevelopment\fR group\. Finally, it adds a gem requirement on your project (\fB:path => \'\.\'\fR)\. In conjunction with \fBBundler\.setup\fR, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths\.
.
.P
The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: "{,\fI,\fR/*}\.gemspec"), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\.
.
.P
When a \fBgemspec\fR dependency encounters version conflicts during resolution, the local version under development will always be selected \-\- even if there are remote versions that better match other requirements for the \fBgemspec\fR gem\.
.
.SH "SOURCE PRIORITY"
When attempting to locate a gem to satisfy a gem requirement, bundler uses the following priority order:
.
.IP "1." 4
The source explicitly attached to the gem (using \fB:source\fR, \fB:path\fR, or \fB:git\fR)
.
.IP "2." 4
For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent\. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from \fBrubygems\.org\fR
.
.IP "3." 4
The sources specified via global \fBsource\fR lines, searching each source in your \fBGemfile\fR from last added to first added\.
.
.IP "" 0
bundler-2.1.4/man/bundle-gem.1.txt 0000644 0000041 0000041 00000006104 13606335352 016702 0 ustar www-data www-data BUNDLE-GEM(1) BUNDLE-GEM(1)
NAME
bundle-gem - Generate a project skeleton for creating a rubygem
SYNOPSIS
bundle gem GEM_NAME OPTIONS
DESCRIPTION
Generates a directory named GEM_NAME with a Rakefile, GEM_NAME.gemspec,
and other supporting files and directories that can be used to develop
a rubygem with that name.
Run rake -T in the resulting project for a list of Rake tasks that can
be used to test and publish the gem to rubygems.org.
The generated project skeleton can be customized with OPTIONS, as
explained below. Note that these options can also be specified via
Bundler's global configuration file using the following names:
o gem.coc
o gem.mit
o gem.test
OPTIONS
--exe or -b or --bin
Specify that Bundler should create a binary executable (as
exe/GEM_NAME) in the generated rubygem project. This binary will
also be added to the GEM_NAME.gemspec manifest. This behavior is
disabled by default.
--no-exe
Do not create a binary (overrides --exe specified in the global
config).
--coc Add a CODE_OF_CONDUCT.md file to the root of the generated
project. If this option is unspecified, an interactive prompt
will be displayed and the answer will be saved in Bundler's
global config for future bundle gem use.
--no-coc
Do not create a CODE_OF_CONDUCT.md (overrides --coc specified in
the global config).
--ext Add boilerplate for C extension code to the generated project.
This behavior is disabled by default.
--no-ext
Do not add C extension code (overrides --ext specified in the
global config).
--mit Add an MIT license to a LICENSE.txt file in the root of the gen-
erated project. Your name from the global git config is used for
the copyright statement. If this option is unspecified, an
interactive prompt will be displayed and the answer will be
saved in Bundler's global config for future bundle gem use.
--no-mit
Do not create a LICENSE.txt (overrides --mit specified in the
global config).
-t, --test=minitest, --test=rspec
Specify the test framework that Bundler should use when generat-
ing the project. Acceptable values are minitest and rspec. The
GEM_NAME.gemspec will be configured and a skeleton test/spec
directory will be created based on this option. If this option
is unspecified, an interactive prompt will be displayed and the
answer will be saved in Bundler's global config for future bun-
dle gem use. If no option is specified, the default testing
framework is RSpec.
-e, --edit[=EDITOR]
Open the resulting GEM_NAME.gemspec in EDITOR, or the default
editor if not specified. The default is $BUNDLER_EDITOR, $VIS-
UAL, or $EDITOR.
SEE ALSO
o bundle config(1) bundle-config.1.html
January 2020 BUNDLE-GEM(1)
bundler-2.1.4/man/bundle-lock.ronn 0000644 0000041 0000041 00000005735 13606335352 017071 0 ustar www-data www-data bundle-lock(1) -- Creates / Updates a lockfile without installing
=================================================================
## SYNOPSIS
`bundle lock` [--update]
[--local]
[--print]
[--lockfile=PATH]
[--full-index]
[--add-platform]
[--remove-platform]
[--patch]
[--minor]
[--major]
[--strict]
[--conservative]
## DESCRIPTION
Lock the gems specified in Gemfile.
## OPTIONS
* `--update=<*gems>`:
Ignores the existing lockfile. Resolve then updates lockfile. Taking a list
of gems or updating all gems if no list is given.
* `--local`:
Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the
gems already present in Rubygems' cache or in `vendor/cache`. Note that if a
appropriate platform-specific gem exists on `rubygems.org` it will not be
found.
* `--print`:
Prints the lockfile to STDOUT instead of writing to the file system.
* `--lockfile=`:
The path where the lockfile should be written to.
* `--full-index`:
Fall back to using the single-file index of all gems.
* `--add-platform`:
Add a new platform to the lockfile, re-resolving for the addition of that
platform.
* `--remove-platform`:
Remove a platform from the lockfile.
* `--patch`:
If updating, prefer updating only to next patch version.
* `--minor`:
If updating, prefer updating only to next minor version.
* `--major`:
If updating, prefer updating to next major version (default).
* `--strict`:
If updating, do not allow any gem to be updated past latest --patch | --minor | --major.
* `--conservative`:
If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated.
## UPDATING ALL GEMS
If you run `bundle lock` with `--update` option without list of gems, bundler will
ignore any previously installed gems and resolve all dependencies again based
on the latest versions of all gems available in the sources.
## UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of
the gems that you specified locked to the versions in the `Gemfile.lock`.
For instance, you only want to update `nokogiri`, run `bundle lock --update nokogiri`.
Bundler will update `nokogiri` and any of its dependencies, but leave the rest of the
gems that you specified locked to the versions in the `Gemfile.lock`.
## SUPPORTING OTHER PLATFORMS
If you want your bundle to support platforms other than the one you're running
locally, you can run `bundle lock --add-platform PLATFORM` to add PLATFORM to
the lockfile, force bundler to re-resolve and consider the new platform when
picking gems, all without needing to have a machine that matches PLATFORM handy
to install those platform-specific gems on.
For a full explanation of gem platforms, see `gem help platform`.
## PATCH LEVEL OPTIONS
See [bundle update(1)](bundle-update.1.html) for details.
bundler-2.1.4/man/bundle-exec.1.txt 0000644 0000041 0000041 00000014744 13606335352 017067 0 ustar www-data www-data BUNDLE-EXEC(1) BUNDLE-EXEC(1)
NAME
bundle-exec - Execute a command in the context of the bundle
SYNOPSIS
bundle exec [--keep-file-descriptors] command
DESCRIPTION
This command executes the command, making all gems specified in the
[Gemfile(5)][Gemfile(5)] available to require in Ruby programs.
Essentially, if you would normally have run something like rspec
spec/my_spec.rb, and you want to use the gems specified in the [Gem-
file(5)][Gemfile(5)] and installed via bundle install(1) bun-
dle-install.1.html, you should run bundle exec rspec spec/my_spec.rb.
Note that bundle exec does not require that an executable is available
on your shell's $PATH.
OPTIONS
--keep-file-descriptors
Exec in Ruby 2.0 began discarding non-standard file descriptors.
When this flag is passed, exec will revert to the 1.9 behaviour
of passing all file descriptors to the new process.
BUNDLE INSTALL --BINSTUBS
If you use the --binstubs flag in bundle install(1) bun-
dle-install.1.html, Bundler will automatically create a directory
(which defaults to app_root/bin) containing all of the executables
available from gems in the bundle.
After using --binstubs, bin/rspec spec/my_spec.rb is identical to bun-
dle exec rspec spec/my_spec.rb.
ENVIRONMENT MODIFICATIONS
bundle exec makes a number of changes to the shell environment, then
executes the command you specify in full.
o make sure that it's still possible to shell out to bundle from
inside a command invoked by bundle exec (using $BUNDLE_BIN_PATH)
o put the directory containing executables (like rails, rspec,
rackup) for your bundle on $PATH
o make sure that if bundler is invoked in the subshell, it uses the
same Gemfile (by setting BUNDLE_GEMFILE)
o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby pro-
grams invoked in the subshell can see the gems in the bundle
It also modifies Rubygems:
o disallow loading additional gems not in the bundle
o modify the gem method to be a no-op if a gem matching the require-
ments is in the bundle, and to raise a Gem::LoadError if it's not
o Define Gem.refresh to be a no-op, since the source index is always
frozen when using bundler, and to prevent gems from the system
leaking into the environment
o Override Gem.bin_path to use the gems in the bundle, making system
executables work
o Add all gems in the bundle into Gem.loaded_specs
Finally, bundle exec also implicitly modifies Gemfile.lock if the lock-
file and the Gemfile do not match. Bundler needs the Gemfile to deter-
mine things such as a gem's groups, autorequire, and platforms, etc.,
and that information isn't stored in the lockfile. The Gemfile and
lockfile must be synced in order to bundle exec successfully, so bundle
exec updates the lockfile beforehand.
Loading
By default, when attempting to bundle exec to a file with a ruby she-
bang, Bundler will Kernel.load that file instead of using Kernel.exec.
For the vast majority of cases, this is a performance improvement. In a
rare few cases, this could cause some subtle side-effects (such as
dependence on the exact contents of $0 or __FILE__) and the optimiza-
tion can be disabled by enabling the disable_exec_load setting.
Shelling out
Any Ruby code that opens a subshell (like system, backticks, or %x{})
will automatically use the current Bundler environment. If you need to
shell out to a Ruby command that is not part of your current bundle,
use the with_clean_env method with a block. Any subshells created
inside the block will be given the environment present before Bundler
was activated. For example, Homebrew commands run Ruby, but don't work
inside a bundle:
Bundler.with_clean_env do
`brew install wget`
end
Using with_clean_env is also necessary if you are shelling out to a
different bundle. Any Bundler commands run in a subshell will inherit
the current Gemfile, so commands that need to run in the context of a
different bundle also need to use with_clean_env.
Bundler.with_clean_env do
Dir.chdir "/other/bundler/project" do
`bundle exec ./script`
end
end
Bundler provides convenience helpers that wrap system and exec, and
they can be used like this:
Bundler.clean_system('brew install wget')
Bundler.clean_exec('brew install wget')
RUBYGEMS PLUGINS
At present, the Rubygems plugin system requires all files named
rubygems_plugin.rb on the load path of any installed gem when any Ruby
code requires rubygems.rb. This includes executables installed into the
system, like rails, rackup, and rspec.
Since Rubygems plugins can contain arbitrary Ruby code, they commonly
end up activating themselves or their dependencies.
For instance, the gemcutter 0.5 gem depended on json_pure. If you had
that version of gemcutter installed (even if you also had a newer ver-
sion without this problem), Rubygems would activate gemcutter 0.5 and
json_pure .
If your Gemfile(5) also contained json_pure (or a gem with a dependency
on json_pure), the latest version on your system might conflict with
the version in your Gemfile(5), or the snapshot version in your Gem-
file.lock.
If this happens, bundler will say:
You have already activated json_pure 1.4.6 but your Gemfile
requires json_pure 1.4.3. Consider using bundle exec.
In this situation, you almost certainly want to remove the underlying
gem with the problematic gem plugin. In general, the authors of these
plugins (in this case, the gemcutter gem) have released newer versions
that are more careful in their plugins.
You can find a list of all the gems containing gem plugins by running
ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest version of each
gem plugin, and also remove all gem plugins that you aren't using (gem
uninstall gem_name).
January 2020 BUNDLE-EXEC(1)
bundler-2.1.4/man/bundle-info.1.txt 0000644 0000041 0000041 00000000573 13606335352 017071 0 ustar www-data www-data BUNDLE-INFO(1) BUNDLE-INFO(1)
NAME
bundle-info - Show information for the given gem in your bundle
SYNOPSIS
bundle info [GEM] [--path]
DESCRIPTION
Print the basic information about the provided GEM such as homepage,
version, path and summary.
OPTIONS
--path Print the path of the given gem
January 2020 BUNDLE-INFO(1)
bundler-2.1.4/man/bundle-viz.1.txt 0000644 0000041 0000041 00000001723 13606335352 016744 0 ustar www-data www-data BUNDLE-VIZ(1) BUNDLE-VIZ(1)
NAME
bundle-viz - Generates a visual dependency graph for your Gemfile
SYNOPSIS
bundle viz [--file=FILE] [--format=FORMAT] [--requirements] [--version]
[--without=GROUP GROUP]
DESCRIPTION
viz generates a PNG file of the current Gemfile(5) as a dependency
graph. viz requires the ruby-graphviz gem (and its dependencies).
The associated gems must also be installed via bundle install(1) bun-
dle-install.1.html.
OPTIONS
--file, -f
The name to use for the generated file. See --format option
--format, -F
This is output format option. Supported format is png, jpg, svg,
dot ...
--requirements, -R
Set to show the version of each required dependency.
--version, -v
Set to show each gem version.
--without, -W
Exclude gems that are part of the specified named group.
January 2020 BUNDLE-VIZ(1)
bundler-2.1.4/man/bundle-viz.1 0000644 0000041 0000041 00000002120 13606335352 016116 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-VIZ" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
.
.SH "SYNOPSIS"
\fBbundle viz\fR [\-\-file=FILE] [\-\-format=FORMAT] [\-\-requirements] [\-\-version] [\-\-without=GROUP GROUP]
.
.SH "DESCRIPTION"
\fBviz\fR generates a PNG file of the current \fBGemfile(5)\fR as a dependency graph\. \fBviz\fR requires the ruby\-graphviz gem (and its dependencies)\.
.
.P
The associated gems must also be installed via \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-file\fR, \fB\-f\fR
The name to use for the generated file\. See \fB\-\-format\fR option
.
.TP
\fB\-\-format\fR, \fB\-F\fR
This is output format option\. Supported format is png, jpg, svg, dot \.\.\.
.
.TP
\fB\-\-requirements\fR, \fB\-R\fR
Set to show the version of each required dependency\.
.
.TP
\fB\-\-version\fR, \fB\-v\fR
Set to show each gem version\.
.
.TP
\fB\-\-without\fR, \fB\-W\fR
Exclude gems that are part of the specified named group\.
bundler-2.1.4/man/bundle-update.1.txt 0000644 0000041 0000041 00000032516 13606335352 017422 0 ustar www-data www-data BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
NAME
bundle-update - Update your gems to the latest available versions
SYNOPSIS
bundle update *gems [--all] [--group=NAME] [--source=NAME] [--local]
[--ruby] [--bundler[=VERSION]] [--full-index] [--jobs=JOBS] [--quiet]
[--patch|--minor|--major] [--redownload] [--strict] [--conservative]
DESCRIPTION
Update the gems specified (all gems, if --all flag is used), ignoring
the previously installed gems specified in the Gemfile.lock. In gen-
eral, you should use bundle install(1) bundle-install.1.html to install
the same exact gems and versions across machines.
You would use bundle update to explicitly update the version of a gem.
OPTIONS
--all Update all gems specified in Gemfile.
--group=, -g=[]
Only update the gems in the specified group. For instance, you
can update all gems in the development group with bundle update
--group development. You can also call bundle update rails
--group test to update the rails gem and all gems in the test
group, for example.
--source=
The name of a :git or :path source used in the Gemfile(5). For
instance, with a :git source of
http://github.com/rails/rails.git, you would call bundle update
--source rails
--local
Do not attempt to fetch gems remotely and use the gem cache
instead.
--ruby Update the locked version of Ruby to the current version of
Ruby.
--bundler
Update the locked version of bundler to the invoked bundler ver-
sion.
--full-index
Fall back to using the single-file index of all gems.
--jobs=[], -j[]
Specify the number of jobs to run in parallel. The default is 1.
--retry=[]
Retry failed network or git requests for number times.
--quiet
Only output warnings and errors.
--redownload
Force downloading every gem.
--patch
Prefer updating only to next patch version.
--minor
Prefer updating only to next minor version.
--major
Prefer updating to next major version (default).
--strict
Do not allow any gem to be updated past latest --patch | --minor
| --major.
--conservative
Use bundle install conservative update behavior and do not allow
shared dependencies to be updated.
UPDATING ALL GEMS
If you run bundle update --all, bundler will ignore any previously
installed gems and resolve all dependencies again based on the latest
versions of all gems available in the sources.
Consider the following Gemfile(5):
source "https://rubygems.org"
gem "rails", "3.0.0.rc"
gem "nokogiri"
When you run bundle install(1) bundle-install.1.html the first time,
bundler will resolve all of the dependencies, all the way down, and
install what you need:
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing builder 2.1.2
Installing abstract 1.0.0
Installing rack 1.2.8
Using bundler 1.7.6
Installing rake 10.4.0
Installing polyglot 0.3.5
Installing mime-types 1.25.1
Installing i18n 0.4.2
Installing mini_portile 0.6.1
Installing tzinfo 0.3.42
Installing rack-mount 0.6.14
Installing rack-test 0.5.7
Installing treetop 1.4.15
Installing thor 0.14.6
Installing activesupport 3.0.0.rc
Installing erubis 2.6.6
Installing activemodel 3.0.0.rc
Installing arel 0.4.0
Installing mail 2.2.20
Installing activeresource 3.0.0.rc
Installing actionpack 3.0.0.rc
Installing activerecord 3.0.0.rc
Installing actionmailer 3.0.0.rc
Installing railties 3.0.0.rc
Installing rails 3.0.0.rc
Installing nokogiri 1.6.5
Bundle complete! 2 Gemfile dependencies, 26 gems total.
Use `bundle show [gemname]` to see where a bundled gem is installed.
As you can see, even though you have two gems in the Gemfile(5), your
application needs 26 different gems in order to run. Bundler remembers
the exact versions it installed in Gemfile.lock. The next time you run
bundle install(1) bundle-install.1.html, bundler skips the dependency
resolution and installs the same gems as it installed last time.
After checking in the Gemfile.lock into version control and cloning it
on another machine, running bundle install(1) bundle-install.1.html
will still install the gems that you installed last time. You don't
need to worry that a new release of erubis or mail changes the gems you
use.
However, from time to time, you might want to update the gems you are
using to the newest versions that still match the gems in your Gem-
file(5).
To do this, run bundle update --all, which will ignore the Gem-
file.lock, and resolve all the dependencies again. Keep in mind that
this process can result in a significantly different set of the 25
gems, based on the requirements of new gems that the gem authors
released since the last time you ran bundle update --all.
UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave
the rest of the gems that you specified locked to the versions in the
Gemfile.lock.
For instance, in the scenario above, imagine that nokogiri releases
version 1.4.4, and you want to update it without updating Rails and all
of its dependencies. To do this, run bundle update nokogiri.
Bundler will update nokogiri and any of its dependencies, but leave
alone Rails and its dependencies.
OVERLAPPING DEPENDENCIES
Sometimes, multiple gems declared in your Gemfile(5) are satisfied by
the same second-level dependency. For instance, consider the case of
thin and rack-perftools-profiler.
source "https://rubygems.org"
gem "thin"
gem "rack-perftools-profiler"
The thin gem depends on rack >= 1.0, while rack-perftools-profiler
depends on rack ~> 1.0. If you run bundle install, you get:
Fetching source index for https://rubygems.org/
Installing daemons (1.1.0)
Installing eventmachine (0.12.10) with native extensions
Installing open4 (1.0.1)
Installing perftools.rb (0.4.7) with native extensions
Installing rack (1.2.1)
Installing rack-perftools_profiler (0.0.2)
Installing thin (1.2.7) with native extensions
Using bundler (1.0.0.rc.3)
In this case, the two gems have their own set of dependencies, but they
share rack in common. If you run bundle update thin, bundler will
update daemons, eventmachine and rack, which are dependencies of thin,
but not open4 or perftools.rb, which are dependencies of
rack-perftools_profiler. Note that bundle update thin will update rack
even though it's also a dependency of rack-perftools_profiler.
In short, by default, when you update a gem using bundle update,
bundler will update all dependencies of that gem, including those that
are also dependencies of another gem.
To prevent updating shared dependencies, prior to version 1.14 the only
option was the CONSERVATIVE UPDATING behavior in bundle install(1) bun-
dle-install.1.html:
In this scenario, updating the thin version manually in the Gemfile(5),
and then running bundle install(1) bundle-install.1.html will only
update daemons and eventmachine, but not rack. For more information,
see the CONSERVATIVE UPDATING section of bundle install(1) bun-
dle-install.1.html.
Starting with 1.14, specifying the --conservative option will also pre-
vent shared dependencies from being updated.
PATCH LEVEL OPTIONS
Version 1.14 introduced 4 patch-level options that will influence how
gem versions are resolved. One of the following options can be used:
--patch, --minor or --major. --strict can be added to further influence
resolution.
--patch
Prefer updating only to next patch version.
--minor
Prefer updating only to next minor version.
--major
Prefer updating to next major version (default).
--strict
Do not allow any gem to be updated past latest --patch | --minor
| --major.
When Bundler is resolving what versions to use to satisfy declared
requirements in the Gemfile or in parent gems, it looks up all avail-
able versions, filters out any versions that don't satisfy the require-
ment, and then, by default, sorts them from newest to oldest, consider-
ing them in that order.
Providing one of the patch level options (e.g. --patch) changes the
sort order of the satisfying versions, causing Bundler to consider the
latest --patch or --minor version available before other versions. Note
that versions outside the stated patch level could still be resolved to
if necessary to find a suitable dependency graph.
For example, if gem 'foo' is locked at 1.0.2, with no gem requirement
defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0
all exist, the default order of preference by default (--major) will be
"2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2".
If the --patch option is used, the order of preference will change to
"1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0".
If the --minor option is used, the order of preference will change to
"1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0".
Combining the --strict option with any of the patch level options will
remove any versions beyond the scope of the patch level option, to
ensure that no gem is updated that far.
To continue the previous example, if both --patch and --strict options
are used, the available versions for resolution would be "1.0.4, 1.0.3,
1.0.2". If --minor and --strict are used, it would be "1.1.1, 1.1.0,
1.0.4, 1.0.3, 1.0.2".
Gem requirements as defined in the Gemfile will still be the first
determining factor for what versions are available. If the gem require-
ment for foo in the Gemfile is '~> 1.0', that will accomplish the same
thing as providing the --minor and --strict options.
PATCH LEVEL EXAMPLES
Given the following gem specifications:
foo 1.4.3, requires: ~> bar 2.0
foo 1.4.4, requires: ~> bar 2.0
foo 1.4.5, requires: ~> bar 2.1
foo 1.5.0, requires: ~> bar 2.1
foo 1.5.1, requires: ~> bar 3.0
bar with versions 2.0.3, 2.0.4, 2.1.0, 2.1.1, 3.0.0
Gemfile:
gem 'foo'
Gemfile.lock:
foo (1.4.3)
bar (~> 2.0)
bar (2.0.3)
Cases:
# Command Line Result
------------------------------------------------------------
1 bundle update --patch 'foo 1.4.5', 'bar 2.1.1'
2 bundle update --patch foo 'foo 1.4.5', 'bar 2.1.1'
3 bundle update --minor 'foo 1.5.1', 'bar 3.0.0'
4 bundle update --minor --strict 'foo 1.5.0', 'bar 2.1.1'
5 bundle update --patch --strict 'foo 1.4.4', 'bar 2.0.4'
In case 1, bar is upgraded to 2.1.1, a minor version increase, because
the dependency from foo 1.4.5 required it.
In case 2, only foo is requested to be unlocked, but bar is also
allowed to move because it's not a declared dependency in the Gemfile.
In case 3, bar goes up a whole major release, because a minor increase
is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0
of bar.
In case 4, foo is preferred up to a minor version, but 1.5.1 won't work
because the --strict flag removes bar 3.0.0 from consideration since
it's a major increment.
In case 5, both foo and bar have any minor or major increments removed
from consideration because of the --strict flag, so the most they can
move is up to 1.4.4 and 2.0.4.
RECOMMENDED WORKFLOW
In general, when working with an application managed with bundler, you
should use the following workflow:
o After you create your Gemfile(5) for the first time, run
$ bundle install
o Check the resulting Gemfile.lock into version control
$ git add Gemfile.lock
o When checking out this repository on another development machine,
run
$ bundle install
o When checking out this repository on a deployment machine, run
$ bundle install --deployment
o After changing the Gemfile(5) to reflect a new or update depen-
dency, run
$ bundle install
o Make sure to check the updated Gemfile.lock into version control
$ git add Gemfile.lock
o If bundle install(1) bundle-install.1.html reports a conflict, man-
ually update the specific gems that you changed in the Gemfile(5)
$ bundle update rails thin
o If you want to update all the gems to the latest possible versions
that still match the gems listed in the Gemfile(5), run
$ bundle update --all
January 2020 BUNDLE-UPDATE(1)
bundler-2.1.4/man/bundle.ronn 0000644 0000041 0000041 00000006110 13606335352 016127 0 ustar www-data www-data bundle(1) -- Ruby Dependency Management
=======================================
## SYNOPSIS
`bundle` COMMAND [--no-color] [--verbose] [ARGS]
## DESCRIPTION
Bundler manages an `application's dependencies` through its entire life
across many machines systematically and repeatably.
See [the bundler website](https://bundler.io) for information on getting
started, and Gemfile(5) for more information on the `Gemfile` format.
## OPTIONS
* `--no-color`:
Print all output without color
* `--retry`, `-r`:
Specify the number of times you wish to attempt network commands
* `--verbose`, `-V`:
Print out additional logging information
## BUNDLE COMMANDS
We divide `bundle` subcommands into primary commands and utilities:
## PRIMARY COMMANDS
* [`bundle install(1)`](bundle-install.1.html):
Install the gems specified by the `Gemfile` or `Gemfile.lock`
* [`bundle update(1)`](bundle-update.1.html):
Update dependencies to their latest versions
* [`bundle package(1)`](bundle-package.1.html):
Package the .gem files required by your application into the
`vendor/cache` directory
* [`bundle exec(1)`](bundle-exec.1.html):
Execute a script in the current bundle
* [`bundle config(1)`](bundle-config.1.html):
Specify and read configuration options for Bundler
* `bundle help(1)`:
Display detailed help for each subcommand
## UTILITIES
* [`bundle add(1)`](bundle-add.1.html):
Add the named gem to the Gemfile and run `bundle install`
* [`bundle binstubs(1)`](bundle-binstubs.1.html):
Generate binstubs for executables in a gem
* [`bundle check(1)`](bundle-check.1.html):
Determine whether the requirements for your application are installed
and available to Bundler
* [`bundle show(1)`](bundle-show.1.html):
Show the source location of a particular gem in the bundle
* [`bundle outdated(1)`](bundle-outdated.1.html):
Show all of the outdated gems in the current bundle
* `bundle console(1)`:
Start an IRB session in the current bundle
* [`bundle open(1)`](bundle-open.1.html):
Open an installed gem in the editor
* [`bundle lock(1)`](bundle-lock.1.html):
Generate a lockfile for your dependencies
* [`bundle viz(1)`](bundle-viz.1.html):
Generate a visual representation of your dependencies
* [`bundle init(1)`](bundle-init.1.html):
Generate a simple `Gemfile`, placed in the current directory
* [`bundle gem(1)`](bundle-gem.1.html):
Create a simple gem, suitable for development with Bundler
* [`bundle platform(1)`](bundle-platform.1.html):
Display platform compatibility information
* [`bundle clean(1)`](bundle-clean.1.html):
Clean up unused gems in your Bundler directory
* [`bundle doctor(1)`](bundle-doctor.1.html):
Display warnings about common problems
* [`bundle remove(1)`](bundle-remove.1.html):
Removes gems from the Gemfile
## PLUGINS
When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES,
Bundler will try to find an executable on your path named `bundler-`
and execute it, passing down any extra arguments to it.
## OBSOLETE
These commands are obsolete and should no longer be used:
* `bundle cache(1)`
* `bundle show(1)`
bundler-2.1.4/man/bundle-doctor.1.txt 0000644 0000041 0000041 00000002133 13606335352 017422 0 ustar www-data www-data BUNDLE-DOCTOR(1) BUNDLE-DOCTOR(1)
NAME
bundle-doctor - Checks the bundle for common problems
SYNOPSIS
bundle doctor [--quiet] [--gemfile=GEMFILE]
DESCRIPTION
Checks your Gemfile and gem environment for common problems. If issues
are detected, Bundler prints them and exits status 1. Otherwise,
Bundler prints a success message and exits status 0.
Examples of common problems caught by bundle-doctor include:
o Invalid Bundler settings
o Mismatched Ruby versions
o Mismatched platforms
o Uninstalled gems
o Missing dependencies
OPTIONS
--quiet
Only output warnings and errors.
--gemfile=
The location of the Gemfile(5) which Bundler should use. This
defaults to a Gemfile(5) in the current working directory. In
general, Bundler will assume that the location of the Gemfile(5)
is also the project's root and will try to find Gemfile.lock and
vendor/cache relative to this location.
January 2020 BUNDLE-DOCTOR(1)
bundler-2.1.4/man/bundle-cache.1 0000644 0000041 0000041 00000006303 13606335352 016360 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CACHE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
.
.SH "SYNOPSIS"
\fBbundle cache\fR
.
.SH "DESCRIPTION"
Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running [bundle install(1)][bundle\-install], use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\.
.
.SH "GIT AND PATH GEMS"
The \fBbundle cache\fR command can also package \fB:git\fR and \fB:path\fR dependencies besides \.gem files\. This needs to be explicitly enabled via the \fB\-\-all\fR option\. Once used, the \fB\-\-all\fR option will be remembered\.
.
.SH "SUPPORT FOR MULTIPLE PLATFORMS"
When using gems that have different packages for different platforms, Bundler supports caching of gems for other platforms where the Gemfile has been resolved (i\.e\. present in the lockfile) in \fBvendor/cache\fR\. This needs to be enabled via the \fB\-\-all\-platforms\fR option\. This setting will be remembered in your local bundler configuration\.
.
.SH "REMOTE FETCHING"
By default, if you run \fBbundle install(1)\fR](bundle\-install\.1\.html) after running bundle cache(1) \fIbundle\-cache\.1\.html\fR, bundler will still connect to \fBrubygems\.org\fR to check whether a platform\-specific gem exists for any of the gems in \fBvendor/cache\fR\.
.
.P
For instance, consider this Gemfile(5):
.
.IP "" 4
.
.nf
source "https://rubygems\.org"
gem "nokogiri"
.
.fi
.
.IP "" 0
.
.P
If you run \fBbundle cache\fR under C Ruby, bundler will retrieve the version of \fBnokogiri\fR for the \fB"ruby"\fR platform\. If you deploy to JRuby and run \fBbundle install\fR, bundler is forced to check to see whether a \fB"java"\fR platformed \fBnokogiri\fR exists\.
.
.P
Even though the \fBnokogiri\fR gem for the Ruby platform is \fItechnically\fR acceptable on JRuby, it has a C extension that does not run on JRuby\. As a result, bundler will, by default, still connect to \fBrubygems\.org\fR to check whether it has a version of one of your gems more specific to your platform\.
.
.P
This problem is also not limited to the \fB"java"\fR platform\. A similar (common) problem can happen when developing on Windows and deploying to Linux, or even when developing on OSX and deploying to Linux\.
.
.P
If you know for sure that the gems packaged in \fBvendor/cache\fR are appropriate for the platform you are on, you can run \fBbundle install \-\-local\fR to skip checking for more appropriate gems, and use the ones in \fBvendor/cache\fR\.
.
.P
One way to be sure that you have the right platformed versions of all your gems is to run \fBbundle cache\fR on an identical machine and check in the gems\. For instance, you can run \fBbundle cache\fR on an identical staging box during your staging process, and check in the \fBvendor/cache\fR before deploying to production\.
.
.P
By default, bundle cache(1) \fIbundle\-cache\.1\.html\fR fetches and also installs the gems to the default location\. To package the dependencies to \fBvendor/cache\fR without installing them to the local install location, you can run \fBbundle cache \-\-no\-install\fR\.
bundler-2.1.4/man/bundle-show.1 0000644 0000041 0000041 00000001261 13606335352 016273 0 ustar www-data www-data .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-SHOW" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
.
.SH "SYNOPSIS"
\fBbundle show\fR [GEM] [\-\-paths]
.
.SH "DESCRIPTION"
Without the [GEM] option, \fBshow\fR will print a list of the names and versions of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by name\.
.
.P
Calling show with [GEM] will list the exact location of that gem on your machine\.
.
.SH "OPTIONS"
.
.TP
\fB\-\-paths\fR
List the paths of all gems that are required by your [\fBGemfile(5)\fR][Gemfile(5)], sorted by gem name\.
bundler-2.1.4/lib/ 0000755 0000041 0000041 00000000000 13606335352 013755 5 ustar www-data www-data bundler-2.1.4/lib/bundler.rb 0000644 0000041 0000041 00000056246 13606335352 015752 0 ustar www-data www-data # frozen_string_literal: true
require_relative "bundler/vendored_fileutils"
require "pathname"
require "rbconfig"
require_relative "bundler/errors"
require_relative "bundler/environment_preserver"
require_relative "bundler/plugin"
require_relative "bundler/rubygems_ext"
require_relative "bundler/rubygems_integration"
require_relative "bundler/version"
require_relative "bundler/constants"
require_relative "bundler/current_ruby"
require_relative "bundler/build_metadata"
# Bundler provides a consistent environment for Ruby projects by
# tracking and installing the exact gems and versions that are needed.
#
# Since Ruby 2.6, Bundler is a part of Ruby's standard library.
#
# Bunder is used by creating _gemfiles_ listing all the project dependencies
# and (optionally) their versions and then using
#
# require 'bundler/setup'
#
# or Bundler.setup to setup environment where only specified gems and their
# specified versions could be used.
#
# See {Bundler website}[https://bundler.io/docs.html] for extensive documentation
# on gemfiles creation and Bundler usage.
#
# As a standard library inside project, Bundler could be used for introspection
# of loaded and required modules.
#
module Bundler
environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
ORIGINAL_ENV = environment_preserver.restore
ENV.replace(environment_preserver.backup)
SUDO_MUTEX = Mutex.new
autoload :Definition, File.expand_path("bundler/definition", __dir__)
autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
autoload :DepProxy, File.expand_path("bundler/dep_proxy", __dir__)
autoload :Deprecate, File.expand_path("bundler/deprecate", __dir__)
autoload :Dsl, File.expand_path("bundler/dsl", __dir__)
autoload :EndpointSpecification, File.expand_path("bundler/endpoint_specification", __dir__)
autoload :Env, File.expand_path("bundler/env", __dir__)
autoload :Fetcher, File.expand_path("bundler/fetcher", __dir__)
autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
autoload :Graph, File.expand_path("bundler/graph", __dir__)
autoload :Index, File.expand_path("bundler/index", __dir__)
autoload :Injector, File.expand_path("bundler/injector", __dir__)
autoload :Installer, File.expand_path("bundler/installer", __dir__)
autoload :LazySpecification, File.expand_path("bundler/lazy_specification", __dir__)
autoload :LockfileParser, File.expand_path("bundler/lockfile_parser", __dir__)
autoload :MatchPlatform, File.expand_path("bundler/match_platform", __dir__)
autoload :ProcessLock, File.expand_path("bundler/process_lock", __dir__)
autoload :RemoteSpecification, File.expand_path("bundler/remote_specification", __dir__)
autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
autoload :Retry, File.expand_path("bundler/retry", __dir__)
autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
autoload :RubyGemsGemInstaller, File.expand_path("bundler/rubygems_gem_installer", __dir__)
autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
autoload :Settings, File.expand_path("bundler/settings", __dir__)
autoload :SharedHelpers, File.expand_path("bundler/shared_helpers", __dir__)
autoload :Source, File.expand_path("bundler/source", __dir__)
autoload :SourceList, File.expand_path("bundler/source_list", __dir__)
autoload :SpecSet, File.expand_path("bundler/spec_set", __dir__)
autoload :StubSpecification, File.expand_path("bundler/stub_specification", __dir__)
autoload :UI, File.expand_path("bundler/ui", __dir__)
autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
autoload :VersionRanges, File.expand_path("bundler/version_ranges", __dir__)
class << self
def configure
@configured ||= configure_gem_home_and_path
end
def ui
(defined?(@ui) && @ui) || (self.ui = UI::Shell.new)
end
def ui=(ui)
Bundler.rubygems.ui = UI::RGProxy.new(ui)
@ui = ui
end
# Returns absolute path of where gems are installed on the filesystem.
def bundle_path
@bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
end
def configured_bundle_path
@configured_bundle_path ||= settings.path.tap(&:validate!)
end
# Returns absolute location of where binstubs are installed to.
def bin_path
@bin_path ||= begin
path = settings[:bin] || "bin"
path = Pathname.new(path).expand_path(root).expand_path
SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) }
path
end
end
# Turns on the Bundler runtime. After +Bundler.setup+ call, all +load+ or
# +require+ of the gems would be allowed only if they are part of
# the Gemfile or Ruby's standard library. If the versions specified
# in Gemfile, only those versions would be loaded.
#
# Assuming Gemfile
#
# gem 'first_gem', '= 1.0'
# group :test do
# gem 'second_gem', '= 1.0'
# end
#
# The code using Bundler.setup works as follows:
#
# require 'third_gem' # allowed, required from global gems
# require 'first_gem' # allowed, loads the last installed version
# Bundler.setup
# require 'fourth_gem' # fails with LoadError
# require 'second_gem' # loads exactly version 1.0
#
# +Bundler.setup+ can be called only once, all subsequent calls are no-op.
#
# If _groups_ list is provided, only gems from specified groups would
# be allowed (gems specified outside groups belong to special +:default+ group).
#
# To require all gems from Gemfile (or only some groups), see Bundler.require.
#
def setup(*groups)
# Return if all groups are already loaded
return @setup if defined?(@setup) && @setup
definition.validate_runtime!
SharedHelpers.print_major_deprecations!
if groups.empty?
# Load all groups, but only once
@setup = load.setup
else
load.setup(*groups)
end
end
# Setups Bundler environment (see Bundler.setup) if it is not already set,
# and loads all gems from groups specified. Unlike ::setup, can be called
# multiple times with different groups (if they were allowed by setup).
#
# Assuming Gemfile
#
# gem 'first_gem', '= 1.0'
# group :test do
# gem 'second_gem', '= 1.0'
# end
#
# The code will work as follows:
#
# Bundler.setup # allow all groups
# Bundler.require(:default) # requires only first_gem
# # ...later
# Bundler.require(:test) # requires second_gem
#
def require(*groups)
setup(*groups).require(*groups)
end
def load
@load ||= Runtime.new(root, definition)
end
def environment
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", :print_caller_location => true
load
end
# Returns an instance of Bundler::Definition for given Gemfile and lockfile
#
# @param unlock [Hash, Boolean, nil] Gems that have been requested
# to be updated or true if all gems should be updated
# @return [Bundler::Definition]
def definition(unlock = nil)
@definition = nil if unlock
@definition ||= begin
configure
Definition.build(default_gemfile, default_lockfile, unlock)
end
end
def frozen_bundle?
frozen = settings[:deployment]
frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
frozen
end
def locked_gems
@locked_gems ||=
if defined?(@definition) && @definition
definition.locked_gems
elsif Bundler.default_lockfile.file?
lock = Bundler.read_file(Bundler.default_lockfile)
LockfileParser.new(lock)
end
end
def ruby_scope
"#{Bundler.rubygems.ruby_engine}/#{RbConfig::CONFIG["ruby_version"]}"
end
def user_home
@user_home ||= begin
home = Bundler.rubygems.user_home
bundle_home = home ? File.join(home, ".bundle") : nil
warning = if home.nil?
"Your home directory is not set."
elsif !File.directory?(home)
"`#{home}` is not a directory."
elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home))
"`#{home}` is not writable."
end
if warning
user_home = tmp_home_path(warning)
Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
user_home
else
Pathname.new(home)
end
end
end
def user_bundle_path(dir = "home")
env_var, fallback = case dir
when "home"
["BUNDLE_USER_HOME", proc { Pathname.new(user_home).join(".bundle") }]
when "cache"
["BUNDLE_USER_CACHE", proc { user_bundle_path.join("cache") }]
when "config"
["BUNDLE_USER_CONFIG", proc { user_bundle_path.join("config") }]
when "plugin"
["BUNDLE_USER_PLUGIN", proc { user_bundle_path.join("plugin") }]
else
raise BundlerError, "Unknown user path requested: #{dir}"
end
# `fallback` will already be a Pathname, but Pathname.new() is
# idempotent so it's OK
Pathname.new(ENV.fetch(env_var, &fallback))
end
def user_cache
user_bundle_path("cache")
end
def home
bundle_path.join("bundler")
end
def install_path
home.join("gems")
end
def specs_path
bundle_path.join("specifications")
end
def root
@root ||= begin
SharedHelpers.root
rescue GemfileNotFound
bundle_dir = default_bundle_dir
raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
Pathname.new(File.expand_path("..", bundle_dir))
end
end
def app_config_path
if app_config = ENV["BUNDLE_APP_CONFIG"]
Pathname.new(app_config).expand_path(root)
else
root.join(".bundle")
end
end
def app_cache(custom_path = nil)
path = custom_path || root
Pathname.new(path).join(settings.app_cache_path)
end
def tmp(name = Process.pid.to_s)
Kernel.send(:require, "tmpdir")
Pathname.new(Dir.mktmpdir(["bundler", name]))
end
def rm_rf(path)
FileUtils.remove_entry_secure(path) if path && File.exist?(path)
rescue ArgumentError
message = < true
)
unbundled_env
end
# @return [Hash] Environment with all bundler-related variables removed
def unbundled_env
env = original_env
if env.key?("BUNDLER_ORIG_MANPATH")
env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
end
env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
if env.key?("RUBYOPT")
env["RUBYOPT"] = env["RUBYOPT"].sub "-rbundler/setup", ""
end
if env.key?("RUBYLIB")
rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
rubylib.delete(File.expand_path("..", __FILE__))
env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
end
env
end
# Run block with environment present before Bundler was activated
def with_original_env
with_env(original_env) { yield }
end
# @deprecated Use `with_unbundled_env` instead
def with_clean_env
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`",
:print_caller_location => true
)
with_env(unbundled_env) { yield }
end
# Run block with all bundler-related variables removed
def with_unbundled_env
with_env(unbundled_env) { yield }
end
# Run subcommand with the environment present before Bundler was activated
def original_system(*args)
with_original_env { Kernel.system(*args) }
end
# @deprecated Use `unbundled_system` instead
def clean_system(*args)
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`",
:print_caller_location => true
)
with_env(unbundled_env) { Kernel.system(*args) }
end
# Run subcommand in an environment with all bundler related variables removed
def unbundled_system(*args)
with_unbundled_env { Kernel.system(*args) }
end
# Run a `Kernel.exec` to a subcommand with the environment present before Bundler was activated
def original_exec(*args)
with_original_env { Kernel.exec(*args) }
end
# @deprecated Use `unbundled_exec` instead
def clean_exec(*args)
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`",
:print_caller_location => true
)
with_env(unbundled_env) { Kernel.exec(*args) }
end
# Run a `Kernel.exec` to a subcommand in an environment with all bundler related variables removed
def unbundled_exec(*args)
with_env(unbundled_env) { Kernel.exec(*args) }
end
def local_platform
return Gem::Platform::RUBY if settings[:force_ruby_platform]
Gem::Platform.local
end
def default_gemfile
SharedHelpers.default_gemfile
end
def default_lockfile
SharedHelpers.default_lockfile
end
def default_bundle_dir
SharedHelpers.default_bundle_dir
end
def system_bindir
# Gem.bindir doesn't always return the location that RubyGems will install
# system binaries. If you put '-n foo' in your .gemrc, RubyGems will
# install binstubs there instead. Unfortunately, RubyGems doesn't expose
# that directory at all, so rather than parse .gemrc ourselves, we allow
# the directory to be set as well, via `bundle config set bindir foo`.
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
end
def use_system_gems?
configured_bundle_path.use_system_gems?
end
def requires_sudo?
return @requires_sudo if defined?(@requires_sudo_ran)
sudo_present = which "sudo" if settings.allow_sudo?
if sudo_present
# the bundle path and subdirectories need to be writable for RubyGems
# to be able to unpack and install gems without exploding
path = bundle_path
path = path.parent until path.exist?
# bins are written to a different location on OS X
bin_dir = Pathname.new(Bundler.system_bindir)
bin_dir = bin_dir.parent until bin_dir.exist?
# if any directory is not writable, we need sudo
files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
unwritable_files = files.reject {|f| File.writable?(f) }
sudo_needed = !unwritable_files.empty?
if sudo_needed
Bundler.ui.warn "Following files may not be writable, so sudo is needed:\n #{unwritable_files.map(&:to_s).sort.join("\n ")}"
end
end
@requires_sudo_ran = true
@requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
end
def mkdir_p(path, options = {})
if requires_sudo? && !options[:no_sudo]
sudo "mkdir -p '#{path}'" unless File.exist?(path)
else
SharedHelpers.filesystem_access(path, :write) do |p|
FileUtils.mkdir_p(p)
end
end
end
def which(executable)
if File.file?(executable) && File.executable?(executable)
executable
elsif paths = ENV["PATH"]
quote = '"'.freeze
paths.split(File::PATH_SEPARATOR).find do |path|
path = path[1..-2] if path.start_with?(quote) && path.end_with?(quote)
executable_path = File.expand_path(executable, path)
return executable_path if File.file?(executable_path) && File.executable?(executable_path)
end
end
end
def sudo(str)
SUDO_MUTEX.synchronize do
prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to RubyGems using sudo.
Password:
PROMPT
unless @prompted_for_sudo ||= system(%(sudo -k -p "#{prompt}" true))
raise SudoNotPermittedError,
"Bundler requires sudo access to install at the moment. " \
"Try installing again, granting Bundler sudo access when prompted, or installing into a different path."
end
`sudo -p "#{prompt}" #{str}`
end
end
def read_file(file)
SharedHelpers.filesystem_access(file, :read) do
File.open(file, "r:UTF-8", &:read)
end
end
def load_marshal(data)
Marshal.load(data)
rescue StandardError => e
raise MarshalError, "#{e.class}: #{e.message}"
end
def load_gemspec(file, validate = false)
@gemspec_cache ||= {}
key = File.expand_path(file)
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
# Protect against caching side-effected gemspecs by returning a
# new instance each time.
@gemspec_cache[key].dup if @gemspec_cache[key]
end
def load_gemspec_uncached(file, validate = false)
path = Pathname.new(file)
contents = read_file(file)
spec = if contents.start_with?("---") # YAML header
eval_yaml_gemspec(path, contents)
else
# Eval the gemspec from its parent directory, because some gemspecs
# depend on "./" relative paths.
SharedHelpers.chdir(path.dirname.to_s) do
eval_gemspec(path, contents)
end
end
return unless spec
spec.loaded_from = path.expand_path.to_s
Bundler.rubygems.validate(spec) if validate
spec
end
def clear_gemspec_cache
@gemspec_cache = {}
end
def git_present?
return @git_present if defined?(@git_present)
@git_present = Bundler.which("git") || Bundler.which("git.exe")
end
def feature_flag
@feature_flag ||= FeatureFlag.new(VERSION)
end
def reset!
reset_paths!
Plugin.reset!
reset_rubygems!
end
def reset_paths!
@bin_path = nil
@bundler_major_version = nil
@bundle_path = nil
@configured = nil
@configured_bundle_path = nil
@definition = nil
@load = nil
@locked_gems = nil
@root = nil
@settings = nil
@setup = nil
@user_home = nil
end
def reset_rubygems!
return unless defined?(@rubygems) && @rubygems
rubygems.undo_replacements
rubygems.reset
@rubygems = nil
end
private
def eval_yaml_gemspec(path, contents)
require_relative "bundler/psyched_yaml"
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
Gem::Specification.from_yaml(contents)
rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
eval_gemspec(path, contents)
end
def eval_gemspec(path, contents)
eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
rescue ScriptError, StandardError => e
msg = "There was an error while loading `#{path.basename}`: #{e.message}"
if e.is_a?(LoadError)
msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
end
raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
end
def configure_gem_home_and_path
configure_gem_path
configure_gem_home
bundle_path
end
def configure_gem_path(env = ENV)
blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty?
if !use_system_gems?
# this needs to be empty string to cause
# PathSupport.split_gem_path to only load up the
# Bundler --path setting as the GEM_PATH.
env["GEM_PATH"] = ""
elsif blank_home
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
paths = possibles.flatten.compact.uniq.reject(&:empty?)
env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
end
end
def configure_gem_home
Bundler::SharedHelpers.set_env "GEM_HOME", File.expand_path(bundle_path, root)
Bundler.rubygems.clear_paths
end
def tmp_home_path(warning)
Kernel.send(:require, "tmpdir")
SharedHelpers.filesystem_access(Dir.tmpdir) do
path = Bundler.tmp
at_exit { Bundler.rm_rf(path) }
path
end
rescue RuntimeError => e
raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}")
end
# @param env [Hash]
def with_env(env)
backup = ENV.to_hash
ENV.replace(env)
yield
ensure
ENV.replace(backup)
end
end
end
bundler-2.1.4/lib/bundler/ 0000755 0000041 0000041 00000000000 13606335352 015410 5 ustar www-data www-data bundler-2.1.4/lib/bundler/lockfile_generator.rb 0000644 0000041 0000041 00000004267 13606335352 021604 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class LockfileGenerator
attr_reader :definition
attr_reader :out
# @private
def initialize(definition)
@definition = definition
@out = String.new
end
def self.generate(definition)
new(definition).generate!
end
def generate!
add_sources
add_platforms
add_dependencies
add_locked_ruby_version
add_bundled_with
out
end
private
def add_sources
definition.send(:sources).lock_sources.each_with_index do |source, idx|
out << "\n" unless idx.zero?
# Add the source header
out << source.to_lock
# Find all specs for this source
specs = definition.resolve.select {|s| source.can_lock?(s) }
add_specs(specs)
end
end
def add_specs(specs)
# This needs to be sorted by full name so that
# gems with the same name, but different platform
# are ordered consistently
specs.sort_by(&:full_name).each do |spec|
next if spec.name == "bundler".freeze
out << spec.to_lock
end
end
def add_platforms
add_section("PLATFORMS", definition.platforms)
end
def add_dependencies
out << "\nDEPENDENCIES\n"
handled = []
definition.dependencies.sort_by(&:to_s).each do |dep|
next if handled.include?(dep.name)
out << dep.to_lock
handled << dep.name
end
end
def add_locked_ruby_version
return unless locked_ruby_version = definition.locked_ruby_version
add_section("RUBY VERSION", locked_ruby_version.to_s)
end
def add_bundled_with
add_section("BUNDLED WITH", definition.locked_bundler_version.to_s)
end
def add_section(name, value)
out << "\n#{name}\n"
case value
when Array
value.map(&:to_s).sort.each do |val|
out << " #{val}\n"
end
when Hash
value.to_a.sort_by {|k, _| k.to_s }.each do |key, val|
out << " #{key}: #{val}\n"
end
when String
out << " #{value}\n"
else
raise ArgumentError, "#{value.inspect} can't be serialized in a lockfile"
end
end
end
end
bundler-2.1.4/lib/bundler/ruby_dsl.rb 0000644 0000041 0000041 00000001371 13606335352 017562 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
module RubyDsl
def ruby(*ruby_version)
options = ruby_version.last.is_a?(Hash) ? ruby_version.pop : {}
ruby_version.flatten!
raise GemfileError, "Please define :engine_version" if options[:engine] && options[:engine_version].nil?
raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
if options[:engine] == "ruby" && options[:engine_version] &&
ruby_version != Array(options[:engine_version])
raise GemfileEvalError, "ruby_version must match the :engine_version for MRI"
end
@ruby_version = RubyVersion.new(ruby_version, options[:patchlevel], options[:engine], options[:engine_version])
end
end
end
bundler-2.1.4/lib/bundler/ruby_version.rb 0000644 0000041 0000041 00000010712 13606335352 020464 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class RubyVersion
attr_reader :versions,
:patchlevel,
:engine,
:engine_versions,
:gem_version,
:engine_gem_version
def initialize(versions, patchlevel, engine, engine_version)
# The parameters to this method must satisfy the
# following constraints, which are verified in
# the DSL:
#
# * If an engine is specified, an engine version
# must also be specified
# * If an engine version is specified, an engine
# must also be specified
# * If the engine is "ruby", the engine version
# must not be specified, or the engine version
# specified must match the version.
@versions = Array(versions).map do |v|
op, v = Gem::Requirement.parse(v)
op == "=" ? v.to_s : "#{op} #{v}"
end
@gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
@input_engine = engine && engine.to_s
@engine = engine && engine.to_s || "ruby"
@engine_versions = (engine_version && Array(engine_version)) || @versions
@engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
@patchlevel = patchlevel
end
def to_s(versions = self.versions)
output = String.new("ruby #{versions_string(versions)}")
output << "p#{patchlevel}" if patchlevel
output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby"
output
end
# @private
PATTERN = /
ruby\s
([\d.]+) # ruby version
(?:p(-?\d+))? # optional patchlevel
(?:\s\((\S+)\s(.+)\))? # optional engine info
/xo.freeze
# Returns a RubyVersion from the given string.
# @param [String] the version string to match.
# @return [RubyVersion,Nil] The version if the string is a valid RubyVersion
# description, and nil otherwise.
def self.from_string(string)
new($1, $2, $3, $4) if string =~ PATTERN
end
def single_version_string
to_s(gem_version)
end
def ==(other)
versions == other.versions &&
engine == other.engine &&
engine_versions == other.engine_versions &&
patchlevel == other.patchlevel
end
def host
@host ||= [
RbConfig::CONFIG["host_cpu"],
RbConfig::CONFIG["host_vendor"],
RbConfig::CONFIG["host_os"],
].join("-")
end
# Returns a tuple of these things:
# [diff, this, other]
# The priority of attributes are
# 1. engine
# 2. ruby_version
# 3. engine_version
def diff(other)
raise ArgumentError, "Can only diff with a RubyVersion, not a #{other.class}" unless other.is_a?(RubyVersion)
if engine != other.engine && @input_engine
[:engine, engine, other.engine]
elsif versions.empty? || !matches?(versions, other.gem_version)
[:version, versions_string(versions), versions_string(other.versions)]
elsif @input_engine && !matches?(engine_versions, other.engine_gem_version)
[:engine_version, versions_string(engine_versions), versions_string(other.engine_versions)]
elsif patchlevel && (!patchlevel.is_a?(String) || !other.patchlevel.is_a?(String) || !matches?(patchlevel, other.patchlevel))
[:patchlevel, patchlevel, other.patchlevel]
end
end
def versions_string(versions)
Array(versions).join(", ")
end
def self.system
ruby_engine = RUBY_ENGINE.dup
ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup
ruby_engine_version = RUBY_ENGINE_VERSION.dup
patchlevel = RUBY_PATCHLEVEL.to_s
@ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
end
def to_gem_version_with_patchlevel
@gem_version_with_patch ||= begin
Gem::Version.create("#{@gem_version}.#{@patchlevel}")
rescue ArgumentError
@gem_version
end
end
def exact?
return @exact if defined?(@exact)
@exact = versions.all? {|v| Gem::Requirement.create(v).exact? }
end
private
def matches?(requirements, version)
# Handles RUBY_PATCHLEVEL of -1 for instances like ruby-head
return requirements == version if requirements.to_s == "-1" || version.to_s == "-1"
Array(requirements).all? do |requirement|
Gem::Requirement.create(requirement).satisfied_by?(Gem::Version.create(version))
end
end
end
end
bundler-2.1.4/lib/bundler/dep_proxy.rb 0000644 0000041 0000041 00000001473 13606335352 017753 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class DepProxy
attr_reader :__platform, :dep
def initialize(dep, platform)
@dep = dep
@__platform = platform
end
def hash
@hash ||= [dep, __platform].hash
end
def ==(other)
return false if other.class != self.class
dep == other.dep && __platform == other.__platform
end
alias_method :eql?, :==
def type
@dep.type
end
def name
@dep.name
end
def requirement
@dep.requirement
end
def to_s
s = name.dup
s << " (#{requirement})" unless requirement == Gem::Requirement.default
s << " #{__platform}" unless __platform == Gem::Platform::RUBY
s
end
private
def method_missing(*args, &blk)
@dep.send(*args, &blk)
end
end
end
bundler-2.1.4/lib/bundler/retry.rb 0000644 0000041 0000041 00000003162 13606335352 017104 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
# General purpose class for retrying code that may fail
class Retry
attr_accessor :name, :total_runs, :current_run
class << self
def default_attempts
default_retries + 1
end
alias_method :attempts, :default_attempts
def default_retries
Bundler.settings[:retry]
end
end
def initialize(name, exceptions = nil, retries = self.class.default_retries)
@name = name
@retries = retries
@exceptions = Array(exceptions) || []
@total_runs = @retries + 1 # will run once, then upto attempts.times
end
def attempt(&block)
@current_run = 0
@failed = false
@error = nil
run(&block) while keep_trying?
@result
end
alias_method :attempts, :attempt
private
def run(&block)
@failed = false
@current_run += 1
@result = block.call
rescue StandardError => e
fail_attempt(e)
end
def fail_attempt(e)
@failed = true
if last_attempt? || @exceptions.any? {|k| e.is_a?(k) }
Bundler.ui.info "" unless Bundler.ui.debug?
raise e
end
return true unless name
Bundler.ui.info "" unless Bundler.ui.debug? # Add new line incase dots preceded this
Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", Bundler.ui.debug?
end
def keep_trying?
return true if current_run.zero?
return false if last_attempt?
return true if @failed
end
def last_attempt?
current_run >= total_runs
end
end
end
bundler-2.1.4/lib/bundler/resolver/ 0000755 0000041 0000041 00000000000 13606335352 017251 5 ustar www-data www-data bundler-2.1.4/lib/bundler/resolver/spec_group.rb 0000644 0000041 0000041 00000006530 13606335352 021750 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Resolver
class SpecGroup
include GemHelpers
attr_accessor :name, :version, :source
attr_accessor :ignores_bundler_dependencies
def initialize(all_specs)
raise ArgumentError, "cannot initialize with an empty value" unless exemplary_spec = all_specs.first
@name = exemplary_spec.name
@version = exemplary_spec.version
@source = exemplary_spec.source
@activated_platforms = []
@dependencies = nil
@specs = Hash.new do |specs, platform|
specs[platform] = select_best_platform_match(all_specs, platform)
end
@ignores_bundler_dependencies = true
end
def to_specs
@activated_platforms.map do |p|
next unless s = @specs[p]
lazy_spec = LazySpecification.new(name, version, s.platform, source)
lazy_spec.dependencies.replace s.dependencies
lazy_spec
end.compact
end
def activate_platform!(platform)
return unless for?(platform)
return if @activated_platforms.include?(platform)
@activated_platforms << platform
end
def for?(platform)
spec = @specs[platform]
!spec.nil?
end
def to_s
@to_s ||= "#{name} (#{version})"
end
def dependencies_for_activated_platforms
dependencies = @activated_platforms.map {|p| __dependencies[p] }
metadata_dependencies = @activated_platforms.map do |platform|
metadata_dependencies(@specs[platform], platform)
end
dependencies.concat(metadata_dependencies).flatten
end
def ==(other)
return unless other.is_a?(SpecGroup)
name == other.name &&
version == other.version &&
source == other.source
end
def eql?(other)
return unless other.is_a?(SpecGroup)
name.eql?(other.name) &&
version.eql?(other.version) &&
source.eql?(other.source)
end
def hash
to_s.hash ^ source.hash
end
private
def __dependencies
@dependencies = Hash.new do |dependencies, platform|
dependencies[platform] = []
if spec = @specs[platform]
spec.dependencies.each do |dep|
next if dep.type == :development
next if @ignores_bundler_dependencies && dep.name == "bundler".freeze
dependencies[platform] << DepProxy.new(dep, platform)
end
end
dependencies[platform]
end
end
def metadata_dependencies(spec, platform)
return [] unless spec
# Only allow endpoint specifications since they won't hit the network to
# fetch the full gemspec when calling required_ruby_version
return [] if !spec.is_a?(EndpointSpecification) && !spec.is_a?(Gem::Specification)
dependencies = []
if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
dependencies << DepProxy.new(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
end
if !spec.required_rubygems_version.nil? && !spec.required_rubygems_version.none?
dependencies << DepProxy.new(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
end
dependencies
end
end
end
end
bundler-2.1.4/lib/bundler/process_lock.rb 0000644 0000041 0000041 00000001276 13606335352 020431 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class ProcessLock
def self.lock(bundle_path = Bundler.bundle_path)
lock_file_path = File.join(bundle_path, "bundler.lock")
has_lock = false
File.open(lock_file_path, "w") do |f|
f.flock(File::LOCK_EX)
has_lock = true
yield
f.flock(File::LOCK_UN)
end
rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact
# In the case the user does not have access to
# create the lock file or is using NFS where
# locks are not available we skip locking.
yield
ensure
FileUtils.rm_f(lock_file_path) if has_lock
end
end
end
bundler-2.1.4/lib/bundler/shared_helpers.rb 0000644 0000041 0000041 00000026417 13606335352 020737 0 ustar www-data www-data # frozen_string_literal: true
require "pathname"
require "rbconfig"
require_relative "version"
require_relative "constants"
require_relative "rubygems_integration"
require_relative "current_ruby"
module Bundler
module SharedHelpers
def root
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
end
def default_gemfile
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
end
def default_lockfile
gemfile = default_gemfile
case gemfile.basename.to_s
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
else Pathname.new("#{gemfile}.lock")
end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
end
def default_bundle_dir
bundle_dir = find_directory(".bundle")
return nil unless bundle_dir
bundle_dir = Pathname.new(bundle_dir)
global_bundle_dir = Bundler.user_home.join(".bundle")
return nil if bundle_dir == global_bundle_dir
bundle_dir
end
def in_bundle?
find_gemfile
end
def chdir(dir, &blk)
Bundler.rubygems.ext_lock.synchronize do
Dir.chdir dir, &blk
end
end
def pwd
Bundler.rubygems.ext_lock.synchronize do
Pathname.pwd
end
end
def with_clean_git_env(&block)
keys = %w[GIT_DIR GIT_WORK_TREE]
old_env = keys.inject({}) do |h, k|
h.update(k => ENV[k])
end
keys.each {|key| ENV.delete(key) }
block.call
ensure
keys.each {|key| ENV[key] = old_env[key] }
end
def set_bundle_environment
set_bundle_variables
set_path
set_rubyopt
set_rubylib
end
# Rescues permissions errors raised by file system operations
# (ie. Errno:EACCESS, Errno::EAGAIN) and raises more friendly errors instead.
#
# @param path [String] the path that the action will be attempted to
# @param action [Symbol, #to_s] the type of operation that will be
# performed. For example: :write, :read, :exec
#
# @yield path
#
# @raise [Bundler::PermissionError] if Errno:EACCES is raised in the
# given block
# @raise [Bundler::TemporaryResourceError] if Errno:EAGAIN is raised in the
# given block
#
# @example
# filesystem_access("vendor/cache", :write) do
# FileUtils.mkdir_p("vendor/cache")
# end
#
# @see {Bundler::PermissionError}
def filesystem_access(path, action = :write, &block)
yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
rescue Errno::EACCES
raise PermissionError.new(path, action)
rescue Errno::EAGAIN
raise TemporaryResourceError.new(path, action)
rescue Errno::EPROTO
raise VirtualProtocolError.new
rescue Errno::ENOSPC
raise NoSpaceOnDeviceError.new(path, action)
rescue *[const_get_safely(:ENOTSUP, Errno)].compact
raise OperationNotSupportedError.new(path, action)
rescue Errno::EEXIST, Errno::ENOENT
raise
rescue SystemCallError => e
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
end
def const_get_safely(constant_name, namespace)
const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
namespace.constants.include?(constant_name.to_sym)
return nil unless const_in_namespace
namespace.const_get(constant_name)
end
def major_deprecation(major_version, message, print_caller_location: false)
if print_caller_location
caller_location = caller_locations(2, 2).first
message = "#{message} (called at #{caller_location.path}:#{caller_location.lineno})"
end
bundler_major_version = Bundler.bundler_major_version
if bundler_major_version > major_version
require_relative "errors"
raise DeprecatedError, "[REMOVED] #{message}"
end
return unless bundler_major_version >= major_version && prints_major_deprecations?
Bundler.ui.warn("[DEPRECATED] #{message}")
end
def print_major_deprecations!
multiple_gemfiles = search_up(".") do |dir|
gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
next if gemfiles.empty?
break gemfiles.size != 1
end
return unless multiple_gemfiles
message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
Bundler.ui.warn message
end
def trap(signal, override = false, &block)
prior = Signal.trap(signal) do
block.call
prior.call unless override
end
end
def ensure_same_dependencies(spec, old_deps, new_deps)
new_deps = new_deps.reject {|d| d.type == :development }
old_deps = old_deps.reject {|d| d.type == :development }
without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) }
new_deps.map!(&without_type)
old_deps.map!(&without_type)
extra_deps = new_deps - old_deps
return if extra_deps.empty?
Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has either corrupted API or lockfile dependencies" \
" (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
raise APIResponseMismatchError,
"Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \
"\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
end
def pretty_dependency(dep, print_source = false)
msg = String.new(dep.name)
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
if dep.is_a?(Bundler::Dependency)
platform_string = dep.platforms.join(", ")
msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
end
msg << " from the `#{dep.source}` source" if print_source && dep.source
msg
end
def md5_available?
return @md5_available if defined?(@md5_available)
@md5_available = begin
require "openssl"
OpenSSL::Digest::MD5.digest("")
true
rescue LoadError
true
rescue OpenSSL::Digest::DigestError
false
end
end
def digest(name)
require "digest"
Digest(name)
end
def write_to_gemfile(gemfile_path, contents)
filesystem_access(gemfile_path) {|g| File.open(g, "w") {|file| file.puts contents } }
end
private
def validate_bundle_path
path_separator = Bundler.rubygems.path_separator
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
message = "Your bundle path contains text matching #{path_separator.inspect}, " \
"which is the path separator for your system. Bundler cannot " \
"function correctly when the Bundle path contains the " \
"system's PATH separator. Please change your " \
"bundle path to not match #{path_separator.inspect}." \
"\nYour current bundle path is '#{Bundler.bundle_path}'."
raise Bundler::PathError, message
end
def find_gemfile
given = ENV["BUNDLE_GEMFILE"]
return given if given && !given.empty?
find_file(*gemfile_names)
end
def gemfile_names
["gems.rb", "Gemfile"]
end
def find_file(*names)
search_up(*names) do |filename|
return filename if File.file?(filename)
end
end
def find_directory(*names)
search_up(*names) do |dirname|
return dirname if File.directory?(dirname)
end
end
def search_up(*names)
previous = nil
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
until !File.directory?(current) || current == previous
if ENV["BUNDLE_SPEC_RUN"]
# avoid stepping above the tmp directory when testing
gemspec = if ENV["GEM_COMMAND"]
# for Ruby Core
"lib/bundler/bundler.gemspec"
else
"bundler.gemspec"
end
# avoid stepping above the tmp directory when testing
return nil if File.file?(File.join(current, gemspec))
end
names.each do |name|
filename = File.join(current, name)
yield filename
end
previous = current
current = File.expand_path("..", current)
end
end
def set_env(key, value)
raise ArgumentError, "new key #{key}" unless EnvironmentPreserver::BUNDLER_KEYS.include?(key)
orig_key = "#{EnvironmentPreserver::BUNDLER_PREFIX}#{key}"
orig = ENV[key]
orig ||= EnvironmentPreserver::INTENTIONALLY_NIL
ENV[orig_key] ||= orig
ENV[key] = value
end
public :set_env
def set_bundle_variables
# bundler exe & lib folders have same root folder, typical gem installation
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
# for Ruby core repository testing
exe_file = File.expand_path("../../../libexec/bundle", __FILE__) unless File.exist?(exe_file)
# bundler is a default gem, exe path is separate
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
end
def set_path
validate_bundle_path
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
paths.unshift "#{Bundler.bundle_path}/bin"
Bundler::SharedHelpers.set_env "PATH", paths.uniq.join(File::PATH_SEPARATOR)
end
def set_rubyopt
rubyopt = [ENV["RUBYOPT"]].compact
setup_require = "-r#{File.expand_path("setup", __dir__)}"
return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/
rubyopt.unshift setup_require
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
end
def set_rubylib
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
end
def bundler_ruby_lib
resolve_path File.expand_path("../..", __FILE__)
end
def clean_load_path
bundler_lib = bundler_ruby_lib
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
$LOAD_PATH.reject! do |p|
next if resolve_path(p).start_with?(bundler_lib)
loaded_gem_paths.delete(p)
end
$LOAD_PATH.uniq!
end
def resolve_path(path)
expanded = File.expand_path(path)
return expanded unless File.respond_to?(:realpath) && File.exist?(expanded)
File.realpath(expanded)
end
def prints_major_deprecations?
require_relative "../bundler"
return false if Bundler.settings[:silence_deprecations]
require_relative "deprecate"
return false if Bundler::Deprecate.skip
true
end
extend self
end
end
bundler-2.1.4/lib/bundler/source/ 0000755 0000041 0000041 00000000000 13606335352 016710 5 ustar www-data www-data bundler-2.1.4/lib/bundler/source/rubygems.rb 0000644 0000041 0000041 00000042624 13606335352 021102 0 ustar www-data www-data # frozen_string_literal: true
require "rubygems/user_interaction"
module Bundler
class Source
class Rubygems < Source
autoload :Remote, File.expand_path("rubygems/remote", __dir__)
# Use the API when installing less than X gems
API_REQUEST_LIMIT = 500
# Ask for X gems per API request
API_REQUEST_SIZE = 50
attr_reader :remotes, :caches
def initialize(options = {})
@options = options
@remotes = []
@dependency_names = []
@allow_remote = false
@allow_cached = false
@caches = [cache_path, *Bundler.rubygems.gem_cache]
Array(options["remotes"] || []).reverse_each {|r| add_remote(r) }
end
def remote!
@specs = nil
@allow_remote = true
end
def cached!
@specs = nil
@allow_cached = true
end
def hash
@remotes.hash
end
def eql?(other)
other.is_a?(Rubygems) && other.credless_remotes == credless_remotes
end
alias_method :==, :eql?
def include?(o)
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
end
def can_lock?(spec)
return super if Bundler.feature_flag.disable_multisource?
spec.source.is_a?(Rubygems)
end
def options
{ "remotes" => @remotes.map(&:to_s) }
end
def self.from_lock(options)
new(options)
end
def to_lock
out = String.new("GEM\n")
remotes.reverse_each do |remote|
out << " remote: #{suppress_configured_credentials remote}\n"
end
out << " specs:\n"
end
def to_s
if remotes.empty?
"locally installed gems"
else
remote_names = remotes.map(&:to_s).join(", ")
"rubygems repository #{remote_names} or installed locally"
end
end
alias_method :name, :to_s
def specs
@specs ||= begin
# remote_specs usually generates a way larger Index than the other
# sources, and large_idx.use small_idx is way faster than
# small_idx.use large_idx.
idx = @allow_remote ? remote_specs.dup : Index.new
idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
idx.use(installed_specs, :override_dupes)
idx
end
end
def install(spec, opts = {})
force = opts[:force]
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
if ensure_builtin_gems_cached && builtin_gem?(spec)
if !cached_path(spec)
cached_built_in_gem(spec) unless spec.remote
force = true
else
spec.loaded_from = loaded_from(spec)
end
end
if (installed?(spec) || Plugin.installed?(spec.name)) && !force
print_using_message "Using #{version_message(spec)}"
return nil # no post-install message
end
# Download the gem to get the spec, because some specs that are returned
# by rubygems.org are broken and wrong.
if spec.remote
# Check for this spec from other sources
uris = [spec.remote.anonymized_uri]
uris += remotes_for_spec(spec).map(&:anonymized_uri)
uris.uniq!
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
path = fetch_gem(spec)
begin
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
spec.__swap__(s)
rescue StandardError
Bundler.rm_rf(path)
raise
end
end
unless Bundler.settings[:no_install]
message = "Installing #{version_message(spec)}"
message += " with native extensions" if spec.extensions.any?
Bundler.ui.confirm message
path = cached_gem(spec)
if requires_sudo?
install_path = Bundler.tmp(spec.full_name)
bin_path = install_path.join("bin")
else
install_path = rubygems_dir
bin_path = Bundler.system_bindir
end
Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
installed_spec = nil
Bundler.rubygems.preserve_paths do
installed_spec = Bundler::RubyGemsGemInstaller.at(
path,
:install_dir => install_path.to_s,
:bin_dir => bin_path.to_s,
:ignore_dependencies => true,
:wrappers => true,
:env_shebang => true,
:build_args => opts[:build_args],
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
:bundler_extension_cache_path => extension_cache_path(spec)
).install
end
spec.full_gem_path = installed_spec.full_gem_path
# SUDO HAX
if requires_sudo?
Bundler.rubygems.repository_subdirectories.each do |name|
src = File.join(install_path, name, "*")
dst = File.join(rubygems_dir, name)
if name == "extensions" && Dir.glob(src).any?
src = File.join(src, "*/*")
ext_src = Dir.glob(src).first
ext_src.gsub!(src[0..-6], "")
dst = File.dirname(File.join(dst, ext_src))
end
SharedHelpers.filesystem_access(dst) do |p|
Bundler.mkdir_p(p)
end
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
end
spec.executables.each do |exe|
SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
Bundler.mkdir_p(p)
end
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
end
end
installed_spec.loaded_from = loaded_from(spec)
end
spec.loaded_from = loaded_from(spec)
spec.post_install_message
ensure
Bundler.rm_rf(install_path) if requires_sudo?
end
def cache(spec, custom_path = nil)
if builtin_gem?(spec)
cached_path = cached_built_in_gem(spec)
else
cached_path = cached_gem(spec)
end
raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
return if File.dirname(cached_path) == Bundler.app_cache.to_s
Bundler.ui.info " * #{File.basename(cached_path)}"
FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
rescue Errno::EACCES => e
Bundler.ui.debug(e)
raise InstallError, e.message
end
def cached_built_in_gem(spec)
cached_path = cached_path(spec)
if cached_path.nil?
remote_spec = remote_specs.search(spec).first
if remote_spec
cached_path = fetch_gem(remote_spec)
else
Bundler.ui.warn "#{spec.full_name} is built in to Ruby, and can't be cached because your Gemfile doesn't have any sources that contain it."
end
end
cached_path
end
def add_remote(source)
uri = normalize_uri(source)
@remotes.unshift(uri) unless @remotes.include?(uri)
end
def equivalent_remotes?(other_remotes)
other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth))
end
def replace_remotes(other_remotes, allow_equivalent = false)
return false if other_remotes == @remotes
equivalent = allow_equivalent && equivalent_remotes?(other_remotes)
@remotes = []
other_remotes.reverse_each do |r|
add_remote r.to_s
end
!equivalent
end
def unmet_deps
if @allow_remote && api_fetchers.any?
remote_specs.unmet_dependency_names
else
[]
end
end
def fetchers
@fetchers ||= remotes.map do |uri|
remote = Source::Rubygems::Remote.new(uri)
Bundler::Fetcher.new(remote)
end
end
def double_check_for(unmet_dependency_names)
return unless @allow_remote
return unless api_fetchers.any?
unmet_dependency_names = unmet_dependency_names.call
unless unmet_dependency_names.nil?
if api_fetchers.size <= 1
# can't do this when there are multiple fetchers because then we might not fetch from _all_
# of them
unmet_dependency_names -= remote_specs.spec_names # avoid re-fetching things we've already gotten
end
return if unmet_dependency_names.empty?
end
Bundler.ui.debug "Double checking for #{unmet_dependency_names || "all specs (due to the size of the request)"} in #{self}"
fetch_names(api_fetchers, unmet_dependency_names, specs, false)
end
def dependency_names_to_double_check
names = []
remote_specs.each do |spec|
case spec
when EndpointSpecification, Gem::Specification, StubSpecification, LazySpecification
names.concat(spec.runtime_dependencies)
when RemoteSpecification # from the full index
return nil
else
raise "unhandled spec type (#{spec.inspect})"
end
end
names.map!(&:name) if names
names
end
protected
def credless_remotes
remotes.map(&method(:suppress_configured_credentials))
end
def remotes_for_spec(spec)
specs.search_all(spec.name).inject([]) do |uris, s|
uris << s.remote if s.remote
uris
end
end
def loaded_from(spec)
"#{rubygems_dir}/specifications/#{spec.full_name}.gemspec"
end
def cached_gem(spec)
cached_gem = cached_path(spec)
unless cached_gem
raise Bundler::GemNotFound, "Could not find #{spec.file_name} for installation"
end
cached_gem
end
def cached_path(spec)
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
possibilities.find {|p| File.exist?(p) }
end
def normalize_uri(uri)
uri = uri.to_s
uri = "#{uri}/" unless uri =~ %r{/$}
require_relative "../vendored_uri"
uri = Bundler::URI(uri)
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Bundler::URI::HTTP) && uri.host.nil?)
uri
end
def suppress_configured_credentials(remote)
remote_nouser = remove_auth(remote)
if remote.userinfo && remote.userinfo == Bundler.settings[remote_nouser]
remote_nouser
else
remote
end
end
def remove_auth(remote)
if remote.user || remote.password
remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s
else
remote.to_s
end
end
def installed_specs
@installed_specs ||= Index.build do |idx|
Bundler.rubygems.all_specs.reverse_each do |spec|
next if spec.name == "bundler"
spec.source = self
if Bundler.rubygems.spec_missing_extensions?(spec, false)
Bundler.ui.debug "Source #{self} is ignoring #{spec} because it is missing extensions"
next
end
idx << spec
end
end
end
def cached_specs
@cached_specs ||= begin
idx = installed_specs.dup
Dir["#{cache_path}/*.gem"].each do |gemfile|
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
s ||= Bundler.rubygems.spec_from_gem(gemfile)
s.source = self
if Bundler.rubygems.spec_missing_extensions?(s, false)
Bundler.ui.debug "Source #{self} is ignoring #{s} because it is missing extensions"
next
end
idx << s
end
idx
end
end
def api_fetchers
fetchers.select {|f| f.use_api && f.fetchers.first.api_fetcher? }
end
def remote_specs
@remote_specs ||= Index.build do |idx|
index_fetchers = fetchers - api_fetchers
# gather lists from non-api sites
fetch_names(index_fetchers, nil, idx, false)
# because ensuring we have all the gems we need involves downloading
# the gemspecs of those gems, if the non-api sites contain more than
# about 500 gems, we treat all sites as non-api for speed.
allow_api = idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT
Bundler.ui.debug "Need to query more than #{API_REQUEST_LIMIT} gems." \
" Downloading full index instead..." unless allow_api
fetch_names(api_fetchers, allow_api && dependency_names, idx, false)
end
end
def fetch_names(fetchers, dependency_names, index, override_dupes)
fetchers.each do |f|
if dependency_names
Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
index.use f.specs_with_retry(dependency_names, self), override_dupes
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
else
Bundler.ui.info "Fetching source index from #{f.uri}"
index.use f.specs_with_retry(nil, self), override_dupes
end
end
end
def fetch_gem(spec)
return false unless spec.remote
spec.fetch_platform
download_path = requires_sudo? ? Bundler.tmp(spec.full_name) : rubygems_dir
gem_path = "#{rubygems_dir}/cache/#{spec.full_name}.gem"
SharedHelpers.filesystem_access("#{download_path}/cache") do |p|
FileUtils.mkdir_p(p)
end
download_gem(spec, download_path)
if requires_sudo?
SharedHelpers.filesystem_access("#{rubygems_dir}/cache") do |p|
Bundler.mkdir_p(p)
end
Bundler.sudo "mv #{download_path}/cache/#{spec.full_name}.gem #{gem_path}"
end
gem_path
ensure
Bundler.rm_rf(download_path) if requires_sudo?
end
def builtin_gem?(spec)
# Ruby 2.1, where all included gems have this summary
return true if spec.summary =~ /is bundled with Ruby/
# Ruby 2.0, where gemspecs are stored in specifications/default/
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
end
def installed?(spec)
installed_specs[spec].any?
end
def requires_sudo?
Bundler.requires_sudo?
end
def rubygems_dir
Bundler.rubygems.gem_dir
end
def cache_path
Bundler.app_cache
end
private
# Checks if the requested spec exists in the global cache. If it does,
# we copy it to the download path, and if it does not, we download it.
#
# @param [Specification] spec
# the spec we want to download or retrieve from the cache.
#
# @param [String] download_path
# the local directory the .gem will end up in.
#
def download_gem(spec, download_path)
local_path = File.join(download_path, "cache/#{spec.full_name}.gem")
if (cache_path = download_cache_path(spec)) && cache_path.file?
SharedHelpers.filesystem_access(local_path) do
FileUtils.cp(cache_path, local_path)
end
else
uri = spec.remote.uri
Bundler.ui.confirm("Fetching #{version_message(spec)}")
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
if rubygems_local_path != local_path
FileUtils.mv(rubygems_local_path, local_path)
end
cache_globally(spec, local_path)
end
end
# Checks if the requested spec exists in the global cache. If it does
# not, we create the relevant global cache subdirectory if it does not
# exist and copy the spec from the local cache to the global cache.
#
# @param [Specification] spec
# the spec we want to copy to the global cache.
#
# @param [String] local_cache_path
# the local directory from which we want to copy the .gem.
#
def cache_globally(spec, local_cache_path)
return unless cache_path = download_cache_path(spec)
return if cache_path.exist?
SharedHelpers.filesystem_access(cache_path.dirname, &:mkpath)
SharedHelpers.filesystem_access(cache_path) do
FileUtils.cp(local_cache_path, cache_path)
end
end
# Returns the global cache path of the calling Rubygems::Source object.
#
# Note that the Source determines the path's subdirectory. We use this
# subdirectory in the global cache path so that gems with the same name
# -- and possibly different versions -- from different sources are saved
# to their respective subdirectories and do not override one another.
#
# @param [Gem::Specification] specification
#
# @return [Pathname] The global cache path.
#
def download_cache_path(spec)
return unless Bundler.feature_flag.global_gem_cache?
return unless remote = spec.remote
return unless cache_slug = remote.cache_slug
Bundler.user_cache.join("gems", cache_slug, spec.file_name)
end
def extension_cache_slug(spec)
return unless remote = spec.remote
remote.cache_slug
end
end
end
end
bundler-2.1.4/lib/bundler/source/rubygems/ 0000755 0000041 0000041 00000000000 13606335352 020545 5 ustar www-data www-data bundler-2.1.4/lib/bundler/source/rubygems/remote.rb 0000644 0000041 0000041 00000003445 13606335352 022373 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Source
class Rubygems
class Remote
attr_reader :uri, :anonymized_uri, :original_uri
def initialize(uri)
orig_uri = uri
uri = Bundler.settings.mirror_for(uri)
@original_uri = orig_uri if orig_uri != uri
fallback_auth = Bundler.settings.credentials_for(uri)
@uri = apply_auth(uri, fallback_auth).freeze
@anonymized_uri = remove_auth(@uri).freeze
end
# @return [String] A slug suitable for use as a cache key for this
# remote.
#
def cache_slug
@cache_slug ||= begin
return nil unless SharedHelpers.md5_available?
cache_uri = original_uri || uri
host = cache_uri.to_s.start_with?("file://") ? nil : cache_uri.host
uri_parts = [host, cache_uri.user, cache_uri.port, cache_uri.path]
uri_digest = SharedHelpers.digest(:MD5).hexdigest(uri_parts.compact.join("."))
uri_parts[-1] = uri_digest
uri_parts.compact.join(".")
end
end
def to_s
"rubygems remote at #{anonymized_uri}"
end
private
def apply_auth(uri, auth)
if auth && uri.userinfo.nil?
uri = uri.dup
uri.userinfo = auth
end
uri
rescue Bundler::URI::InvalidComponentError
error_message = "Please CGI escape your usernames and passwords before " \
"setting them for authentication."
raise HTTPError.new(error_message)
end
def remove_auth(uri)
if uri.userinfo
uri = uri.dup
uri.user = uri.password = nil
end
uri
end
end
end
end
end
bundler-2.1.4/lib/bundler/source/metadata.rb 0000644 0000041 0000041 00000003334 13606335352 021020 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Source
class Metadata < Source
def specs
@specs ||= Index.build do |idx|
idx << Gem::Specification.new("Ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
s.required_rubygems_version = Gem::Requirement.default
end
idx << Gem::Specification.new do |s|
s.name = "bundler"
s.version = VERSION
s.license = "MIT"
s.platform = Gem::Platform::RUBY
s.source = self
s.authors = ["bundler team"]
s.bindir = "exe"
s.homepage = "https://bundler.io"
s.summary = "The best way to manage your application's dependencies"
s.executables = %w[bundle]
# can't point to the actual gemspec or else the require paths will be wrong
s.loaded_from = File.expand_path("..", __FILE__)
end
if local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION }
idx << local_spec
end
idx.each {|s| s.source = self }
end
end
def cached!; end
def remote!; end
def options
{}
end
def install(spec, _opts = {})
print_using_message "Using #{version_message(spec)}"
nil
end
def to_s
"the local ruby installation"
end
def ==(other)
self.class == other.class
end
alias_method :eql?, :==
def hash
self.class.hash
end
def version_message(spec)
"#{spec.name} #{spec.version}"
end
end
end
end
bundler-2.1.4/lib/bundler/source/git/ 0000755 0000041 0000041 00000000000 13606335352 017473 5 ustar www-data www-data bundler-2.1.4/lib/bundler/source/git/git_proxy.rb 0000644 0000041 0000041 00000022012 13606335352 022041 0 ustar www-data www-data # frozen_string_literal: true
require "shellwords"
module Bundler
class Source
class Git
class GitNotInstalledError < GitError
def initialize
msg = String.new
msg << "You need to install git to be able to use gems from git repositories. "
msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git"
super msg
end
end
class GitNotAllowedError < GitError
def initialize(command)
msg = String.new
msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, "
msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/bundler/bundler/issues "
msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
super msg
end
end
class GitCommandError < GitError
attr_reader :command
def initialize(command, path = nil, extra_info = nil)
@command = command
msg = String.new
msg << "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed."
msg << "\n#{extra_info}" if extra_info
msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist?
super msg
end
end
class MissingGitRevisionError < GitCommandError
def initialize(command, path, ref, repo)
msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
super command, path, msg
end
end
# The GitProxy is responsible to interact with git repositories.
# All actions required by the Git source is encapsulated in this
# object.
class GitProxy
attr_accessor :path, :uri, :ref
attr_writer :revision
def initialize(path, uri, ref, revision = nil, git = nil)
@path = path
@uri = uri
@ref = ref
@revision = revision
@git = git
raise GitNotInstalledError.new if allow? && !Bundler.git_present?
end
def revision
return @revision if @revision
begin
@revision ||= find_local_revision
rescue GitCommandError => e
raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
end
@revision
end
def branch
@branch ||= allowed_in_path do
git("rev-parse --abbrev-ref HEAD").strip
end
end
def contains?(commit)
allowed_in_path do
result, status = git_null("branch --contains #{commit}")
status.success? && result =~ /^\* (.*)$/
end
end
def version
git("--version").match(/(git version\s*)?((\.?\d+)+).*/)[2]
end
def full_version
git("--version").sub("git version", "").strip
end
def checkout
return if path.exist? && has_revision_cached?
extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
unless path.exist?
SharedHelpers.filesystem_access(path.dirname) do |p|
FileUtils.mkdir_p(p)
end
git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
return unless extra_ref
end
in_path do
git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref})
end
end
def copy_to(destination, submodules = false)
# method 1
unless File.exist?(destination.join(".git"))
begin
SharedHelpers.filesystem_access(destination.dirname) do |p|
FileUtils.mkdir_p(p)
end
SharedHelpers.filesystem_access(destination) do |p|
FileUtils.rm_rf(p)
end
git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
rescue Errno::EEXIST => e
file_path = e.message[%r{.*?(/.*)}, 1]
raise GitError, "Bundler could not install a gem because it needs to " \
"create a directory, but a file exists - #{file_path}. Please delete " \
"this file and try again."
end
end
# method 2
SharedHelpers.chdir(destination) do
git_retry %(fetch --force --quiet --tags "#{path}")
begin
git "reset --hard #{@revision}"
rescue GitCommandError => e
raise MissingGitRevisionError.new(e.command, path, @revision, URICredentialsFilter.credential_filtered_uri(uri))
end
if submodules
git_retry "submodule update --init --recursive"
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
git_retry "submodule deinit --all --force"
end
end
end
private
def git_null(command)
command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
out, status = SharedHelpers.with_clean_git_env do
capture_and_ignore_stderr("git #{command}")
end
[URICredentialsFilter.credential_filtered_string(out, uri), status]
end
def git_retry(command)
Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
git(command)
end
end
def git(command, check_errors = true, error_msg = nil)
command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
out, status = SharedHelpers.with_clean_git_env do
capture_and_filter_stderr(uri, "git #{command}")
end
stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !status.success?
stdout_with_no_credentials
end
def has_revision_cached?
return unless @revision
in_path { git("cat-file -e #{@revision}") }
true
rescue GitError
false
end
def remove_cache
FileUtils.rm_rf(path)
end
def find_local_revision
allowed_in_path do
git("rev-parse --verify #{Shellwords.shellescape(ref)}", true).strip
end
end
# Escape the URI for git commands
def uri_escaped_with_configured_credentials
remote = configured_uri_for(uri)
if Bundler::WINDOWS
# Windows quoting requires double quotes only, with double quotes
# inside the string escaped by being doubled.
'"' + remote.gsub('"') { '""' } + '"'
else
# Bash requires single quoted strings, with the single quotes escaped
# by ending the string, escaping the quote, and restarting the string.
"'" + remote.gsub("'") { "'\\''" } + "'"
end
end
# Adds credentials to the URI as Fetcher#configured_uri_for does
def configured_uri_for(uri)
if /https?:/ =~ uri
remote = Bundler::URI(uri)
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
remote.userinfo ||= config_auth
remote.to_s
else
uri
end
end
def allow?
@git ? @git.allow_git_ops? : true
end
def in_path(&blk)
checkout unless path.exist?
_ = URICredentialsFilter # load it before we chdir
SharedHelpers.chdir(path, &blk)
end
def allowed_in_path
return in_path { yield } if allow?
raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
end
def capture_and_filter_stderr(uri, cmd)
require "open3"
return_value, captured_err, status = Open3.capture3(cmd)
Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
[return_value, status]
end
def capture_and_ignore_stderr(cmd)
require "open3"
return_value, _, status = Open3.capture3(cmd)
[return_value, status]
end
end
end
end
end
bundler-2.1.4/lib/bundler/source/gemspec.rb 0000644 0000041 0000041 00000000436 13606335352 020663 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Source
class Gemspec < Path
attr_reader :gemspec
def initialize(options)
super
@gemspec = options["gemspec"]
end
def as_path_source
Path.new(options)
end
end
end
end
bundler-2.1.4/lib/bundler/source/path/ 0000755 0000041 0000041 00000000000 13606335352 017644 5 ustar www-data www-data bundler-2.1.4/lib/bundler/source/path/installer.rb 0000644 0000041 0000041 00000004245 13606335352 022173 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Source
class Path
class Installer < Bundler::RubyGemsGemInstaller
attr_reader :spec
def initialize(spec, options = {})
@options = options
@spec = spec
@gem_dir = Bundler.rubygems.path(spec.full_gem_path)
@wrappers = true
@env_shebang = true
@format_executable = options[:format_executable] || false
@build_args = options[:build_args] || Bundler.rubygems.build_args
@gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin"
@disable_extensions = options[:disable_extensions]
if Bundler.requires_sudo?
@tmp_dir = Bundler.tmp(spec.full_name).to_s
@bin_dir = "#{@tmp_dir}/bin"
else
@bin_dir = @gem_bin_dir
end
end
def post_install
SharedHelpers.chdir(@gem_dir) do
run_hooks(:pre_install)
unless @disable_extensions
build_extensions
run_hooks(:post_build)
end
generate_bin unless spec.executables.nil? || spec.executables.empty?
run_hooks(:post_install)
end
ensure
Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
end
private
def generate_bin
super
if Bundler.requires_sudo?
SharedHelpers.filesystem_access(@gem_bin_dir) do |p|
Bundler.mkdir_p(p)
end
spec.executables.each do |exe|
Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}"
end
end
end
def run_hooks(type)
hooks_meth = "#{type}_hooks"
return unless Gem.respond_to?(hooks_meth)
Gem.send(hooks_meth).each do |hook|
result = hook.call(self)
next unless result == false
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
message = "#{type} hook#{location} failed for #{spec.full_name}"
raise InstallHookError, message
end
end
end
end
end
end
bundler-2.1.4/lib/bundler/source/git.rb 0000644 0000041 0000041 00000024045 13606335352 020025 0 ustar www-data www-data # frozen_string_literal: true
require_relative "../vendored_fileutils"
module Bundler
class Source
class Git < Path
autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)
attr_reader :uri, :ref, :branch, :options, :glob, :submodules
def initialize(options)
@options = options
@glob = options["glob"] || DEFAULT_GLOB
@allow_cached = false
@allow_remote = false
# Stringify options that could be set as symbols
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
@uri = options["uri"] || ""
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
@branch = options["branch"]
@ref = options["ref"] || options["branch"] || options["tag"] || "master"
@submodules = options["submodules"]
@name = options["name"]
@version = options["version"].to_s.strip.gsub("-", ".pre.")
@copied = false
@local = false
end
def self.from_lock(options)
new(options.merge("uri" => options.delete("remote")))
end
def to_lock
out = String.new("GIT\n")
out << " remote: #{@uri}\n"
out << " revision: #{revision}\n"
%w[ref branch tag submodules].each do |opt|
out << " #{opt}: #{options[opt]}\n" if options[opt]
end
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
out << " specs:\n"
end
def hash
[self.class, uri, ref, branch, name, version, glob, submodules].hash
end
def eql?(other)
other.is_a?(Git) && uri == other.uri && ref == other.ref &&
branch == other.branch && name == other.name &&
version == other.version && glob == other.glob &&
submodules == other.submodules
end
alias_method :==, :eql?
def to_s
at = if local?
path
elsif user_ref = options["ref"]
if ref =~ /\A[a-z0-9]{4,}\z/i
shortref_for_display(user_ref)
else
user_ref
end
else
ref
end
rev = begin
"@#{shortref_for_display(revision)}"
rescue GitError
nil
end
"#{@safe_uri} (at #{at}#{rev})"
end
def name
File.basename(@uri, ".git")
end
# This is the path which is going to contain a specific
# checkout of the git repository. When using local git
# repos, this is set to the local repo.
def install_path
@install_path ||= begin
git_scope = "#{base_name}-#{shortref_for_path(revision)}"
path = Bundler.install_path.join(git_scope)
if !path.exist? && Bundler.requires_sudo?
Bundler.user_bundle_path.join(Bundler.ruby_scope).join(git_scope)
else
path
end
end
end
alias_method :path, :install_path
def extension_dir_name
"#{base_name}-#{shortref_for_path(revision)}"
end
def unlock!
git_proxy.revision = nil
options["revision"] = nil
@unlocked = true
end
def local_override!(path)
return false if local?
original_path = path
path = Pathname.new(path)
path = path.expand_path(Bundler.root) unless path.relative?
unless options["branch"] || Bundler.settings[:disable_local_branch_check]
raise GitError, "Cannot use local override for #{name} at #{path} because " \
":branch is not specified in Gemfile. Specify a branch or run " \
"`bundle config unset local.#{override_for(original_path)}` to remove the local override"
end
unless path.exist?
raise GitError, "Cannot use local override for #{name} because #{path} " \
"does not exist. Run `bundle config unset local.#{override_for(original_path)}` to remove the local override"
end
set_local!(path)
# Create a new git proxy without the cached revision
# so the Gemfile.lock always picks up the new revision.
@git_proxy = GitProxy.new(path, uri, ref)
if git_proxy.branch != options["branch"] && !Bundler.settings[:disable_local_branch_check]
raise GitError, "Local override for #{name} at #{path} is using branch " \
"#{git_proxy.branch} but Gemfile specifies #{options["branch"]}"
end
changed = cached_revision && cached_revision != git_proxy.revision
if changed && !@unlocked && !git_proxy.contains?(cached_revision)
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(cached_revision)} " \
"but the current branch in your local override for #{name} does not contain such commit. " \
"Please make sure your branch is up to date."
end
changed
end
def specs(*)
set_local!(app_cache_path) if has_app_cache? && !local?
if requires_checkout? && !@copied
fetch
git_proxy.copy_to(install_path, submodules)
serialize_gemspecs_in(install_path)
@copied = true
end
local_specs
end
def install(spec, options = {})
force = options[:force]
print_using_message "Using #{version_message(spec)} from #{self}"
if (requires_checkout? && !@copied) || force
Bundler.ui.debug " * Checking out revision: #{ref}"
git_proxy.copy_to(install_path, submodules)
serialize_gemspecs_in(install_path)
@copied = true
end
generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] }
generate_bin(spec, generate_bin_options)
requires_checkout? ? spec.post_install_message : nil
end
def cache(spec, custom_path = nil)
app_cache_path = app_cache_path(custom_path)
return unless Bundler.feature_flag.cache_all?
return if path == app_cache_path
cached!
FileUtils.rm_rf(app_cache_path)
git_proxy.checkout if requires_checkout?
git_proxy.copy_to(app_cache_path, @submodules)
serialize_gemspecs_in(app_cache_path)
end
def load_spec_files
super
rescue PathError => e
Bundler.ui.trace e
raise GitError, "#{self} is not yet checked out. Run `bundle install` first."
end
# This is the path which is going to contain a cache
# of the git repository. When using the same git repository
# across different projects, this cache will be shared.
# When using local git repos, this is set to the local repo.
def cache_path
@cache_path ||= begin
if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
Bundler.user_cache
else
Bundler.bundle_path.join("cache", "bundler")
end.join("git", git_scope)
end
end
def app_cache_dirname
"#{base_name}-#{shortref_for_path(cached_revision || revision)}"
end
def revision
git_proxy.revision
end
def allow_git_ops?
@allow_remote || @allow_cached
end
private
def serialize_gemspecs_in(destination)
destination = destination.expand_path(Bundler.root) if destination.relative?
Dir["#{destination}/#{@glob}"].each do |spec_path|
# Evaluate gemspecs and cache the result. Gemspecs
# in git might require git or other dependencies.
# The gemspecs we cache should already be evaluated.
spec = Bundler.load_gemspec(spec_path)
next unless spec
Bundler.rubygems.set_installed_by_version(spec)
Bundler.rubygems.validate(spec)
File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
end
end
def set_local!(path)
@local = true
@local_specs = @git_proxy = nil
@cache_path = @install_path = path
end
def has_app_cache?
cached_revision && super
end
def local?
@local
end
def requires_checkout?
allow_git_ops? && !local? && !cached_revision_checked_out?
end
def cached_revision_checked_out?
cached_revision && cached_revision == revision && install_path.exist?
end
def base_name
File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)?(//\w*/)?(\w*/)*}, ""), ".git")
end
def shortref_for_display(ref)
ref[0..6]
end
def shortref_for_path(ref)
ref[0..11]
end
def uri_hash
if uri =~ %r{^\w+://(\w+@)?}
# Downcase the domain component of the URI
# and strip off a trailing slash, if one is present
input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
else
# If there is no URI scheme, assume it is an ssh/git URI
input = uri
end
SharedHelpers.digest(:SHA1).hexdigest(input)
end
def cached_revision
options["revision"]
end
def cached?
cache_path.exist?
end
def git_proxy
@git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision, self)
end
def fetch
git_proxy.checkout
rescue GitError => e
raise unless Bundler.feature_flag.allow_offline_install?
Bundler.ui.warn "Using cached git data because of network errors:\n#{e}"
end
# no-op, since we validate when re-serializing the gemspec
def validate_spec(_spec); end
def load_gemspec(file)
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
StubSpecification.from_stub(stub)
end
def git_scope
"#{base_name}-#{uri_hash}"
end
def extension_cache_slug(_)
extension_dir_name
end
def override_for(path)
Bundler.settings.local_overrides.key(path)
end
end
end
end
bundler-2.1.4/lib/bundler/source/path.rb 0000644 0000041 0000041 00000016634 13606335352 020203 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Source
class Path < Source
autoload :Installer, File.expand_path("path/installer", __dir__)
attr_reader :path, :options, :root_path, :original_path
attr_writer :name
attr_accessor :version
protected :original_path
DEFAULT_GLOB = "{,*,*/*}.gemspec".freeze
def initialize(options)
@options = options.dup
@glob = options["glob"] || DEFAULT_GLOB
@allow_cached = false
@allow_remote = false
@root_path = options["root_path"] || root
if options["path"]
@path = Pathname.new(options["path"])
expanded_path = expand(@path)
@path = if @path.relative?
expanded_path.relative_path_from(root_path.expand_path)
else
expanded_path
end
end
@name = options["name"]
@version = options["version"]
# Stores the original path. If at any point we move to the
# cached directory, we still have the original path to copy from.
@original_path = @path
end
def remote!
@local_specs = nil
@allow_remote = true
end
def cached!
@local_specs = nil
@allow_cached = true
end
def self.from_lock(options)
new(options.merge("path" => options.delete("remote")))
end
def to_lock
out = String.new("PATH\n")
out << " remote: #{lockfile_path}\n"
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
out << " specs:\n"
end
def to_s
"source at `#{@path}`"
end
def hash
[self.class, expanded_path, version].hash
end
def eql?(other)
return unless other.class == self.class
expanded_original_path == other.expanded_original_path &&
version == other.version
end
alias_method :==, :eql?
def name
File.basename(expanded_path.to_s)
end
def install(spec, options = {})
print_using_message "Using #{version_message(spec)} from #{self}"
generate_bin(spec, :disable_extensions => true)
nil # no post-install message
end
def cache(spec, custom_path = nil)
app_cache_path = app_cache_path(custom_path)
return unless Bundler.feature_flag.cache_all?
return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0
unless @original_path.exist?
raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{self} is missing!"
end
FileUtils.rm_rf(app_cache_path)
FileUtils.cp_r("#{@original_path}/.", app_cache_path)
FileUtils.touch(app_cache_path.join(".bundlecache"))
end
def local_specs(*)
@local_specs ||= load_spec_files
end
def specs
if has_app_cache?
@path = app_cache_path
@expanded_path = nil # Invalidate
end
local_specs
end
def app_cache_dirname
name
end
def root
Bundler.root
end
def expanded_original_path
@expanded_original_path ||= expand(original_path)
end
private
def expanded_path
@expanded_path ||= expand(path)
end
def expand(somepath)
somepath.expand_path(root_path)
rescue ArgumentError => e
Bundler.ui.debug(e)
raise PathError, "There was an error while trying to use the path " \
"`#{somepath}`.\nThe error message was: #{e.message}."
end
def lockfile_path
return relative_path(original_path) if original_path.absolute?
expand(original_path).relative_path_from(root)
end
def app_cache_path(custom_path = nil)
@app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname)
end
def has_app_cache?
SharedHelpers.in_bundle? && app_cache_path.exist?
end
def load_gemspec(file)
return unless spec = Bundler.load_gemspec(file)
Bundler.rubygems.set_installed_by_version(spec)
spec
end
def validate_spec(spec)
Bundler.rubygems.validate(spec)
end
def load_spec_files
index = Index.new
if File.directory?(expanded_path)
# We sort depth-first since `<<` will override the earlier-found specs
Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
next unless spec = load_gemspec(file)
spec.source = self
# Validation causes extension_dir to be calculated, which depends
# on #source, so we validate here instead of load_gemspec
validate_spec(spec)
index << spec
end
if index.empty? && @name && @version
index << Gem::Specification.new do |s|
s.name = @name
s.source = self
s.version = Gem::Version.new(@version)
s.platform = Gem::Platform::RUBY
s.summary = "Fake gemspec for #{@name}"
s.relative_loaded_from = "#{@name}.gemspec"
s.authors = ["no one"]
if expanded_path.join("bin").exist?
executables = expanded_path.join("bin").children
executables.reject! {|p| File.directory?(p) }
s.executables = executables.map {|c| c.basename.to_s }
end
end
end
else
message = String.new("The path `#{expanded_path}` ")
message << if File.exist?(expanded_path)
"is not a directory."
else
"does not exist."
end
raise PathError, message
end
index
end
def relative_path(path = self.path)
if path.to_s.start_with?(root_path.to_s)
return path.relative_path_from(root_path)
end
path
end
def generate_bin(spec, options = {})
gem_dir = Pathname.new(spec.full_gem_path)
# Some gem authors put absolute paths in their gemspec
# and we have to save them from themselves
spec.files = spec.files.map do |p|
next p unless p =~ /\A#{Pathname::SEPARATOR_PAT}/
next if File.directory?(p)
begin
Pathname.new(p).relative_path_from(gem_dir).to_s
rescue ArgumentError
p
end
end.compact
installer = Path::Installer.new(
spec,
:env_shebang => false,
:disable_extensions => options[:disable_extensions],
:build_args => options[:build_args],
:bundler_extension_cache_path => extension_cache_path(spec)
)
installer.post_install
rescue Gem::InvalidSpecificationException => e
Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" \
"This prevents bundler from installing bins or native extensions, but " \
"that may not affect its functionality."
if !spec.extensions.empty? && !spec.email.empty?
Bundler.ui.warn "If you need to use this package without installing it from a gem " \
"repository, please contact #{spec.email} and ask them " \
"to modify their .gemspec so it can work with `gem build`."
end
Bundler.ui.warn "The validation message from RubyGems was:\n #{e.message}"
end
end
end
end
bundler-2.1.4/lib/bundler/similarity_detector.rb 0000644 0000041 0000041 00000003532 13606335352 022017 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class SimilarityDetector
SimilarityScore = Struct.new(:string, :distance)
# initialize with an array of words to be matched against
def initialize(corpus)
@corpus = corpus
end
# return an array of words similar to 'word' from the corpus
def similar_words(word, limit = 3)
words_by_similarity = @corpus.map {|w| SimilarityScore.new(w, levenshtein_distance(word, w)) }
words_by_similarity.select {|s| s.distance <= limit }.sort_by(&:distance).map(&:string)
end
# return the result of 'similar_words', concatenated into a list
# (eg "a, b, or c")
def similar_word_list(word, limit = 3)
words = similar_words(word, limit)
if words.length == 1
words[0]
elsif words.length > 1
[words[0..-2].join(", "), words[-1]].join(" or ")
end
end
protected
# https://www.informit.com/articles/article.aspx?p=683059&seqNum=36
def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
# ins, del, sub are weighted costs
return nil if this.nil?
return nil if that.nil?
dm = [] # distance matrix
# Initialize first row values
dm[0] = (0..this.length).collect {|i| i * ins }
fill = [0] * (this.length - 1)
# Initialize first column values
(1..that.length).each do |i|
dm[i] = [i * del, fill.flatten]
end
# populate matrix
(1..that.length).each do |i|
(1..this.length).each do |j|
# critical comparison
dm[i][j] = [
dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
dm[i][j - 1] + ins,
dm[i - 1][j] + del,
].min
end
end
# The last value in matrix is the Levenshtein distance between the strings
dm[that.length][this.length]
end
end
end
bundler-2.1.4/lib/bundler/version.rb 0000644 0000041 0000041 00000000263 13606335352 017423 0 ustar www-data www-data # frozen_string_literal: false
module Bundler
VERSION = "2.1.4".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
end
end
bundler-2.1.4/lib/bundler/gem_version_promoter.rb 0000644 0000041 0000041 00000015010 13606335352 022176 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
# This class contains all of the logic for determining the next version of a
# Gem to update to based on the requested level (patch, minor, major).
# Primarily designed to work with Resolver which will provide it the list of
# available dependency versions as found in its index, before returning it to
# to the resolution engine to select the best version.
class GemVersionPromoter
DEBUG = ENV["DEBUG_RESOLVER"]
attr_reader :level, :locked_specs, :unlock_gems
# By default, strict is false, meaning every available version of a gem
# is returned from sort_versions. The order gives preference to the
# requested level (:patch, :minor, :major) but in complicated requirement
# cases some gems will by necessity by promoted past the requested level,
# or even reverted to older versions.
#
# If strict is set to true, the results from sort_versions will be
# truncated, eliminating any version outside the current level scope.
# This can lead to unexpected outcomes or even VersionConflict exceptions
# that report a version of a gem not existing for versions that indeed do
# existing in the referenced source.
attr_accessor :strict
attr_accessor :prerelease_specified
# Given a list of locked_specs and a list of gems to unlock creates a
# GemVersionPromoter instance.
#
# @param locked_specs [SpecSet] All current locked specs. Unlike Definition
# where this list is empty if all gems are being updated, this should
# always be populated for all gems so this class can properly function.
# @param unlock_gems [String] List of gem names being unlocked. If empty,
# all gems will be considered unlocked.
# @return [GemVersionPromoter]
def initialize(locked_specs = SpecSet.new([]), unlock_gems = [])
@level = :major
@strict = false
@locked_specs = locked_specs
@unlock_gems = unlock_gems
@sort_versions = {}
@prerelease_specified = {}
end
# @param value [Symbol] One of three Symbols: :major, :minor or :patch.
def level=(value)
v = case value
when String, Symbol
value.to_sym
end
raise ArgumentError, "Unexpected level #{v}. Must be :major, :minor or :patch" unless [:major, :minor, :patch].include?(v)
@level = v
end
# Given a Dependency and an Array of SpecGroups of available versions for a
# gem, this method will return the Array of SpecGroups sorted (and possibly
# truncated if strict is true) in an order to give preference to the current
# level (:major, :minor or :patch) when resolution is deciding what versions
# best resolve all dependencies in the bundle.
# @param dep [Dependency] The Dependency of the gem.
# @param spec_groups [SpecGroup] An array of SpecGroups for the same gem
# named in the @dep param.
# @return [SpecGroup] A new instance of the SpecGroup Array sorted and
# possibly filtered.
def sort_versions(dep, spec_groups)
before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if DEBUG
@sort_versions[dep] ||= begin
gem_name = dep.name
# An Array per version returned, different entries for different platforms.
# We only need the version here so it's ok to hard code this to the first instance.
locked_spec = locked_specs[gem_name].first
if strict
filter_dep_specs(spec_groups, locked_spec)
else
sort_dep_specs(spec_groups, locked_spec)
end.tap do |specs|
if DEBUG
warn before_result
warn " after sort_versions: #{debug_format_result(dep, specs).inspect}"
end
end
end
end
# @return [bool] Convenience method for testing value of level variable.
def major?
level == :major
end
# @return [bool] Convenience method for testing value of level variable.
def minor?
level == :minor
end
private
def filter_dep_specs(spec_groups, locked_spec)
res = spec_groups.select do |spec_group|
if locked_spec && !major?
gsv = spec_group.version
lsv = locked_spec.version
must_match = minor? ? [0] : [0, 1]
matches = must_match.map {|idx| gsv.segments[idx] == lsv.segments[idx] }
matches.uniq == [true] ? (gsv >= lsv) : false
else
true
end
end
sort_dep_specs(res, locked_spec)
end
def sort_dep_specs(spec_groups, locked_spec)
return spec_groups unless locked_spec
@gem_name = locked_spec.name
@locked_version = locked_spec.version
result = spec_groups.sort do |a, b|
@a_ver = a.version
@b_ver = b.version
unless @prerelease_specified[@gem_name]
a_pre = @a_ver.prerelease?
b_pre = @b_ver.prerelease?
next -1 if a_pre && !b_pre
next 1 if b_pre && !a_pre
end
if major?
@a_ver <=> @b_ver
elsif either_version_older_than_locked
@a_ver <=> @b_ver
elsif segments_do_not_match(:major)
@b_ver <=> @a_ver
elsif !minor? && segments_do_not_match(:minor)
@b_ver <=> @a_ver
else
@a_ver <=> @b_ver
end
end
post_sort(result)
end
def either_version_older_than_locked
@a_ver < @locked_version || @b_ver < @locked_version
end
def segments_do_not_match(level)
index = [:major, :minor].index(level)
@a_ver.segments[index] != @b_ver.segments[index]
end
def unlocking_gem?
unlock_gems.empty? || unlock_gems.include?(@gem_name)
end
# Specific version moves can't always reliably be done during sorting
# as not all elements are compared against each other.
def post_sort(result)
# default :major behavior in Bundler does not do this
return result if major?
if unlocking_gem?
result
else
move_version_to_end(result, @locked_version)
end
end
def move_version_to_end(result, version)
move, keep = result.partition {|s| s.version.to_s == version.to_s }
keep.concat(move)
end
def debug_format_result(dep, spec_groups)
a = [dep.to_s,
spec_groups.map {|sg| [sg.version, sg.dependencies_for_activated_platforms.map {|dp| [dp.name, dp.requirement.to_s] }] }]
last_map = a.last.map {|sg_data| [sg_data.first.version, sg_data.last.map {|aa| aa.join(" ") }] }
[a.first, last_map, level, strict ? :strict : :not_strict]
end
end
end
bundler-2.1.4/lib/bundler/worker.rb 0000644 0000041 0000041 00000005133 13606335352 017250 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Worker
POISON = Object.new
class WrappedException < StandardError
attr_reader :exception
def initialize(exn)
@exception = exn
end
end
# @return [String] the name of the worker
attr_reader :name
# Creates a worker pool of specified size
#
# @param size [Integer] Size of pool
# @param name [String] name the name of the worker
# @param func [Proc] job to run in inside the worker pool
def initialize(size, name, func)
@name = name
@request_queue = Queue.new
@response_queue = Queue.new
@func = func
@size = size
@threads = nil
SharedHelpers.trap("INT") { abort_threads }
end
# Enqueue a request to be executed in the worker pool
#
# @param obj [String] mostly it is name of spec that should be downloaded
def enq(obj)
create_threads unless @threads
@request_queue.enq obj
end
# Retrieves results of job function being executed in worker pool
def deq
result = @response_queue.deq
raise result.exception if result.is_a?(WrappedException)
result
end
def stop
stop_threads
end
private
def process_queue(i)
loop do
obj = @request_queue.deq
break if obj.equal? POISON
@response_queue.enq apply_func(obj, i)
end
end
def apply_func(obj, i)
@func.call(obj, i)
rescue Exception => e # rubocop:disable Lint/RescueException
WrappedException.new(e)
end
# Stop the worker threads by sending a poison object down the request queue
# so as worker threads after retrieving it, shut themselves down
def stop_threads
return unless @threads
@threads.each { @request_queue.enq POISON }
@threads.each(&:join)
@threads = nil
end
def abort_threads
return unless @threads
Bundler.ui.debug("\n#{caller.join("\n")}")
@threads.each(&:exit)
exit 1
end
def create_threads
creation_errors = []
@threads = Array.new(@size) do |i|
begin
Thread.start { process_queue(i) }.tap do |thread|
thread.name = "#{name} Worker ##{i}" if thread.respond_to?(:name=)
end
rescue ThreadError => e
creation_errors << e
nil
end
end.compact
return if creation_errors.empty?
message = "Failed to create threads for the #{name} worker: #{creation_errors.map(&:to_s).uniq.join(", ")}"
raise ThreadCreationError, message if @threads.empty?
Bundler.ui.info message
end
end
end
bundler-2.1.4/lib/bundler/gem_helper.rb 0000644 0000041 0000041 00000014347 13606335352 020055 0 ustar www-data www-data # frozen_string_literal: true
require_relative "../bundler"
require "shellwords"
module Bundler
class GemHelper
include Rake::DSL if defined? Rake::DSL
class << self
# set when install'd.
attr_accessor :instance
def install_tasks(opts = {})
new(opts[:dir], opts[:name]).install
end
def gemspec(&block)
gemspec = instance.gemspec
block.call(gemspec) if block
gemspec
end
end
attr_reader :spec_path, :base, :gemspec
def initialize(base = nil, name = nil)
@base = (base ||= SharedHelpers.pwd)
gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
@spec_path = gemspecs.first
@gemspec = Bundler.load_gemspec(@spec_path)
end
def install
built_gem_path = nil
desc "Build #{name}-#{version}.gem into the pkg directory."
task "build" do
built_gem_path = build_gem
end
desc "Build and install #{name}-#{version}.gem into system gems."
task "install" => "build" do
install_gem(built_gem_path)
end
desc "Build and install #{name}-#{version}.gem into system gems without network access."
task "install:local" => "build" do
install_gem(built_gem_path, :local)
end
desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{gem_push_host}\n" \
"To prevent publishing in RubyGems use `gem_push=no rake release`"
task "release", [:remote] => ["build", "release:guard_clean",
"release:source_control_push", "release:rubygem_push"] do
end
task "release:guard_clean" do
guard_clean
end
task "release:source_control_push", [:remote] do |_, args|
tag_version { git_push(args[:remote]) } unless already_tagged?
end
task "release:rubygem_push" do
rubygem_push(built_gem_path) if gem_push?
end
GemHelper.instance = self
end
def build_gem
file_name = nil
sh("#{gem_command} build -V #{spec_path.shellescape}".shellsplit) do
file_name = File.basename(built_gem_path)
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
FileUtils.mv(built_gem_path, "pkg")
Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}."
end
File.join(base, "pkg", file_name)
end
def install_gem(built_gem_path = nil, local = false)
built_gem_path ||= build_gem
cmd = "#{gem_command} install #{built_gem_path}"
cmd += " --local" if local
_, status = sh_with_status(cmd.shellsplit)
unless status.success?
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
end
Bundler.ui.confirm "#{name} (#{version}) installed."
end
protected
def rubygem_push(path)
cmd = %W[#{gem_command} push #{path}]
cmd << "--key" << gem_key if gem_key
cmd << "--host" << allowed_push_host if allowed_push_host
unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
end
sh_with_input(cmd)
Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
end
def built_gem_path
Dir[File.join(base, "#{name}-*.gem")].sort_by {|f| File.mtime(f) }.last
end
def git_push(remote = "")
perform_git_push remote
perform_git_push "#{remote} --tags"
Bundler.ui.confirm "Pushed git commits and tags."
end
def allowed_push_host
@gemspec.metadata["allowed_push_host"] if @gemspec.respond_to?(:metadata)
end
def gem_push_host
env_rubygems_host = ENV["RUBYGEMS_HOST"]
env_rubygems_host = nil if
env_rubygems_host && env_rubygems_host.empty?
allowed_push_host || env_rubygems_host || "rubygems.org"
end
def perform_git_push(options = "")
cmd = "git push #{options}"
out, status = sh_with_status(cmd.shellsplit)
return if status.success?
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
end
def already_tagged?
return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
Bundler.ui.confirm "Tag #{version_tag} has already been created."
true
end
def guard_clean
clean? && committed? || raise("There are files that need to be committed first.")
end
def clean?
sh_with_status(%w[git diff --exit-code])[1].success?
end
def committed?
sh_with_status(%w[git diff-index --quiet --cached HEAD])[1].success?
end
def tag_version
sh %W[git tag -m Version\ #{version} #{version_tag}]
Bundler.ui.confirm "Tagged #{version_tag}."
yield if block_given?
rescue RuntimeError
Bundler.ui.error "Untagging #{version_tag} due to error."
sh_with_status %W[git tag -d #{version_tag}]
raise
end
def version
gemspec.version
end
def version_tag
"v#{version}"
end
def name
gemspec.name
end
def sh_with_input(cmd)
Bundler.ui.debug(cmd)
SharedHelpers.chdir(base) do
abort unless Kernel.system(*cmd)
end
end
def sh(cmd, &block)
out, status = sh_with_status(cmd, &block)
unless status.success?
cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
end
out
end
def sh_with_status(cmd, &block)
Bundler.ui.debug(cmd)
SharedHelpers.chdir(base) do
outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
status = $?
block.call(outbuf) if status.success? && block
[outbuf, status]
end
end
def gem_key
Bundler.settings["gem.push_key"].to_s.downcase if Bundler.settings["gem.push_key"]
end
def gem_push?
!%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase)
end
def gem_command
ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
end
end
end
bundler-2.1.4/lib/bundler/gem_tasks.rb 0000644 0000041 0000041 00000000212 13606335352 017705 0 ustar www-data www-data # frozen_string_literal: true
require "rake/clean"
CLOBBER.include "pkg"
require_relative "gem_helper"
Bundler::GemHelper.install_tasks
bundler-2.1.4/lib/bundler/build_metadata.rb 0000644 0000041 0000041 00000003221 13606335352 020672 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
# Represents metadata from when the Bundler gem was built.
module BuildMetadata
# begin ivars
@built_at = "2020-01-05".freeze
@git_commit_sha = "32a4159325".freeze
@release = true
# end ivars
# A hash representation of the build metadata.
def self.to_h
{
"Built At" => built_at,
"Git SHA" => git_commit_sha,
"Released Version" => release?,
}
end
# A string representing the date the bundler gem was built.
def self.built_at
@built_at ||= Time.now.utc.strftime("%Y-%m-%d").freeze
end
# The SHA for the git commit the bundler gem was built from.
def self.git_commit_sha
return @git_commit_sha if instance_variable_defined? :@git_commit_sha
# If Bundler has been installed without its .git directory and without a
# commit instance variable then we can't determine its commits SHA.
git_dir = File.join(File.expand_path("../../..", __FILE__), ".git")
if File.directory?(git_dir)
return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze }
end
# If Bundler is a submodule in RubyGems, get the submodule commit
git_sub_dir = File.join(File.expand_path("../../../..", __FILE__), ".git")
if File.directory?(git_sub_dir)
return @git_commit_sha = Dir.chdir(git_sub_dir) do
`git ls-tree --abbrev=8 HEAD bundler`.split(/\s/).fetch(2, "").strip.freeze
end
end
@git_commit_sha ||= "unknown"
end
# Whether this is an official release build of Bundler.
def self.release?
@release
end
end
end
bundler-2.1.4/lib/bundler/vendored_persistent.rb 0000644 0000041 0000041 00000003253 13606335352 022026 0 ustar www-data www-data # frozen_string_literal: true
# We forcibly require OpenSSL, because net/http/persistent will only autoload
# it. On some Rubies, autoload fails but explicit require succeeds.
begin
require "openssl"
rescue LoadError
# some Ruby builds don't have OpenSSL
end
module Bundler
module Persistent
module Net
module HTTP
end
end
end
end
require_relative "vendor/net-http-persistent/lib/net/http/persistent"
module Bundler
class PersistentHTTP < Persistent::Net::HTTP::Persistent
def connection_for(uri)
super(uri) do |connection|
result = yield connection
warn_old_tls_version_rubygems_connection(uri, connection)
result
end
end
def warn_old_tls_version_rubygems_connection(uri, connection)
return unless connection.http.use_ssl?
return unless (uri.host || "").end_with?("rubygems.org")
socket = connection.instance_variable_get(:@socket)
return unless socket
socket_io = socket.io
return unless socket_io.respond_to?(:ssl_version)
ssl_version = socket_io.ssl_version
case ssl_version
when /TLSv([\d\.]+)/
version = Gem::Version.new($1)
if version < Gem::Version.new("1.2")
Bundler.ui.warn \
"Warning: Your Ruby version is compiled against a copy of OpenSSL that is very old. " \
"Starting in January 2018, RubyGems.org will refuse connection requests from these " \
"very old versions of OpenSSL. If you will need to continue installing gems after " \
"January 2018, please follow this guide to upgrade: http://ruby.to/tls-outdated.",
:wrap => true
end
end
end
end
end
bundler-2.1.4/lib/bundler/vendored_fileutils.rb 0000644 0000041 0000041 00000000145 13606335352 021623 0 ustar www-data www-data # frozen_string_literal: true
module Bundler; end
require_relative "vendor/fileutils/lib/fileutils"
bundler-2.1.4/lib/bundler/dependency.rb 0000644 0000041 0000041 00000011533 13606335352 020056 0 ustar www-data www-data # frozen_string_literal: true
require "rubygems/dependency"
require_relative "shared_helpers"
require_relative "rubygems_ext"
module Bundler
class Dependency < Gem::Dependency
attr_reader :autorequire
attr_reader :groups, :platforms, :gemfile, :git, :branch
PLATFORM_MAP = {
:ruby => Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY,
:ruby_19 => Gem::Platform::RUBY,
:ruby_20 => Gem::Platform::RUBY,
:ruby_21 => Gem::Platform::RUBY,
:ruby_22 => Gem::Platform::RUBY,
:ruby_23 => Gem::Platform::RUBY,
:ruby_24 => Gem::Platform::RUBY,
:ruby_25 => Gem::Platform::RUBY,
:ruby_26 => Gem::Platform::RUBY,
:mri => Gem::Platform::RUBY,
:mri_18 => Gem::Platform::RUBY,
:mri_19 => Gem::Platform::RUBY,
:mri_20 => Gem::Platform::RUBY,
:mri_21 => Gem::Platform::RUBY,
:mri_22 => Gem::Platform::RUBY,
:mri_23 => Gem::Platform::RUBY,
:mri_24 => Gem::Platform::RUBY,
:mri_25 => Gem::Platform::RUBY,
:mri_26 => Gem::Platform::RUBY,
:rbx => Gem::Platform::RUBY,
:truffleruby => Gem::Platform::RUBY,
:jruby => Gem::Platform::JAVA,
:jruby_18 => Gem::Platform::JAVA,
:jruby_19 => Gem::Platform::JAVA,
:mswin => Gem::Platform::MSWIN,
:mswin_18 => Gem::Platform::MSWIN,
:mswin_19 => Gem::Platform::MSWIN,
:mswin_20 => Gem::Platform::MSWIN,
:mswin_21 => Gem::Platform::MSWIN,
:mswin_22 => Gem::Platform::MSWIN,
:mswin_23 => Gem::Platform::MSWIN,
:mswin_24 => Gem::Platform::MSWIN,
:mswin_25 => Gem::Platform::MSWIN,
:mswin_26 => Gem::Platform::MSWIN,
:mswin64 => Gem::Platform::MSWIN64,
:mswin64_19 => Gem::Platform::MSWIN64,
:mswin64_20 => Gem::Platform::MSWIN64,
:mswin64_21 => Gem::Platform::MSWIN64,
:mswin64_22 => Gem::Platform::MSWIN64,
:mswin64_23 => Gem::Platform::MSWIN64,
:mswin64_24 => Gem::Platform::MSWIN64,
:mswin64_25 => Gem::Platform::MSWIN64,
:mswin64_26 => Gem::Platform::MSWIN64,
:mingw => Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW,
:mingw_20 => Gem::Platform::MINGW,
:mingw_21 => Gem::Platform::MINGW,
:mingw_22 => Gem::Platform::MINGW,
:mingw_23 => Gem::Platform::MINGW,
:mingw_24 => Gem::Platform::MINGW,
:mingw_25 => Gem::Platform::MINGW,
:mingw_26 => Gem::Platform::MINGW,
:x64_mingw => Gem::Platform::X64_MINGW,
:x64_mingw_20 => Gem::Platform::X64_MINGW,
:x64_mingw_21 => Gem::Platform::X64_MINGW,
:x64_mingw_22 => Gem::Platform::X64_MINGW,
:x64_mingw_23 => Gem::Platform::X64_MINGW,
:x64_mingw_24 => Gem::Platform::X64_MINGW,
:x64_mingw_25 => Gem::Platform::X64_MINGW,
:x64_mingw_26 => Gem::Platform::X64_MINGW,
}.freeze
REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
PLATFORM_MAP.each do |key, value|
reverse_platform_map[value] ||= []
reverse_platform_map[value] << key
end
reverse_platform_map.each {|_, platforms| platforms.freeze }
end.freeze
def initialize(name, version, options = {}, &blk)
type = options["type"] || :runtime
super(name, version, type)
@autorequire = nil
@groups = Array(options["group"] || :default).map(&:to_sym)
@source = options["source"]
@git = options["git"]
@branch = options["branch"]
@platforms = Array(options["platforms"])
@env = options["env"]
@should_include = options.fetch("should_include", true)
@gemfile = options["gemfile"]
@autorequire = Array(options["require"] || []) if options.key?("require")
end
# Returns the platforms this dependency is valid for, in the same order as
# passed in the `valid_platforms` parameter
def gem_platforms(valid_platforms)
return valid_platforms if @platforms.empty?
@gem_platforms ||= expanded_platforms.compact.uniq
valid_platforms & @gem_platforms
end
def expanded_platforms
@platforms.map {|pl| PLATFORM_MAP[pl] }
end
def should_include?
@should_include && current_env? && current_platform?
end
def current_env?
return true unless @env
if @env.is_a?(Hash)
@env.all? do |key, val|
ENV[key.to_s] && (val.is_a?(String) ? ENV[key.to_s] == val : ENV[key.to_s] =~ val)
end
else
ENV[@env.to_s]
end
end
def current_platform?
return true if @platforms.empty?
@platforms.any? do |p|
Bundler.current_ruby.send("#{p}?")
end
end
def to_lock
out = super
out << "!" if source
out << "\n"
end
def specific?
super
rescue NoMethodError
requirement != ">= 0"
end
end
end
bundler-2.1.4/lib/bundler/stub_specification.rb 0000644 0000041 0000041 00000004430 13606335352 021613 0 ustar www-data www-data # frozen_string_literal: true
require_relative "remote_specification"
module Bundler
class StubSpecification < RemoteSpecification
def self.from_stub(stub)
return stub if stub.is_a?(Bundler::StubSpecification)
spec = new(stub.name, stub.version, stub.platform, nil)
spec.stub = stub
spec
end
attr_accessor :stub, :ignored
def source=(source)
super
# Stub has no concept of source, which means that extension_dir may be wrong
# This is the case for git-based gems. So, instead manually assign the extension dir
return unless source.respond_to?(:extension_dir_name)
path = File.join(stub.extensions_dir, source.extension_dir_name)
stub.extension_dir = File.expand_path(path)
end
def to_yaml
_remote_specification.to_yaml
end
# @!group Stub Delegates
# This is defined directly to avoid having to load every installed spec
def missing_extensions?
stub.missing_extensions?
end
def activated
stub.activated
end
def activated=(activated)
stub.instance_variable_set(:@activated, activated)
end
def default_gem
stub.default_gem
end
def full_gem_path
# deleted gems can have their stubs return nil, so in that case grab the
# expired path from the full spec
stub.full_gem_path || method_missing(:full_gem_path)
end
def full_require_paths
stub.full_require_paths
end
def load_paths
full_require_paths
end
def loaded_from
stub.loaded_from
end
def matches_for_glob(glob)
stub.matches_for_glob(glob)
end
def raw_require_paths
stub.raw_require_paths
end
private
def _remote_specification
@_remote_specification ||= begin
rs = stub.to_spec
if rs.equal?(self) # happens when to_spec gets the spec from Gem.loaded_specs
rs = Gem::Specification.load(loaded_from)
Bundler.rubygems.stub_set_spec(stub, rs)
end
unless rs
raise GemspecError, "The gemspec for #{full_name} at #{loaded_from}" \
" was missing or broken. Try running `gem pristine #{name} -v #{version}`" \
" to fix the cached spec."
end
rs.source = source
rs
end
end
end
end
bundler-2.1.4/lib/bundler/settings.rb 0000644 0000041 0000041 00000026624 13606335352 017607 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Settings
autoload :Mirror, File.expand_path("mirror", __dir__)
autoload :Mirrors, File.expand_path("mirror", __dir__)
autoload :Validator, File.expand_path("settings/validator", __dir__)
BOOL_KEYS = %w[
allow_bundler_dependency_conflicts
allow_deployment_source_credential_changes
allow_offline_install
auto_clean_without_path
auto_install
auto_config_jobs
cache_all
cache_all_platforms
default_install_uses_path
deployment
deployment_means_frozen
disable_checksum_validation
disable_exec_load
disable_local_branch_check
disable_multisource
disable_platform_warnings
disable_shared_gems
disable_version_check
force_ruby_platform
forget_cli_options
frozen
gem.coc
gem.mit
global_gem_cache
ignore_messages
init_gems_rb
no_install
no_prune
only_update_to_newer_versions
path_relative_to_cwd
path.system
plugins
prefer_patch
print_only_version_number
setup_makes_kernel_gem_public
silence_deprecations
silence_root_warning
skip_default_git_sources
specific_platform
suppress_install_using_messages
unlock_source_unlocks_spec
update_requires_all_flag
use_gem_version_promoter_for_major_updates
].freeze
NUMBER_KEYS = %w[
jobs
redirect
retry
ssl_verify_mode
timeout
].freeze
ARRAY_KEYS = %w[
with
without
].freeze
DEFAULT_CONFIG = {
:silence_deprecations => false,
:disable_version_check => true,
:prefer_patch => false,
:redirect => 5,
:retry => 3,
:timeout => 10,
}.freeze
def initialize(root = nil)
@root = root
@local_config = load_config(local_config_file)
@global_config = load_config(global_config_file)
@temporary = {}
end
def [](name)
key = key_for(name)
value = @temporary.fetch(key) do
@local_config.fetch(key) do
ENV.fetch(key) do
@global_config.fetch(key) do
DEFAULT_CONFIG.fetch(name) do
nil
end end end end end
converted_value(value, name)
end
def set_command_option(key, value)
if Bundler.feature_flag.forget_cli_options?
temporary(key => value)
value
else
set_local(key, value)
end
end
def set_command_option_if_given(key, value)
return if value.nil?
set_command_option(key, value)
end
def set_local(key, value)
local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
set_key(key, value, @local_config, local_config_file)
end
def temporary(update)
existing = Hash[update.map {|k, _| [k, @temporary[key_for(k)]] }]
update.each do |k, v|
set_key(k, v, @temporary, nil)
end
return unless block_given?
begin
yield
ensure
existing.each {|k, v| set_key(k, v, @temporary, nil) }
end
end
def set_global(key, value)
set_key(key, value, @global_config, global_config_file)
end
def all
env_keys = ENV.keys.grep(/\ABUNDLE_.+/)
keys = @temporary.keys | @global_config.keys | @local_config.keys | env_keys
keys.map do |key|
key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase
end
end
def local_overrides
repos = {}
all.each do |k|
repos[$'] = self[k] if k =~ /^local\./
end
repos
end
def mirror_for(uri)
if uri.is_a?(String)
require_relative "vendored_uri"
uri = Bundler::URI(uri)
end
gem_mirrors.for(uri.to_s).uri
end
def credentials_for(uri)
self[uri.to_s] || self[uri.host]
end
def gem_mirrors
all.inject(Mirrors.new) do |mirrors, k|
mirrors.parse(k, self[k]) if k.start_with?("mirror.")
mirrors
end
end
def locations(key)
key = key_for(key)
locations = {}
locations[:temporary] = @temporary[key] if @temporary.key?(key)
locations[:local] = @local_config[key] if @local_config.key?(key)
locations[:env] = ENV[key] if ENV[key]
locations[:global] = @global_config[key] if @global_config.key?(key)
locations[:default] = DEFAULT_CONFIG[key] if DEFAULT_CONFIG.key?(key)
locations
end
def pretty_values_for(exposed_key)
key = key_for(exposed_key)
locations = []
if @temporary.key?(key)
locations << "Set for the current command: #{converted_value(@temporary[key], exposed_key).inspect}"
end
if @local_config.key?(key)
locations << "Set for your local app (#{local_config_file}): #{converted_value(@local_config[key], exposed_key).inspect}"
end
if value = ENV[key]
locations << "Set via #{key}: #{converted_value(value, exposed_key).inspect}"
end
if @global_config.key?(key)
locations << "Set for the current user (#{global_config_file}): #{converted_value(@global_config[key], exposed_key).inspect}"
end
return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
locations
end
# for legacy reasons, in Bundler 2, we do not respect :disable_shared_gems
def path
key = key_for(:path)
path = ENV[key] || @global_config[key]
if path && !@temporary.key?(key) && !@local_config.key?(key)
return Path.new(path, false, false)
end
system_path = self["path.system"] || (self[:disable_shared_gems] == false)
Path.new(self[:path], system_path, Bundler.feature_flag.default_install_uses_path?)
end
Path = Struct.new(:explicit_path, :system_path, :default_install_uses_path) do
def path
path = base_path
path = File.join(path, Bundler.ruby_scope) unless use_system_gems?
path
end
def use_system_gems?
return true if system_path
return false if explicit_path
!default_install_uses_path
end
def base_path
path = explicit_path
path ||= ".bundle" unless use_system_gems?
path ||= Bundler.rubygems.gem_dir
path
end
def base_path_relative_to_pwd
base_path = Pathname.new(self.base_path)
expanded_base_path = base_path.expand_path(Bundler.root)
relative_path = expanded_base_path.relative_path_from(Pathname.pwd)
if relative_path.to_s.start_with?("..")
relative_path = base_path if base_path.absolute?
else
relative_path = Pathname.new(File.join(".", relative_path))
end
relative_path
rescue ArgumentError
expanded_base_path
end
def validate!
return unless explicit_path && system_path
path = Bundler.settings.pretty_values_for(:path)
path.unshift(nil, "path:") unless path.empty?
system_path = Bundler.settings.pretty_values_for("path.system")
system_path.unshift(nil, "path.system:") unless system_path.empty?
disable_shared_gems = Bundler.settings.pretty_values_for(:disable_shared_gems)
disable_shared_gems.unshift(nil, "disable_shared_gems:") unless disable_shared_gems.empty?
raise InvalidOption,
"Using a custom path while using system gems is unsupported.\n#{path.join("\n")}\n#{system_path.join("\n")}\n#{disable_shared_gems.join("\n")}"
end
end
def allow_sudo?
key = key_for(:path)
path_configured = @temporary.key?(key) || @local_config.key?(key)
!path_configured
end
def ignore_config?
ENV["BUNDLE_IGNORE_CONFIG"]
end
def app_cache_path
@app_cache_path ||= self[:cache_path] || "vendor/cache"
end
def validate!
all.each do |raw_key|
[@local_config, ENV, @global_config].each do |settings|
value = converted_value(settings[key_for(raw_key)], raw_key)
Validator.validate!(raw_key, value, settings.to_hash.dup)
end
end
end
def key_for(key)
key = Settings.normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
key = key.to_s.gsub(".", "__").upcase
"BUNDLE_#{key}"
end
private
def parent_setting_for(name)
split_specific_setting_for(name)[0]
end
def specific_gem_for(name)
split_specific_setting_for(name)[1]
end
def split_specific_setting_for(name)
name.split(".")
end
def is_bool(name)
BOOL_KEYS.include?(name.to_s) || BOOL_KEYS.include?(parent_setting_for(name.to_s))
end
def to_bool(value)
case value
when nil, /\A(false|f|no|n|0|)\z/i, false
false
else
true
end
end
def is_num(key)
NUMBER_KEYS.include?(key.to_s)
end
def is_array(key)
ARRAY_KEYS.include?(key.to_s)
end
def to_array(value)
return [] unless value
value.split(":").map(&:to_sym)
end
def array_to_s(array)
array = Array(array)
return nil if array.empty?
array.join(":").tr(" ", ":")
end
def set_key(raw_key, value, hash, file)
raw_key = raw_key.to_s
value = array_to_s(value) if is_array(raw_key)
key = key_for(raw_key)
return if hash[key] == value
hash[key] = value
hash.delete(key) if value.nil?
Validator.validate!(raw_key, converted_value(value, raw_key), hash)
return unless file
SharedHelpers.filesystem_access(file) do |p|
FileUtils.mkdir_p(p.dirname)
require_relative "yaml_serializer"
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
end
end
def converted_value(value, key)
if is_array(key)
to_array(value)
elsif value.nil?
nil
elsif is_bool(key) || value == "false"
to_bool(value)
elsif is_num(key)
value.to_i
else
value.to_s
end
end
def global_config_file
if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
Pathname.new(ENV["BUNDLE_CONFIG"])
else
begin
Bundler.user_bundle_path("config")
rescue PermissionError, GenericSystemCallError
nil
end
end
end
def local_config_file
Pathname.new(@root).join("config") if @root
end
def load_config(config_file)
return {} if !config_file || ignore_config?
SharedHelpers.filesystem_access(config_file, :read) do |file|
valid_file = file.exist? && !file.size.zero?
return {} unless valid_file
require_relative "yaml_serializer"
YAMLSerializer.load file.read
end
end
PER_URI_OPTIONS = %w[
fallback_timeout
].freeze
NORMALIZE_URI_OPTIONS_PATTERN =
/
\A
(\w+\.)? # optional prefix key
(https?.*?) # URI
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
\z
/ix.freeze
# TODO: duplicates Rubygems#normalize_uri
# TODO: is this the correct place to validate mirror URIs?
def self.normalize_uri(uri)
uri = uri.to_s
if uri =~ NORMALIZE_URI_OPTIONS_PATTERN
prefix = $1
uri = $2
suffix = $3
end
uri = "#{uri}/" unless uri.end_with?("/")
require_relative "vendored_uri"
uri = Bundler::URI(uri)
unless uri.absolute?
raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
end
"#{prefix}#{uri}#{suffix}"
end
end
end
bundler-2.1.4/lib/bundler/rubygems_gem_installer.rb 0000644 0000041 0000041 00000006766 13606335352 022516 0 ustar www-data www-data # frozen_string_literal: true
require "rubygems/installer"
module Bundler
class RubyGemsGemInstaller < Gem::Installer
unless respond_to?(:at)
def self.at(*args)
new(*args)
end
end
def check_executable_overwrite(filename)
# Bundler needs to install gems regardless of binstub overwriting
end
def pre_install_checks
super && validate_bundler_checksum(options[:bundler_expected_checksum])
end
def build_extensions
extension_cache_path = options[:bundler_extension_cache_path]
return super unless extension_cache_path && extension_dir = Bundler.rubygems.spec_extension_dir(spec)
extension_dir = Pathname.new(extension_dir)
build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
if build_complete && !options[:force]
SharedHelpers.filesystem_access(extension_dir.parent, &:mkpath)
SharedHelpers.filesystem_access(extension_cache_path) do
FileUtils.cp_r extension_cache_path, spec.extension_dir
end
else
super
if extension_dir.directory? # not made for gems without extensions
SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)
SharedHelpers.filesystem_access(extension_cache_path) do
FileUtils.cp_r extension_dir, extension_cache_path
end
end
end
end
private
def validate_bundler_checksum(checksum)
return true if Bundler.settings[:disable_checksum_validation]
return true unless checksum
return true unless source = @package.instance_variable_get(:@gem)
return true unless source.respond_to?(:with_read_io)
digest = source.with_read_io do |io|
digest = SharedHelpers.digest(:SHA256).new
digest << io.read(16_384) until io.eof?
io.rewind
send(checksum_type(checksum), digest)
end
unless digest == checksum
raise SecurityError, <<-MESSAGE
Bundler cannot continue installing #{spec.name} (#{spec.version}).
The checksum for the downloaded `#{spec.full_name}.gem` does not match \
the checksum given by the server. This means the contents of the downloaded \
gem is different from what was uploaded to the server, and could be a potential security issue.
To resolve this issue:
1. delete the downloaded gem located at: `#{spec.gem_dir}/#{spec.full_name}.gem`
2. run `bundle install`
If you wish to continue installing the downloaded gem, and are certain it does not pose a \
security issue despite the mismatching checksum, do the following:
1. run `bundle config set disable_checksum_validation true` to turn off checksum verification
2. run `bundle install`
(More info: The expected SHA256 checksum was #{checksum.inspect}, but the \
checksum for the downloaded gem was #{digest.inspect}.)
MESSAGE
end
true
end
def checksum_type(checksum)
case checksum.length
when 64 then :hexdigest!
when 44 then :base64digest!
else raise InstallError, "The given checksum for #{spec.full_name} (#{checksum.inspect}) is not a valid SHA256 hexdigest nor base64digest"
end
end
def hexdigest!(digest)
digest.hexdigest!
end
def base64digest!(digest)
if digest.respond_to?(:base64digest!)
digest.base64digest!
else
[digest.digest!].pack("m0")
end
end
end
end
bundler-2.1.4/lib/bundler/injector.rb 0000644 0000041 0000041 00000021415 13606335352 017555 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Injector
INJECTED_GEMS = "injected gems".freeze
def self.inject(new_deps, options = {})
injector = new(new_deps, options)
injector.inject(Bundler.default_gemfile, Bundler.default_lockfile)
end
def self.remove(gems, options = {})
injector = new(gems, options)
injector.remove(Bundler.default_gemfile, Bundler.default_lockfile)
end
def initialize(deps, options = {})
@deps = deps
@options = options
end
# @param [Pathname] gemfile_path The Gemfile in which to inject the new dependency.
# @param [Pathname] lockfile_path The lockfile in which to inject the new dependency.
# @return [Array]
def inject(gemfile_path, lockfile_path)
if Bundler.frozen_bundle?
# ensure the lock and Gemfile are synced
Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true)
end
# temporarily unfreeze
Bundler.settings.temporary(:deployment => false, :frozen => false) do
# evaluate the Gemfile we have now
builder = Dsl.new
builder.eval_gemfile(gemfile_path)
# don't inject any gems that are already in the Gemfile
@deps -= builder.dependencies
# add new deps to the end of the in-memory Gemfile
# Set conservative versioning to false because
# we want to let the resolver resolve the version first
builder.eval_gemfile(INJECTED_GEMS, build_gem_lines(false)) if @deps.any?
# resolve to see if the new deps broke anything
@definition = builder.to_definition(lockfile_path, {})
@definition.resolve_remotely!
# since nothing broke, we can add those gems to the gemfile
append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
# since we resolved successfully, write out the lockfile
@definition.lock(Bundler.default_lockfile)
# invalidate the cached Bundler.definition
Bundler.reset_paths!
# return an array of the deps that we added
@deps
end
end
# @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
# @param [Pathname] lockfile_path The lockfile from which to remove dependencies.
# @return [Array]
def remove(gemfile_path, lockfile_path)
# remove gems from each gemfiles we have
Bundler.definition.gemfiles.each do |path|
deps = remove_deps(path)
show_warning("No gems were removed from the gemfile.") if deps.empty?
deps.each {|dep| Bundler.ui.confirm "#{SharedHelpers.pretty_dependency(dep, false)} was removed." }
end
end
private
def conservative_version(spec)
version = spec.version
return ">= 0" if version.nil?
segments = version.segments
seg_end_index = version >= Gem::Version.new("1.0") ? 1 : 2
prerelease_suffix = version.to_s.gsub(version.release.to_s, "") if version.prerelease?
"#{version_prefix}#{segments[0..seg_end_index].join(".")}#{prerelease_suffix}"
end
def version_prefix
if @options[:strict]
"= "
elsif @options[:optimistic]
">= "
else
"~> "
end
end
def build_gem_lines(conservative_versioning)
@deps.map do |d|
name = d.name.dump
requirement = if conservative_versioning
", \"#{conservative_version(@definition.specs[d.name][0])}\""
else
", #{d.requirement.as_list.map(&:dump).join(", ")}"
end
if d.groups != Array(:default)
group = d.groups.size == 1 ? ", :group => #{d.groups.first.inspect}" : ", :groups => #{d.groups.inspect}"
end
source = ", :source => \"#{d.source}\"" unless d.source.nil?
git = ", :git => \"#{d.git}\"" unless d.git.nil?
branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
%(gem #{name}#{requirement}#{group}#{source}#{git}#{branch})
end.join("\n")
end
def append_to(gemfile_path, new_gem_lines)
gemfile_path.open("a") do |f|
f.puts
f.puts new_gem_lines
end
end
# evaluates a gemfile to remove the specified gem
# from it.
def remove_deps(gemfile_path)
initial_gemfile = IO.readlines(gemfile_path)
Bundler.ui.info "Removing gems from #{gemfile_path}"
# evaluate the Gemfile we have
builder = Dsl.new
builder.eval_gemfile(gemfile_path)
removed_deps = remove_gems_from_dependencies(builder, @deps, gemfile_path)
# abort the operation if no gems were removed
# no need to operate on gemfile further
return [] if removed_deps.empty?
cleaned_gemfile = remove_gems_from_gemfile(@deps, gemfile_path)
SharedHelpers.write_to_gemfile(gemfile_path, cleaned_gemfile)
# check for errors
# including extra gems being removed
# or some gems not being removed
# and return the actual removed deps
cross_check_for_errors(gemfile_path, builder.dependencies, removed_deps, initial_gemfile)
end
# @param [Dsl] builder Dsl object of current Gemfile.
# @param [Array] gems Array of names of gems to be removed.
# @param [Pathname] gemfile_path Path of the Gemfile.
# @return [Array] Array of removed dependencies.
def remove_gems_from_dependencies(builder, gems, gemfile_path)
removed_deps = []
gems.each do |gem_name|
deleted_dep = builder.dependencies.find {|d| d.name == gem_name }
if deleted_dep.nil?
raise GemfileError, "`#{gem_name}` is not specified in #{gemfile_path} so it could not be removed."
end
builder.dependencies.delete(deleted_dep)
removed_deps << deleted_dep
end
removed_deps
end
# @param [Array] gems Array of names of gems to be removed.
# @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
def remove_gems_from_gemfile(gems, gemfile_path)
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
# remove lines which match the regex
new_gemfile = IO.readlines(gemfile_path).reject {|line| line.match(patterns) }
# remove lone \n and append them with other strings
new_gemfile.each_with_index do |_line, index|
if new_gemfile[index + 1] == "\n"
new_gemfile[index] += new_gemfile[index + 1]
new_gemfile.delete_at(index + 1)
end
end
%w[group source env install_if].each {|block| remove_nested_blocks(new_gemfile, block) }
new_gemfile.join.chomp
end
# @param [Array] gemfile Array of gemfile contents.
# @param [String] block_name Name of block name to look for.
def remove_nested_blocks(gemfile, block_name)
nested_blocks = 0
# count number of nested blocks
gemfile.each_with_index {|line, index| nested_blocks += 1 if !gemfile[index + 1].nil? && gemfile[index + 1].include?(block_name) && line.include?(block_name) }
while nested_blocks >= 0
nested_blocks -= 1
gemfile.each_with_index do |line, index|
next unless !line.nil? && line.strip.start_with?(block_name)
if gemfile[index + 1] =~ /^\s*end\s*$/
gemfile[index] = nil
gemfile[index + 1] = nil
end
end
gemfile.compact!
end
end
# @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
# @param [Array] original_deps Array of original dependencies.
# @param [Array] removed_deps Array of removed dependencies.
# @param [Array] initial_gemfile Contents of original Gemfile before any operation.
def cross_check_for_errors(gemfile_path, original_deps, removed_deps, initial_gemfile)
# evaluate the new gemfile to look for any failure cases
builder = Dsl.new
builder.eval_gemfile(gemfile_path)
# record gems which were removed but not requested
extra_removed_gems = original_deps - builder.dependencies
# if some extra gems were removed then raise error
# and revert Gemfile to original
unless extra_removed_gems.empty?
SharedHelpers.write_to_gemfile(gemfile_path, initial_gemfile.join)
raise InvalidOption, "Gems could not be removed. #{extra_removed_gems.join(", ")} would also have been removed. Bundler cannot continue."
end
# record gems which could not be removed due to some reasons
errored_deps = builder.dependencies.select {|d| d.gemfile == gemfile_path } & removed_deps.select {|d| d.gemfile == gemfile_path }
show_warning "#{errored_deps.map(&:name).join(", ")} could not be removed." unless errored_deps.empty?
# return actual removed dependencies
removed_deps - errored_deps
end
def show_warning(message)
Bundler.ui.info Bundler.ui.add_color(message, :yellow)
end
end
end
bundler-2.1.4/lib/bundler/source.rb 0000644 0000041 0000041 00000005376 13606335352 017250 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Source
autoload :Gemspec, File.expand_path("source/gemspec", __dir__)
autoload :Git, File.expand_path("source/git", __dir__)
autoload :Metadata, File.expand_path("source/metadata", __dir__)
autoload :Path, File.expand_path("source/path", __dir__)
autoload :Rubygems, File.expand_path("source/rubygems", __dir__)
attr_accessor :dependency_names
def unmet_deps
specs.unmet_dependency_names
end
def version_message(spec)
message = "#{spec.name} #{spec.version}"
message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
if Bundler.locked_gems
locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
locked_spec_version = locked_spec.version if locked_spec
if locked_spec_version && spec.version != locked_spec_version
message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
end
end
message
end
def can_lock?(spec)
spec.source == self
end
# it's possible that gems from one source depend on gems from some
# other source, so now we download gemspecs and iterate over those
# dependencies, looking for gems we don't have info on yet.
def double_check_for(*); end
def dependency_names_to_double_check
specs.dependency_names
end
def include?(other)
other == self
end
def inspect
"#<#{self.class}:0x#{object_id} #{self}>"
end
def path?
instance_of?(Bundler::Source::Path)
end
def extension_cache_path(spec)
return unless Bundler.feature_flag.global_gem_cache?
return unless source_slug = extension_cache_slug(spec)
Bundler.user_cache.join(
"extensions", Gem::Platform.local.to_s, Bundler.ruby_scope,
source_slug, spec.full_name
)
end
private
def version_color(spec_version, locked_spec_version)
if Gem::Version.correct?(spec_version) && Gem::Version.correct?(locked_spec_version)
# display yellow if there appears to be a regression
earlier_version?(spec_version, locked_spec_version) ? :yellow : :green
else
# default to green if the versions cannot be directly compared
:green
end
end
def earlier_version?(spec_version, locked_spec_version)
Gem::Version.new(spec_version) < Gem::Version.new(locked_spec_version)
end
def print_using_message(message)
if !message.include?("(was ") && Bundler.feature_flag.suppress_install_using_messages?
Bundler.ui.debug message
else
Bundler.ui.info message
end
end
def extension_cache_slug(_)
nil
end
end
end
bundler-2.1.4/lib/bundler/psyched_yaml.rb 0000644 0000041 0000041 00000001526 13606335352 020422 0 ustar www-data www-data # frozen_string_literal: true
# Psych could be a gem, so try to ask for it
begin
gem "psych"
rescue LoadError
end if defined?(gem)
# Psych could be in the stdlib
# but it's too late if Syck is already loaded
begin
require "psych" unless defined?(Syck)
rescue LoadError
# Apparently Psych wasn't available. Oh well.
end
# At least load the YAML stdlib, whatever that may be
require "yaml" unless defined?(YAML.dump)
module Bundler
# On encountering invalid YAML,
# Psych raises Psych::SyntaxError
if defined?(::Psych::SyntaxError)
YamlLibrarySyntaxError = ::Psych::SyntaxError
else # Syck raises ArgumentError
YamlLibrarySyntaxError = ::ArgumentError
end
end
require_relative "deprecate"
begin
Bundler::Deprecate.skip_during do
require "rubygems/safe_yaml"
end
rescue LoadError
# it's OK if the file isn't there
end
bundler-2.1.4/lib/bundler/plugin.rb 0000644 0000041 0000041 00000023174 13606335352 017242 0 ustar www-data www-data # frozen_string_literal: true
require_relative "plugin/api"
module Bundler
module Plugin
autoload :DSL, File.expand_path("plugin/dsl", __dir__)
autoload :Events, File.expand_path("plugin/events", __dir__)
autoload :Index, File.expand_path("plugin/index", __dir__)
autoload :Installer, File.expand_path("plugin/installer", __dir__)
autoload :SourceList, File.expand_path("plugin/source_list", __dir__)
class MalformattedPlugin < PluginError; end
class UndefinedCommandError < PluginError; end
class UnknownSourceError < PluginError; end
PLUGIN_FILE_NAME = "plugins.rb".freeze
module_function
def reset!
instance_variables.each {|i| remove_instance_variable(i) }
@sources = {}
@commands = {}
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
@loaded_plugin_names = []
end
reset!
# Installs a new plugin by the given name
#
# @param [Array] names the name of plugin to be installed
# @param [Hash] options various parameters as described in description.
# Refer to cli/plugin for available options
def install(names, options)
specs = Installer.new.install(names, options)
save_plugins names, specs
rescue PluginError => e
if specs
specs_to_delete = Hash[specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }]
specs_to_delete.values.each {|spec| Bundler.rm_rf(spec.full_gem_path) }
end
Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}"
end
# List installed plugins and commands
#
def list
installed_plugins = index.installed_plugins
if installed_plugins.any?
output = String.new
installed_plugins.each do |plugin|
output << "#{plugin}\n"
output << "-----\n"
index.plugin_commands(plugin).each do |command|
output << " #{command}\n"
end
output << "\n"
end
else
output = "No plugins installed"
end
Bundler.ui.info output
end
# Evaluates the Gemfile with a limited DSL and installs the plugins
# specified by plugin method
#
# @param [Pathname] gemfile path
# @param [Proc] block that can be evaluated for (inline) Gemfile
def gemfile_install(gemfile = nil, &inline)
Bundler.settings.temporary(:frozen => false, :deployment => false) do
builder = DSL.new
if block_given?
builder.instance_eval(&inline)
else
builder.eval_gemfile(gemfile)
end
definition = builder.to_definition(nil, true)
return if definition.dependencies.empty?
plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
installed_specs = Installer.new.install_definition(definition)
save_plugins plugins, installed_specs, builder.inferred_plugins
end
rescue RuntimeError => e
unless e.is_a?(GemfileError)
Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"
end
raise
end
# The index object used to store the details about the plugin
def index
@index ||= Index.new
end
# The directory root for all plugin related data
#
# If run in an app, points to local root, in app_config_path
# Otherwise, points to global root, in Bundler.user_bundle_path("plugin")
def root
@root ||= if SharedHelpers.in_bundle?
local_root
else
global_root
end
end
def local_root
Bundler.app_config_path.join("plugin")
end
# The global directory root for all plugin related data
def global_root
Bundler.user_bundle_path("plugin")
end
# The cache directory for plugin stuffs
def cache
@cache ||= root.join("cache")
end
# To be called via the API to register to handle a command
def add_command(command, cls)
@commands[command] = cls
end
# Checks if any plugin handles the command
def command?(command)
!index.command_plugin(command).nil?
end
# To be called from Cli class to pass the command and argument to
# approriate plugin class
def exec_command(command, args)
raise UndefinedCommandError, "Command `#{command}` not found" unless command? command
load_plugin index.command_plugin(command) unless @commands.key? command
@commands[command].new.exec(command, args)
end
# To be called via the API to register to handle a source plugin
def add_source(source, cls)
@sources[source] = cls
end
# Checks if any plugin declares the source
def source?(name)
!index.source_plugin(name.to_s).nil?
end
# @return [Class] that handles the source. The calss includes API::Source
def source(name)
raise UnknownSourceError, "Source #{name} not found" unless source? name
load_plugin(index.source_plugin(name)) unless @sources.key? name
@sources[name]
end
# @param [Hash] The options that are present in the lock file
# @return [API::Source] the instance of the class that handles the source
# type passed in locked_opts
def source_from_lock(locked_opts)
src = source(locked_opts["type"])
src.new(locked_opts.merge("uri" => locked_opts["remote"]))
end
# To be called via the API to register a hooks and corresponding block that
# will be called to handle the hook
def add_hook(event, &block)
unless Events.defined_event?(event)
raise ArgumentError, "Event '#{event}' not defined in Bundler::Plugin::Events"
end
@hooks_by_event[event.to_s] << block
end
# Runs all the hooks that are registered for the passed event
#
# It passes the passed arguments and block to the block registered with
# the api.
#
# @param [String] event
def hook(event, *args, &arg_blk)
return unless Bundler.feature_flag.plugins?
unless Events.defined_event?(event)
raise ArgumentError, "Event '#{event}' not defined in Bundler::Plugin::Events"
end
plugins = index.hook_plugins(event)
return unless plugins.any?
(plugins - @loaded_plugin_names).each {|name| load_plugin(name) }
@hooks_by_event[event].each {|blk| blk.call(*args, &arg_blk) }
end
# currently only intended for specs
#
# @return [String, nil] installed path
def installed?(plugin)
Index.new.installed?(plugin)
end
# Post installation processing and registering with index
#
# @param [Array] plugins list to be installed
# @param [Hash] specs of plugins mapped to installation path (currently they
# contain all the installed specs, including plugins)
# @param [Array] names of inferred source plugins that can be ignored
def save_plugins(plugins, specs, optional_plugins = [])
plugins.each do |name|
spec = specs[name]
validate_plugin! Pathname.new(spec.full_gem_path)
installed = register_plugin(name, spec, optional_plugins.include?(name))
Bundler.ui.info "Installed plugin #{name}" if installed
end
end
# Checks if the gem is good to be a plugin
#
# At present it only checks whether it contains plugins.rb file
#
# @param [Pathname] plugin_path the path plugin is installed at
# @raise [MalformattedPlugin] if plugins.rb file is not found
def validate_plugin!(plugin_path)
plugin_file = plugin_path.join(PLUGIN_FILE_NAME)
raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
end
# Runs the plugins.rb file in an isolated namespace, records the plugin
# actions it registers for and then passes the data to index to be stored.
#
# @param [String] name the name of the plugin
# @param [Specification] spec of installed plugin
# @param [Boolean] optional_plugin, removed if there is conflict with any
# other plugin (used for default source plugins)
#
# @raise [MalformattedPlugin] if plugins.rb raises any error
def register_plugin(name, spec, optional_plugin = false)
commands = @commands
sources = @sources
hooks = @hooks_by_event
@commands = {}
@sources = {}
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
load_paths = spec.load_paths
Bundler.rubygems.add_to_load_path(load_paths)
path = Pathname.new spec.full_gem_path
begin
load path.join(PLUGIN_FILE_NAME), true
rescue StandardError => e
raise MalformattedPlugin, "#{e.class}: #{e.message}"
end
if optional_plugin && @sources.keys.any? {|s| source? s }
Bundler.rm_rf(path)
false
else
index.register_plugin(name, path.to_s, load_paths, @commands.keys,
@sources.keys, @hooks_by_event.keys)
true
end
ensure
@commands = commands
@sources = sources
@hooks_by_event = hooks
end
# Executes the plugins.rb file
#
# @param [String] name of the plugin
def load_plugin(name)
# Need to ensure before this that plugin root where the rest of gems
# are installed to be on load path to support plugin deps. Currently not
# done to avoid conflicts
path = index.plugin_path(name)
Bundler.rubygems.add_to_load_path(index.load_paths(name))
load path.join(PLUGIN_FILE_NAME)
@loaded_plugin_names << name
rescue RuntimeError => e
Bundler.ui.error "Failed loading plugin #{name}: #{e.message}"
raise
end
class << self
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin!
end
end
end
bundler-2.1.4/lib/bundler/vendored_molinillo.rb 0000644 0000041 0000041 00000000145 13606335352 021621 0 ustar www-data www-data # frozen_string_literal: true
module Bundler; end
require_relative "vendor/molinillo/lib/molinillo"
bundler-2.1.4/lib/bundler/fetcher.rb 0000644 0000041 0000041 00000026150 13606335352 017361 0 ustar www-data www-data # frozen_string_literal: true
require_relative "vendored_persistent"
require "cgi"
require "securerandom"
require "zlib"
require "rubygems/request"
module Bundler
# Handles all the fetching with the rubygems server
class Fetcher
autoload :CompactIndex, File.expand_path("fetcher/compact_index", __dir__)
autoload :Downloader, File.expand_path("fetcher/downloader", __dir__)
autoload :Dependency, File.expand_path("fetcher/dependency", __dir__)
autoload :Index, File.expand_path("fetcher/index", __dir__)
# This error is raised when it looks like the network is down
class NetworkDownError < HTTPError; end
# This error is raised if we should rate limit our requests to the API
class TooManyRequestsError < HTTPError; end
# This error is raised if the API returns a 413 (only printed in verbose)
class FallbackError < HTTPError; end
# This is the error raised if OpenSSL fails the cert verification
class CertificateFailureError < HTTPError
def initialize(remote_uri)
remote_uri = filter_uri(remote_uri)
super "Could not verify the SSL certificate for #{remote_uri}.\nThere" \
" is a chance you are experiencing a man-in-the-middle attack, but" \
" most likely your system doesn't have the CA certificates needed" \
" for verification. For information about OpenSSL certificates, see" \
" http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile" \
" sources and change 'https' to 'http'."
end
end
# This is the error raised when a source is HTTPS and OpenSSL didn't load
class SSLError < HTTPError
def initialize(msg = nil)
super msg || "Could not load OpenSSL.\n" \
"You must recompile Ruby with OpenSSL support or change the sources in your " \
"Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL " \
"using RVM are available at rvm.io/packages/openssl."
end
end
# This error is raised if HTTP authentication is required, but not provided.
class AuthenticationRequiredError < HTTPError
def initialize(remote_uri)
remote_uri = filter_uri(remote_uri)
super "Authentication is required for #{remote_uri}.\n" \
"Please supply credentials for this source. You can do this by running:\n" \
" bundle config set #{remote_uri} username:password"
end
end
# This error is raised if HTTP authentication is provided, but incorrect.
class BadAuthenticationError < HTTPError
def initialize(remote_uri)
remote_uri = filter_uri(remote_uri)
super "Bad username or password for #{remote_uri}.\n" \
"Please double-check your credentials and correct them."
end
end
# Exceptions classes that should bypass retry attempts. If your password didn't work the
# first time, it's not going to the third time.
NET_ERRORS = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency,
:HTTPForbidden, :HTTPInsufficientStorage, :HTTPMethodNotAllowed,
:HTTPMovedPermanently, :HTTPNoContent, :HTTPNotFound,
:HTTPNotImplemented, :HTTPPreconditionFailed, :HTTPRequestEntityTooLarge,
:HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity,
:HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
FAIL_ERRORS = begin
fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError)
fail_errors.concat(NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact)
end.freeze
class << self
attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries
end
self.redirect_limit = Bundler.settings[:redirect] # How many redirects to allow in one request
self.api_timeout = Bundler.settings[:timeout] # How long to wait for each API call
self.max_retries = Bundler.settings[:retry] # How many retries for the API call
def initialize(remote)
@remote = remote
Socket.do_not_reverse_lookup = true
connection # create persistent connection
end
def uri
@remote.anonymized_uri
end
# fetch a gem specification
def fetch_spec(spec)
spec -= [nil, "ruby", ""]
spec_file_name = "#{spec.join "-"}.gemspec"
uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
if uri.scheme == "file"
path = Bundler.rubygems.correct_for_windows_path(uri.path)
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
Bundler.load_gemspec(cached_spec_path)
else
Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
end
rescue MarshalError
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
"Your network or your gem server is probably having issues right now."
end
# return the specs in the bundler format as an index with retries
def specs_with_retry(gem_names, source)
Bundler::Retry.new("fetcher", FAIL_ERRORS).attempts do
specs(gem_names, source)
end
end
# return the specs in the bundler format as an index
def specs(gem_names, source)
old = Bundler.rubygems.sources
index = Bundler::Index.new
if Bundler::Fetcher.disable_endpoint
@use_api = false
specs = fetchers.last.specs(gem_names)
else
specs = []
fetchers.shift until fetchers.first.available? || fetchers.empty?
fetchers.dup.each do |f|
break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
fetchers.delete(f)
end
@use_api = false if fetchers.none?(&:api_fetcher?)
end
specs.each do |name, version, platform, dependencies, metadata|
next if name == "bundler"
spec = if dependencies
EndpointSpecification.new(name, version, platform, dependencies, metadata)
else
RemoteSpecification.new(name, version, platform, self)
end
spec.source = source
spec.remote = @remote
index << spec
end
index
rescue CertificateFailureError
Bundler.ui.info "" if gem_names && use_api # newline after dots
raise
ensure
Bundler.rubygems.sources = old
end
def use_api
return @use_api if defined?(@use_api)
fetchers.shift until fetchers.first.available?
@use_api = if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
false
else
fetchers.first.api_fetcher?
end
end
def user_agent
@user_agent ||= begin
ruby = Bundler::RubyVersion.system
agent = String.new("bundler/#{Bundler::VERSION}")
agent << " rubygems/#{Gem::VERSION}"
agent << " ruby/#{ruby.versions_string(ruby.versions)}"
agent << " (#{ruby.host})"
agent << " command/#{ARGV.first}"
if ruby.engine != "ruby"
# engine_version raises on unknown engines
engine_version = begin
ruby.engine_versions
rescue RuntimeError
"???"
end
agent << " #{ruby.engine}/#{ruby.versions_string(engine_version)}"
end
agent << " options/#{Bundler.settings.all.join(",")}"
agent << " ci/#{cis.join(",")}" if cis.any?
# add a random ID so we can consolidate runs server-side
agent << " " << SecureRandom.hex(8)
# add any user agent strings set in the config
extra_ua = Bundler.settings[:user_agent]
agent << " " << extra_ua if extra_ua
agent
end
end
def fetchers
@fetchers ||= FETCHERS.map {|f| f.new(downloader, @remote, uri) }
end
def http_proxy
return unless uri = connection.proxy_uri
uri.to_s
end
def inspect
"#<#{self.class}:0x#{object_id} uri=#{uri}>"
end
private
FETCHERS = [CompactIndex, Dependency, Index].freeze
def cis
env_cis = {
"TRAVIS" => "travis",
"CIRCLECI" => "circle",
"SEMAPHORE" => "semaphore",
"JENKINS_URL" => "jenkins",
"BUILDBOX" => "buildbox",
"GO_SERVER_URL" => "go",
"SNAP_CI" => "snap",
"CI_NAME" => ENV["CI_NAME"],
"CI" => "ci",
}
env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci }
end
def connection
@connection ||= begin
needs_ssl = remote_uri.scheme == "https" ||
Bundler.settings[:ssl_verify_mode] ||
Bundler.settings[:ssl_client_cert]
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
end
if remote_uri.scheme == "https"
con.verify_mode = (Bundler.settings[:ssl_verify_mode] ||
OpenSSL::SSL::VERIFY_PEER)
con.cert_store = bundler_cert_store
end
ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
(Bundler.rubygems.configuration.ssl_client_cert if
Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
if ssl_client_cert
pem = File.read(ssl_client_cert)
con.cert = OpenSSL::X509::Certificate.new(pem)
con.key = OpenSSL::PKey::RSA.new(pem)
end
con.read_timeout = Fetcher.api_timeout
con.open_timeout = Fetcher.api_timeout
con.override_headers["User-Agent"] = user_agent
con.override_headers["X-Gemfile-Source"] = @remote.original_uri.to_s if @remote.original_uri
con
end
end
# cached gem specification path, if one exists
def gemspec_cached_path(spec_file_name)
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
paths = paths.select {|path| File.file? path }
paths.first
end
HTTP_ERRORS = [
Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
PersistentHTTP::Error, Zlib::BufError, Errno::EHOSTUNREACH
].freeze
def bundler_cert_store
store = OpenSSL::X509::Store.new
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
(Bundler.rubygems.configuration.ssl_ca_cert if
Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
if ssl_ca_cert
if File.directory? ssl_ca_cert
store.add_path ssl_ca_cert
else
store.add_file ssl_ca_cert
end
else
store.set_default_paths
Gem::Request.get_cert_files.each {|c| store.add_file c }
end
store
end
private
def remote_uri
@remote.uri
end
def downloader
@downloader ||= Downloader.new(connection, self.class.redirect_limit)
end
end
end
bundler-2.1.4/lib/bundler/lazy_specification.rb 0000644 0000041 0000041 00000007155 13606335352 021624 0 ustar www-data www-data # frozen_string_literal: true
require_relative "match_platform"
module Bundler
class LazySpecification
Identifier = Struct.new(:name, :version, :source, :platform, :dependencies)
class Identifier
include Comparable
def <=>(other)
return unless other.is_a?(Identifier)
[name, version, platform_string] <=> [other.name, other.version, other.platform_string]
end
protected
def platform_string
platform_string = platform.to_s
platform_string == Index::RUBY ? Index::NULL : platform_string
end
end
include MatchPlatform
attr_reader :name, :version, :dependencies, :platform
attr_accessor :source, :remote
def initialize(name, version, platform, source = nil)
@name = name
@version = version
@dependencies = []
@platform = platform || Gem::Platform::RUBY
@source = source
@specification = nil
end
def full_name
if platform == Gem::Platform::RUBY || platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
end
end
def ==(other)
identifier == other.identifier
end
def satisfies?(dependency)
@name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
end
def to_lock
out = String.new
if platform == Gem::Platform::RUBY || platform.nil?
out << " #{name} (#{version})\n"
else
out << " #{name} (#{version}-#{platform})\n"
end
dependencies.sort_by(&:to_s).uniq.each do |dep|
next if dep.type == :development
out << " #{dep.to_lock}\n"
end
out
end
def __materialize__
search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version)
@specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
source.gemspec.tap {|s| s.source = source }
else
search = source.specs.search(search_object).last
if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
"because it has different dependencies from the #{platform} version. " \
"To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
search = source.specs.search(self).last
end
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
search
end
end
def respond_to?(*args)
super || @specification ? @specification.respond_to?(*args) : nil
end
def to_s
@__to_s ||= if platform == Gem::Platform::RUBY || platform.nil?
"#{name} (#{version})"
else
"#{name} (#{version}-#{platform})"
end
end
def identifier
@__identifier ||= Identifier.new(name, version, source, platform, dependencies)
end
def git_version
return unless source.is_a?(Bundler::Source::Git)
" #{source.revision[0..6]}"
end
private
def to_ary
nil
end
def method_missing(method, *args, &blk)
raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification
return super unless respond_to?(method)
@specification.send(method, *args, &blk)
end
end
end
bundler-2.1.4/lib/bundler/friendly_errors.rb 0000644 0000041 0000041 00000010562 13606335352 021151 0 ustar www-data www-data # frozen_string_literal: true
require_relative "vendored_thor"
module Bundler
module FriendlyErrors
module_function
def log_error(error)
case error
when YamlSyntaxError
Bundler.ui.error error.message
Bundler.ui.trace error.orig_exception
when Dsl::DSLError, GemspecError
Bundler.ui.error error.message
when GemRequireError
Bundler.ui.error error.message
Bundler.ui.trace error.orig_exception
when BundlerError
Bundler.ui.error error.message, :wrap => true
Bundler.ui.trace error
when Thor::Error
Bundler.ui.error error.message
when LoadError
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
Bundler.ui.error "\nCould not load OpenSSL."
Bundler.ui.warn <<-WARN, :wrap => true
You must recompile Ruby with OpenSSL support or change the sources in your \
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
using RVM are available at https://rvm.io/packages/openssl.
WARN
Bundler.ui.trace error
when Interrupt
Bundler.ui.error "\nQuitting..."
Bundler.ui.trace error
when Gem::InvalidSpecificationException
Bundler.ui.error error.message, :wrap => true
when SystemExit
when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \
"You can decrease the amount of memory Bundler needs by removing gems from your Gemfile, " \
"especially large gems. (Gems can be as large as hundreds of megabytes, and Bundler has to read those files!). " \
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
else request_issue_report_for(error)
end
rescue StandardError
raise error
end
def exit_status(error)
case error
when BundlerError then error.status_code
when Thor::Error then 15
when SystemExit then error.status
else 1
end
end
def request_issue_report_for(e)
Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
--- ERROR REPORT TEMPLATE -------------------------------------------------------
# Error Report
## Questions
Please fill out answers to these questions, it'll help us figure out
why things are going wrong.
- **What did you do?**
I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
- **What did you expect to happen?**
I expected Bundler to...
- **What happened instead?**
Instead, what happened was...
- **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
I tried...
- **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**
...
## Backtrace
```
#{e.class}: #{e.message}
#{e.backtrace && e.backtrace.join("\n ").chomp}
```
#{Bundler::Env.report}
--- TEMPLATE END ----------------------------------------------------------------
EOS
Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
Bundler.ui.warn <<-EOS.gsub(/^ {8}/, "")
First, try this link to see if there are any existing issue reports for this error:
#{issues_url(e)}
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new
EOS
end
def issues_url(exception)
message = exception.message.lines.first.tr(":", " ").chomp
message = message.split("-").first if exception.is_a?(Errno)
require "cgi"
"https://github.com/bundler/bundler/search?q=" \
"#{CGI.escape(message)}&type=Issues"
end
end
def self.with_friendly_errors
yield
rescue SignalException
raise
rescue Exception => e # rubocop:disable Lint/RescueException
FriendlyErrors.log_error(e)
exit FriendlyErrors.exit_status(e)
end
end
bundler-2.1.4/lib/bundler/templates/ 0000755 0000041 0000041 00000000000 13606335352 017406 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/ 0000755 0000041 0000041 00000000000 13606335352 020670 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/gitignore.tt 0000644 0000041 0000041 00000000344 13606335352 023231 0 ustar www-data www-data /.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
<%- if config[:ext] -%>
*.bundle
*.so
*.o
*.a
mkmf.log
<%- end -%>
<%- if config[:test] == "rspec" -%>
# rspec failure tracking
.rspec_status
<%- end -%>
bundler-2.1.4/lib/bundler/templates/newgem/Gemfile.tt 0000644 0000041 0000041 00000000445 13606335352 022614 0 ustar www-data www-data source "https://rubygems.org"
# Specify your gem's dependencies in <%= config[:name] %>.gemspec
gemspec
gem "rake", "~> 12.0"
<%- if config[:ext] -%>
gem "rake-compiler"
<%- end -%>
<%- if config[:test] -%>
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
<%- end -%>
bundler-2.1.4/lib/bundler/templates/newgem/test/ 0000755 0000041 0000041 00000000000 13606335352 021647 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/test/test_helper.rb.tt 0000644 0000041 0000041 00000000175 13606335352 025143 0 ustar www-data www-data $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "<%= config[:namespaced_path] %>"
require "minitest/autorun"
bundler-2.1.4/lib/bundler/templates/newgem/test/newgem_test.rb.tt 0000644 0000041 0000041 00000000366 13606335352 025150 0 ustar www-data www-data require "test_helper"
class <%= config[:constant_name] %>Test < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::<%= config[:constant_name] %>::VERSION
end
def test_it_does_something_useful
assert false
end
end
bundler-2.1.4/lib/bundler/templates/newgem/Rakefile.tt 0000644 0000041 0000041 00000001233 13606335352 022762 0 ustar www-data www-data require "bundler/gem_tasks"
<% if config[:test] == "minitest" -%>
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
<% elsif config[:test] == "rspec" -%>
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
<% end -%>
<% if config[:ext] -%>
require "rake/extensiontask"
task :build => :compile
Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
task :default => [:clobber, :compile, :<%= config[:test_task] %>]
<% else -%>
task :default => :<%= config[:test_task] %>
<% end -%>
bundler-2.1.4/lib/bundler/templates/newgem/bin/ 0000755 0000041 0000041 00000000000 13606335352 021440 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/bin/console.tt 0000644 0000041 0000041 00000000556 13606335352 023461 0 ustar www-data www-data #!/usr/bin/env ruby
require "bundler/setup"
require "<%= config[:namespaced_path] %>"
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
require "irb"
IRB.start(__FILE__)
bundler-2.1.4/lib/bundler/templates/newgem/bin/setup.tt 0000644 0000041 0000041 00000000203 13606335352 023144 0 ustar www-data www-data #!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx
bundle install
# Do any other automated setup that you need to do here
bundler-2.1.4/lib/bundler/templates/newgem/spec/ 0000755 0000041 0000041 00000000000 13606335352 021622 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt 0000644 0000041 0000041 00000000337 13606335352 025074 0 ustar www-data www-data RSpec.describe <%= config[:constant_name] %> do
it "has a version number" do
expect(<%= config[:constant_name] %>::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
bundler-2.1.4/lib/bundler/templates/newgem/spec/spec_helper.rb.tt 0000644 0000041 0000041 00000000603 13606335352 025065 0 ustar www-data www-data require "bundler/setup"
require "<%= config[:namespaced_path] %>"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
bundler-2.1.4/lib/bundler/templates/newgem/rspec.tt 0000644 0000041 0000041 00000000065 13606335352 022356 0 ustar www-data www-data --format documentation
--color
--require spec_helper
bundler-2.1.4/lib/bundler/templates/newgem/LICENSE.txt.tt 0000644 0000041 0000041 00000002121 13606335352 023135 0 ustar www-data www-data The MIT License (MIT)
Copyright (c) <%= Time.now.year %> <%= config[:author] %>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
bundler-2.1.4/lib/bundler/templates/newgem/lib/ 0000755 0000041 0000041 00000000000 13606335352 021436 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/lib/newgem.rb.tt 0000644 0000041 0000041 00000000756 13606335352 023703 0 ustar www-data www-data require "<%= config[:namespaced_path] %>/version"
<%- if config[:ext] -%>
require "<%= config[:namespaced_path] %>/<%= config[:underscored_name] %>"
<%- end -%>
<%- config[:constant_array].each_with_index do |c, i| -%>
<%= " " * i %>module <%= c %>
<%- end -%>
<%= " " * config[:constant_array].size %>class Error < StandardError; end
<%= " " * config[:constant_array].size %># Your code goes here...
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
<%= " " * i %>end
<%- end -%>
bundler-2.1.4/lib/bundler/templates/newgem/lib/newgem/ 0000755 0000041 0000041 00000000000 13606335352 022720 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/lib/newgem/version.rb.tt 0000644 0000041 0000041 00000000372 13606335352 025362 0 ustar www-data www-data <%- config[:constant_array].each_with_index do |c, i| -%>
<%= " " * i %>module <%= c %>
<%- end -%>
<%= " " * config[:constant_array].size %>VERSION = "0.1.0"
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
<%= " " * i %>end
<%- end -%>
bundler-2.1.4/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt 0000644 0000041 0000041 00000006240 13606335352 024117 0 ustar www-data www-data # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <%= config[:email] %>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [https://contributor-covenant.org/version/1/4][version]
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
bundler-2.1.4/lib/bundler/templates/newgem/newgem.gemspec.tt 0000644 0000041 0000041 00000003032 13606335352 024143 0 ustar www-data www-data require_relative 'lib/<%=config[:namespaced_path]%>/version'
Gem::Specification.new do |spec|
spec.name = <%= config[:name].inspect %>
spec.version = <%= config[:constant_name] %>::VERSION
spec.authors = [<%= config[:author].inspect %>]
spec.email = [<%= config[:email].inspect %>]
spec.summary = %q{TODO: Write a short summary, because RubyGems requires one.}
spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
<%- if config[:mit] -%>
spec.license = "MIT"
<%- end -%>
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
<%- if config[:ext] -%>
spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
<%- end -%>
end
bundler-2.1.4/lib/bundler/templates/newgem/README.md.tt 0000644 0000041 0000041 00000004410 13606335352 022574 0 ustar www-data www-data # <%= config[:constant_name] %>
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%= config[:namespaced_path] %>`. To experiment with that code, run `bin/console` for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
## Installation
Add this line to your application's Gemfile:
```ruby
gem '<%= config[:name] %>'
```
And then execute:
$ bundle install
Or install it yourself as:
$ gem install <%= config[:name] %>
## Usage
TODO: Write usage instructions here
## Development
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).<% end %>
<% if config[:mit] -%>
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
<% end -%>
<% if config[:coc] -%>
## Code of Conduct
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).
<% end -%>
bundler-2.1.4/lib/bundler/templates/newgem/travis.yml.tt 0000644 0000041 0000041 00000000176 13606335352 023355 0 ustar www-data www-data ---
language: ruby
cache: bundler
rvm:
- <%= RUBY_VERSION %>
before_install: gem install bundler -v <%= Bundler::VERSION %>
bundler-2.1.4/lib/bundler/templates/newgem/ext/ 0000755 0000041 0000041 00000000000 13606335352 021470 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/ext/newgem/ 0000755 0000041 0000041 00000000000 13606335352 022752 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt 0000644 0000041 0000041 00000000371 13606335352 025027 0 ustar www-data www-data #include "<%= config[:underscored_name] %>.h"
VALUE rb_m<%= config[:constant_array].join %>;
void
Init_<%= config[:underscored_name] %>(void)
{
rb_m<%= config[:constant_array].join %> = rb_define_module(<%= config[:constant_name].inspect %>);
}
bundler-2.1.4/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt 0000644 0000041 0000041 00000000261 13606335352 025032 0 ustar www-data www-data #ifndef <%= config[:underscored_name].upcase %>_H
#define <%= config[:underscored_name].upcase %>_H 1
#include "ruby.h"
#endif /* <%= config[:underscored_name].upcase %>_H */
bundler-2.1.4/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt 0000644 0000041 0000041 00000000107 13606335352 025371 0 ustar www-data www-data require "mkmf"
create_makefile(<%= config[:makefile_path].inspect %>)
bundler-2.1.4/lib/bundler/templates/newgem/exe/ 0000755 0000041 0000041 00000000000 13606335352 021451 5 ustar www-data www-data bundler-2.1.4/lib/bundler/templates/newgem/exe/newgem.tt 0000644 0000041 0000041 00000000077 13606335352 023310 0 ustar www-data www-data #!/usr/bin/env ruby
require "<%= config[:namespaced_path] %>"
bundler-2.1.4/lib/bundler/templates/Executable.bundler 0000644 0000041 0000041 00000005770 13606335352 023055 0 ustar www-data www-data #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application '<%= executable %>' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "rubygems"
m = Module.new do
module_function
def invoked_as_script?
File.expand_path($0) == File.expand_path(__FILE__)
end
def env_var_version
ENV["BUNDLER_VERSION"]
end
def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
bundler_version = nil
update_index = nil
ARGV.each_with_index do |a, i|
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
bundler_version = a
end
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
bundler_version = $1
update_index = i
end
bundler_version
end
def gemfile
gemfile = ENV["BUNDLE_GEMFILE"]
return gemfile if gemfile && !gemfile.empty?
File.expand_path("../<%= relative_gemfile_path %>", __FILE__)
end
def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
end
def lockfile_version
return unless File.file?(lockfile)
lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
Regexp.last_match(1)
end
def bundler_version
@bundler_version ||=
env_var_version || cli_arg_version ||
lockfile_version
end
def bundler_requirement
return "#{Gem::Requirement.default}.a" unless bundler_version
bundler_gem_version = Gem::Version.new(bundler_version)
requirement = bundler_gem_version.approximate_recommendation
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
requirement += ".a" if bundler_gem_version.prerelease?
requirement
end
def load_bundler!
ENV["BUNDLE_GEMFILE"] ||= gemfile
activate_bundler
end
def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
end
return if gem_error.nil?
require_error = activation_error_handling do
require "bundler/version"
end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
exit 42
end
def activation_error_handling
yield
nil
rescue StandardError, LoadError => e
e
end
end
m.load_bundler!
if m.invoked_as_script?
load Gem.bin_path("<%= spec.name %>", "<%= executable %>")
end
bundler-2.1.4/lib/bundler/templates/.document 0000644 0000041 0000041 00000000045 13606335352 021224 0 ustar www-data www-data # Ignore all files in this directory
bundler-2.1.4/lib/bundler/templates/Executable.standalone 0000644 0000041 0000041 00000000720 13606335352 023540 0 ustar www-data www-data #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
#
# This file was generated by Bundler.
#
# The application '<%= executable %>' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
path = Pathname.new(__FILE__)
$:.unshift File.expand_path "../<%= standalone_path %>", path.realpath
require "bundler/setup"
load File.expand_path "../<%= executable_path %>", path.realpath
bundler-2.1.4/lib/bundler/templates/Gemfile 0000644 0000041 0000041 00000000222 13606335352 020675 0 ustar www-data www-data # frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
bundler-2.1.4/lib/bundler/templates/gems.rb 0000644 0000041 0000041 00000000245 13606335352 020667 0 ustar www-data www-data # frozen_string_literal: true
# A sample gems.rb
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
bundler-2.1.4/lib/bundler/templates/Executable 0000644 0000041 0000041 00000001621 13606335352 021412 0 ustar www-data www-data #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application '<%= executable %>' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("<%= spec.name %>", "<%= executable %>")
bundler-2.1.4/lib/bundler/runtime.rb 0000644 0000041 0000041 00000025262 13606335352 017427 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Runtime
include SharedHelpers
def initialize(root, definition)
@root = root
@definition = definition
end
def setup(*groups)
@definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen_bundle?
groups.map!(&:to_sym)
# Has to happen first
clean_load_path
specs = groups.any? ? @definition.specs_for(groups) : requested_specs
SharedHelpers.set_bundle_environment
Bundler.rubygems.replace_entrypoints(specs)
# Activate the specs
load_paths = specs.map do |spec|
unless spec.loaded_from
raise GemNotFound, "#{spec.full_name} is missing. Run `bundle install` to get it."
end
check_for_activated_spec!(spec)
Bundler.rubygems.mark_loaded(spec)
spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
end.reverse.flatten
Bundler.rubygems.add_to_load_path(load_paths)
setup_manpath
lock(:preserve_unknown_sections => true)
self
end
REQUIRE_ERRORS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
/^dlopen\([^)]*\): Library not loaded: (.+)$/i,
].freeze
def require(*groups)
groups.map!(&:to_sym)
groups = [:default] if groups.empty?
@definition.dependencies.each do |dep|
# Skip the dependency if it is not in any of the requested groups, or
# not for the current platform, or doesn't match the gem constraints.
next unless (dep.groups & groups).any? && dep.should_include?
required_file = nil
begin
# Loop through all the specified autorequires for the
# dependency. If there are none, use the dependency's name
# as the autorequire.
Array(dep.autorequire || dep.name).each do |file|
# Allow `require: true` as an alias for `require: `
file = dep.name if file == true
required_file = file
begin
Kernel.require file
rescue RuntimeError => e
raise e if e.is_a?(LoadError) # we handle this a little later
raise Bundler::GemRequireError.new e,
"There was an error while trying to load the gem '#{file}'."
end
end
rescue LoadError => e
REQUIRE_ERRORS.find {|r| r =~ e.message }
raise if dep.autorequire || $1 != required_file
if dep.autorequire.nil? && dep.name.include?("-")
begin
namespaced_file = dep.name.tr("-", "/")
Kernel.require namespaced_file
rescue LoadError => e
REQUIRE_ERRORS.find {|r| r =~ e.message }
raise if $1 != namespaced_file
end
end
end
end
end
def self.definition_method(meth)
define_method(meth) do
raise ArgumentError, "no definition when calling Runtime##{meth}" unless @definition
@definition.send(meth)
end
end
private_class_method :definition_method
definition_method :requested_specs
definition_method :specs
definition_method :dependencies
definition_method :current_dependencies
definition_method :requires
def lock(opts = {})
return if @definition.nothing_changed? && !@definition.unlocking?
@definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
end
alias_method :gems, :specs
def cache(custom_path = nil)
cache_path = Bundler.app_cache(custom_path)
SharedHelpers.filesystem_access(cache_path) do |p|
FileUtils.mkdir_p(p)
end unless File.exist?(cache_path)
Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
specs_to_cache = Bundler.settings[:cache_all_platforms] ? @definition.resolve.materialized_for_all_platforms : specs
specs_to_cache.each do |spec|
next if spec.name == "bundler"
next if spec.source.is_a?(Source::Gemspec)
spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true)
spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
end
Dir[cache_path.join("*/.git")].each do |git_dir|
FileUtils.rm_rf(git_dir)
FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
end
prune_cache(cache_path) unless Bundler.settings[:no_prune]
end
def prune_cache(cache_path)
SharedHelpers.filesystem_access(cache_path) do |p|
FileUtils.mkdir_p(p)
end unless File.exist?(cache_path)
resolve = @definition.resolve
prune_gem_cache(resolve, cache_path)
prune_git_and_path_cache(resolve, cache_path)
end
def clean(dry_run = false)
gem_bins = Dir["#{Gem.dir}/bin/*"]
git_dirs = Dir["#{Gem.dir}/bundler/gems/*"]
git_cache_dirs = Dir["#{Gem.dir}/cache/bundler/git/*"]
gem_dirs = Dir["#{Gem.dir}/gems/*"]
gem_files = Dir["#{Gem.dir}/cache/*.gem"]
gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] + Dir["#{Gem.dir}/bundler/gems/extensions/*/*/*"]
spec_gem_paths = []
# need to keep git sources around
spec_git_paths = @definition.spec_git_paths
spec_git_cache_dirs = []
spec_gem_executables = []
spec_cache_paths = []
spec_gemspec_paths = []
spec_extension_paths = []
specs.each do |spec|
spec_gem_paths << spec.full_gem_path
# need to check here in case gems are nested like for the rails git repo
md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
spec_git_paths << md[1] if md
spec_gem_executables << spec.executables.collect do |executable|
e = "#{Bundler.rubygems.gem_bindir}/#{executable}"
[e, "#{e}.bat"]
end
spec_cache_paths << spec.cache_file
spec_gemspec_paths << spec.spec_file
spec_extension_paths << spec.extension_dir if spec.respond_to?(:extension_dir)
spec_git_cache_dirs << spec.source.cache_path.to_s if spec.source.is_a?(Bundler::Source::Git)
end
spec_gem_paths.uniq!
spec_gem_executables.flatten!
stale_gem_bins = gem_bins - spec_gem_executables
stale_git_dirs = git_dirs - spec_git_paths - ["#{Gem.dir}/bundler/gems/extensions"]
stale_git_cache_dirs = git_cache_dirs - spec_git_cache_dirs
stale_gem_dirs = gem_dirs - spec_gem_paths
stale_gem_files = gem_files - spec_cache_paths
stale_gemspec_files = gemspec_files - spec_gemspec_paths
stale_extension_dirs = extension_dirs - spec_extension_paths
removed_stale_gem_dirs = stale_gem_dirs.collect {|dir| remove_dir(dir, dry_run) }
removed_stale_git_dirs = stale_git_dirs.collect {|dir| remove_dir(dir, dry_run) }
output = removed_stale_gem_dirs + removed_stale_git_dirs
unless dry_run
stale_files = stale_gem_bins + stale_gem_files + stale_gemspec_files
stale_files.each do |file|
SharedHelpers.filesystem_access(File.dirname(file)) do |_p|
FileUtils.rm(file) if File.exist?(file)
end
end
stale_dirs = stale_git_cache_dirs + stale_extension_dirs
stale_dirs.each do |stale_dir|
SharedHelpers.filesystem_access(stale_dir) do |dir|
FileUtils.rm_rf(dir) if File.exist?(dir)
end
end
end
output
end
private
def prune_gem_cache(resolve, cache_path)
cached = Dir["#{cache_path}/*.gem"]
cached = cached.delete_if do |path|
spec = Bundler.rubygems.spec_from_gem path
resolve.any? do |s|
s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git)
end
end
if cached.any?
Bundler.ui.info "Removing outdated .gem files from #{Bundler.settings.app_cache_path}"
cached.each do |path|
Bundler.ui.info " * #{File.basename(path)}"
File.delete(path)
end
end
end
def prune_git_and_path_cache(resolve, cache_path)
cached = Dir["#{cache_path}/*/.bundlecache"]
cached = cached.delete_if do |path|
name = File.basename(File.dirname(path))
resolve.any? do |s|
source = s.source
source.respond_to?(:app_cache_dirname) && source.app_cache_dirname == name
end
end
if cached.any?
Bundler.ui.info "Removing outdated git and path gems from #{Bundler.settings.app_cache_path}"
cached.each do |path|
path = File.dirname(path)
Bundler.ui.info " * #{File.basename(path)}"
FileUtils.rm_rf(path)
end
end
end
def setup_manpath
# Add man/ subdirectories from activated bundles to MANPATH for man(1)
manuals = $LOAD_PATH.map do |path|
man_subdir = path.sub(/lib$/, "man")
man_subdir unless Dir[man_subdir + "/man?/"].empty?
end.compact
return if manuals.empty?
Bundler::SharedHelpers.set_env "MANPATH", manuals.concat(
ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR)
).uniq.join(File::PATH_SEPARATOR)
end
def remove_dir(dir, dry_run)
full_name = Pathname.new(dir).basename.to_s
parts = full_name.split("-")
name = parts[0..-2].join("-")
version = parts.last
output = "#{name} (#{version})"
if dry_run
Bundler.ui.info "Would have removed #{output}"
else
Bundler.ui.info "Removing #{output}"
FileUtils.rm_rf(dir)
end
output
end
def check_for_activated_spec!(spec)
return unless activated_spec = Bundler.rubygems.loaded_specs(spec.name)
return if activated_spec.version == spec.version
suggestion = if Bundler.rubygems.spec_default_gem?(activated_spec)
"Since #{spec.name} is a default gem, you can either remove your dependency on it" \
" or try updating to a newer version of bundler that supports #{spec.name} as a default gem."
else
"Prepending `bundle exec` to your command may solve this."
end
e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
"but your Gemfile requires #{spec.name} #{spec.version}. #{suggestion}"
e.name = spec.name
if e.respond_to?(:requirement=)
e.requirement = Gem::Requirement.new(spec.version.to_s)
else
e.version_requirement = Gem::Requirement.new(spec.version.to_s)
end
raise e
end
end
end
bundler-2.1.4/lib/bundler/compact_index_client.rb 0000644 0000041 0000041 00000007127 13606335352 022117 0 ustar www-data www-data # frozen_string_literal: true
require "pathname"
require "set"
module Bundler
class CompactIndexClient
DEBUG_MUTEX = Mutex.new
def self.debug
return unless ENV["DEBUG_COMPACT_INDEX"]
DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
end
class Error < StandardError; end
require_relative "compact_index_client/cache"
require_relative "compact_index_client/updater"
attr_reader :directory
def initialize(directory, fetcher)
@directory = Pathname.new(directory)
@updater = Updater.new(fetcher)
@cache = Cache.new(@directory)
@endpoints = Set.new
@info_checksums_by_name = {}
@parsed_checksums = false
@mutex = Mutex.new
end
def execution_mode=(block)
Bundler::CompactIndexClient.debug { "execution_mode=" }
@endpoints = Set.new
@execution_mode = block
end
# @return [Lambda] A lambda that takes an array of inputs and a block, and
# maps the inputs with the block in parallel.
#
def execution_mode
@execution_mode || sequentially
end
def sequential_execution_mode!
self.execution_mode = sequentially
end
def sequentially
@sequentially ||= lambda do |inputs, &blk|
inputs.map(&blk)
end
end
def names
Bundler::CompactIndexClient.debug { "/names" }
update(@cache.names_path, "names")
@cache.names
end
def versions
Bundler::CompactIndexClient.debug { "/versions" }
update(@cache.versions_path, "versions")
versions, @info_checksums_by_name = @cache.versions
versions
end
def dependencies(names)
Bundler::CompactIndexClient.debug { "dependencies(#{names})" }
execution_mode.call(names) do |name|
update_info(name)
@cache.dependencies(name).map {|d| d.unshift(name) }
end.flatten(1)
end
def spec(name, version, platform = nil)
Bundler::CompactIndexClient.debug { "spec(name = #{name}, version = #{version}, platform = #{platform})" }
update_info(name)
@cache.specific_dependency(name, version, platform)
end
def update_and_parse_checksums!
Bundler::CompactIndexClient.debug { "update_and_parse_checksums!" }
return @info_checksums_by_name if @parsed_checksums
update(@cache.versions_path, "versions")
@info_checksums_by_name = @cache.checksums
@parsed_checksums = true
end
private
def update(local_path, remote_path)
Bundler::CompactIndexClient.debug { "update(#{local_path}, #{remote_path})" }
unless synchronize { @endpoints.add?(remote_path) }
Bundler::CompactIndexClient.debug { "already fetched #{remote_path}" }
return
end
@updater.update(local_path, url(remote_path))
end
def update_info(name)
Bundler::CompactIndexClient.debug { "update_info(#{name})" }
path = @cache.info_path(name)
checksum = @updater.checksum_for_file(path)
unless existing = @info_checksums_by_name[name]
Bundler::CompactIndexClient.debug { "skipping updating info for #{name} since it is missing from versions" }
return
end
if checksum == existing
Bundler::CompactIndexClient.debug { "skipping updating info for #{name} since the versions checksum matches the local checksum" }
return
end
Bundler::CompactIndexClient.debug { "updating info for #{name} since the versions checksum #{existing} != the local checksum #{checksum}" }
update(path, "info/#{name}")
end
def url(path)
path
end
def synchronize
@mutex.synchronize { yield }
end
end
end
bundler-2.1.4/lib/bundler/cli/ 0000755 0000041 0000041 00000000000 13606335352 016157 5 ustar www-data www-data bundler-2.1.4/lib/bundler/cli/exec.rb 0000644 0000041 0000041 00000005201 13606335352 017426 0 ustar www-data www-data # frozen_string_literal: true
require_relative "../current_ruby"
module Bundler
class CLI::Exec
attr_reader :options, :args, :cmd
TRAPPED_SIGNALS = %w[INT].freeze
def initialize(options, args)
@options = options
@cmd = args.shift
@args = args
if !Bundler.current_ruby.jruby?
@args << { :close_others => !options.keep_file_descriptors? }
elsif options.keep_file_descriptors?
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
end
end
def run
validate_cmd!
SharedHelpers.set_bundle_environment
if bin_path = Bundler.which(cmd)
if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
return kernel_load(bin_path, *args)
end
kernel_exec(bin_path, *args)
else
# exec using the given command
kernel_exec(cmd, *args)
end
end
private
def validate_cmd!
return unless cmd.nil?
Bundler.ui.error "bundler: exec needs a command to run"
exit 128
end
def kernel_exec(*args)
Kernel.exec(*args)
rescue Errno::EACCES, Errno::ENOEXEC
Bundler.ui.error "bundler: not executable: #{cmd}"
exit 126
rescue Errno::ENOENT
Bundler.ui.error "bundler: command not found: #{cmd}"
Bundler.ui.warn "Install missing gem executables with `bundle install`"
exit 127
end
def kernel_load(file, *args)
args.pop if args.last.is_a?(Hash)
ARGV.replace(args)
$0 = file
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
require_relative "../setup"
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
Kernel.load(file)
rescue SystemExit, SignalException
raise
rescue Exception => e # rubocop:disable Lint/RescueException
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
end
def process_title(file, args)
"#{file} #{args.join(" ")}".strip
end
def ruby_shebang?(file)
possibilities = [
"#!/usr/bin/env ruby\n",
"#!/usr/bin/env jruby\n",
"#!/usr/bin/env truffleruby\n",
"#!#{Gem.ruby}\n",
]
if File.zero?(file)
Bundler.ui.warn "#{file} is empty"
return false
end
first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
possibilities.any? {|shebang| first_line.start_with?(shebang) }
end
end
end
bundler-2.1.4/lib/bundler/cli/list.rb 0000644 0000041 0000041 00000003675 13606335352 017472 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::List
def initialize(options)
@options = options
end
def run
raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @options["only-group"] && @options["without-group"]
raise InvalidOption, "The `--name-only` and `--paths` options cannot be used together" if @options["name-only"] && @options[:paths]
specs = if @options["only-group"] || @options["without-group"]
filtered_specs_by_groups
else
Bundler.load.specs
end.reject {|s| s.name == "bundler" }.sort_by(&:name)
return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
return specs.each {|s| Bundler.ui.info s.name } if @options["name-only"]
return specs.each {|s| Bundler.ui.info s.full_gem_path } if @options["paths"]
Bundler.ui.info "Gems included by the bundle:"
specs.each {|s| Bundler.ui.info " * #{s.name} (#{s.version}#{s.git_version})" }
Bundler.ui.info "Use `bundle info` to print more detailed information about a gem"
end
private
def verify_group_exists(groups)
raise InvalidOption, "`#{@options["without-group"]}` group could not be found." if @options["without-group"] && !groups.include?(@options["without-group"].to_sym)
raise InvalidOption, "`#{@options["only-group"]}` group could not be found." if @options["only-group"] && !groups.include?(@options["only-group"].to_sym)
end
def filtered_specs_by_groups
definition = Bundler.definition
groups = definition.groups
verify_group_exists(groups)
show_groups =
if @options["without-group"]
groups.reject {|g| g == @options["without-group"].to_sym }
elsif @options["only-group"]
groups.select {|g| g == @options["only-group"].to_sym }
else
groups
end.map(&:to_sym)
definition.specs_for(show_groups)
end
end
end
bundler-2.1.4/lib/bundler/cli/cache.rb 0000644 0000041 0000041 00000002576 13606335352 017561 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Cache
attr_reader :options
def initialize(options)
@options = options
end
def run
Bundler.ui.level = "error" if options[:quiet]
Bundler.settings.set_command_option_if_given :path, options[:path]
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
setup_cache_all
install
# TODO: move cache contents here now that all bundles are locked
custom_path = Bundler.settings[:path] if options[:path]
Bundler.settings.temporary(:cache_all_platforms => options["all-platforms"]) do
Bundler.load.cache(custom_path)
end
end
private
def install
require_relative "install"
options = self.options.dup
options["local"] = false if Bundler.settings[:cache_all_platforms]
Bundler::CLI::Install.new(options).run
end
def setup_cache_all
all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil)
Bundler.settings.set_command_option_if_given :cache_all, all
if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
"to cache them as well, please pass the --all flag. This will be the default " \
"on Bundler 3.0."
end
end
end
end
bundler-2.1.4/lib/bundler/cli/gem.rb 0000644 0000041 0000041 00000021111 13606335352 017250 0 ustar www-data www-data # frozen_string_literal: true
require "pathname"
module Bundler
class CLI
Bundler.require_thor_actions
include Thor::Actions
end
class CLI::Gem
TEST_FRAMEWORK_VERSIONS = {
"rspec" => "3.0",
"minitest" => "5.0",
}.freeze
attr_reader :options, :gem_name, :thor, :name, :target
def initialize(options, gem_name, thor)
@options = options
@gem_name = resolve_name(gem_name)
@thor = thor
thor.behavior = :invoke
thor.destination_root = nil
@name = @gem_name
@target = SharedHelpers.pwd.join(gem_name)
validate_ext_name if options[:ext]
end
def run
Bundler.ui.confirm "Creating gem '#{name}'..."
underscored_name = name.tr("-", "_")
namespaced_path = name.tr("-", "/")
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
constant_array = constant_name.split("::")
git_installed = Bundler.git_present?
git_author_name = git_installed ? `git config user.name`.chomp : ""
github_username = git_installed ? `git config github.user`.chomp : ""
git_user_email = git_installed ? `git config user.email`.chomp : ""
config = {
:name => name,
:underscored_name => underscored_name,
:namespaced_path => namespaced_path,
:makefile_path => "#{underscored_name}/#{underscored_name}",
:constant_name => constant_name,
:constant_array => constant_array,
:author => git_author_name.empty? ? "TODO: Write your name" : git_author_name,
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
:test => options[:test],
:ext => options[:ext],
:exe => options[:exe],
:bundler_version => bundler_dependency_version,
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
}
ensure_safe_gem_name(name, constant_array)
templates = {
"Gemfile.tt" => "Gemfile",
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
"newgem.gemspec.tt" => "#{name}.gemspec",
"Rakefile.tt" => "Rakefile",
"README.md.tt" => "README.md",
"bin/console.tt" => "bin/console",
"bin/setup.tt" => "bin/setup",
}
executables = %w[
bin/console
bin/setup
]
templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
if test_framework = ask_and_set_test_framework
config[:test] = test_framework
config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
templates.merge!("travis.yml.tt" => ".travis.yml")
case test_framework
when "rspec"
templates.merge!(
"rspec.tt" => ".rspec",
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
)
when "minitest"
templates.merge!(
"test/test_helper.rb.tt" => "test/test_helper.rb",
"test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
)
end
end
config[:test_task] = config[:test] == "minitest" ? "test" : "spec"
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
"This means that any other developer or company will be legally allowed to use your code " \
"for free as long as they admit you created it. You can read more about the MIT license " \
"at https://choosealicense.com/licenses/mit.")
config[:mit] = true
Bundler.ui.info "MIT License enabled in config"
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
end
if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
"Codes of conduct can increase contributions to your project by contributors who " \
"prefer collaborative, safe spaces. You can read more about the code of conduct at " \
"contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
"of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
"address is specified as a contact in the generated code of conduct so that people know " \
"who to contact in case of a violation. For suggestions about " \
"how to enforce codes of conduct, see https://bit.ly/coc-enforcement.")
config[:coc] = true
Bundler.ui.info "Code of conduct enabled in config"
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
end
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
if options[:ext]
templates.merge!(
"ext/newgem/extconf.rb.tt" => "ext/#{name}/extconf.rb",
"ext/newgem/newgem.h.tt" => "ext/#{name}/#{underscored_name}.h",
"ext/newgem/newgem.c.tt" => "ext/#{name}/#{underscored_name}.c"
)
end
templates.each do |src, dst|
destination = target.join(dst)
SharedHelpers.filesystem_access(destination) do
thor.template("newgem/#{src}", destination, config)
end
end
executables.each do |file|
SharedHelpers.filesystem_access(target.join(file)) do |path|
executable = (path.stat.mode | 0o111)
path.chmod(executable)
end
end
if Bundler.git_present? && options[:git]
Bundler.ui.info "Initializing git repo in #{target}"
Dir.chdir(target) do
`git init`
`git add .`
end
end
# Open gemspec in editor
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
Bundler.ui.info "Gem '#{name}' was successfully created. " \
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
rescue Errno::EEXIST => e
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
end
private
def resolve_name(name)
SharedHelpers.pwd.join(name).basename.to_s
end
def ask_and_set(key, header, message)
choice = options[key]
choice = Bundler.settings["gem.#{key}"] if choice.nil?
if choice.nil?
Bundler.ui.confirm header
choice = Bundler.ui.yes? "#{message} y/(n):"
Bundler.settings.set_global("gem.#{key}", choice)
end
choice
end
def validate_ext_name
return unless gem_name.index("-")
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
"naming guidelines for C extensions. For more information, \n" \
"see the 'Extension Naming' section at the following URL:\n" \
"https://guides.rubygems.org/gems-with-extensions/\n"
exit 1
end
def ask_and_set_test_framework
test_framework = options[:test] || Bundler.settings["gem.test"]
if test_framework.nil?
Bundler.ui.confirm "Do you want to generate tests with your gem?"
result = Bundler.ui.ask "Type 'rspec' or 'minitest' to generate those test files now and " \
"in the future. rspec/minitest/(none):"
if result =~ /rspec|minitest/
test_framework = result
else
test_framework = false
end
end
if Bundler.settings["gem.test"].nil?
Bundler.settings.set_global("gem.test", test_framework)
end
test_framework
end
def bundler_dependency_version
v = Gem::Version.new(Bundler::VERSION)
req = v.segments[0..1]
req << "a" if v.prerelease?
req.join(".")
end
def ensure_safe_gem_name(name, constant_array)
if name =~ /^\d/
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
exit 1
end
constant_name = constant_array.join("::")
existing_constant = constant_array.inject(Object) do |c, s|
defined = begin
c.const_defined?(s)
rescue NameError
Bundler.ui.error "Invalid gem name #{name} -- `#{constant_name}` is an invalid constant name"
exit 1
end
(defined && c.const_get(s)) || break
end
return unless existing_constant
Bundler.ui.error "Invalid gem name #{name} constant #{constant_name} is already in use. Please choose another gem name."
exit 1
end
def open_editor(editor, file)
thor.run(%(#{editor} "#{file}"))
end
end
end
bundler-2.1.4/lib/bundler/cli/lock.rb 0000644 0000041 0000041 00000003423 13606335352 017436 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Lock
attr_reader :options
def initialize(options)
@options = options
end
def run
unless Bundler.default_gemfile
Bundler.ui.error "Unable to find a Gemfile to lock"
exit 1
end
print = options[:print]
ui = Bundler.ui
Bundler.ui = UI::Silent.new if print
Bundler::Fetcher.disable_endpoint = options["full-index"]
update = options[:update]
if update.is_a?(Array) # unlocking specific gems
Bundler::CLI::Common.ensure_all_gems_in_lockfile!(update)
update = { :gems => update, :lock_shared_dependencies => options[:conservative] }
end
definition = Bundler.definition(update)
Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options) if options[:update]
options["remove-platform"].each do |platform|
definition.remove_platform(platform)
end
options["add-platform"].each do |platform_string|
platform = Gem::Platform.new(platform_string)
if platform.to_s == "unknown"
Bundler.ui.warn "The platform `#{platform_string}` is unknown to RubyGems " \
"and adding it will likely lead to resolution errors"
end
definition.add_platform(platform)
end
if definition.platforms.empty?
raise InvalidOption, "Removing all platforms from the bundle is not allowed"
end
definition.resolve_remotely! unless options[:local]
if print
puts definition.to_lock
else
file = options[:lockfile]
file = file ? File.expand_path(file) : Bundler.default_lockfile
puts "Writing lockfile to #{file}"
definition.lock(file)
end
Bundler.ui = ui
end
end
end
bundler-2.1.4/lib/bundler/cli/plugin.rb 0000644 0000041 0000041 00000002501 13606335352 020000 0 ustar www-data www-data # frozen_string_literal: true
require_relative "../vendored_thor"
module Bundler
class CLI::Plugin < Thor
desc "install PLUGINS", "Install the plugin from the source"
long_desc <<-D
Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources
D
method_option "source", :type => :string, :default => nil, :banner =>
"URL of the RubyGems source to fetch the plugin from"
method_option "version", :type => :string, :default => nil, :banner =>
"The version of the plugin to fetch"
method_option "git", :type => :string, :default => nil, :banner =>
"URL of the git repo to fetch from"
method_option "local_git", :type => :string, :default => nil, :banner =>
"Path of the local git repo to fetch from"
method_option "branch", :type => :string, :default => nil, :banner =>
"The git branch to checkout"
method_option "ref", :type => :string, :default => nil, :banner =>
"The git revision to check out"
def install(*plugins)
Bundler::Plugin.install(plugins, options)
end
desc "list", "List the installed plugins and available commands"
def list
Bundler::Plugin.list
end
end
end
bundler-2.1.4/lib/bundler/cli/viz.rb 0000644 0000041 0000041 00000002076 13606335352 017321 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Viz
attr_reader :options, :gem_name
def initialize(options)
@options = options
end
def run
# make sure we get the right `graphviz`. There is also a `graphviz`
# gem we're not built to support
gem "ruby-graphviz"
require "graphviz"
options[:without] = options[:without].join(":").tr(" ", ":").split(":")
output_file = File.expand_path(options[:file])
graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format], options[:without])
graph.viz
rescue LoadError => e
Bundler.ui.error e.inspect
Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:"
Bundler.ui.warn "`gem install ruby-graphviz`"
rescue StandardError => e
raise unless e.message =~ /GraphViz not installed or dot not in PATH/
Bundler.ui.error e.message
Bundler.ui.warn "Please install GraphViz. On a Mac with Homebrew, you can run `brew install graphviz`."
end
end
end
bundler-2.1.4/lib/bundler/cli/init.rb 0000644 0000041 0000041 00000002241 13606335352 017446 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Init
attr_reader :options
def initialize(options)
@options = options
end
def run
if File.exist?(gemfile)
Bundler.ui.error "#{gemfile} already exists at #{File.expand_path(gemfile)}"
exit 1
end
unless File.writable?(Dir.pwd)
Bundler.ui.error "Can not create #{gemfile} as the current directory is not writable."
exit 1
end
if options[:gemspec]
gemspec = File.expand_path(options[:gemspec])
unless File.exist?(gemspec)
Bundler.ui.error "Gem specification #{gemspec} doesn't exist"
exit 1
end
spec = Bundler.load_gemspec_uncached(gemspec)
File.open(gemfile, "wb") do |file|
file << "# Generated from #{gemspec}\n"
file << spec.to_gemfile
end
else
FileUtils.cp(File.expand_path("../../templates/#{gemfile}", __FILE__), gemfile)
end
puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
end
private
def gemfile
@gemfile ||= Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
end
end
end
bundler-2.1.4/lib/bundler/cli/info.rb 0000644 0000041 0000041 00000003402 13606335352 017436 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Info
attr_reader :gem_name, :options
def initialize(options, gem_name)
@options = options
@gem_name = gem_name
end
def run
Bundler.ui.silence do
Bundler.definition.validate_runtime!
Bundler.load.lock
end
spec = spec_for_gem(gem_name)
if spec
return print_gem_path(spec) if @options[:path]
print_gem_info(spec)
end
end
private
def spec_for_gem(gem_name)
spec = Bundler.definition.specs.find {|s| s.name == gem_name }
spec || default_gem_spec(gem_name) || Bundler::CLI::Common.select_spec(gem_name, :regex_match)
end
def default_gem_spec(gem_name)
return unless Gem::Specification.respond_to?(:find_all_by_name)
gem_spec = Gem::Specification.find_all_by_name(gem_name).last
return gem_spec if gem_spec && gem_spec.respond_to?(:default_gem?) && gem_spec.default_gem?
end
def spec_not_found(gem_name)
raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(gem_name, Bundler.definition.dependencies)
end
def print_gem_path(spec)
path = if spec.name == "bundler"
File.expand_path("../../../..", __FILE__)
else
spec.full_gem_path
end
Bundler.ui.info path
end
def print_gem_info(spec)
gem_info = String.new
gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n"
gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
gem_info << "\tPath: #{spec.full_gem_path}\n"
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
Bundler.ui.info gem_info
end
end
end
bundler-2.1.4/lib/bundler/cli/platform.rb 0000644 0000041 0000041 00000002607 13606335352 020335 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Platform
attr_reader :options
def initialize(options)
@options = options
end
def run
platforms, ruby_version = Bundler.ui.silence do
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version
gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
[Bundler.definition.platforms.map {|p| "* #{p}" },
locked_ruby_version || gemfile_ruby_version]
end
output = []
if options[:ruby]
if ruby_version
output << ruby_version
else
output << "No ruby version specified"
end
else
output << "Your platform is: #{RUBY_PLATFORM}"
output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
if ruby_version
output << "Your Gemfile specifies a Ruby version requirement:\n* #{ruby_version}"
begin
Bundler.definition.validate_runtime!
output << "Your current platform satisfies the Ruby version requirement."
rescue RubyVersionMismatch => e
output << e.message
end
else
output << "Your Gemfile does not specify a Ruby version requirement."
end
end
Bundler.ui.info output.join("\n\n")
end
end
end
bundler-2.1.4/lib/bundler/cli/add.rb 0000644 0000041 0000041 00000002727 13606335352 017244 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Add
attr_reader :gems, :options, :version
def initialize(options, gems)
@gems = gems
@options = options
@options[:group] = options[:group].split(",").map(&:strip) unless options[:group].nil?
@version = options[:version].split(",").map(&:strip) unless options[:version].nil?
end
def run
validate_options!
inject_dependencies
perform_bundle_install unless options["skip-install"]
end
private
def perform_bundle_install
Installer.install(Bundler.root, Bundler.definition)
Bundler.load.cache if Bundler.app_cache.exist?
end
def inject_dependencies
dependencies = gems.map {|g| Bundler::Dependency.new(g, version, options) }
Injector.inject(dependencies,
:conservative_versioning => options[:version].nil?, # Perform conservative versioning only when version is not specified
:optimistic => options[:optimistic],
:strict => options[:strict])
end
def validate_options!
raise InvalidOption, "You can not specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
# raise error when no gems are specified
raise InvalidOption, "Please specify gems to add." if gems.empty?
version.to_a.each do |v|
raise InvalidOption, "Invalid gem requirement pattern '#{v}'" unless Gem::Requirement::PATTERN =~ v.to_s
end
end
end
end
bundler-2.1.4/lib/bundler/cli/show.rb 0000644 0000041 0000041 00000004346 13606335352 017473 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Show
attr_reader :options, :gem_name, :latest_specs
def initialize(options, gem_name)
@options = options
@gem_name = gem_name
@verbose = options[:verbose] || options[:outdated]
@latest_specs = fetch_latest_specs if @verbose
end
def run
Bundler.ui.silence do
Bundler.definition.validate_runtime!
Bundler.load.lock
end
if gem_name
if gem_name == "bundler"
path = File.expand_path("../../../..", __FILE__)
else
spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
return unless spec
path = spec.full_gem_path
unless File.directory?(path)
return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
end
end
return Bundler.ui.info(path)
end
if options[:paths]
Bundler.load.specs.sort_by(&:name).map do |s|
Bundler.ui.info s.full_gem_path
end
else
Bundler.ui.info "Gems included by the bundle:"
Bundler.load.specs.sort_by(&:name).each do |s|
desc = " * #{s.name} (#{s.version}#{s.git_version})"
if @verbose
latest = latest_specs.find {|l| l.name == s.name }
Bundler.ui.info <<-END.gsub(/^ +/, "")
#{desc}
\tSummary: #{s.summary || "No description available."}
\tHomepage: #{s.homepage || "No website available."}
\tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"}
END
else
Bundler.ui.info desc
end
end
end
end
private
def fetch_latest_specs
definition = Bundler.definition(true)
if options[:outdated]
Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
Bundler.ui.silence { definition.resolve_remotely! }
else
definition.resolve_with_cache!
end
Bundler.reset!
definition.specs
end
def outdated?(current, latest)
return false unless latest
Gem::Version.new(current.version) < Gem::Version.new(latest.version)
end
end
end
bundler-2.1.4/lib/bundler/cli/pristine.rb 0000644 0000041 0000041 00000002773 13606335352 020352 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Pristine
def initialize(gems)
@gems = gems
end
def run
CLI::Common.ensure_all_gems_in_lockfile!(@gems)
definition = Bundler.definition
definition.validate_runtime!
installer = Bundler::Installer.new(Bundler.root, definition)
Bundler.load.specs.each do |spec|
next if spec.name == "bundler" # Source::Rubygems doesn't install bundler
next if !@gems.empty? && !@gems.include?(spec.name)
gem_name = "#{spec.name} (#{spec.version}#{spec.git_version})"
gem_name += " (#{spec.platform})" if !spec.platform.nil? && spec.platform != Gem::Platform::RUBY
case source = spec.source
when Source::Rubygems
cached_gem = spec.cache_file
unless File.exist?(cached_gem)
Bundler.ui.error("Failed to pristine #{gem_name}. Cached gem #{cached_gem} does not exist.")
next
end
FileUtils.rm_rf spec.full_gem_path
when Source::Git
source.remote!
if extension_cache_path = source.extension_cache_path(spec)
FileUtils.rm_rf extension_cache_path
end
FileUtils.rm_rf spec.extension_dir
FileUtils.rm_rf spec.full_gem_path
else
Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
next
end
Bundler::GemInstaller.new(spec, installer, false, 0, true).install_from_spec
end
end
end
end
bundler-2.1.4/lib/bundler/cli/clean.rb 0000644 0000041 0000041 00000001136 13606335352 017567 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Clean
attr_reader :options
def initialize(options)
@options = options
end
def run
require_path_or_force unless options[:"dry-run"]
Bundler.load.clean(options[:"dry-run"])
end
protected
def require_path_or_force
return unless Bundler.use_system_gems? && !options[:force]
raise InvalidOption, "Cleaning all the gems on your system is dangerous! " \
"If you're sure you want to remove every system gem not in this " \
"bundle, run `bundle clean --force`."
end
end
end
bundler-2.1.4/lib/bundler/cli/install.rb 0000644 0000041 0000041 00000021500 13606335352 020150 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Install
attr_reader :options
def initialize(options)
@options = options
end
def run
Bundler.ui.level = "error" if options[:quiet]
warn_if_root
normalize_groups
Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
# Disable color in deployment mode
Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
check_for_options_conflicts
check_trust_policy
if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
unless Bundler.default_lockfile.exist?
flag = "--deployment flag" if options[:deployment]
flag ||= "--frozen flag" if options[:frozen]
flag ||= "deployment setting"
raise ProductionError, "The #{flag} requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \
"sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \
"before deploying."
end
options[:local] = true if Bundler.app_cache.exist?
if Bundler.feature_flag.deployment_means_frozen?
Bundler.settings.set_command_option :deployment, true
else
Bundler.settings.set_command_option :deployment, true if options[:deployment]
Bundler.settings.set_command_option :frozen, true if options[:frozen]
end
end
# When install is called with --no-deployment, disable deployment mode
if options[:deployment] == false
Bundler.settings.set_command_option :frozen, nil
options[:system] = true
end
normalize_settings
Bundler::Fetcher.disable_endpoint = options["full-index"]
if options["binstubs"]
Bundler::SharedHelpers.major_deprecation 2,
"The --binstubs option will be removed in favor of `bundle binstubs`"
end
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
definition = Bundler.definition
definition.validate_runtime!
installer = Installer.install(Bundler.root, definition, options)
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
Bundler::CLI::Common.output_without_groups_message(:install)
if Bundler.use_system_gems?
Bundler.ui.confirm "Use `bundle info [gemname]` to see where a bundled gem is installed."
else
relative_path = Bundler.configured_bundle_path.base_path_relative_to_pwd
Bundler.ui.confirm "Bundled gems are installed into `#{relative_path}`"
end
Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
warn_ambiguous_gems
if CLI::Common.clean_after_install?
require_relative "clean"
Bundler::CLI::Clean.new(options).run
end
rescue GemNotFound, VersionConflict => e
if options[:local] && Bundler.app_cache.exist?
Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
end
unless Bundler.definition.has_rubygems_remotes?
Bundler.ui.warn <<-WARN, :wrap => true
Your Gemfile has no gem server sources. If you need gems that are \
not already on your machine, add a line like this to your Gemfile:
source 'https://rubygems.org'
WARN
end
raise e
rescue Gem::InvalidSpecificationException => e
Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
raise e
end
private
def warn_if_root
return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero?
Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
"if it is needed, and installing your bundle as root will break this " \
"application for all non-root users on this machine.", :wrap => true
end
def dependencies_count_for(definition)
count = definition.dependencies.count
"#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
end
def gems_installed_for(definition)
count = definition.specs.count
"#{count} #{count == 1 ? "gem" : "gems"} now installed"
end
def check_for_group_conflicts_in_cli_options
conflicting_groups = Array(options[:without]) & Array(options[:with])
return if conflicting_groups.empty?
raise InvalidOption, "You can't list a group in both with and without." \
" The offending groups are: #{conflicting_groups.join(", ")}."
end
def check_for_options_conflicts
if (options[:path] || options[:deployment]) && options[:system]
error_message = String.new
error_message << "You have specified both --path as well as --system. Please choose only one option.\n" if options[:path]
error_message << "You have specified both --deployment as well as --system. Please choose only one option.\n" if options[:deployment]
raise InvalidOption.new(error_message)
end
end
def check_trust_policy
trust_policy = options["trust-policy"]
unless Bundler.rubygems.security_policies.keys.unshift(nil).include?(trust_policy)
raise InvalidOption, "RubyGems doesn't know about trust policy '#{trust_policy}'. " \
"The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
end
Bundler.settings.set_command_option_if_given :"trust-policy", trust_policy
end
def normalize_groups
options[:with] &&= options[:with].join(":").tr(" ", ":").split(":")
options[:without] &&= options[:without].join(":").tr(" ", ":").split(":")
check_for_group_conflicts_in_cli_options
Bundler.settings.set_command_option :with, nil if options[:with] == []
Bundler.settings.set_command_option :without, nil if options[:without] == []
with = options.fetch(:with, [])
with |= Bundler.settings[:with].map(&:to_s)
with -= options[:without] if options[:without]
without = options.fetch(:without, [])
without |= Bundler.settings[:without].map(&:to_s)
without -= options[:with] if options[:with]
options[:with] = with
options[:without] = without
end
def normalize_settings
Bundler.settings.set_command_option :path, nil if options[:system]
Bundler.settings.temporary(:path_relative_to_cwd => false) do
Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
end
Bundler.settings.set_command_option_if_given :path, options[:path]
Bundler.settings.temporary(:path_relative_to_cwd => false) do
Bundler.settings.set_command_option :path, "bundle" if options["standalone"] && Bundler.settings[:path].nil?
end
bin_option = options["binstubs"]
bin_option = nil if bin_option && bin_option.empty?
Bundler.settings.set_command_option :bin, bin_option if options["binstubs"]
Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
Bundler.settings.set_command_option_if_given :jobs, options["jobs"]
Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
Bundler.settings.set_command_option_if_given :clean, options["clean"]
unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
# need to nil them out first to get around validation for backwards compatibility
Bundler.settings.set_command_option :without, nil
Bundler.settings.set_command_option :with, nil
Bundler.settings.set_command_option :without, options[:without] - options[:with]
Bundler.settings.set_command_option :with, options[:with]
end
options[:force] = options[:redownload]
end
def warn_ambiguous_gems
# TODO: remove this when we drop Bundler 1.x support
Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
Bundler.ui.warn "Warning: the gem '#{name}' was found in multiple sources."
Bundler.ui.warn "Installed from: #{installed_from_uri}"
Bundler.ui.warn "Also found in:"
also_found_in_uris.each {|uri| Bundler.ui.warn " * #{uri}" }
Bundler.ui.warn "You should add a source requirement to restrict this gem to your preferred source."
Bundler.ui.warn "For example:"
Bundler.ui.warn " gem '#{name}', :source => '#{installed_from_uri}'"
Bundler.ui.warn "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
end
end
end
end
bundler-2.1.4/lib/bundler/cli/common.rb 0000644 0000041 0000041 00000007013 13606335352 017775 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
module CLI::Common
def self.output_post_install_messages(messages)
return if Bundler.settings["ignore_messages"]
messages.to_a.each do |name, msg|
print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
end
end
def self.print_post_install_message(name, msg)
Bundler.ui.confirm "Post-install message from #{name}:"
Bundler.ui.info msg
end
def self.output_without_groups_message(command)
return if Bundler.settings[:without].empty?
Bundler.ui.confirm without_groups_message(command)
end
def self.without_groups_message(command)
command_in_past_tense = command == :install ? "installed" : "updated"
groups = Bundler.settings[:without]
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
reject {|s| s.to_s.empty? }.join(" and ")
group_str = groups.size == 1 ? "group" : "groups"
"Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
end
def self.select_spec(name, regex_match = nil)
specs = []
regexp = Regexp.new(name) if regex_match
Bundler.definition.specs.each do |spec|
return spec if spec.name == name
specs << spec if regexp && spec.name =~ regexp
end
case specs.count
when 0
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
when 1
specs.first
else
ask_for_spec_from(specs)
end
rescue RegexpError
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
end
def self.ask_for_spec_from(specs)
specs.each_with_index do |spec, index|
Bundler.ui.info "#{index.succ} : #{spec.name}", true
end
Bundler.ui.info "0 : - exit -", true
num = Bundler.ui.ask("> ").to_i
num > 0 ? specs[num - 1] : nil
end
def self.gem_not_found_message(missing_gem_name, alternatives)
require_relative "../similarity_detector"
message = "Could not find gem '#{missing_gem_name}'."
alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
message += "\nDid you mean #{suggestions}?" if suggestions
message
end
def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
locked_names = locked_gems.specs.map(&:name).uniq
names.-(locked_names).each do |g|
raise GemNotFound, gem_not_found_message(g, locked_names)
end
end
def self.configure_gem_version_promoter(definition, options)
patch_level = patch_level_options(options)
patch_level << :patch if patch_level.empty? && Bundler.settings[:prefer_patch]
raise InvalidOption, "Provide only one of the following options: #{patch_level.join(", ")}" unless patch_level.length <= 1
definition.gem_version_promoter.tap do |gvp|
gvp.level = patch_level.first || :major
gvp.strict = options[:strict] || options["update-strict"] || options["filter-strict"]
end
end
def self.patch_level_options(options)
[:major, :minor, :patch].select {|v| options.keys.include?(v.to_s) }
end
def self.clean_after_install?
clean = Bundler.settings[:clean]
return clean unless clean.nil?
clean ||= Bundler.feature_flag.auto_clean_without_path? && Bundler.settings[:path].nil?
clean &&= !Bundler.use_system_gems?
clean
end
end
end
bundler-2.1.4/lib/bundler/cli/binstubs.rb 0000644 0000041 0000041 00000003231 13606335352 020334 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Binstubs
attr_reader :options, :gems
def initialize(options, gems)
@options = options
@gems = gems
end
def run
Bundler.definition.validate_runtime!
path_option = options["path"]
path_option = nil if path_option && path_option.empty?
Bundler.settings.set_command_option :bin, path_option if options["path"]
Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
installer = Installer.new(Bundler.root, Bundler.definition)
installer_opts = { :force => options[:force], :binstubs_cmd => true }
if options[:all]
raise InvalidOption, "Cannot specify --all with specific gems" unless gems.empty?
@gems = Bundler.definition.specs.map(&:name)
installer_opts.delete(:binstubs_cmd)
elsif gems.empty?
Bundler.ui.error "`bundle binstubs` needs at least one gem to run."
exit 1
end
gems.each do |gem_name|
spec = Bundler.definition.specs.find {|s| s.name == gem_name }
unless spec
raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(
gem_name, Bundler.definition.specs
)
end
if options[:standalone]
next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
installer.generate_standalone_bundler_executable_stubs(spec)
end
else
installer.generate_bundler_executable_stubs(spec, installer_opts)
end
end
end
end
end
bundler-2.1.4/lib/bundler/cli/doctor.rb 0000644 0000041 0000041 00000007603 13606335352 020004 0 ustar www-data www-data # frozen_string_literal: true
require "rbconfig"
module Bundler
class CLI::Doctor
DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
attr_reader :options
def initialize(options)
@options = options
end
def otool_available?
Bundler.which("otool")
end
def ldd_available?
Bundler.which("ldd")
end
def dylibs_darwin(path)
output = `/usr/bin/otool -L "#{path}"`.chomp
dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
# ignore @rpath and friends
dylibs.reject {|dylib| dylib.start_with? "@" }
end
def dylibs_ldd(path)
output = `/usr/bin/ldd "#{path}"`.chomp
output.split("\n").map do |l|
match = l.match(LDD_REGEX)
next if match.nil?
match.captures[0]
end.compact
end
def dylibs(path)
case RbConfig::CONFIG["host_os"]
when /darwin/
return [] unless otool_available?
dylibs_darwin(path)
when /(linux|solaris|bsd)/
return [] unless ldd_available?
dylibs_ldd(path)
else # Windows, etc.
Bundler.ui.warn("Dynamic library check not supported on this platform.")
[]
end
end
def bundles_for_gem(spec)
Dir.glob("#{spec.full_gem_path}/**/*.bundle")
end
def check!
require_relative "check"
Bundler::CLI::Check.new({}).run
end
def run
Bundler.ui.level = "error" if options[:quiet]
Bundler.settings.validate!
check!
definition = Bundler.definition
broken_links = {}
definition.specs.each do |spec|
bundles_for_gem(spec).each do |bundle|
bad_paths = dylibs(bundle).select {|f| !File.exist?(f) }
if bad_paths.any?
broken_links[spec] ||= []
broken_links[spec].concat(bad_paths)
end
end
end
permissions_valid = check_home_permissions
if broken_links.any?
message = "The following gems are missing OS dependencies:"
broken_links.map do |spec, paths|
paths.uniq.map do |path|
"\n * #{spec.name}: #{path}"
end
end.flatten.sort.each {|m| message += m }
raise ProductionError, message
elsif !permissions_valid
Bundler.ui.info "No issues found with the installed bundle"
end
end
private
def check_home_permissions
require "find"
files_not_readable_or_writable = []
files_not_rw_and_owned_by_different_user = []
files_not_owned_by_current_user_but_still_rw = []
Find.find(Bundler.bundle_path.to_s).each do |f|
if !File.writable?(f) || !File.readable?(f)
if File.stat(f).uid != Process.uid
files_not_rw_and_owned_by_different_user << f
else
files_not_readable_or_writable << f
end
elsif File.stat(f).uid != Process.uid
files_not_owned_by_current_user_but_still_rw << f
end
end
ok = true
if files_not_owned_by_current_user_but_still_rw.any?
Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
"user, but are still readable/writable. These files are:\n - #{files_not_owned_by_current_user_but_still_rw.join("\n - ")}"
ok = false
end
if files_not_rw_and_owned_by_different_user.any?
Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
"user, and are not readable/writable. These files are:\n - #{files_not_rw_and_owned_by_different_user.join("\n - ")}"
ok = false
end
if files_not_readable_or_writable.any?
Bundler.ui.warn "Files exist in the Bundler home that are not " \
"readable/writable by the current user. These files are:\n - #{files_not_readable_or_writable.join("\n - ")}"
ok = false
end
ok
end
end
end
bundler-2.1.4/lib/bundler/cli/open.rb 0000644 0000041 0000041 00000001721 13606335352 017446 0 ustar www-data www-data # frozen_string_literal: true
require "shellwords"
module Bundler
class CLI::Open
attr_reader :options, :name
def initialize(options, name)
@options = options
@name = name
end
def run
editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match)
if spec.default_gem?
Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist."
else
path = spec.full_gem_path
Dir.chdir(path) do
command = Shellwords.split(editor) + [path]
Bundler.with_original_env do
system(*command)
end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
end
end
end
end
end
bundler-2.1.4/lib/bundler/cli/check.rb 0000644 0000041 0000041 00000002366 13606335352 017570 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Check
attr_reader :options
def initialize(options)
@options = options
end
def run
Bundler.settings.set_command_option_if_given :path, options[:path]
begin
definition = Bundler.definition
definition.validate_runtime!
not_installed = definition.missing_specs
rescue GemNotFound, VersionConflict
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
Bundler.ui.warn "Install missing gems with `bundle install`."
exit 1
end
if not_installed.any?
Bundler.ui.error "The following gems are missing"
not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" }
Bundler.ui.warn "Install missing gems with `bundle install`"
exit 1
elsif !Bundler.default_lockfile.file? && Bundler.frozen_bundle?
Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present"
exit 1
else
Bundler.load.lock(:preserve_unknown_sections => true) unless options[:"dry-run"]
Bundler.ui.info "The Gemfile's dependencies are satisfied"
end
end
end
end
bundler-2.1.4/lib/bundler/cli/remove.rb 0000644 0000041 0000041 00000000567 13606335352 020011 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Remove
def initialize(gems, options)
@gems = gems
@options = options
end
def run
raise InvalidOption, "Please specify gems to remove." if @gems.empty?
Injector.remove(@gems, {})
Installer.install(Bundler.root, Bundler.definition) if @options["install"]
end
end
end
bundler-2.1.4/lib/bundler/cli/update.rb 0000644 0000041 0000041 00000007525 13606335352 017777 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Update
attr_reader :options, :gems
def initialize(options, gems)
@options = options
@gems = gems
end
def run
Bundler.ui.level = "error" if options[:quiet]
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
sources = Array(options[:source])
groups = Array(options[:group]).map(&:to_sym)
full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
if full_update && !options[:all]
if Bundler.feature_flag.update_requires_all_flag?
raise InvalidOption, "To update everything, pass the `--all` flag."
end
SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything"
elsif !full_update && options[:all]
raise InvalidOption, "Cannot specify --all along with specific options."
end
if full_update
# We're doing a full update
Bundler.definition(true)
else
unless Bundler.default_lockfile.exist?
raise GemfileLockNotFound, "This Bundle hasn't been installed yet. " \
"Run `bundle install` to update and install the bundled gems."
end
Bundler::CLI::Common.ensure_all_gems_in_lockfile!(gems)
if groups.any?
deps = Bundler.definition.dependencies.select {|d| (d.groups & groups).any? }
gems.concat(deps.map(&:name))
end
Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
:lock_shared_dependencies => options[:conservative],
:bundler => options[:bundler])
end
Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
Bundler::Fetcher.disable_endpoint = options["full-index"]
opts = options.dup
opts["update"] = true
opts["local"] = options[:local]
Bundler.settings.set_command_option_if_given :jobs, opts["jobs"]
Bundler.definition.validate_runtime!
if locked_gems = Bundler.definition.locked_gems
previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
h[s.name] = { :spec => s, :version => s.version, :source => s.source.to_s }
h
end
end
installer = Installer.install Bundler.root, Bundler.definition, opts
Bundler.load.cache if Bundler.app_cache.exist?
if CLI::Common.clean_after_install?
require_relative "clean"
Bundler::CLI::Clean.new(options).run
end
if locked_gems
gems.each do |name|
locked_info = previous_locked_info[name]
next unless locked_info
locked_spec = locked_info[:spec]
new_spec = Bundler.definition.specs[name].first
unless new_spec
if Bundler.rubygems.platforms.none? {|p| locked_spec.match_platform(p) }
Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one"
end
next
end
locked_source = locked_info[:source]
new_source = new_spec.source.to_s
next if locked_source != new_source
new_version = new_spec.version
locked_version = locked_info[:version]
if new_version < locked_version
Bundler.ui.warn "Note: #{name} version regressed from #{locked_version} to #{new_version}"
elsif new_version == locked_version
Bundler.ui.warn "Bundler attempted to update #{name} but its version stayed the same"
end
end
end
Bundler.ui.confirm "Bundle updated!"
Bundler::CLI::Common.output_without_groups_message(:update)
Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
end
end
end
bundler-2.1.4/lib/bundler/cli/console.rb 0000644 0000041 0000041 00000002063 13606335352 020147 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Console
attr_reader :options, :group
def initialize(options, group)
@options = options
@group = group
end
def run
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem `"
group ? Bundler.require(:default, *group.split.map!(&:to_sym)) : Bundler.require
ARGV.clear
console = get_console(Bundler.settings[:console] || "irb")
console.start
end
def get_console(name)
require name
get_constant(name)
rescue LoadError
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
require "irb"
get_constant("irb")
end
def get_constant(name)
const_name = {
"pry" => :Pry,
"ripl" => :Ripl,
"irb" => :IRB,
}[name]
Object.const_get(const_name)
rescue NameError
Bundler.ui.error "Could not find constant #{const_name}"
exit 1
end
end
end
bundler-2.1.4/lib/bundler/cli/config.rb 0000644 0000041 0000041 00000013575 13606335352 017764 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Config < Thor
class_option :parseable, :type => :boolean, :banner => "Use minimal formatting for more parseable output"
def self.scope_options
method_option :global, :type => :boolean, :banner => "Only change the global config"
method_option :local, :type => :boolean, :banner => "Only change the local config"
end
private_class_method :scope_options
desc "base NAME [VALUE]", "The Bundler 1 config interface", :hide => true
scope_options
method_option :delete, :type => :boolean, :banner => "delete"
def base(name = nil, *value)
new_args =
if ARGV.size == 1
["config", "list"]
elsif ARGV.include?("--delete")
ARGV.map {|arg| arg == "--delete" ? "unset" : arg }
elsif ARGV.include?("--global") || ARGV.include?("--local") || ARGV.size == 3
["config", "set", *ARGV[1..-1]]
else
["config", "get", ARGV[1]]
end
SharedHelpers.major_deprecation 3,
"Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
Base.new(options, name, value, self).run
end
desc "list", "List out all configured settings"
def list
Base.new(options, nil, nil, self).run
end
desc "get NAME", "Returns the value for the given key"
def get(name)
Base.new(options, name, nil, self).run
end
desc "set NAME VALUE", "Sets the given value for the given key"
scope_options
def set(name, value, *value_)
Base.new(options, name, value_.unshift(value), self).run
end
desc "unset NAME", "Unsets the value for the given key"
scope_options
def unset(name)
options[:delete] = true
Base.new(options, name, nil, self).run
end
default_task :base
class Base
attr_reader :name, :value, :options, :scope, :thor
def initialize(options, name, value, thor)
@options = options
@name = name
value = Array(value)
@value = value.empty? ? nil : value.join(" ")
@thor = thor
validate_scope!
end
def run
unless name
warn_unused_scope "Ignoring --#{scope}"
confirm_all
return
end
if options[:delete]
if !explicit_scope? || scope != "global"
Bundler.settings.set_local(name, nil)
end
if !explicit_scope? || scope != "local"
Bundler.settings.set_global(name, nil)
end
return
end
if value.nil?
warn_unused_scope "Ignoring --#{scope} since no value to set was given"
if options[:parseable]
if value = Bundler.settings[name]
Bundler.ui.info("#{name}=#{value}")
end
return
end
confirm(name)
return
end
Bundler.ui.info(message) if message
Bundler.settings.send("set_#{scope}", name, new_value)
end
def confirm_all
if @options[:parseable]
thor.with_padding do
Bundler.settings.all.each do |setting|
val = Bundler.settings[setting]
Bundler.ui.info "#{setting}=#{val}"
end
end
else
Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
Bundler.settings.all.each do |setting|
Bundler.ui.confirm setting
show_pretty_values_for(setting)
Bundler.ui.confirm ""
end
end
end
def confirm(name)
Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
show_pretty_values_for(name)
end
def new_value
pathname = Pathname.new(value)
if name.start_with?("local.") && pathname.directory?
pathname.expand_path.to_s
else
value
end
end
def message
locations = Bundler.settings.locations(name)
if @options[:parseable]
"#{name}=#{new_value}" if new_value
elsif scope == "global"
if !locations[:local].nil?
"Your application has set #{name} to #{locations[:local].inspect}. " \
"This will override the global value you are currently setting"
elsif locations[:env]
"You have a bundler environment variable for #{name} set to " \
"#{locations[:env].inspect}. This will take precedence over the global value you are setting"
elsif !locations[:global].nil? && locations[:global] != value
"You are replacing the current global value of #{name}, which is currently " \
"#{locations[:global].inspect}"
end
elsif scope == "local" && !locations[:local].nil? && locations[:local] != value
"You are replacing the current local value of #{name}, which is currently " \
"#{locations[:local].inspect}"
end
end
def show_pretty_values_for(setting)
thor.with_padding do
Bundler.settings.pretty_values_for(setting).each do |line|
Bundler.ui.info line
end
end
end
def explicit_scope?
@explicit_scope
end
def warn_unused_scope(msg)
return unless explicit_scope?
return if options[:parseable]
Bundler.ui.warn(msg)
end
def validate_scope!
@explicit_scope = true
scopes = %w[global local].select {|s| options[s] }
case scopes.size
when 0
@scope = "global"
@explicit_scope = false
when 1
@scope = scopes.first
else
raise InvalidOption,
"The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
end
end
end
end
end
bundler-2.1.4/lib/bundler/cli/inject.rb 0000644 0000041 0000041 00000004165 13606335352 017766 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Inject
attr_reader :options, :name, :version, :group, :source, :gems
def initialize(options, name, version)
@options = options
@name = name
@version = version || last_version_number
@group = options[:group].split(",") unless options[:group].nil?
@source = options[:source]
@gems = []
end
def run
# The required arguments allow Thor to give useful feedback when the arguments
# are incorrect. This adds those first two arguments onto the list as a whole.
gems.unshift(source).unshift(group).unshift(version).unshift(name)
# Build an array of Dependency objects out of the arguments
deps = []
# when `inject` support addition of more than one gem, then this loop will
# help. Currently this loop is running once.
gems.each_slice(4) do |gem_name, gem_version, gem_group, gem_source|
ops = Gem::Requirement::OPS.map {|key, _val| key }
has_op = ops.any? {|op| gem_version.start_with? op }
gem_version = "~> #{gem_version}" unless has_op
deps << Bundler::Dependency.new(gem_name, gem_version, "group" => gem_group, "source" => gem_source)
end
added = Injector.inject(deps, options)
if added.any?
Bundler.ui.confirm "Added to Gemfile:"
Bundler.ui.confirm(added.map do |d|
name = "'#{d.name}'"
requirement = ", '#{d.requirement}'"
group = ", :group => #{d.groups.inspect}" if d.groups != Array(:default)
source = ", :source => '#{d.source}'" unless d.source.nil?
%(gem #{name}#{requirement}#{group}#{source})
end.join("\n"))
else
Bundler.ui.confirm "All gems were already present in the Gemfile"
end
end
private
def last_version_number
definition = Bundler.definition(true)
definition.resolve_remotely!
specs = definition.index[name].sort_by(&:version)
unless options[:pre]
specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
end
spec = specs.last
spec.version.to_s
end
end
end
bundler-2.1.4/lib/bundler/cli/issue.rb 0000644 0000041 0000041 00000002376 13606335352 017644 0 ustar www-data www-data # frozen_string_literal: true
require "rbconfig"
module Bundler
class CLI::Issue
def run
Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
Did you find an issue with Bundler? Before filing a new issue,
be sure to check out these resources:
1. Check out our troubleshooting guide for quick fixes to common issues:
https://github.com/bundler/bundler/blob/master/doc/TROUBLESHOOTING.md
2. Instructions for common Bundler uses can be found on the documentation
site: https://bundler.io/
3. Information about each Bundler command can be found in the Bundler
man pages: https://bundler.io/man/bundle.1.html
Hopefully the troubleshooting steps above resolved your problem! If things
still aren't working the way you expect them to, please let us know so
that we can diagnose and help fix the problem you're having. Please
view the Filing Issues guide for more information:
https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md
EOS
Bundler.ui.info Bundler::Env.report
Bundler.ui.info "\n## Bundle Doctor"
doctor
end
def doctor
require_relative "doctor"
Bundler::CLI::Doctor.new({}).run
end
end
end
bundler-2.1.4/lib/bundler/cli/outdated.rb 0000644 0000041 0000041 00000020526 13606335352 020322 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class CLI::Outdated
attr_reader :options, :gems, :options_include_groups, :filter_options_patch, :sources, :strict
attr_accessor :outdated_gems_by_groups, :outdated_gems_list
def initialize(options, gems)
@options = options
@gems = gems
@sources = Array(options[:source])
@filter_options_patch = options.keys &
%w[filter-major filter-minor filter-patch]
@outdated_gems_by_groups = {}
@outdated_gems_list = []
@options_include_groups = [:group, :groups].any? do |v|
options.keys.include?(v.to_s)
end
# the patch level options imply strict is also true. It wouldn't make
# sense otherwise.
@strict = options["filter-strict"] ||
Bundler::CLI::Common.patch_level_options(options).any?
end
def run
check_for_deployment_mode!
gems.each do |gem_name|
Bundler::CLI::Common.select_spec(gem_name)
end
Bundler.definition.validate_runtime!
current_specs = Bundler.ui.silence { Bundler.definition.resolve }
current_dependencies = Bundler.ui.silence do
Bundler.load.dependencies.map {|dep| [dep.name, dep] }.to_h
end
definition = if gems.empty? && sources.empty?
# We're doing a full update
Bundler.definition(true)
else
Bundler.definition(:gems => gems, :sources => sources)
end
Bundler::CLI::Common.configure_gem_version_promoter(
Bundler.definition,
options
)
definition_resolution = proc do
options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely!
end
if options[:parseable]
Bundler.ui.silence(&definition_resolution)
else
definition_resolution.call
end
Bundler.ui.info ""
# Loop through the current specs
gemfile_specs, dependency_specs = current_specs.partition do |spec|
current_dependencies.key? spec.name
end
specs = if options["only-explicit"]
gemfile_specs
else
gemfile_specs + dependency_specs
end
specs.sort_by(&:name).each do |current_spec|
next if !gems.empty? && !gems.include?(current_spec.name)
dependency = current_dependencies[current_spec.name]
active_spec = retrieve_active_spec(definition, current_spec)
next if active_spec.nil?
next if filter_options_patch.any? &&
!update_present_via_semver_portions(current_spec, active_spec, options)
gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
next unless gem_outdated || (current_spec.git_version != active_spec.git_version)
groups = nil
if dependency && !options[:parseable]
groups = dependency.groups.join(", ")
end
outdated_gems_list << { :active_spec => active_spec,
:current_spec => current_spec,
:dependency => dependency,
:groups => groups }
outdated_gems_by_groups[groups] ||= []
outdated_gems_by_groups[groups] << outdated_gems_list[-1]
end
if outdated_gems_list.empty?
display_nothing_outdated_message
else
unless options[:parseable]
Bundler.ui.info(header_outdated_message)
end
if options_include_groups
ordered_groups = outdated_gems_by_groups.keys.compact.sort
ordered_groups.insert(0, nil).each do |groups|
gems = outdated_gems_by_groups[groups]
contains_group = if groups
groups.split(", ").include?(options[:group])
else
options[:group] == "group"
end
next if (!options[:groups] && !contains_group) || gems.nil?
unless options[:parseable]
Bundler.ui.info(header_group_message(groups))
end
print_gems(gems)
end
else
print_gems(outdated_gems_list)
end
exit 1
end
end
private
def groups_text(group_text, groups)
"#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
end
def header_outdated_message
if options[:pre]
"Outdated gems included in the bundle (including pre-releases):"
else
"Outdated gems included in the bundle:"
end
end
def header_group_message(groups)
if groups
"===== #{groups_text("Group", groups)} ====="
else
"===== Without group ====="
end
end
def nothing_outdated_message
if filter_options_patch.any?
display = filter_options_patch.map do |o|
o.sub("filter-", "")
end.join(" or ")
"No #{display} updates to display.\n"
else
"Bundle up to date!\n"
end
end
def retrieve_active_spec(definition, current_spec)
if strict
active_spec = definition.find_resolved_spec(current_spec)
else
active_specs = definition.find_indexed_specs(current_spec)
if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
end
active_spec = active_specs.last
end
active_spec
end
def display_nothing_outdated_message
unless options[:parseable]
Bundler.ui.info(nothing_outdated_message)
end
end
def print_gems(gems_list)
gems_list.each do |gem|
print_gem(
gem[:current_spec],
gem[:active_spec],
gem[:dependency],
gem[:groups],
)
end
end
def print_gem(current_spec, active_spec, dependency, groups)
spec_version = "#{active_spec.version}#{active_spec.git_version}"
spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
current_version = "#{current_spec.version}#{current_spec.git_version}"
if dependency && dependency.specific?
dependency_version = %(, requested #{dependency.requirement})
end
spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, " \
"installed #{current_version}#{dependency_version})"
output_message = if options[:parseable]
spec_outdated_info.to_s
elsif options_include_groups || !groups
" * #{spec_outdated_info}"
else
" * #{spec_outdated_info} in #{groups_text("group", groups)}"
end
Bundler.ui.info output_message.rstrip
end
def check_for_deployment_mode!
return unless Bundler.frozen_bundle?
suggested_command = if Bundler.settings.locations("frozen")[:global]
"bundle config unset frozen"
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
"bundle config unset deployment"
else
"bundle install --no-deployment"
end
raise ProductionError, "You are trying to check outdated gems in " \
"deployment mode. Run `bundle outdated` elsewhere.\n" \
"\nIf this is a development machine, remove the " \
"#{Bundler.default_gemfile} freeze" \
"\nby running `#{suggested_command}`."
end
def update_present_via_semver_portions(current_spec, active_spec, options)
current_major = current_spec.version.segments.first
active_major = active_spec.version.segments.first
update_present = false
update_present = active_major > current_major if options["filter-major"]
if !update_present && (options["filter-minor"] || options["filter-patch"]) && current_major == active_major
current_minor = get_version_semver_portion_value(current_spec, 1)
active_minor = get_version_semver_portion_value(active_spec, 1)
update_present = active_minor > current_minor if options["filter-minor"]
if !update_present && options["filter-patch"] && current_minor == active_minor
current_patch = get_version_semver_portion_value(current_spec, 2)
active_patch = get_version_semver_portion_value(active_spec, 2)
update_present = active_patch > current_patch
end
end
update_present
end
def get_version_semver_portion_value(spec, version_portion_index)
version_section = spec.version.segments[version_portion_index, 1]
version_section.to_a[0].to_i
end
end
end
bundler-2.1.4/lib/bundler/version_ranges.rb 0000644 0000041 0000041 00000007460 13606335352 020770 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
module VersionRanges
NEq = Struct.new(:version)
ReqR = Struct.new(:left, :right)
class ReqR
Endpoint = Struct.new(:version, :inclusive) do
def <=>(other)
if version.equal?(INFINITY)
return 0 if other.version.equal?(INFINITY)
return 1
elsif other.version.equal?(INFINITY)
return -1
end
comp = version <=> other.version
return comp unless comp.zero?
if inclusive && !other.inclusive
1
elsif !inclusive && other.inclusive
-1
else
0
end
end
end
def to_s
"#{left.inclusive ? "[" : "("}#{left.version}, #{right.version}#{right.inclusive ? "]" : ")"}"
end
INFINITY = begin
inf = Object.new
def inf.to_s
"∞"
end
def inf.<=>(other)
return 0 if other.equal?(self)
1
end
inf.freeze
end
ZERO = Gem::Version.new("0.a")
def cover?(v)
return false if left.inclusive && left.version > v
return false if !left.inclusive && left.version >= v
if right.version != INFINITY
return false if right.inclusive && right.version < v
return false if !right.inclusive && right.version <= v
end
true
end
def empty?
left.version == right.version && !(left.inclusive && right.inclusive)
end
def single?
left.version == right.version
end
def <=>(other)
return -1 if other.equal?(INFINITY)
comp = left <=> other.left
return comp unless comp.zero?
right <=> other.right
end
UNIVERSAL = ReqR.new(ReqR::Endpoint.new(Gem::Version.new("0.a"), true), ReqR::Endpoint.new(ReqR::INFINITY, false)).freeze
end
def self.for_many(requirements)
requirements = requirements.map(&:requirements).flatten(1).map {|r| r.join(" ") }
requirements << ">= 0.a" if requirements.empty?
requirement = Gem::Requirement.new(requirements)
self.for(requirement)
end
def self.for(requirement)
ranges = requirement.requirements.map do |op, v|
case op
when "=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v, true))
when "!=" then NEq.new(v)
when ">=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(ReqR::INFINITY, false))
when ">" then ReqR.new(ReqR::Endpoint.new(v, false), ReqR::Endpoint.new(ReqR::INFINITY, false))
when "<" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, false))
when "<=" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, true))
when "~>" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v.bump, false))
else raise "unknown version op #{op} in requirement #{requirement}"
end
end.uniq
ranges, neqs = ranges.partition {|r| !r.is_a?(NEq) }
[ranges.sort, neqs.map(&:version)]
end
def self.empty?(ranges, neqs)
!ranges.reduce(ReqR::UNIVERSAL) do |last_range, curr_range|
next false unless last_range
next false if curr_range.single? && neqs.include?(curr_range.left.version)
next curr_range if last_range.right.version == ReqR::INFINITY
case last_range.right.version <=> curr_range.left.version
# higher
when 1 then next ReqR.new(curr_range.left, last_range.right)
# equal
when 0
if last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version)
ReqR.new(curr_range.left, [curr_range.right, last_range.right].max)
end
# lower
when -1 then next false
end
end
end
end
end
bundler-2.1.4/lib/bundler/gem_helpers.rb 0000644 0000041 0000041 00000006305 13606335352 020233 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
module GemHelpers
GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
GENERICS = [
[Gem::Platform.new("java"), Gem::Platform.new("java")],
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
[Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
[Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
[Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
[Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")],
].freeze
def generic(p)
GENERIC_CACHE[p] ||= begin
_, found = GENERICS.find do |match, _generic|
p.os == match.os && (!match.cpu || p.cpu == match.cpu)
end
found || Gem::Platform::RUBY
end
end
module_function :generic
def generic_local_platform
generic(Bundler.local_platform)
end
module_function :generic_local_platform
def platform_specificity_match(spec_platform, user_platform)
spec_platform = Gem::Platform.new(spec_platform)
return PlatformMatch::EXACT_MATCH if spec_platform == user_platform
return PlatformMatch::WORST_MATCH if spec_platform.nil? || spec_platform == Gem::Platform::RUBY || user_platform == Gem::Platform::RUBY
PlatformMatch.new(
PlatformMatch.os_match(spec_platform, user_platform),
PlatformMatch.cpu_match(spec_platform, user_platform),
PlatformMatch.platform_version_match(spec_platform, user_platform)
)
end
module_function :platform_specificity_match
def select_best_platform_match(specs, platform)
specs.select {|spec| spec.match_platform(platform) }.
min_by {|spec| platform_specificity_match(spec.platform, platform) }
end
module_function :select_best_platform_match
PlatformMatch = Struct.new(:os_match, :cpu_match, :platform_version_match)
class PlatformMatch
def <=>(other)
return nil unless other.is_a?(PlatformMatch)
m = os_match <=> other.os_match
return m unless m.zero?
m = cpu_match <=> other.cpu_match
return m unless m.zero?
m = platform_version_match <=> other.platform_version_match
m
end
EXACT_MATCH = new(-1, -1, -1).freeze
WORST_MATCH = new(1_000_000, 1_000_000, 1_000_000).freeze
def self.os_match(spec_platform, user_platform)
if spec_platform.os == user_platform.os
0
else
1
end
end
def self.cpu_match(spec_platform, user_platform)
if spec_platform.cpu == user_platform.cpu
0
elsif spec_platform.cpu == "arm" && user_platform.cpu.to_s.start_with?("arm")
0
elsif spec_platform.cpu.nil? || spec_platform.cpu == "universal"
1
else
2
end
end
def self.platform_version_match(spec_platform, user_platform)
if spec_platform.version == user_platform.version
0
elsif spec_platform.version.nil?
1
else
2
end
end
end
end
end
bundler-2.1.4/lib/bundler/yaml_serializer.rb 0000644 0000041 0000041 00000004554 13606335352 021140 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
# A stub yaml serializer that can handle only hashes and strings (as of now).
module YAMLSerializer
module_function
def dump(hash)
yaml = String.new("---")
yaml << dump_hash(hash)
end
def dump_hash(hash)
yaml = String.new("\n")
hash.each do |k, v|
yaml << k << ":"
if v.is_a?(Hash)
yaml << dump_hash(v).gsub(/^(?!$)/, " ") # indent all non-empty lines
elsif v.is_a?(Array) # Expected to be array of strings
yaml << "\n- " << v.map {|s| s.to_s.gsub(/\s+/, " ").inspect }.join("\n- ") << "\n"
else
yaml << " " << v.to_s.gsub(/\s+/, " ").inspect << "\n"
end
end
yaml
end
ARRAY_REGEX = /
^
(?:[ ]*-[ ]) # '- ' before array items
(['"]?) # optional opening quote
(.*) # value
\1 # matching closing quote
$
/xo.freeze
HASH_REGEX = /
^
([ ]*) # indentations
(.+) # key
(?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
[ ]?
(['"]?) # optional opening quote
(.*) # value
\3 # matching closing quote
$
/xo.freeze
def load(str)
res = {}
stack = [res]
last_hash = nil
last_empty_key = nil
str.split(/\r?\n/).each do |line|
if match = HASH_REGEX.match(line)
indent, key, quote, val = match.captures
key = convert_to_backward_compatible_key(key)
depth = indent.scan(/ /).length
if quote.empty? && val.empty?
new_hash = {}
stack[depth][key] = new_hash
stack[depth + 1] = new_hash
last_empty_key = key
last_hash = stack[depth]
else
stack[depth][key] = val
end
elsif match = ARRAY_REGEX.match(line)
_, val = match.captures
last_hash[last_empty_key] = [] unless last_hash[last_empty_key].is_a?(Array)
last_hash[last_empty_key].push(val)
end
end
res
end
# for settings' keys
def convert_to_backward_compatible_key(key)
key = "#{key}/" if key =~ /https?:/i && key !~ %r{/\Z}
key = key.gsub(".", "__") if key.include?(".")
key
end
class << self
private :dump_hash, :convert_to_backward_compatible_key
end
end
end
bundler-2.1.4/lib/bundler/errors.rb 0000644 0000041 0000041 00000011134 13606335352 017251 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class BundlerError < StandardError
def self.status_code(code)
define_method(:status_code) { code }
if match = BundlerError.all_errors.find {|_k, v| v == code }
error, _ = match
raise ArgumentError,
"Trying to register #{self} for status code #{code} but #{error} is already registered"
end
BundlerError.all_errors[self] = code
end
def self.all_errors
@all_errors ||= {}
end
end
class GemfileError < BundlerError; status_code(4); end
class InstallError < BundlerError; status_code(5); end
# Internal error, should be rescued
class VersionConflict < BundlerError
attr_reader :conflicts
def initialize(conflicts, msg = nil)
super(msg)
@conflicts = conflicts
end
status_code(6)
end
class GemNotFound < BundlerError; status_code(7); end
class InstallHookError < BundlerError; status_code(8); end
class GemfileNotFound < BundlerError; status_code(10); end
class GitError < BundlerError; status_code(11); end
class DeprecatedError < BundlerError; status_code(12); end
class PathError < BundlerError; status_code(13); end
class GemspecError < BundlerError; status_code(14); end
class InvalidOption < BundlerError; status_code(15); end
class ProductionError < BundlerError; status_code(16); end
class HTTPError < BundlerError
status_code(17)
def filter_uri(uri)
URICredentialsFilter.credential_filtered_uri(uri)
end
end
class RubyVersionMismatch < BundlerError; status_code(18); end
class SecurityError < BundlerError; status_code(19); end
class LockfileError < BundlerError; status_code(20); end
class CyclicDependencyError < BundlerError; status_code(21); end
class GemfileLockNotFound < BundlerError; status_code(22); end
class PluginError < BundlerError; status_code(29); end
class SudoNotPermittedError < BundlerError; status_code(30); end
class ThreadCreationError < BundlerError; status_code(33); end
class APIResponseMismatchError < BundlerError; status_code(34); end
class GemfileEvalError < GemfileError; end
class MarshalError < StandardError; end
class PermissionError < BundlerError
def initialize(path, permission_type = :write)
@path = path
@permission_type = permission_type
end
def action
case @permission_type
when :read then "read from"
when :write then "write to"
when :executable, :exec then "execute"
else @permission_type.to_s
end
end
def message
"There was an error while trying to #{action} `#{@path}`. " \
"It is likely that you need to grant #{@permission_type} permissions " \
"for that path."
end
status_code(23)
end
class GemRequireError < BundlerError
attr_reader :orig_exception
def initialize(orig_exception, msg)
full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
"Backtrace for gem load error is:\n"\
"#{orig_exception.backtrace.join("\n")}\n"\
"Bundler Error Backtrace:\n"
super(full_message)
@orig_exception = orig_exception
end
status_code(24)
end
class YamlSyntaxError < BundlerError
attr_reader :orig_exception
def initialize(orig_exception, msg)
super(msg)
@orig_exception = orig_exception
end
status_code(25)
end
class TemporaryResourceError < PermissionError
def message
"There was an error while trying to #{action} `#{@path}`. " \
"Some resource was temporarily unavailable. It's suggested that you try" \
"the operation again."
end
status_code(26)
end
class VirtualProtocolError < BundlerError
def message
"There was an error relating to virtualization and file access." \
"It is likely that you need to grant access to or mount some file system correctly."
end
status_code(27)
end
class OperationNotSupportedError < PermissionError
def message
"Attempting to #{action} `#{@path}` is unsupported by your OS."
end
status_code(28)
end
class NoSpaceOnDeviceError < PermissionError
def message
"There was an error while trying to #{action} `#{@path}`. " \
"There was insufficient space remaining on the device."
end
status_code(31)
end
class GenericSystemCallError < BundlerError
attr_reader :underlying_error
def initialize(underlying_error, message)
@underlying_error = underlying_error
super("#{message}\nThe underlying system error is #{@underlying_error.class}: #{@underlying_error}")
end
status_code(32)
end
end
bundler-2.1.4/lib/bundler/vlad.rb 0000644 0000041 0000041 00000000724 13606335352 016666 0 ustar www-data www-data # frozen_string_literal: true
require_relative "shared_helpers"
Bundler::SharedHelpers.major_deprecation 2,
"The Bundler task for Vlad"
# Vlad task for Bundler.
#
# Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
# include the vlad:bundle:install task in your vlad:deploy task.
require_relative "deployment"
include Rake::DSL if defined? Rake::DSL
namespace :vlad do
Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, :roles => :app)
end
bundler-2.1.4/lib/bundler/installer.rb 0000644 0000041 0000041 00000027142 13606335352 017740 0 ustar www-data www-data # frozen_string_literal: true
require "erb"
require "rubygems/dependency_installer"
require_relative "worker"
require_relative "installer/parallel_installer"
require_relative "installer/standalone"
require_relative "installer/gem_installer"
module Bundler
class Installer
class << self
attr_accessor :ambiguous_gems
Installer.ambiguous_gems = []
end
attr_reader :post_install_messages
# Begins the installation process for Bundler.
# For more information see the #run method on this class.
def self.install(root, definition, options = {})
installer = new(root, definition)
Plugin.hook(Plugin::Events::GEM_BEFORE_INSTALL_ALL, definition.dependencies)
installer.run(options)
Plugin.hook(Plugin::Events::GEM_AFTER_INSTALL_ALL, definition.dependencies)
installer
end
def initialize(root, definition)
@root = root
@definition = definition
@post_install_messages = {}
end
# Runs the install procedures for a specific Gemfile.
#
# Firstly, this method will check to see if `Bundler.bundle_path` exists
# and if not then Bundler will create the directory. This is usually the same
# location as RubyGems which typically is the `~/.gem` directory
# unless other specified.
#
# Secondly, it checks if Bundler has been configured to be "frozen".
# Frozen ensures that the Gemfile and the Gemfile.lock file are matching.
# This stops a situation where a developer may update the Gemfile but may not run
# `bundle install`, which leads to the Gemfile.lock file not being correctly updated.
# If this file is not correctly updated then any other developer running
# `bundle install` will potentially not install the correct gems.
#
# Thirdly, Bundler checks if there are any dependencies specified in the Gemfile.
# If there are no dependencies specified then Bundler returns a warning message stating
# so and this method returns.
#
# Fourthly, Bundler checks if the Gemfile.lock exists, and if so
# then proceeds to set up a definition based on the Gemfile and the Gemfile.lock.
# During this step Bundler will also download information about any new gems
# that are not in the Gemfile.lock and resolve any dependencies if needed.
#
# Fifthly, Bundler resolves the dependencies either through a cache of gems or by remote.
# This then leads into the gems being installed, along with stubs for their executables,
# but only if the --binstubs option has been passed or Bundler.options[:bin] has been set
# earlier.
#
# Sixthly, a new Gemfile.lock is created from the installed gems to ensure that the next time
# that a user runs `bundle install` they will receive any updates from this process.
#
# Finally, if the user has specified the standalone flag, Bundler will generate the needed
# require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
# information.
def run(options)
create_bundle_path
ProcessLock.lock do
if Bundler.frozen_bundle?
@definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
end
if @definition.dependencies.empty?
Bundler.ui.warn "The Gemfile specifies no dependencies"
lock
return
end
if resolve_if_needed(options)
ensure_specs_are_compatible!
warn_on_incompatible_bundler_deps
load_plugins
options.delete(:jobs)
else
options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
end
install(options)
lock unless Bundler.frozen_bundle?
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
end
end
def generate_bundler_executable_stubs(spec, options = {})
if options[:binstubs_cmd] && spec.executables.empty?
options = {}
spec.runtime_dependencies.each do |dep|
bins = @definition.specs[dep].first.executables
options[dep.name] = bins unless bins.empty?
end
if options.any?
Bundler.ui.warn "#{spec.name} has no executables, but you may want " \
"one from a gem it depends on."
options.each {|name, bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" }
else
Bundler.ui.warn "There are no executables for the gem #{spec.name}."
end
return
end
# double-assignment to avoid warnings about variables that will be used by ERB
bin_path = Bundler.bin_path
bin_path = bin_path
relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
relative_gemfile_path = relative_gemfile_path
ruby_command = Thor::Util.ruby_command
ruby_command = ruby_command
template_path = File.expand_path("../templates/Executable", __FILE__)
if spec.name == "bundler"
template_path += ".bundler"
spec.executables = %(bundle)
end
template = File.read(template_path)
exists = []
spec.executables.each do |executable|
binstub_path = "#{bin_path}/#{executable}"
if File.exist?(binstub_path) && !options[:force]
exists << executable
next
end
File.open(binstub_path, "w", 0o777 & ~File.umask) do |f|
if RUBY_VERSION >= "2.6"
f.puts ERB.new(template, :trim_mode => "-").result(binding)
else
f.puts ERB.new(template, nil, "-").result(binding)
end
end
end
if options[:binstubs_cmd] && exists.any?
case exists.size
when 1
Bundler.ui.warn "Skipped #{exists[0]} since it already exists."
when 2
Bundler.ui.warn "Skipped #{exists.join(" and ")} since they already exist."
else
items = exists[0...-1].empty? ? nil : exists[0...-1].join(", ")
skipped = [items, exists[-1]].compact.join(" and ")
Bundler.ui.warn "Skipped #{skipped} since they already exist."
end
Bundler.ui.warn "If you want to overwrite skipped stubs, use --force."
end
end
def generate_standalone_bundler_executable_stubs(spec)
# double-assignment to avoid warnings about variables that will be used by ERB
bin_path = Bundler.bin_path
unless path = Bundler.settings[:path]
raise "Can't standalone without an explicit path set"
end
standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
standalone_path = standalone_path
template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
ruby_command = Thor::Util.ruby_command
ruby_command = ruby_command
spec.executables.each do |executable|
next if executable == "bundle"
executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
executable_path = executable_path
File.open "#{bin_path}/#{executable}", "w", 0o755 do |f|
if RUBY_VERSION >= "2.6"
f.puts ERB.new(template, :trim_mode => "-").result(binding)
else
f.puts ERB.new(template, nil, "-").result(binding)
end
end
end
end
private
# the order that the resolver provides is significant, since
# dependencies might affect the installation of a gem.
# that said, it's a rare situation (other than rake), and parallel
# installation is SO MUCH FASTER. so we let people opt in.
def install(options)
force = options["force"]
jobs = installation_parallelization(options)
install_in_parallel jobs, options[:standalone], force
end
def installation_parallelization(options)
if jobs = options.delete(:jobs)
return jobs
end
return 1 unless can_install_in_parallel?
auto_config_jobs = Bundler.feature_flag.auto_config_jobs?
if jobs = Bundler.settings[:jobs]
if auto_config_jobs
jobs
else
[jobs.pred, 1].max
end
elsif auto_config_jobs
processor_count
else
1
end
end
def processor_count
require "etc"
Etc.nprocessors
rescue StandardError
1
end
def load_plugins
Bundler.rubygems.load_plugins
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
path_plugin_files = requested_path_gems.map do |spec|
begin
Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
rescue TypeError
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
raise Gem::InvalidSpecificationException, error_message
end
end.flatten
Bundler.rubygems.load_plugin_files(path_plugin_files)
end
def ensure_specs_are_compatible!
system_ruby = Bundler::RubyVersion.system
rubygems_version = Gem::Version.create(Gem::VERSION)
@definition.specs.each do |spec|
if required_ruby_version = spec.required_ruby_version
unless required_ruby_version.satisfied_by?(system_ruby.gem_version)
raise InstallError, "#{spec.full_name} requires ruby version #{required_ruby_version}, " \
"which is incompatible with the current version, #{system_ruby}"
end
end
next unless required_rubygems_version = spec.required_rubygems_version
unless required_rubygems_version.satisfied_by?(rubygems_version)
raise InstallError, "#{spec.full_name} requires rubygems version #{required_rubygems_version}, " \
"which is incompatible with the current version, #{rubygems_version}"
end
end
end
def warn_on_incompatible_bundler_deps
bundler_version = Gem::Version.create(Bundler::VERSION)
@definition.specs.each do |spec|
spec.dependencies.each do |dep|
next if dep.type == :development
next unless dep.name == "bundler".freeze
next if dep.requirement.satisfied_by?(bundler_version)
Bundler.ui.warn "#{spec.name} (#{spec.version}) has dependency" \
" #{SharedHelpers.pretty_dependency(dep)}" \
", which is unsatisfied by the current bundler version #{VERSION}" \
", so the dependency is being ignored"
end
end
end
def can_install_in_parallel?
true
end
def install_in_parallel(size, standalone, force = false)
spec_installations = ParallelInstaller.call(self, @definition.specs, size, standalone, force)
spec_installations.each do |installation|
post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
end
end
def create_bundle_path
SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p|
Bundler.mkdir_p(p)
end unless Bundler.bundle_path.exist?
rescue Errno::EEXIST
raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
"because a file already exists at that path. Either remove or rename the file so the directory can be created."
end
# returns whether or not a re-resolve was needed
def resolve_if_needed(options)
if !@definition.unlocking? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
return false if @definition.nothing_changed? && !@definition.missing_specs?
end
options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
true
end
def lock(opts = {})
@definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
end
end
end
bundler-2.1.4/lib/bundler/fetcher/ 0000755 0000041 0000041 00000000000 13606335352 017030 5 ustar www-data www-data bundler-2.1.4/lib/bundler/fetcher/dependency.rb 0000644 0000041 0000041 00000005226 13606335352 021500 0 ustar www-data www-data # frozen_string_literal: true
require_relative "base"
require "cgi"
module Bundler
class Fetcher
class Dependency < Base
def available?
@available ||= fetch_uri.scheme != "file" && downloader.fetch(dependency_api_uri)
rescue NetworkDownError => e
raise HTTPError, e.message
rescue AuthenticationRequiredError
# Fail since we got a 401 from the server.
raise
rescue HTTPError
false
end
def api_fetcher?
true
end
def specs(gem_names, full_dependency_list = [], last_spec_list = [])
query_list = gem_names.uniq - full_dependency_list
log_specs "Query List: #{query_list.inspect}"
return last_spec_list if query_list.empty?
spec_list, deps_list = Bundler::Retry.new("dependency api", FAIL_ERRORS).attempts do
dependency_specs(query_list)
end
returned_gems = spec_list.map(&:first).uniq
specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list)
rescue MarshalError
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
Bundler.ui.debug "could not fetch from the dependency API, trying the full index"
nil
rescue HTTPError, GemspecError
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
Bundler.ui.debug "could not fetch from the dependency API\nit's suggested to retry using the full index via `bundle install --full-index`"
nil
end
def dependency_specs(gem_names)
Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(",")}"
gem_list = unmarshalled_dep_gems(gem_names)
get_formatted_specs_and_deps(gem_list)
end
def unmarshalled_dep_gems(gem_names)
gem_list = []
gem_names.each_slice(Source::Rubygems::API_REQUEST_SIZE) do |names|
marshalled_deps = downloader.fetch(dependency_api_uri(names)).body
gem_list.concat(Bundler.load_marshal(marshalled_deps))
end
gem_list
end
def get_formatted_specs_and_deps(gem_list)
deps_list = []
spec_list = []
gem_list.each do |s|
deps_list.concat(s[:dependencies].map(&:first))
deps = s[:dependencies].map {|n, d| [n, d.split(", ")] }
spec_list.push([s[:name], s[:number], s[:platform], deps])
end
[spec_list, deps_list]
end
def dependency_api_uri(gem_names = [])
uri = fetch_uri + "api/v1/dependencies"
uri.query = "gems=#{CGI.escape(gem_names.sort.join(","))}" if gem_names.any?
uri
end
end
end
end
bundler-2.1.4/lib/bundler/fetcher/downloader.rb 0000644 0000041 0000041 00000006036 13606335352 021520 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Fetcher
class Downloader
attr_reader :connection
attr_reader :redirect_limit
def initialize(connection, redirect_limit)
@connection = connection
@redirect_limit = redirect_limit
end
def fetch(uri, headers = {}, counter = 0)
raise HTTPError, "Too many redirects" if counter >= redirect_limit
response = request(uri, headers)
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{uri}")
case response
when Net::HTTPSuccess, Net::HTTPNotModified
response
when Net::HTTPRedirection
new_uri = Bundler::URI.parse(response["location"])
if new_uri.host == uri.host
new_uri.user = uri.user
new_uri.password = uri.password
end
fetch(new_uri, headers, counter + 1)
when Net::HTTPRequestedRangeNotSatisfiable
new_headers = headers.dup
new_headers.delete("Range")
new_headers["Accept-Encoding"] = "gzip"
fetch(uri, new_headers)
when Net::HTTPRequestEntityTooLarge
raise FallbackError, response.body
when Net::HTTPTooManyRequests
raise TooManyRequestsError, response.body
when Net::HTTPUnauthorized
raise BadAuthenticationError, uri.host if uri.userinfo
raise AuthenticationRequiredError, uri.host
when Net::HTTPNotFound
raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
else
raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
end
end
def request(uri, headers)
validate_uri_scheme!(uri)
Bundler.ui.debug "HTTP GET #{uri}"
req = Net::HTTP::Get.new uri.request_uri, headers
if uri.user
user = CGI.unescape(uri.user)
password = uri.password ? CGI.unescape(uri.password) : nil
req.basic_auth(user, password)
end
connection.request(uri, req)
rescue NoMethodError => e
raise unless ["undefined method", "use_ssl="].all? {|snippet| e.message.include? snippet }
raise LoadError.new("cannot load such file -- openssl")
rescue OpenSSL::SSL::SSLError
raise CertificateFailureError.new(uri)
rescue *HTTP_ERRORS => e
Bundler.ui.trace e
case e.message
when /host down:/, /getaddrinfo: nodename nor servname provided/
raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
"connection and try again."
else
raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" \
" (#{e})"
end
end
private
def validate_uri_scheme!(uri)
return if uri.scheme =~ /\Ahttps?\z/
raise InvalidOption,
"The request uri `#{uri}` has an invalid scheme (`#{uri.scheme}`). " \
"Did you mean `http` or `https`?"
end
end
end
end
bundler-2.1.4/lib/bundler/fetcher/compact_index.rb 0000644 0000041 0000041 00000010727 13606335352 022201 0 ustar www-data www-data # frozen_string_literal: true
require_relative "base"
require_relative "../worker"
module Bundler
autoload :CompactIndexClient, File.expand_path("../compact_index_client", __dir__)
class Fetcher
class CompactIndex < Base
def self.compact_index_request(method_name)
method = instance_method(method_name)
undef_method(method_name)
define_method(method_name) do |*args, &blk|
begin
method.bind(self).call(*args, &blk)
rescue NetworkDownError, CompactIndexClient::Updater::MisMatchedChecksumError => e
raise HTTPError, e.message
rescue AuthenticationRequiredError
# Fail since we got a 401 from the server.
raise
rescue HTTPError => e
Bundler.ui.trace(e)
nil
end
end
end
def specs(gem_names)
specs_for_names(gem_names)
end
compact_index_request :specs
def specs_for_names(gem_names)
gem_info = []
complete_gems = []
remaining_gems = gem_names.dup
until remaining_gems.empty?
log_specs "Looking up gems #{remaining_gems.inspect}"
deps = begin
parallel_compact_index_client.dependencies(remaining_gems)
rescue TooManyRequestsError
@bundle_worker.stop if @bundle_worker
@bundle_worker = nil # reset it. Not sure if necessary
serial_compact_index_client.dependencies(remaining_gems)
end
next_gems = deps.map {|d| d[3].map(&:first).flatten(1) }.flatten(1).uniq
deps.each {|dep| gem_info << dep }
complete_gems.concat(deps.map(&:first)).uniq!
remaining_gems = next_gems - complete_gems
end
@bundle_worker.stop if @bundle_worker
@bundle_worker = nil # reset it. Not sure if necessary
gem_info
end
def fetch_spec(spec)
spec -= [nil, "ruby", ""]
contents = compact_index_client.spec(*spec)
return nil if contents.nil?
contents.unshift(spec.first)
contents[3].map! {|d| Gem::Dependency.new(*d) }
EndpointSpecification.new(*contents)
end
compact_index_request :fetch_spec
def available?
return nil unless SharedHelpers.md5_available?
user_home = Bundler.user_home
return nil unless user_home.directory? && user_home.writable?
# Read info file checksums out of /versions, so we can know if gems are up to date
fetch_uri.scheme != "file" && compact_index_client.update_and_parse_checksums!
rescue CompactIndexClient::Updater::MisMatchedChecksumError => e
Bundler.ui.debug(e.message)
nil
end
compact_index_request :available?
def api_fetcher?
true
end
private
def compact_index_client
@compact_index_client ||=
SharedHelpers.filesystem_access(cache_path) do
CompactIndexClient.new(cache_path, client_fetcher)
end
end
def parallel_compact_index_client
compact_index_client.execution_mode = lambda do |inputs, &blk|
func = lambda {|object, _index| blk.call(object) }
worker = bundle_worker(func)
inputs.each {|input| worker.enq(input) }
inputs.map { worker.deq }
end
compact_index_client
end
def serial_compact_index_client
compact_index_client.sequential_execution_mode!
compact_index_client
end
def bundle_worker(func = nil)
@bundle_worker ||= begin
worker_name = "Compact Index (#{display_uri.host})"
Bundler::Worker.new(Bundler.current_ruby.rbx? ? 1 : 25, worker_name, func)
end
@bundle_worker.tap do |worker|
worker.instance_variable_set(:@func, func) if func
end
end
def cache_path
Bundler.user_cache.join("compact_index", remote.cache_slug)
end
def client_fetcher
ClientFetcher.new(self, Bundler.ui)
end
ClientFetcher = Struct.new(:fetcher, :ui) do
def call(path, headers)
fetcher.downloader.fetch(fetcher.fetch_uri + path, headers)
rescue NetworkDownError => e
raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"]
ui.warn "Using the cached data for the new index because of a network error: #{e}"
Net::HTTPNotModified.new(nil, nil, nil)
end
end
end
end
end
bundler-2.1.4/lib/bundler/fetcher/base.rb 0000644 0000041 0000041 00000001731 13606335352 020271 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class Fetcher
class Base
attr_reader :downloader
attr_reader :display_uri
attr_reader :remote
def initialize(downloader, remote, display_uri)
raise "Abstract class" if self.class == Base
@downloader = downloader
@remote = remote
@display_uri = display_uri
end
def remote_uri
@remote.uri
end
def fetch_uri
@fetch_uri ||= begin
if remote_uri.host == "rubygems.org"
uri = remote_uri.dup
uri.host = "index.rubygems.org"
uri
else
remote_uri
end
end
end
def available?
true
end
def api_fetcher?
false
end
private
def log_specs(debug_msg)
if Bundler.ui.debug?
Bundler.ui.debug debug_msg
else
Bundler.ui.info ".", false
end
end
end
end
end
bundler-2.1.4/lib/bundler/fetcher/index.rb 0000644 0000041 0000041 00000003647 13606335352 020476 0 ustar www-data www-data # frozen_string_literal: true
require_relative "base"
require "rubygems/remote_fetcher"
module Bundler
class Fetcher
class Index < Base
def specs(_gem_names)
Bundler.rubygems.fetch_all_remote_specs(remote)
rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e
case e.message
when /certificate verify failed/
raise CertificateFailureError.new(display_uri)
when /401/
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
raise AuthenticationRequiredError, remote_uri
when /403/
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
raise AuthenticationRequiredError, remote_uri
else
Bundler.ui.trace e
raise HTTPError, "Could not fetch specs from #{display_uri}"
end
end
def fetch_spec(spec)
spec -= [nil, "ruby", ""]
spec_file_name = "#{spec.join "-"}.gemspec"
uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
if uri.scheme == "file"
path = Bundler.rubygems.correct_for_windows_path(uri.path)
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
Bundler.load_gemspec(cached_spec_path)
else
Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
end
rescue MarshalError
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
"Your network or your gem server is probably having issues right now."
end
private
# cached gem specification path, if one exists
def gemspec_cached_path(spec_file_name)
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
paths.find {|path| File.file? path }
end
end
end
end
bundler-2.1.4/lib/bundler/feature_flag.rb 0000644 0000041 0000041 00000004713 13606335352 020366 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
class FeatureFlag
def self.settings_flag(flag, &default)
unless Bundler::Settings::BOOL_KEYS.include?(flag.to_s)
raise "Cannot use `#{flag}` as a settings feature flag since it isn't a bool key"
end
settings_method("#{flag}?", flag, &default)
end
private_class_method :settings_flag
def self.settings_option(key, &default)
settings_method(key, key, &default)
end
private_class_method :settings_option
def self.settings_method(name, key, &default)
define_method(name) do
value = Bundler.settings[key]
value = instance_eval(&default) if value.nil?
value
end
end
private_class_method :settings_method
(1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }
settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? }
settings_flag(:allow_offline_install) { bundler_3_mode? }
settings_flag(:auto_clean_without_path) { bundler_3_mode? }
settings_flag(:auto_config_jobs) { bundler_3_mode? }
settings_flag(:cache_all) { bundler_3_mode? }
settings_flag(:default_install_uses_path) { bundler_3_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
settings_flag(:disable_multisource) { bundler_3_mode? }
settings_flag(:forget_cli_options) { bundler_3_mode? }
settings_flag(:global_gem_cache) { bundler_3_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
settings_flag(:print_only_version_number) { bundler_3_mode? }
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
settings_flag(:skip_default_git_sources) { bundler_3_mode? }
settings_flag(:specific_platform) { bundler_3_mode? }
settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
settings_flag(:update_requires_all_flag) { bundler_4_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
def initialize(bundler_version)
@bundler_version = Gem::Version.create(bundler_version)
end
def major_version
@bundler_version.segments.first
end
private :major_version
end
end
bundler-2.1.4/lib/bundler/ui.rb 0000644 0000041 0000041 00000000377 13606335352 016361 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
module UI
autoload :RGProxy, File.expand_path("ui/rg_proxy", __dir__)
autoload :Shell, File.expand_path("ui/shell", __dir__)
autoload :Silent, File.expand_path("ui/silent", __dir__)
end
end
bundler-2.1.4/lib/bundler/vendored_thor.rb 0000644 0000041 0000041 00000000264 13606335352 020601 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
def self.require_thor_actions
require_relative "vendor/thor/lib/thor/actions"
end
end
require_relative "vendor/thor/lib/thor"
bundler-2.1.4/lib/bundler/source_list.rb 0000644 0000041 0000041 00000013021 13606335352 020265 0 ustar www-data www-data # frozen_string_literal: true
require "set"
module Bundler
class SourceList
attr_reader :path_sources,
:git_sources,
:plugin_sources,
:global_rubygems_source,
:metadata_source
def initialize
@path_sources = []
@git_sources = []
@plugin_sources = []
@global_rubygems_source = nil
@rubygems_aggregate = rubygems_aggregate_class.new
@rubygems_sources = []
@metadata_source = Source::Metadata.new
end
def add_path_source(options = {})
if options["gemspec"]
add_source_to_list Source::Gemspec.new(options), path_sources
else
add_source_to_list Source::Path.new(options), path_sources
end
end
def add_git_source(options = {})
add_source_to_list(Source::Git.new(options), git_sources).tap do |source|
warn_on_git_protocol(source)
end
end
def add_rubygems_source(options = {})
add_source_to_list Source::Rubygems.new(options), @rubygems_sources
end
def add_plugin_source(source, options = {})
add_source_to_list Plugin.source(source).new(options), @plugin_sources
end
def global_rubygems_source=(uri)
if Bundler.feature_flag.disable_multisource?
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
end
add_rubygems_remote(uri)
end
def add_rubygems_remote(uri)
return if Bundler.feature_flag.disable_multisource?
@rubygems_aggregate.add_remote(uri)
@rubygems_aggregate
end
def default_source
global_rubygems_source || @rubygems_aggregate
end
def rubygems_sources
@rubygems_sources + [default_source]
end
def rubygems_remotes
rubygems_sources.map(&:remotes).flatten.uniq
end
def all_sources
path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
end
def get(source)
source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
end
def lock_sources
lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
if Bundler.feature_flag.disable_multisource?
lock_sources + rubygems_sources.sort_by(&:to_s)
else
lock_sources << combine_rubygems_sources
end
end
# Returns true if there are changes
def replace_sources!(replacement_sources)
return true if replacement_sources.empty?
[path_sources, git_sources, plugin_sources].each do |source_list|
source_list.map! do |source|
replacement_sources.find {|s| s == source } || source
end
end
replacement_rubygems = !Bundler.feature_flag.disable_multisource? &&
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
@rubygems_aggregate = replacement_rubygems if replacement_rubygems
return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
return true if replacement_rubygems && rubygems_remotes.to_set != replacement_rubygems.remotes.to_set
false
end
def cached!
all_sources.each(&:cached!)
end
def remote!
all_sources.each(&:remote!)
end
def rubygems_primary_remotes
@rubygems_aggregate.remotes
end
private
def rubygems_aggregate_class
Source::Rubygems
end
def add_source_to_list(source, list)
list.unshift(source).uniq!
source
end
def source_list_for(source)
case source
when Source::Git then git_sources
when Source::Path then path_sources
when Source::Rubygems then rubygems_sources
when Plugin::API::Source then plugin_sources
else raise ArgumentError, "Invalid source: #{source.inspect}"
end
end
def combine_rubygems_sources
Source::Rubygems.new("remotes" => rubygems_remotes)
end
def warn_on_git_protocol(source)
return if Bundler.settings["git.allow_insecure"]
if source.uri =~ /^git\:/
Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
"which transmits data without encryption. Disable this warning with " \
"`bundle config set git.allow_insecure true`, or switch to the `https` " \
"protocol to keep your data secure."
end
end
def equal_sources?(lock_sources, replacement_sources)
lock_sources.to_set == replacement_sources.to_set
end
def equal_source?(source, other_source)
source == other_source
end
def equivalent_source?(source, other_source)
return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems)
equivalent_rubygems_sources?([source], [other_source])
end
def equivalent_sources?(lock_sources, replacement_sources)
return false unless Bundler.settings[:allow_deployment_source_credential_changes]
lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) }
replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) }
equivalent_rubygems_sources?(lock_rubygems_sources, replacement_rubygems_sources) && equal_sources?(lock_other_sources, replacement_other_sources)
end
def equivalent_rubygems_sources?(lock_sources, replacement_sources)
actual_remotes = replacement_sources.map(&:remotes).flatten.uniq
lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) }
end
end
end
bundler-2.1.4/lib/bundler/remote_specification.rb 0000644 0000041 0000041 00000006705 13606335352 022140 0 ustar www-data www-data # frozen_string_literal: true
module Bundler
# Represents a lazily loaded gem specification, where the full specification
# is on the source server in rubygems' "quick" index. The proxy object is to
# be seeded with what we're given from the source's abbreviated index - the
# full specification will only be fetched when necessary.
class RemoteSpecification
include MatchPlatform
include Comparable
attr_reader :name, :version, :platform
attr_writer :dependencies
attr_accessor :source, :remote
def initialize(name, version, platform, spec_fetcher)
@name = name
@version = Gem::Version.create version
@platform = platform
@spec_fetcher = spec_fetcher
@dependencies = nil
end
# Needed before installs, since the arch matters then and quick
# specs don't bother to include the arch in the platform string
def fetch_platform
@platform = _remote_specification.platform
end
def full_name
if platform == Gem::Platform::RUBY || platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
end
end
# Compare this specification against another object. Using sort_obj
# is compatible with Gem::Specification and other Bundler or RubyGems
# objects. Otherwise, use the default Object comparison.
def <=>(other)
if other.respond_to?(:sort_obj)
sort_obj <=> other.sort_obj
else
super
end
end
# Because Rubyforge cannot be trusted to provide valid specifications
# once the remote gem is downloaded, the backend specification will
# be swapped out.
def __swap__(spec)
SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies)
@_remote_specification = spec
end
# Create a delegate used for sorting. This strategy is copied from
# RubyGems 2.23 and ensures that Bundler's specifications can be
# compared and sorted with RubyGems' own specifications.
#
# @see #<=>
# @see Gem::Specification#sort_obj
#
# @return [Array] an object you can use to compare and sort this
# specification against other specifications
def sort_obj
[@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1]
end
def to_s
"#<#{self.class} name=#{name} version=#{version} platform=#{platform}>"
end
def dependencies
@dependencies ||= begin
deps = method_missing(:dependencies)
# allow us to handle when the specs dependencies are an array of array of string
# see https://github.com/bundler/bundler/issues/5797
deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) }
deps
end
end
def git_version
return unless loaded_from && source.is_a?(Bundler::Source::Git)
" #{source.revision[0..6]}"
end
private
def to_ary
nil
end
def _remote_specification
@_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform])
@_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
" missing from the server! Try installing with `--full-index` as a workaround.")
end
def method_missing(method, *args, &blk)
_remote_specification.send(method, *args, &blk)
end
def respond_to?(method, include_all = false)
super || _remote_specification.respond_to?(method, include_all)
end
public :respond_to?
end
end
bundler-2.1.4/lib/bundler/dsl.rb 0000644 0000041 0000041 00000050666 13606335352 016534 0 ustar www-data www-data # frozen_string_literal: true
require_relative "dependency"
require_relative "ruby_dsl"
module Bundler
class Dsl
include RubyDsl
def self.evaluate(gemfile, lockfile, unlock)
builder = new
builder.eval_gemfile(gemfile)
builder.to_definition(lockfile, unlock)
end
VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
platform platforms type source install_if gemfile].freeze
attr_reader :gemspecs
attr_accessor :dependencies
def initialize
@source = nil
@sources = SourceList.new
@git_sources = {}
@dependencies = []
@groups = []
@install_conditionals = []
@optional_groups = []
@platforms = []
@env = nil
@ruby_version = nil
@gemspecs = []
@gemfile = nil
@gemfiles = []
add_git_sources
end
def eval_gemfile(gemfile, contents = nil)
expanded_gemfile_path = Pathname.new(gemfile).expand_path(@gemfile && @gemfile.parent)
original_gemfile = @gemfile
@gemfile = expanded_gemfile_path
@gemfiles << expanded_gemfile_path
contents ||= Bundler.read_file(@gemfile.to_s)
instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
rescue Exception => e # rubocop:disable Lint/RescueException
message = "There was an error " \
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
"`#{File.basename gemfile.to_s}`: #{e.message}"
raise DSLError.new(message, gemfile, e.backtrace, contents)
ensure
@gemfile = original_gemfile
end
def gemspec(opts = nil)
opts ||= {}
path = opts[:path] || "."
glob = opts[:glob]
name = opts[:name]
development_group = opts[:development_group] || :development
expanded_path = gemfile_root.join(path)
gemspecs = Dir[File.join(expanded_path, "{,*}.gemspec")].map {|g| Bundler.load_gemspec(g) }.compact
gemspecs.reject! {|s| s.name != name } if name
Index.sort_specs(gemspecs)
specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
case specs_by_name_and_version.size
when 1
specs = specs_by_name_and_version.values.first
spec = specs.find {|s| s.match_platform(Bundler.local_platform) } || specs.first
@gemspecs << spec
gem_platforms = Bundler::Dependency::REVERSE_PLATFORM_MAP[Bundler::GemHelpers.generic_local_platform]
gem spec.name, :name => spec.name, :path => path, :glob => glob, :platforms => gem_platforms
group(development_group) do
spec.development_dependencies.each do |dep|
gem dep.name, *(dep.requirement.as_list + [:type => :development])
end
end
when 0
raise InvalidOption, "There are no gemspecs at #{expanded_path}"
else
raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. " \
"Please use the :name option to specify which one should be used"
end
end
def gem(name, *args)
options = args.last.is_a?(Hash) ? args.pop.dup : {}
options["gemfile"] = @gemfile
version = args || [">= 0"]
normalize_options(name, version, options)
dep = Dependency.new(name, version, options)
# if there's already a dependency with this name we try to prefer one
if current = @dependencies.find {|d| d.name == dep.name }
deleted_dep = @dependencies.delete(current) if current.type == :development
if current.requirement != dep.requirement
unless deleted_dep
return if dep.type == :development
update_prompt = ""
if File.basename(@gemfile) == Injector::INJECTED_GEMS
if dep.requirements_list.include?(">= 0") && !current.requirements_list.include?(">= 0")
update_prompt = ". Gem already added"
else
update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current.requirements_list.include?(">= 0")
end
end
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
"#{update_prompt}"
end
else
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
"You should probably keep only one of them.\n" \
"Remove any duplicate entries and specify the gem only once.\n" \
"While it's not a problem now, it could cause errors if you change the version of one of them later."
end
if current.source != dep.source
unless deleted_dep
return if dep.type == :development
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
"#{current.source || "an unspecified source"} and #{dep.source}\n"
end
end
end
@dependencies << dep
end
def source(source, *args, &blk)
options = args.last.is_a?(Hash) ? args.pop.dup : {}
options = normalize_hash(options)
source = normalize_source(source)
if options.key?("type")
options["type"] = options["type"].to_s
unless Plugin.source?(options["type"])
raise InvalidOption, "No plugin sources available for #{options["type"]}"
end
unless block_given?
raise InvalidOption, "You need to pass a block to #source with :type option"
end
source_opts = options.merge("uri" => source)
with_source(@sources.add_plugin_source(options["type"], source_opts), &blk)
elsif block_given?
with_source(@sources.add_rubygems_source("remotes" => source), &blk)
else
check_primary_source_safety(@sources)
@sources.global_rubygems_source = source
end
end
def git_source(name, &block)
unless block_given?
raise InvalidOption, "You need to pass a block to #git_source"
end
if valid_keys.include?(name.to_s)
raise InvalidOption, "You cannot use #{name} as a git source. It " \
"is a reserved key. Reserved keys are: #{valid_keys.join(", ")}"
end
@git_sources[name.to_s] = block
end
def path(path, options = {}, &blk)
unless block_given?
msg = "You can no longer specify a path source by itself. Instead, \n" \
"either use the :path option on a gem, or specify the gems that \n" \
"bundler should find in the path source by passing a block to \n" \
"the path method, like: \n\n" \
" path 'dir/containing/rails' do\n" \
" gem 'rails'\n" \
" end\n\n"
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
SharedHelpers.major_deprecation(2, msg.strip)
end
source_options = normalize_hash(options).merge(
"path" => Pathname.new(path),
"root_path" => gemfile_root,
"gemspec" => gemspecs.find {|g| g.name == options["name"] }
)
source = @sources.add_path_source(source_options)
with_source(source, &blk)
end
def git(uri, options = {}, &blk)
unless block_given?
msg = "You can no longer specify a git source by itself. Instead, \n" \
"either use the :git option on a gem, or specify the gems that \n" \
"bundler should find in the git source by passing a block to \n" \
"the git method, like: \n\n" \
" git 'git://github.com/rails/rails.git' do\n" \
" gem 'rails'\n" \
" end"
raise DeprecatedError, msg
end
with_source(@sources.add_git_source(normalize_hash(options).merge("uri" => uri)), &blk)
end
def github(repo, options = {})
raise ArgumentError, "GitHub sources require a block" unless block_given?
raise DeprecatedError, "The #github method has been removed" if Bundler.feature_flag.skip_default_git_sources?
github_uri = @git_sources["github"].call(repo)
git_options = normalize_hash(options).merge("uri" => github_uri)
git_source = @sources.add_git_source(git_options)
with_source(git_source) { yield }
end
def to_definition(lockfile, unlock)
Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups, @gemfiles)
end
def group(*args, &blk)
options = args.last.is_a?(Hash) ? args.pop.dup : {}
normalize_group_options(options, args)
@groups.concat args
if options["optional"]
optional_groups = args - @optional_groups
@optional_groups.concat optional_groups
end
yield
ensure
args.each { @groups.pop }
end
def install_if(*args)
@install_conditionals.concat args
yield
ensure
args.each { @install_conditionals.pop }
end
def platforms(*platforms)
@platforms.concat platforms
yield
ensure
platforms.each { @platforms.pop }
end
alias_method :platform, :platforms
def env(name)
old = @env
@env = name
yield
ensure
@env = old
end
def plugin(*args)
# Pass on
end
def method_missing(name, *args)
raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile"
end
private
def add_git_sources
return if Bundler.feature_flag.skip_default_git_sources?
git_source(:github) do |repo_name|
warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
"https://github.com/#{repo_name}.git"
RUBY
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
git_source(:gist) do |repo_name|
warn_deprecated_git_source(:gist, '"https://gist.github.com/#{repo_name}.git"')
"https://gist.github.com/#{repo_name}.git"
end
git_source(:bitbucket) do |repo_name|
warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
user_name, repo_name = repo_name.split("/")
repo_name ||= user_name
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
RUBY
user_name, repo_name = repo_name.split("/")
repo_name ||= user_name
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
end
end
def with_source(source)
old_source = @source
if block_given?
@source = source
yield
end
source
ensure
@source = old_source
end
def normalize_hash(opts)
opts.keys.each do |k|
opts[k.to_s] = opts.delete(k) unless k.is_a?(String)
end
opts
end
def valid_keys
@valid_keys ||= VALID_KEYS
end
def normalize_options(name, version, opts)
if name.is_a?(Symbol)
raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
end
if name =~ /\s/
raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
end
raise GemfileError, %(an empty gem name is not valid) if name.empty?
normalize_hash(opts)
git_names = @git_sources.keys.map(&:to_s)
validate_keys("gem '#{name}'", opts, valid_keys + git_names)
groups = @groups.dup
opts["group"] = opts.delete("groups") || opts["group"]
groups.concat Array(opts.delete("group"))
groups = [:default] if groups.empty?
install_if = @install_conditionals.dup
install_if.concat Array(opts.delete("install_if"))
install_if = install_if.reduce(true) do |memo, val|
memo && (val.respond_to?(:call) ? val.call : val)
end
platforms = @platforms.dup
opts["platforms"] = opts["platform"] || opts["platforms"]
platforms.concat Array(opts.delete("platforms"))
platforms.map!(&:to_sym)
platforms.each do |p|
next if VALID_PLATFORMS.include?(p)
raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
end
# Save sources passed in a key
if opts.key?("source")
source = normalize_source(opts["source"])
opts["source"] = @sources.add_rubygems_source("remotes" => source)
end
git_name = (git_names & opts.keys).last
if @git_sources[git_name]
opts["git"] = @git_sources[git_name].call(opts[git_name])
end
%w[git path].each do |type|
next unless param = opts[type]
if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
options = opts.merge("name" => name, "version" => $1)
else
options = opts.dup
end
source = send(type, param, options) {}
opts["source"] = source
end
opts["source"] ||= @source
opts["env"] ||= @env
opts["platforms"] = platforms.dup
opts["group"] = groups
opts["should_include"] = install_if
end
def normalize_group_options(opts, groups)
normalize_hash(opts)
groups = groups.map {|group| ":#{group}" }.join(", ")
validate_keys("group #{groups}", opts, %w[optional])
opts["optional"] ||= false
end
def validate_keys(command, opts, valid_keys)
invalid_keys = opts.keys - valid_keys
git_source = opts.keys & @git_sources.keys.map(&:to_s)
if opts["branch"] && !(opts["git"] || opts["github"] || git_source.any?)
raise GemfileError, %(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch)
end
return true unless invalid_keys.any?
message = String.new
message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
message << if invalid_keys.size > 1
"as options for #{command}, but they are invalid."
else
"as an option for #{command}, but it is invalid."
end
message << " Valid options are: #{valid_keys.join(", ")}."
message << " You may be able to resolve this by upgrading Bundler to the newest version."
raise InvalidOption, message
end
def normalize_source(source)
case source
when :gemcutter, :rubygems, :rubyforge
Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not."
"http://rubygems.org"
when String
source
else
raise GemfileError, "Unknown source '#{source}'"
end
end
def check_primary_source_safety(source_list)
return if source_list.rubygems_primary_remotes.empty? && source_list.global_rubygems_source.nil?
if Bundler.feature_flag.disable_multisource?
msg = "This Gemfile contains multiple primary sources. " \
"Each source after the first must include a block to indicate which gems " \
"should come from that source"
unless Bundler.feature_flag.bundler_2_mode?
msg += ". To downgrade this error to a warning, run " \
"`bundle config unset disable_multisource`"
end
raise GemfileEvalError, msg
else
Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source. " \
"To upgrade this warning to an error, run `bundle config set " \
"disable_multisource true`."
end
end
def warn_deprecated_git_source(name, replacement, additional_message = nil)
additional_message &&= " #{additional_message}"
replacement = if replacement.count("\n").zero?
"{|repo_name| #{replacement} }"
else
"do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
end
Bundler::SharedHelpers.major_deprecation 3, <<-EOS
The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:#{name}) #{replacement}
EOS
end
class DSLError < GemfileError
# @return [String] the description that should be presented to the user.
#
attr_reader :description
# @return [String] the path of the dsl file that raised the exception.
#
attr_reader :dsl_path
# @return [Exception] the backtrace of the exception raised by the
# evaluation of the dsl file.
#
attr_reader :backtrace
# @param [Exception] backtrace @see backtrace
# @param [String] dsl_path @see dsl_path
#
def initialize(description, dsl_path, backtrace, contents = nil)
@status_code = $!.respond_to?(:status_code) && $!.status_code
@description = description
@dsl_path = dsl_path
@backtrace = backtrace
@contents = contents
end
def status_code
@status_code || super
end
# @return [String] the contents of the DSL that cause the exception to
# be raised.
#
def contents
@contents ||= begin
dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
end
end
# The message of the exception reports the content of podspec for the
# line that generated the original exception.
#
# @example Output
#
# Invalid podspec at `RestKit.podspec` - undefined method
# `exclude_header_search_paths=' for #
#
# from spec-repos/master/RestKit/0.9.3/RestKit.podspec:36
# -------------------------------------------
# # because it would break: #import
# > ns.exclude_header_search_paths = 'Code/RestKit.h'
# end
# -------------------------------------------
#
# @return [String] the message of the exception.
#
def to_s
@to_s ||= begin
trace_line, description = parse_line_number_from_description
m = String.new("\n[!] ")
m << description
m << ". Bundler cannot continue.\n"
return m unless backtrace && dsl_path && contents
trace_line = backtrace.find {|l| l.include?(dsl_path.to_s) } || trace_line
return m unless trace_line
line_numer = trace_line.split(":")[1].to_i - 1
return m unless line_numer
lines = contents.lines.to_a
indent = " # "
indicator = indent.tr("#", ">")
first_line = line_numer.zero?
last_line = (line_numer == (lines.count - 1))
m << "\n"
m << "#{indent}from #{trace_line.gsub(/:in.*$/, "")}\n"
m << "#{indent}-------------------------------------------\n"
m << "#{indent}#{lines[line_numer - 1]}" unless first_line
m << "#{indicator}#{lines[line_numer]}"
m << "#{indent}#{lines[line_numer + 1]}" unless last_line
m << "\n" unless m.end_with?("\n")
m << "#{indent}-------------------------------------------\n"
end
end
private
def parse_line_number_from_description
description = self.description
if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
trace_line = Regexp.last_match[1]
description = description.sub(/\n.*\n(\.\.\.)? *\^~+$/, "").sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
end
[trace_line, description]
end
end
def gemfile_root
@gemfile ||= Bundler.default_gemfile
@gemfile.dirname
end
end
end
bundler-2.1.4/lib/bundler/lockfile_parser.rb 0000644 0000041 0000041 00000020425 13606335352 021104 0 ustar www-data www-data # frozen_string_literal: true
#--
# Some versions of the Bundler 1.1 RC series introduced corrupted
# lockfiles. There were two major problems:
#
# * multiple copies of the same GIT section appeared in the lockfile
# * when this happened, those sections got multiple copies of gems
# in those sections.
#
# As a result, Bundler 1.1 contains code that fixes the earlier
# corruption. We will remove this fix-up code in Bundler 1.2.
module Bundler
class LockfileParser
attr_reader :sources, :dependencies, :specs, :platforms, :bundler_version, :ruby_version
BUNDLED = "BUNDLED WITH".freeze
DEPENDENCIES = "DEPENDENCIES".freeze
PLATFORMS = "PLATFORMS".freeze
RUBY = "RUBY VERSION".freeze
GIT = "GIT".freeze
GEM = "GEM".freeze
PATH = "PATH".freeze
PLUGIN = "PLUGIN SOURCE".freeze
SPECS = " specs:".freeze
OPTIONS = /^ ([a-z]+): (.*)$/i.freeze
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
SECTIONS_BY_VERSION_INTRODUCED = {
Gem::Version.create("1.0") => [DEPENDENCIES, PLATFORMS, GIT, GEM, PATH].freeze,
Gem::Version.create("1.10") => [BUNDLED].freeze,
Gem::Version.create("1.12") => [RUBY].freeze,
Gem::Version.create("1.13") => [PLUGIN].freeze,
}.freeze
KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten.freeze
ENVIRONMENT_VERSION_SECTIONS = [BUNDLED, RUBY].freeze
def self.sections_in_lockfile(lockfile_contents)
lockfile_contents.scan(/^\w[\w ]*$/).uniq
end
def self.unknown_sections_in_lockfile(lockfile_contents)
sections_in_lockfile(lockfile_contents) - KNOWN_SECTIONS
end
def self.sections_to_ignore(base_version = nil)
base_version &&= base_version.release
base_version ||= Gem::Version.create("1.0".dup)
attributes = []
SECTIONS_BY_VERSION_INTRODUCED.each do |version, introduced|
next if version <= base_version
attributes += introduced
end
attributes
end
def initialize(lockfile)
@platforms = []
@sources = []
@dependencies = {}
@state = nil
@specs = {}
@rubygems_aggregate = Source::Rubygems.new
if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
"Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
end
lockfile.split(/(?:\r?\n)+/).each do |line|
if SOURCE.include?(line)
@state = :source
parse_source(line)
elsif line == DEPENDENCIES
@state = :dependency
elsif line == PLATFORMS
@state = :platform
elsif line == RUBY
@state = :ruby
elsif line == BUNDLED
@state = :bundled_with
elsif line =~ /^[^\s]/
@state = nil
elsif @state
send("parse_#{@state}", line)
end
end
@sources << @rubygems_aggregate unless Bundler.feature_flag.disable_multisource?
@specs = @specs.values.sort_by(&:identifier)
warn_for_outdated_bundler_version
rescue ArgumentError => e
Bundler.ui.debug(e)
raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
"and then `bundle install` to generate a new lockfile."
end
def warn_for_outdated_bundler_version
return unless bundler_version
prerelease_text = bundler_version.prerelease? ? " --pre" : ""
current_version = Gem::Version.create(Bundler::VERSION)
return unless current_version < bundler_version
Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
"than the version that created the lockfile (#{bundler_version}). We suggest you to " \
"upgrade to the version that created the lockfile by running `gem install " \
"bundler:#{bundler_version}#{prerelease_text}`.\n"
end
private
TYPES = {
GIT => Bundler::Source::Git,
GEM => Bundler::Source::Rubygems,
PATH => Bundler::Source::Path,
PLUGIN => Bundler::Plugin,
}.freeze
def parse_source(line)
case line
when SPECS
case @type
when PATH
@current_source = TYPES[@type].from_lock(@opts)
@sources << @current_source
when GIT
@current_source = TYPES[@type].from_lock(@opts)
# Strip out duplicate GIT sections
if @sources.include?(@current_source)
@current_source = @sources.find {|s| s == @current_source }
else
@sources << @current_source
end
when GEM
if Bundler.feature_flag.disable_multisource?
@opts["remotes"] = @opts.delete("remote")
@current_source = TYPES[@type].from_lock(@opts)
@sources << @current_source
else
Array(@opts["remote"]).each do |url|
@rubygems_aggregate.add_remote(url)
end
@current_source = @rubygems_aggregate
end
when PLUGIN
@current_source = Plugin.source_from_lock(@opts)
@sources << @current_source
end
when OPTIONS
value = $2
value = true if value == "true"
value = false if value == "false"
key = $1
if @opts[key]
@opts[key] = Array(@opts[key])
@opts[key] << value
else
@opts[key] = value
end
when *SOURCE
@current_source = nil
@opts = {}
@type = line
else
parse_spec(line)
end
end
space = / /
NAME_VERSION = /
^(#{space}{2}|#{space}{4}|#{space}{6})(?!#{space}) # Exactly 2, 4, or 6 spaces at the start of the line
(.*?) # Name
(?:#{space}\(([^-]*) # Space, followed by version
(?:-(.*))?\))? # Optional platform
(!)? # Optional pinned marker
$ # Line end
/xo.freeze
def parse_dependency(line)
return unless line =~ NAME_VERSION
spaces = $1
return unless spaces.size == 2
name = $2
version = $3
pinned = $5
version = version.split(",").map(&:strip) if version
dep = Bundler::Dependency.new(name, version)
if pinned && dep.name != "bundler"
spec = @specs.find {|_, v| v.name == dep.name }
dep.source = spec.last.source if spec
# Path sources need to know what the default name / version
# to use in the case that there are no gemspecs present. A fake
# gemspec is created based on the version set on the dependency
# TODO: Use the version from the spec instead of from the dependency
if version && version.size == 1 && version.first =~ /^\s*= (.+)\s*$/ && dep.source.is_a?(Bundler::Source::Path)
dep.source.name = name
dep.source.version = $1
end
end
@dependencies[dep.name] = dep
end
def parse_spec(line)
return unless line =~ NAME_VERSION
spaces = $1
name = $2
version = $3
platform = $4
if spaces.size == 4
version = Gem::Version.new(version)
platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
@current_spec = LazySpecification.new(name, version, platform)
@current_spec.source = @current_source
# Avoid introducing multiple copies of the same spec (caused by
# duplicate GIT sections)
@specs[@current_spec.identifier] ||= @current_spec
elsif spaces.size == 6
version = version.split(",").map(&:strip) if version
dep = Gem::Dependency.new(name, version)
@current_spec.dependencies << dep
end
end
def parse_platform(line)
@platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
end
def parse_bundled_with(line)
line = line.strip
return unless Gem::Version.correct?(line)
@bundler_version = Gem::Version.create(line)
end
def parse_ruby(line)
@ruby_version = line.strip
end
end
end
bundler-2.1.4/lib/bundler/deprecate.rb 0000644 0000041 0000041 00000001554 13606335352 017676 0 ustar www-data www-data # frozen_string_literal: true
begin
require "rubygems/deprecate"
rescue LoadError
# it's fine if it doesn't exist on the current RubyGems...
nil
end
module Bundler
# If Bundler::Deprecate is an autoload constant, we need to define it
if defined?(Bundler::Deprecate) && !autoload?(:Deprecate)
# nothing to do!
elsif defined? ::Deprecate
Deprecate = ::Deprecate
elsif defined? Gem::Deprecate
Deprecate = Gem::Deprecate
else
class Deprecate
end
end
unless Deprecate.respond_to?(:skip_during)
def Deprecate.skip_during
original = skip
self.skip = true
yield
ensure
self.skip = original
end
end
unless Deprecate.respond_to?(:skip)
def Deprecate.skip
@skip ||= false
end
end
unless Deprecate.respond_to?(:skip=)
def Deprecate.skip=(skip)
@skip = skip
end
end
end
bundler-2.1.4/lib/bundler/index.rb 0000644 0000041 0000041 00000012370 13606335352 017047 0 ustar www-data www-data # frozen_string_literal: true
require "set"
module Bundler
class Index
include Enumerable
def self.build
i = new
yield i
i
end
attr_reader :specs, :all_specs, :sources
protected :specs, :all_specs
RUBY = "ruby".freeze
NULL = "\0".freeze
def initialize
@sources = []
@cache = {}
@specs = Hash.new {|h, k| h[k] = {} }
@all_specs = Hash.new {|h, k| h[k] = EMPTY_SEARCH }
end
def initialize_copy(o)
@sources = o.sources.dup
@cache = {}
@specs = Hash.new {|h, k| h[k] = {} }
@all_specs = Hash.new {|h, k| h[k] = EMPTY_SEARCH }
o.specs.each do |name, hash|
@specs[name] = hash.dup
end
o.all_specs.each do |name, array|
@all_specs[name] = array.dup
end
end
def inspect
"#<#{self.class}:0x#{object_id} sources=#{sources.map(&:inspect)} specs.size=#{specs.size}>"
end
def empty?
each { return false }
true
end
def search_all(name)
all_matches = local_search(name) + @all_specs[name]
@sources.each do |source|
all_matches.concat(source.search_all(name))
end
all_matches
end
# Search this index's specs, and any source indexes that this index knows
# about, returning all of the results.
def search(query, base = nil)
sort_specs(unsorted_search(query, base))
end
def unsorted_search(query, base)
results = local_search(query, base)
seen = results.map(&:full_name).to_set unless @sources.empty?
@sources.each do |source|
source.unsorted_search(query, base).each do |spec|
results << spec if seen.add?(spec.full_name)
end
end
results
end
protected :unsorted_search
def self.sort_specs(specs)
specs.sort_by do |s|
platform_string = s.platform.to_s
[s.version, platform_string == RUBY ? NULL : platform_string]
end
end
def sort_specs(specs)
self.class.sort_specs(specs)
end
def local_search(query, base = nil)
case query
when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
when String then specs_by_name(query)
when Gem::Dependency then search_by_dependency(query, base)
when DepProxy then search_by_dependency(query.dep, base)
else
raise "You can't search for a #{query.inspect}."
end
end
alias_method :[], :search
def <<(spec)
@specs[spec.name][spec.full_name] = spec
spec
end
def each(&blk)
return enum_for(:each) unless blk
specs.values.each do |spec_sets|
spec_sets.values.each(&blk)
end
sources.each {|s| s.each(&blk) }
self
end
def spec_names
names = specs.keys + sources.map(&:spec_names)
names.uniq!
names
end
# returns a list of the dependencies
def unmet_dependency_names
dependency_names.select do |name|
name != "bundler" && search(name).empty?
end
end
def dependency_names
names = []
each do |spec|
spec.dependencies.each do |dep|
next if dep.type == :development
names << dep.name
end
end
names.uniq
end
def use(other, override_dupes = false)
return unless other
other.each do |s|
if (dupes = search_by_spec(s)) && !dupes.empty?
# safe to << since it's a new array when it has contents
@all_specs[s.name] = dupes << s
next unless override_dupes
end
self << s
end
self
end
def size
@sources.inject(@specs.size) do |size, source|
size += source.size
end
end
# Whether all the specs in self are in other
# TODO: rename to #include?
def ==(other)
all? do |spec|
other_spec = other[spec].first
other_spec && dependencies_eql?(spec, other_spec) && spec.source == other_spec.source
end
end
def dependencies_eql?(spec, other_spec)
deps = spec.dependencies.select {|d| d.type != :development }
other_deps = other_spec.dependencies.select {|d| d.type != :development }
Set.new(deps) == Set.new(other_deps)
end
def add_source(index)
raise ArgumentError, "Source must be an index, not #{index.class}" unless index.is_a?(Index)
@sources << index
@sources.uniq! # need to use uniq! here instead of checking for the item before adding
end
private
def specs_by_name(name)
@specs[name].values
end
def search_by_dependency(dependency, base = nil)
@cache[base || false] ||= {}
@cache[base || false][dependency] ||= begin
specs = specs_by_name(dependency.name)
specs += base if base
found = specs.select do |spec|
next true if spec.source.is_a?(Source::Gemspec)
if base # allow all platforms when searching from a lockfile
dependency.matches_spec?(spec)
else
dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
end
end
found
end
end
EMPTY_SEARCH = [].freeze
def search_by_spec(spec)
spec = @specs[spec.name][spec.full_name]
spec ? [spec] : EMPTY_SEARCH
end
end
end
bundler-2.1.4/lib/bundler/vendor/ 0000755 0000041 0000041 00000000000 13606335352 016705 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/fileutils/ 0000755 0000041 0000041 00000000000 13606335352 020705 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/fileutils/lib/ 0000755 0000041 0000041 00000000000 13606335352 021453 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/fileutils/lib/fileutils.rb 0000644 0000041 0000041 00000142457 13606335352 024015 0 ustar www-data www-data # frozen_string_literal: true
begin
require 'rbconfig'
rescue LoadError
# for make mjit-headers
end
#
# = fileutils.rb
#
# Copyright (c) 2000-2007 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the same terms of ruby.
#
# == module Bundler::FileUtils
#
# Namespace for several file utility methods for copying, moving, removing, etc.
#
# === Module Functions
#
# require 'bundler/vendor/fileutils/lib/fileutils'
#
# Bundler::FileUtils.cd(dir, **options)
# Bundler::FileUtils.cd(dir, **options) {|dir| block }
# Bundler::FileUtils.pwd()
# Bundler::FileUtils.mkdir(dir, **options)
# Bundler::FileUtils.mkdir(list, **options)
# Bundler::FileUtils.mkdir_p(dir, **options)
# Bundler::FileUtils.mkdir_p(list, **options)
# Bundler::FileUtils.rmdir(dir, **options)
# Bundler::FileUtils.rmdir(list, **options)
# Bundler::FileUtils.ln(target, link, **options)
# Bundler::FileUtils.ln(targets, dir, **options)
# Bundler::FileUtils.ln_s(target, link, **options)
# Bundler::FileUtils.ln_s(targets, dir, **options)
# Bundler::FileUtils.ln_sf(target, link, **options)
# Bundler::FileUtils.cp(src, dest, **options)
# Bundler::FileUtils.cp(list, dir, **options)
# Bundler::FileUtils.cp_r(src, dest, **options)
# Bundler::FileUtils.cp_r(list, dir, **options)
# Bundler::FileUtils.mv(src, dest, **options)
# Bundler::FileUtils.mv(list, dir, **options)
# Bundler::FileUtils.rm(list, **options)
# Bundler::FileUtils.rm_r(list, **options)
# Bundler::FileUtils.rm_rf(list, **options)
# Bundler::FileUtils.install(src, dest, **options)
# Bundler::FileUtils.chmod(mode, list, **options)
# Bundler::FileUtils.chmod_R(mode, list, **options)
# Bundler::FileUtils.chown(user, group, list, **options)
# Bundler::FileUtils.chown_R(user, group, list, **options)
# Bundler::FileUtils.touch(list, **options)
#
# Possible options are:
#
# :force :: forced operation (rewrite files if exist, remove
# directories if not empty, etc.);
# :verbose :: print command to be run, in bash syntax, before
# performing it;
# :preserve :: preserve object's group, user and modification
# time on copying;
# :noop :: no changes are made (usable in combination with
# :verbose which will print the command to run)
#
# Each method documents the options that it honours. See also ::commands,
# ::options and ::options_of methods to introspect which command have which
# options.
#
# All methods that have the concept of a "source" file or directory can take
# either one file or a list of files in that argument. See the method
# documentation for examples.
#
# There are some `low level' methods, which do not accept keyword arguments:
#
# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
# Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
# Bundler::FileUtils.copy_stream(srcstream, deststream)
# Bundler::FileUtils.remove_entry(path, force = false)
# Bundler::FileUtils.remove_entry_secure(path, force = false)
# Bundler::FileUtils.remove_file(path, force = false)
# Bundler::FileUtils.compare_file(path_a, path_b)
# Bundler::FileUtils.compare_stream(stream_a, stream_b)
# Bundler::FileUtils.uptodate?(file, cmp_list)
#
# == module Bundler::FileUtils::Verbose
#
# This module has all methods of Bundler::FileUtils module, but it outputs messages
# before acting. This equates to passing the :verbose flag to methods
# in Bundler::FileUtils.
#
# == module Bundler::FileUtils::NoWrite
#
# This module has all methods of Bundler::FileUtils module, but never changes
# files/directories. This equates to passing the :noop flag to methods
# in Bundler::FileUtils.
#
# == module Bundler::FileUtils::DryRun
#
# This module has all methods of Bundler::FileUtils module, but never changes
# files/directories. This equates to passing the :noop and
# :verbose flags to methods in Bundler::FileUtils.
#
module Bundler::FileUtils
VERSION = "1.4.1"
def self.private_module_function(name) #:nodoc:
module_function name
private_class_method name
end
#
# Returns the name of the current directory.
#
def pwd
Dir.pwd
end
module_function :pwd
alias getwd pwd
module_function :getwd
#
# Changes the current directory to the directory +dir+.
#
# If this method is called with block, resumes to the previous
# working directory after the block execution has finished.
#
# Bundler::FileUtils.cd('/') # change directory
#
# Bundler::FileUtils.cd('/', verbose: true) # change directory and report it
#
# Bundler::FileUtils.cd('/') do # change directory
# # ... # do something
# end # return to original directory
#
def cd(dir, verbose: nil, &block) # :yield: dir
fu_output_message "cd #{dir}" if verbose
result = Dir.chdir(dir, &block)
fu_output_message 'cd -' if verbose and block
result
end
module_function :cd
alias chdir cd
module_function :chdir
#
# Returns true if +new+ is newer than all +old_list+.
# Non-existent files are older than any file.
#
# Bundler::FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \
# system 'make hello.o'
#
def uptodate?(new, old_list)
return false unless File.exist?(new)
new_time = File.mtime(new)
old_list.each do |old|
if File.exist?(old)
return false unless new_time > File.mtime(old)
end
end
true
end
module_function :uptodate?
def remove_trailing_slash(dir) #:nodoc:
dir == '/' ? dir : dir.chomp(?/)
end
private_module_function :remove_trailing_slash
#
# Creates one or more directories.
#
# Bundler::FileUtils.mkdir 'test'
# Bundler::FileUtils.mkdir %w(tmp data)
# Bundler::FileUtils.mkdir 'notexist', noop: true # Does not really create.
# Bundler::FileUtils.mkdir 'tmp', mode: 0700
#
def mkdir(list, mode: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "mkdir #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
return if noop
list.each do |dir|
fu_mkdir dir, mode
end
end
module_function :mkdir
#
# Creates a directory and all its parent directories.
# For example,
#
# Bundler::FileUtils.mkdir_p '/usr/local/lib/ruby'
#
# causes to make following directories, if they do not exist.
#
# * /usr
# * /usr/local
# * /usr/local/lib
# * /usr/local/lib/ruby
#
# You can pass several directories at a time in a list.
#
def mkdir_p(list, mode: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "mkdir -p #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
return *list if noop
list.map {|path| remove_trailing_slash(path)}.each do |path|
# optimize for the most common case
begin
fu_mkdir path, mode
next
rescue SystemCallError
next if File.directory?(path)
end
stack = []
until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/"
stack.push path
path = File.dirname(path)
end
stack.pop # root directory should exist
stack.reverse_each do |dir|
begin
fu_mkdir dir, mode
rescue SystemCallError
raise unless File.directory?(dir)
end
end
end
return *list
end
module_function :mkdir_p
alias mkpath mkdir_p
alias makedirs mkdir_p
module_function :mkpath
module_function :makedirs
def fu_mkdir(path, mode) #:nodoc:
path = remove_trailing_slash(path)
if mode
Dir.mkdir path, mode
File.chmod mode, path
else
Dir.mkdir path
end
end
private_module_function :fu_mkdir
#
# Removes one or more directories.
#
# Bundler::FileUtils.rmdir 'somedir'
# Bundler::FileUtils.rmdir %w(somedir anydir otherdir)
# # Does not really remove directory; outputs message.
# Bundler::FileUtils.rmdir 'somedir', verbose: true, noop: true
#
def rmdir(list, parents: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "rmdir #{parents ? '-p ' : ''}#{list.join ' '}" if verbose
return if noop
list.each do |dir|
Dir.rmdir(dir = remove_trailing_slash(dir))
if parents
begin
until (parent = File.dirname(dir)) == '.' or parent == dir
dir = parent
Dir.rmdir(dir)
end
rescue Errno::ENOTEMPTY, Errno::EEXIST, Errno::ENOENT
end
end
end
end
module_function :rmdir
#
# :call-seq:
# Bundler::FileUtils.ln(target, link, force: nil, noop: nil, verbose: nil)
# Bundler::FileUtils.ln(target, dir, force: nil, noop: nil, verbose: nil)
# Bundler::FileUtils.ln(targets, dir, force: nil, noop: nil, verbose: nil)
#
# In the first form, creates a hard link +link+ which points to +target+.
# If +link+ already exists, raises Errno::EEXIST.
# But if the +force+ option is set, overwrites +link+.
#
# Bundler::FileUtils.ln 'gcc', 'cc', verbose: true
# Bundler::FileUtils.ln '/usr/bin/emacs21', '/usr/bin/emacs'
#
# In the second form, creates a link +dir/target+ pointing to +target+.
# In the third form, creates several hard links in the directory +dir+,
# pointing to each item in +targets+.
# If +dir+ is not a directory, raises Errno::ENOTDIR.
#
# Bundler::FileUtils.cd '/sbin'
# Bundler::FileUtils.ln %w(cp mv mkdir), '/bin' # Now /sbin/cp and /bin/cp are linked.
#
def ln(src, dest, force: nil, noop: nil, verbose: nil)
fu_output_message "ln#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest0(src, dest) do |s,d|
remove_file d, true if force
File.link s, d
end
end
module_function :ln
alias link ln
module_function :link
#
# Hard link +src+ to +dest+. If +src+ is a directory, this method links
# all its contents recursively. If +dest+ is a directory, links
# +src+ to +dest/src+.
#
# +src+ can be a list of files.
#
# If +dereference_root+ is true, this method dereference tree root.
#
# If +remove_destination+ is true, this method removes each destination file before copy.
#
# Bundler::FileUtils.rm_r site_ruby + '/mylib', force: true
# Bundler::FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
#
# # Examples of linking several files to target directory.
# Bundler::FileUtils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
# Bundler::FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', noop: true, verbose: true
#
# # If you want to link all contents of a directory instead of the
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
# # use the following code.
# Bundler::FileUtils.cp_lr 'src/.', 'dest' # cp_lr('src', 'dest') makes dest/src, but this doesn't.
#
def cp_lr(src, dest, noop: nil, verbose: nil,
dereference_root: true, remove_destination: false)
fu_output_message "cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
link_entry s, d, dereference_root, remove_destination
end
end
module_function :cp_lr
#
# :call-seq:
# Bundler::FileUtils.ln_s(target, link, force: nil, noop: nil, verbose: nil)
# Bundler::FileUtils.ln_s(target, dir, force: nil, noop: nil, verbose: nil)
# Bundler::FileUtils.ln_s(targets, dir, force: nil, noop: nil, verbose: nil)
#
# In the first form, creates a symbolic link +link+ which points to +target+.
# If +link+ already exists, raises Errno::EEXIST.
# But if the force option is set, overwrites +link+.
#
# Bundler::FileUtils.ln_s '/usr/bin/ruby', '/usr/local/bin/ruby'
# Bundler::FileUtils.ln_s 'verylongsourcefilename.c', 'c', force: true
#
# In the second form, creates a link +dir/target+ pointing to +target+.
# In the third form, creates several symbolic links in the directory +dir+,
# pointing to each item in +targets+.
# If +dir+ is not a directory, raises Errno::ENOTDIR.
#
# Bundler::FileUtils.ln_s Dir.glob('/bin/*.rb'), '/home/foo/bin'
#
def ln_s(src, dest, force: nil, noop: nil, verbose: nil)
fu_output_message "ln -s#{force ? 'f' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest0(src, dest) do |s,d|
remove_file d, true if force
File.symlink s, d
end
end
module_function :ln_s
alias symlink ln_s
module_function :symlink
#
# :call-seq:
# Bundler::FileUtils.ln_sf(*args)
#
# Same as
#
# Bundler::FileUtils.ln_s(*args, force: true)
#
def ln_sf(src, dest, noop: nil, verbose: nil)
ln_s src, dest, force: true, noop: noop, verbose: verbose
end
module_function :ln_sf
#
# Hard links a file system entry +src+ to +dest+.
# If +src+ is a directory, this method links its contents recursively.
#
# Both of +src+ and +dest+ must be a path name.
# +src+ must exist, +dest+ must not exist.
#
# If +dereference_root+ is true, this method dereferences the tree root.
#
# If +remove_destination+ is true, this method removes each destination file before copy.
#
def link_entry(src, dest, dereference_root = false, remove_destination = false)
Entry_.new(src, nil, dereference_root).traverse do |ent|
destent = Entry_.new(dest, ent.rel, false)
File.unlink destent.path if remove_destination && File.file?(destent.path)
ent.link destent.path
end
end
module_function :link_entry
#
# Copies a file content +src+ to +dest+. If +dest+ is a directory,
# copies +src+ to +dest/src+.
#
# If +src+ is a list of files, then +dest+ must be a directory.
#
# Bundler::FileUtils.cp 'eval.c', 'eval.c.org'
# Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6'
# Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', verbose: true
# Bundler::FileUtils.cp 'symlink', 'dest' # copy content, "dest" is not a symlink
#
def cp(src, dest, preserve: nil, noop: nil, verbose: nil)
fu_output_message "cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
copy_file s, d, preserve
end
end
module_function :cp
alias copy cp
module_function :copy
#
# Copies +src+ to +dest+. If +src+ is a directory, this method copies
# all its contents recursively. If +dest+ is a directory, copies
# +src+ to +dest/src+.
#
# +src+ can be a list of files.
#
# If +dereference_root+ is true, this method dereference tree root.
#
# If +remove_destination+ is true, this method removes each destination file before copy.
#
# # Installing Ruby library "mylib" under the site_ruby
# Bundler::FileUtils.rm_r site_ruby + '/mylib', force: true
# Bundler::FileUtils.cp_r 'lib/', site_ruby + '/mylib'
#
# # Examples of copying several files to target directory.
# Bundler::FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/tmail'
# Bundler::FileUtils.cp_r Dir.glob('*.rb'), '/home/foo/lib/ruby', noop: true, verbose: true
#
# # If you want to copy all contents of a directory instead of the
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
# # use following code.
# Bundler::FileUtils.cp_r 'src/.', 'dest' # cp_r('src', 'dest') makes dest/src,
# # but this doesn't.
#
def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,
dereference_root: true, remove_destination: nil)
fu_output_message "cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
copy_entry s, d, preserve, dereference_root, remove_destination
end
end
module_function :cp_r
#
# Copies a file system entry +src+ to +dest+.
# If +src+ is a directory, this method copies its contents recursively.
# This method preserves file types, c.f. symlink, directory...
# (FIFO, device files and etc. are not supported yet)
#
# Both of +src+ and +dest+ must be a path name.
# +src+ must exist, +dest+ must not exist.
#
# If +preserve+ is true, this method preserves owner, group, and
# modified time. Permissions are copied regardless +preserve+.
#
# If +dereference_root+ is true, this method dereference tree root.
#
# If +remove_destination+ is true, this method removes each destination file before copy.
#
def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
if dereference_root
src = File.realpath(src)
end
Entry_.new(src, nil, false).wrap_traverse(proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
File.unlink destent.path if remove_destination && (File.file?(destent.path) || File.symlink?(destent.path))
ent.copy destent.path
end, proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
ent.copy_metadata destent.path if preserve
end)
end
module_function :copy_entry
#
# Copies file contents of +src+ to +dest+.
# Both of +src+ and +dest+ must be a path name.
#
def copy_file(src, dest, preserve = false, dereference = true)
ent = Entry_.new(src, nil, dereference)
ent.copy_file dest
ent.copy_metadata dest if preserve
end
module_function :copy_file
#
# Copies stream +src+ to +dest+.
# +src+ must respond to #read(n) and
# +dest+ must respond to #write(str).
#
def copy_stream(src, dest)
IO.copy_stream(src, dest)
end
module_function :copy_stream
#
# Moves file(s) +src+ to +dest+. If +file+ and +dest+ exist on the different
# disk partition, the file is copied then the original file is removed.
#
# Bundler::FileUtils.mv 'badname.rb', 'goodname.rb'
# Bundler::FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', force: true # no error
#
# Bundler::FileUtils.mv %w(junk.txt dust.txt), '/home/foo/.trash/'
# Bundler::FileUtils.mv Dir.glob('test*.rb'), 'test', noop: true, verbose: true
#
def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
fu_output_message "mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
destent = Entry_.new(d, nil, true)
begin
if destent.exist?
if destent.directory?
raise Errno::EEXIST, d
end
end
begin
File.rename s, d
rescue Errno::EXDEV,
Errno::EPERM # move from unencrypted to encrypted dir (ext4)
copy_entry s, d, true
if secure
remove_entry_secure s, force
else
remove_entry s, force
end
end
rescue SystemCallError
raise unless force
end
end
end
module_function :mv
alias move mv
module_function :move
#
# Remove file(s) specified in +list+. This method cannot remove directories.
# All StandardErrors are ignored when the :force option is set.
#
# Bundler::FileUtils.rm %w( junk.txt dust.txt )
# Bundler::FileUtils.rm Dir.glob('*.so')
# Bundler::FileUtils.rm 'NotExistFile', force: true # never raises exception
#
def rm(list, force: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "rm#{force ? ' -f' : ''} #{list.join ' '}" if verbose
return if noop
list.each do |path|
remove_file path, force
end
end
module_function :rm
alias remove rm
module_function :remove
#
# Equivalent to
#
# Bundler::FileUtils.rm(list, force: true)
#
def rm_f(list, noop: nil, verbose: nil)
rm list, force: true, noop: noop, verbose: verbose
end
module_function :rm_f
alias safe_unlink rm_f
module_function :safe_unlink
#
# remove files +list+[0] +list+[1]... If +list+[n] is a directory,
# removes its all contents recursively. This method ignores
# StandardError when :force option is set.
#
# Bundler::FileUtils.rm_r Dir.glob('/tmp/*')
# Bundler::FileUtils.rm_r 'some_dir', force: true
#
# WARNING: This method causes local vulnerability
# if one of parent directories or removing directory tree are world
# writable (including /tmp, whose permission is 1777), and the current
# process has strong privilege such as Unix super user (root), and the
# system has symbolic link. For secure removing, read the documentation
# of remove_entry_secure carefully, and set :secure option to true.
# Default is secure: false.
#
# NOTE: This method calls remove_entry_secure if :secure option is set.
# See also remove_entry_secure.
#
def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
list = fu_list(list)
fu_output_message "rm -r#{force ? 'f' : ''} #{list.join ' '}" if verbose
return if noop
list.each do |path|
if secure
remove_entry_secure path, force
else
remove_entry path, force
end
end
end
module_function :rm_r
#
# Equivalent to
#
# Bundler::FileUtils.rm_r(list, force: true)
#
# WARNING: This method causes local vulnerability.
# Read the documentation of rm_r first.
#
def rm_rf(list, noop: nil, verbose: nil, secure: nil)
rm_r list, force: true, noop: noop, verbose: verbose, secure: secure
end
module_function :rm_rf
alias rmtree rm_rf
module_function :rmtree
#
# This method removes a file system entry +path+. +path+ shall be a
# regular file, a directory, or something. If +path+ is a directory,
# remove it recursively. This method is required to avoid TOCTTOU
# (time-of-check-to-time-of-use) local security vulnerability of rm_r.
# #rm_r causes security hole when:
#
# * Parent directory is world writable (including /tmp).
# * Removing directory tree includes world writable directory.
# * The system has symbolic link.
#
# To avoid this security hole, this method applies special preprocess.
# If +path+ is a directory, this method chown(2) and chmod(2) all
# removing directories. This requires the current process is the
# owner of the removing whole directory tree, or is the super user (root).
#
# WARNING: You must ensure that *ALL* parent directories cannot be
# moved by other untrusted users. For example, parent directories
# should not be owned by untrusted users, and should not be world
# writable except when the sticky bit set.
#
# WARNING: Only the owner of the removing directory tree, or Unix super
# user (root) should invoke this method. Otherwise this method does not
# work.
#
# For details of this security vulnerability, see Perl's case:
#
# * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448
# * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452
#
# For fileutils.rb, this vulnerability is reported in [ruby-dev:26100].
#
def remove_entry_secure(path, force = false)
unless fu_have_symlink?
remove_entry path, force
return
end
fullpath = File.expand_path(path)
st = File.lstat(fullpath)
unless st.directory?
File.unlink fullpath
return
end
# is a directory.
parent_st = File.stat(File.dirname(fullpath))
unless parent_st.world_writable?
remove_entry path, force
return
end
unless parent_st.sticky?
raise ArgumentError, "parent directory is world writable, Bundler::FileUtils#remove_entry_secure does not work; abort: #{path.inspect} (parent directory mode #{'%o' % parent_st.mode})"
end
# freeze tree root
euid = Process.euid
dot_file = fullpath + "/."
begin
File.open(dot_file) {|f|
unless fu_stat_identical_entry?(st, f.stat)
# symlink (TOC-to-TOU attack?)
File.unlink fullpath
return
end
f.chown euid, -1
f.chmod 0700
}
rescue Errno::EISDIR # JRuby in non-native mode can't open files as dirs
File.lstat(dot_file).tap {|fstat|
unless fu_stat_identical_entry?(st, fstat)
# symlink (TOC-to-TOU attack?)
File.unlink fullpath
return
end
File.chown euid, -1, dot_file
File.chmod 0700, dot_file
}
end
unless fu_stat_identical_entry?(st, File.lstat(fullpath))
# TOC-to-TOU attack?
File.unlink fullpath
return
end
# ---- tree root is frozen ----
root = Entry_.new(path)
root.preorder_traverse do |ent|
if ent.directory?
ent.chown euid, -1
ent.chmod 0700
end
end
root.postorder_traverse do |ent|
begin
ent.remove
rescue
raise unless force
end
end
rescue
raise unless force
end
module_function :remove_entry_secure
def fu_have_symlink? #:nodoc:
File.symlink nil, nil
rescue NotImplementedError
return false
rescue TypeError
return true
end
private_module_function :fu_have_symlink?
def fu_stat_identical_entry?(a, b) #:nodoc:
a.dev == b.dev and a.ino == b.ino
end
private_module_function :fu_stat_identical_entry?
#
# This method removes a file system entry +path+.
# +path+ might be a regular file, a directory, or something.
# If +path+ is a directory, remove it recursively.
#
# See also remove_entry_secure.
#
def remove_entry(path, force = false)
Entry_.new(path).postorder_traverse do |ent|
begin
ent.remove
rescue
raise unless force
end
end
rescue
raise unless force
end
module_function :remove_entry
#
# Removes a file +path+.
# This method ignores StandardError if +force+ is true.
#
def remove_file(path, force = false)
Entry_.new(path).remove_file
rescue
raise unless force
end
module_function :remove_file
#
# Removes a directory +dir+ and its contents recursively.
# This method ignores StandardError if +force+ is true.
#
def remove_dir(path, force = false)
remove_entry path, force # FIXME?? check if it is a directory
end
module_function :remove_dir
#
# Returns true if the contents of a file +a+ and a file +b+ are identical.
#
# Bundler::FileUtils.compare_file('somefile', 'somefile') #=> true
# Bundler::FileUtils.compare_file('/dev/null', '/dev/urandom') #=> false
#
def compare_file(a, b)
return false unless File.size(a) == File.size(b)
File.open(a, 'rb') {|fa|
File.open(b, 'rb') {|fb|
return compare_stream(fa, fb)
}
}
end
module_function :compare_file
alias identical? compare_file
alias cmp compare_file
module_function :identical?
module_function :cmp
#
# Returns true if the contents of a stream +a+ and +b+ are identical.
#
def compare_stream(a, b)
bsize = fu_stream_blksize(a, b)
if RUBY_VERSION > "2.4"
sa = String.new(capacity: bsize)
sb = String.new(capacity: bsize)
else
sa = String.new
sb = String.new
end
begin
a.read(bsize, sa)
b.read(bsize, sb)
return true if sa.empty? && sb.empty?
end while sa == sb
false
end
module_function :compare_stream
#
# If +src+ is not same as +dest+, copies it and changes the permission
# mode to +mode+. If +dest+ is a directory, destination is +dest+/+src+.
# This method removes destination before copy.
#
# Bundler::FileUtils.install 'ruby', '/usr/local/bin/ruby', mode: 0755, verbose: true
# Bundler::FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', verbose: true
#
def install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil,
noop: nil, verbose: nil)
if verbose
msg = +"install -c"
msg << ' -p' if preserve
msg << ' -m ' << mode_to_s(mode) if mode
msg << " -o #{owner}" if owner
msg << " -g #{group}" if group
msg << ' ' << [src,dest].flatten.join(' ')
fu_output_message msg
end
return if noop
uid = fu_get_uid(owner)
gid = fu_get_gid(group)
fu_each_src_dest(src, dest) do |s, d|
st = File.stat(s)
unless File.exist?(d) and compare_file(s, d)
remove_file d, true
copy_file s, d
File.utime st.atime, st.mtime, d if preserve
File.chmod fu_mode(mode, st), d if mode
File.chown uid, gid, d if uid or gid
end
end
end
module_function :install
def user_mask(target) #:nodoc:
target.each_char.inject(0) do |mask, chr|
case chr
when "u"
mask | 04700
when "g"
mask | 02070
when "o"
mask | 01007
when "a"
mask | 07777
else
raise ArgumentError, "invalid `who' symbol in file mode: #{chr}"
end
end
end
private_module_function :user_mask
def apply_mask(mode, user_mask, op, mode_mask) #:nodoc:
case op
when '='
(mode & ~user_mask) | (user_mask & mode_mask)
when '+'
mode | (user_mask & mode_mask)
when '-'
mode & ~(user_mask & mode_mask)
end
end
private_module_function :apply_mask
def symbolic_modes_to_i(mode_sym, path) #:nodoc:
mode = if File::Stat === path
path.mode
else
File.stat(path).mode
end
mode_sym.split(/,/).inject(mode & 07777) do |current_mode, clause|
target, *actions = clause.split(/([=+-])/)
raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty?
target = 'a' if target.empty?
user_mask = user_mask(target)
actions.each_slice(2) do |op, perm|
need_apply = op == '='
mode_mask = (perm || '').each_char.inject(0) do |mask, chr|
case chr
when "r"
mask | 0444
when "w"
mask | 0222
when "x"
mask | 0111
when "X"
if FileTest.directory? path
mask | 0111
else
mask
end
when "s"
mask | 06000
when "t"
mask | 01000
when "u", "g", "o"
if mask.nonzero?
current_mode = apply_mask(current_mode, user_mask, op, mask)
end
need_apply = false
copy_mask = user_mask(chr)
(current_mode & copy_mask) / (copy_mask & 0111) * (user_mask & 0111)
else
raise ArgumentError, "invalid `perm' symbol in file mode: #{chr}"
end
end
if mode_mask.nonzero? || need_apply
current_mode = apply_mask(current_mode, user_mask, op, mode_mask)
end
end
current_mode
end
end
private_module_function :symbolic_modes_to_i
def fu_mode(mode, path) #:nodoc:
mode.is_a?(String) ? symbolic_modes_to_i(mode, path) : mode
end
private_module_function :fu_mode
def mode_to_s(mode) #:nodoc:
mode.is_a?(String) ? mode : "%o" % mode
end
private_module_function :mode_to_s
#
# Changes permission bits on the named files (in +list+) to the bit pattern
# represented by +mode+.
#
# +mode+ is the symbolic and absolute mode can be used.
#
# Absolute mode is
# Bundler::FileUtils.chmod 0755, 'somecommand'
# Bundler::FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb)
# Bundler::FileUtils.chmod 0755, '/usr/bin/ruby', verbose: true
#
# Symbolic mode is
# Bundler::FileUtils.chmod "u=wrx,go=rx", 'somecommand'
# Bundler::FileUtils.chmod "u=wr,go=rr", %w(my.rb your.rb his.rb her.rb)
# Bundler::FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', verbose: true
#
# "a" :: is user, group, other mask.
# "u" :: is user's mask.
# "g" :: is group's mask.
# "o" :: is other's mask.
# "w" :: is write permission.
# "r" :: is read permission.
# "x" :: is execute permission.
# "X" ::
# is execute permission for directories only, must be used in conjunction with "+"
# "s" :: is uid, gid.
# "t" :: is sticky bit.
# "+" :: is added to a class given the specified mode.
# "-" :: Is removed from a given class given mode.
# "=" :: Is the exact nature of the class will be given a specified mode.
def chmod(mode, list, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if verbose
return if noop
list.each do |path|
Entry_.new(path).chmod(fu_mode(mode, path))
end
end
module_function :chmod
#
# Changes permission bits on the named files (in +list+)
# to the bit pattern represented by +mode+.
#
# Bundler::FileUtils.chmod_R 0700, "/tmp/app.#{$$}"
# Bundler::FileUtils.chmod_R "u=wrx", "/tmp/app.#{$$}"
#
def chmod_R(mode, list, noop: nil, verbose: nil, force: nil)
list = fu_list(list)
fu_output_message sprintf('chmod -R%s %s %s',
(force ? 'f' : ''),
mode_to_s(mode), list.join(' ')) if verbose
return if noop
list.each do |root|
Entry_.new(root).traverse do |ent|
begin
ent.chmod(fu_mode(mode, ent.path))
rescue
raise unless force
end
end
end
end
module_function :chmod_R
#
# Changes owner and group on the named files (in +list+)
# to the user +user+ and the group +group+. +user+ and +group+
# may be an ID (Integer/String) or a name (String).
# If +user+ or +group+ is nil, this method does not change
# the attribute.
#
# Bundler::FileUtils.chown 'root', 'staff', '/usr/local/bin/ruby'
# Bundler::FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), verbose: true
#
def chown(user, group, list, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message sprintf('chown %s %s',
(group ? "#{user}:#{group}" : user || ':'),
list.join(' ')) if verbose
return if noop
uid = fu_get_uid(user)
gid = fu_get_gid(group)
list.each do |path|
Entry_.new(path).chown uid, gid
end
end
module_function :chown
#
# Changes owner and group on the named files (in +list+)
# to the user +user+ and the group +group+ recursively.
# +user+ and +group+ may be an ID (Integer/String) or
# a name (String). If +user+ or +group+ is nil, this
# method does not change the attribute.
#
# Bundler::FileUtils.chown_R 'www', 'www', '/var/www/htdocs'
# Bundler::FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', verbose: true
#
def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)
list = fu_list(list)
fu_output_message sprintf('chown -R%s %s %s',
(force ? 'f' : ''),
(group ? "#{user}:#{group}" : user || ':'),
list.join(' ')) if verbose
return if noop
uid = fu_get_uid(user)
gid = fu_get_gid(group)
list.each do |root|
Entry_.new(root).traverse do |ent|
begin
ent.chown uid, gid
rescue
raise unless force
end
end
end
end
module_function :chown_R
def fu_get_uid(user) #:nodoc:
return nil unless user
case user
when Integer
user
when /\A\d+\z/
user.to_i
else
require 'etc'
Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
end
end
private_module_function :fu_get_uid
def fu_get_gid(group) #:nodoc:
return nil unless group
case group
when Integer
group
when /\A\d+\z/
group.to_i
else
require 'etc'
Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
end
end
private_module_function :fu_get_gid
#
# Updates modification time (mtime) and access time (atime) of file(s) in
# +list+. Files are created if they don't exist.
#
# Bundler::FileUtils.touch 'timestamp'
# Bundler::FileUtils.touch Dir.glob('*.c'); system 'make'
#
def touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil)
list = fu_list(list)
t = mtime
if verbose
fu_output_message "touch #{nocreate ? '-c ' : ''}#{t ? t.strftime('-t %Y%m%d%H%M.%S ') : ''}#{list.join ' '}"
end
return if noop
list.each do |path|
created = nocreate
begin
File.utime(t, t, path)
rescue Errno::ENOENT
raise if created
File.open(path, 'a') {
;
}
created = true
retry if t
end
end
end
module_function :touch
private
module StreamUtils_
private
case (defined?(::RbConfig) ? ::RbConfig::CONFIG['host_os'] : ::RUBY_PLATFORM)
when /mswin|mingw/
def fu_windows?; true end
else
def fu_windows?; false end
end
def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
IO.copy_stream(src, dest)
end
def fu_stream_blksize(*streams)
streams.each do |s|
next unless s.respond_to?(:stat)
size = fu_blksize(s.stat)
return size if size
end
fu_default_blksize()
end
def fu_blksize(st)
s = st.blksize
return nil unless s
return nil if s == 0
s
end
def fu_default_blksize
1024
end
end
include StreamUtils_
extend StreamUtils_
class Entry_ #:nodoc: internal use only
include StreamUtils_
def initialize(a, b = nil, deref = false)
@prefix = @rel = @path = nil
if b
@prefix = a
@rel = b
else
@path = a
end
@deref = deref
@stat = nil
@lstat = nil
end
def inspect
"\#<#{self.class} #{path()}>"
end
def path
if @path
File.path(@path)
else
join(@prefix, @rel)
end
end
def prefix
@prefix || @path
end
def rel
@rel
end
def dereference?
@deref
end
def exist?
begin
lstat
true
rescue Errno::ENOENT
false
end
end
def file?
s = lstat!
s and s.file?
end
def directory?
s = lstat!
s and s.directory?
end
def symlink?
s = lstat!
s and s.symlink?
end
def chardev?
s = lstat!
s and s.chardev?
end
def blockdev?
s = lstat!
s and s.blockdev?
end
def socket?
s = lstat!
s and s.socket?
end
def pipe?
s = lstat!
s and s.pipe?
end
S_IF_DOOR = 0xD000
def door?
s = lstat!
s and (s.mode & 0xF000 == S_IF_DOOR)
end
def entries
opts = {}
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
files = if Dir.respond_to?(:children)
Dir.children(path, **opts)
else
Dir.entries(path(), **opts)
.reject {|n| n == '.' or n == '..' }
end
untaint = RUBY_VERSION < '2.7'
files.map {|n| Entry_.new(prefix(), join(rel(), untaint ? n.untaint : n)) }
end
def stat
return @stat if @stat
if lstat() and lstat().symlink?
@stat = File.stat(path())
else
@stat = lstat()
end
@stat
end
def stat!
return @stat if @stat
if lstat! and lstat!.symlink?
@stat = File.stat(path())
else
@stat = lstat!
end
@stat
rescue SystemCallError
nil
end
def lstat
if dereference?
@lstat ||= File.stat(path())
else
@lstat ||= File.lstat(path())
end
end
def lstat!
lstat()
rescue SystemCallError
nil
end
def chmod(mode)
if symlink?
File.lchmod mode, path() if have_lchmod?
else
File.chmod mode, path()
end
end
def chown(uid, gid)
if symlink?
File.lchown uid, gid, path() if have_lchown?
else
File.chown uid, gid, path()
end
end
def link(dest)
case
when directory?
if !File.exist?(dest) and descendant_directory?(dest, path)
raise ArgumentError, "cannot link directory %s to itself %s" % [path, dest]
end
begin
Dir.mkdir dest
rescue
raise unless File.directory?(dest)
end
else
File.link path(), dest
end
end
def copy(dest)
lstat
case
when file?
copy_file dest
when directory?
if !File.exist?(dest) and descendant_directory?(dest, path)
raise ArgumentError, "cannot copy directory %s to itself %s" % [path, dest]
end
begin
Dir.mkdir dest
rescue
raise unless File.directory?(dest)
end
when symlink?
File.symlink File.readlink(path()), dest
when chardev?, blockdev?
raise "cannot handle device file"
when socket?
begin
require 'socket'
rescue LoadError
raise "cannot handle socket"
else
raise "cannot handle socket" unless defined?(UNIXServer)
end
UNIXServer.new(dest).close
File.chmod lstat().mode, dest
when pipe?
raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
File.mkfifo dest, lstat().mode
when door?
raise "cannot handle door: #{path()}"
else
raise "unknown file type: #{path()}"
end
end
def copy_file(dest)
File.open(path()) do |s|
File.open(dest, 'wb', s.stat.mode) do |f|
IO.copy_stream(s, f)
end
end
end
def copy_metadata(path)
st = lstat()
if !st.symlink?
File.utime st.atime, st.mtime, path
end
mode = st.mode
begin
if st.symlink?
begin
File.lchown st.uid, st.gid, path
rescue NotImplementedError
end
else
File.chown st.uid, st.gid, path
end
rescue Errno::EPERM, Errno::EACCES
# clear setuid/setgid
mode &= 01777
end
if st.symlink?
begin
File.lchmod mode, path
rescue NotImplementedError
end
else
File.chmod mode, path
end
end
def remove
if directory?
remove_dir1
else
remove_file
end
end
def remove_dir1
platform_support {
Dir.rmdir path().chomp(?/)
}
end
def remove_file
platform_support {
File.unlink path
}
end
def platform_support
return yield unless fu_windows?
first_time_p = true
begin
yield
rescue Errno::ENOENT
raise
rescue => err
if first_time_p
first_time_p = false
begin
File.chmod 0700, path() # Windows does not have symlink
retry
rescue SystemCallError
end
end
raise err
end
end
def preorder_traverse
stack = [self]
while ent = stack.pop
yield ent
stack.concat ent.entries.reverse if ent.directory?
end
end
alias traverse preorder_traverse
def postorder_traverse
if directory?
entries().each do |ent|
ent.postorder_traverse do |e|
yield e
end
end
end
ensure
yield self
end
def wrap_traverse(pre, post)
pre.call self
if directory?
entries.each do |ent|
ent.wrap_traverse pre, post
end
end
post.call self
end
private
@@fileutils_rb_have_lchmod = nil
def have_lchmod?
# This is not MT-safe, but it does not matter.
if @@fileutils_rb_have_lchmod == nil
@@fileutils_rb_have_lchmod = check_have_lchmod?
end
@@fileutils_rb_have_lchmod
end
def check_have_lchmod?
return false unless File.respond_to?(:lchmod)
File.lchmod 0
return true
rescue NotImplementedError
return false
end
@@fileutils_rb_have_lchown = nil
def have_lchown?
# This is not MT-safe, but it does not matter.
if @@fileutils_rb_have_lchown == nil
@@fileutils_rb_have_lchown = check_have_lchown?
end
@@fileutils_rb_have_lchown
end
def check_have_lchown?
return false unless File.respond_to?(:lchown)
File.lchown nil, nil
return true
rescue NotImplementedError
return false
end
def join(dir, base)
return File.path(dir) if not base or base == '.'
return File.path(base) if not dir or dir == '.'
File.join(dir, base)
end
if File::ALT_SEPARATOR
DIRECTORY_TERM = "(?=[/#{Regexp.quote(File::ALT_SEPARATOR)}]|\\z)"
else
DIRECTORY_TERM = "(?=/|\\z)"
end
def descendant_directory?(descendant, ascendant)
if File::FNM_SYSCASE.nonzero?
File.expand_path(File.dirname(descendant)).casecmp(File.expand_path(ascendant)) == 0
else
File.expand_path(File.dirname(descendant)) == File.expand_path(ascendant)
end
end
end # class Entry_
def fu_list(arg) #:nodoc:
[arg].flatten.map {|path| File.path(path) }
end
private_module_function :fu_list
def fu_each_src_dest(src, dest) #:nodoc:
fu_each_src_dest0(src, dest) do |s, d|
raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d)
yield s, d
end
end
private_module_function :fu_each_src_dest
def fu_each_src_dest0(src, dest) #:nodoc:
if tmp = Array.try_convert(src)
tmp.each do |s|
s = File.path(s)
yield s, File.join(dest, File.basename(s))
end
else
src = File.path(src)
if File.directory?(dest)
yield src, File.join(dest, File.basename(src))
else
yield src, File.path(dest)
end
end
end
private_module_function :fu_each_src_dest0
def fu_same?(a, b) #:nodoc:
File.identical?(a, b)
end
private_module_function :fu_same?
def fu_output_message(msg) #:nodoc:
output = @fileutils_output if defined?(@fileutils_output)
output ||= $stderr
if defined?(@fileutils_label)
msg = @fileutils_label + msg
end
output.puts msg
end
private_module_function :fu_output_message
# This hash table holds command options.
OPT_TABLE = {} #:nodoc: internal use only
(private_instance_methods & methods(false)).inject(OPT_TABLE) {|tbl, name|
(tbl[name.to_s] = instance_method(name).parameters).map! {|t, n| n if t == :key}.compact!
tbl
}
public
#
# Returns an Array of names of high-level methods that accept any keyword
# arguments.
#
# p Bundler::FileUtils.commands #=> ["chmod", "cp", "cp_r", "install", ...]
#
def self.commands
OPT_TABLE.keys
end
#
# Returns an Array of option names.
#
# p Bundler::FileUtils.options #=> ["noop", "force", "verbose", "preserve", "mode"]
#
def self.options
OPT_TABLE.values.flatten.uniq.map {|sym| sym.to_s }
end
#
# Returns true if the method +mid+ have an option +opt+.
#
# p Bundler::FileUtils.have_option?(:cp, :noop) #=> true
# p Bundler::FileUtils.have_option?(:rm, :force) #=> true
# p Bundler::FileUtils.have_option?(:rm, :preserve) #=> false
#
def self.have_option?(mid, opt)
li = OPT_TABLE[mid.to_s] or raise ArgumentError, "no such method: #{mid}"
li.include?(opt)
end
#
# Returns an Array of option names of the method +mid+.
#
# p Bundler::FileUtils.options_of(:rm) #=> ["noop", "verbose", "force"]
#
def self.options_of(mid)
OPT_TABLE[mid.to_s].map {|sym| sym.to_s }
end
#
# Returns an Array of methods names which have the option +opt+.
#
# p Bundler::FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
#
def self.collect_method(opt)
OPT_TABLE.keys.select {|m| OPT_TABLE[m].include?(opt) }
end
private
LOW_METHODS = singleton_methods(false) - collect_method(:noop).map(&:intern) # :nodoc:
module LowMethods # :nodoc: internal use only
private
def _do_nothing(*)end
::Bundler::FileUtils::LOW_METHODS.map {|name| alias_method name, :_do_nothing}
end
METHODS = singleton_methods() - [:private_module_function, # :nodoc:
:commands, :options, :have_option?, :options_of, :collect_method]
#
# This module has all methods of Bundler::FileUtils module, but it outputs messages
# before acting. This equates to passing the :verbose flag to
# methods in Bundler::FileUtils.
#
module Verbose
include Bundler::FileUtils
names = ::Bundler::FileUtils.collect_method(:verbose)
names.each do |name|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{name}(*args, **options)
super(*args, **options, verbose: true)
end
EOS
end
private(*names)
extend self
class << self
public(*::Bundler::FileUtils::METHODS)
end
end
#
# This module has all methods of Bundler::FileUtils module, but never changes
# files/directories. This equates to passing the :noop flag
# to methods in Bundler::FileUtils.
#
module NoWrite
include Bundler::FileUtils
include LowMethods
names = ::Bundler::FileUtils.collect_method(:noop)
names.each do |name|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{name}(*args, **options)
super(*args, **options, noop: true)
end
EOS
end
private(*names)
extend self
class << self
public(*::Bundler::FileUtils::METHODS)
end
end
#
# This module has all methods of Bundler::FileUtils module, but never changes
# files/directories, with printing message before acting.
# This equates to passing the :noop and :verbose flag
# to methods in Bundler::FileUtils.
#
module DryRun
include Bundler::FileUtils
include LowMethods
names = ::Bundler::FileUtils.collect_method(:noop)
names.each do |name|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{name}(*args, **options)
super(*args, **options, noop: true, verbose: true)
end
EOS
end
private(*names)
extend self
class << self
public(*::Bundler::FileUtils::METHODS)
end
end
end
bundler-2.1.4/lib/bundler/vendor/uri/ 0000755 0000041 0000041 00000000000 13606335352 017504 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/uri/lib/ 0000755 0000041 0000041 00000000000 13606335352 020252 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/uri/lib/uri.rb 0000644 0000041 0000041 00000006624 13606335352 021406 0 ustar www-data www-data # frozen_string_literal: false
# Bundler::URI is a module providing classes to handle Uniform Resource Identifiers
# (RFC2396[http://tools.ietf.org/html/rfc2396]).
#
# == Features
#
# * Uniform way of handling URIs.
# * Flexibility to introduce custom Bundler::URI schemes.
# * Flexibility to have an alternate Bundler::URI::Parser (or just different patterns
# and regexp's).
#
# == Basic example
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
# #=> #
#
# uri.scheme #=> "http"
# uri.host #=> "foo.com"
# uri.path #=> "/posts"
# uri.query #=> "id=30&limit=5"
# uri.fragment #=> "time=1305298413"
#
# uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
#
# == Adding custom URIs
#
# module Bundler::URI
# class RSYNC < Generic
# DEFAULT_PORT = 873
# end
# @@schemes['RSYNC'] = RSYNC
# end
# #=> Bundler::URI::RSYNC
#
# Bundler::URI.scheme_list
# #=> {"FILE"=>Bundler::URI::File, "FTP"=>Bundler::URI::FTP, "HTTP"=>Bundler::URI::HTTP,
# # "HTTPS"=>Bundler::URI::HTTPS, "LDAP"=>Bundler::URI::LDAP, "LDAPS"=>Bundler::URI::LDAPS,
# # "MAILTO"=>Bundler::URI::MailTo, "RSYNC"=>Bundler::URI::RSYNC}
#
# uri = Bundler::URI("rsync://rsync.foo.com")
# #=> #
#
# == RFC References
#
# A good place to view an RFC spec is http://www.ietf.org/rfc.html.
#
# Here is a list of all related RFC's:
# - RFC822[http://tools.ietf.org/html/rfc822]
# - RFC1738[http://tools.ietf.org/html/rfc1738]
# - RFC2255[http://tools.ietf.org/html/rfc2255]
# - RFC2368[http://tools.ietf.org/html/rfc2368]
# - RFC2373[http://tools.ietf.org/html/rfc2373]
# - RFC2396[http://tools.ietf.org/html/rfc2396]
# - RFC2732[http://tools.ietf.org/html/rfc2732]
# - RFC3986[http://tools.ietf.org/html/rfc3986]
#
# == Class tree
#
# - Bundler::URI::Generic (in uri/generic.rb)
# - Bundler::URI::File - (in uri/file.rb)
# - Bundler::URI::FTP - (in uri/ftp.rb)
# - Bundler::URI::HTTP - (in uri/http.rb)
# - Bundler::URI::HTTPS - (in uri/https.rb)
# - Bundler::URI::LDAP - (in uri/ldap.rb)
# - Bundler::URI::LDAPS - (in uri/ldaps.rb)
# - Bundler::URI::MailTo - (in uri/mailto.rb)
# - Bundler::URI::Parser - (in uri/common.rb)
# - Bundler::URI::REGEXP - (in uri/common.rb)
# - Bundler::URI::REGEXP::PATTERN - (in uri/common.rb)
# - Bundler::URI::Util - (in uri/common.rb)
# - Bundler::URI::Escape - (in uri/common.rb)
# - Bundler::URI::Error - (in uri/common.rb)
# - Bundler::URI::InvalidURIError - (in uri/common.rb)
# - Bundler::URI::InvalidComponentError - (in uri/common.rb)
# - Bundler::URI::BadURIError - (in uri/common.rb)
#
# == Copyright Info
#
# Author:: Akira Yamada
# Documentation::
# Akira Yamada
# Dmitry V. Sabanin
# Vincent Batts
# License::
# Copyright (c) 2001 akira yamada
# You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
module Bundler::URI
end
require_relative 'uri/version'
require_relative 'uri/common'
require_relative 'uri/generic'
require_relative 'uri/file'
require_relative 'uri/ftp'
require_relative 'uri/http'
require_relative 'uri/https'
require_relative 'uri/ldap'
require_relative 'uri/ldaps'
require_relative 'uri/mailto'
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/ 0000755 0000041 0000041 00000000000 13606335352 021051 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/ftp.rb 0000644 0000041 0000041 00000016445 13606335352 022201 0 ustar www-data www-data # frozen_string_literal: false
# = uri/ftp.rb
#
# Author:: Akira Yamada
# License:: You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
# See Bundler::URI for general documentation
#
require_relative 'generic'
module Bundler::URI
#
# FTP Bundler::URI syntax is defined by RFC1738 section 3.2.
#
# This class will be redesigned because of difference of implementations;
# the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
# is a good summary about the de facto spec.
# http://tools.ietf.org/html/draft-hoffman-ftp-uri-04
#
class FTP < Generic
# A Default port of 21 for Bundler::URI::FTP.
DEFAULT_PORT = 21
#
# An Array of the available components for Bundler::URI::FTP.
#
COMPONENT = [
:scheme,
:userinfo, :host, :port,
:path, :typecode
].freeze
#
# Typecode is "a", "i", or "d".
#
# * "a" indicates a text file (the FTP command was ASCII)
# * "i" indicates a binary file (FTP command IMAGE)
# * "d" indicates the contents of a directory should be displayed
#
TYPECODE = ['a', 'i', 'd'].freeze
# Typecode prefix ";type=".
TYPECODE_PREFIX = ';type='.freeze
def self.new2(user, password, host, port, path,
typecode = nil, arg_check = true) # :nodoc:
# Do not use this method! Not tested. [Bug #7301]
# This methods remains just for compatibility,
# Keep it undocumented until the active maintainer is assigned.
typecode = nil if typecode.size == 0
if typecode && !TYPECODE.include?(typecode)
raise ArgumentError,
"bad typecode is specified: #{typecode}"
end
# do escape
self.new('ftp',
[user, password],
host, port, nil,
typecode ? path + TYPECODE_PREFIX + typecode : path,
nil, nil, nil, arg_check)
end
#
# == Description
#
# Creates a new Bundler::URI::FTP object from components, with syntax checking.
#
# The components accepted are +userinfo+, +host+, +port+, +path+, and
# +typecode+.
#
# The components should be provided either as an Array, or as a Hash
# with keys formed by preceding the component names with a colon.
#
# If an Array is used, the components must be passed in the
# order [userinfo, host, port, path, typecode]
.
#
# If the path supplied is absolute, it will be escaped in order to
# make it absolute in the Bundler::URI.
#
# Examples:
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri1 = Bundler::URI::FTP.build(['user:password', 'ftp.example.com', nil,
# '/path/file.zip', 'i'])
# uri1.to_s # => "ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i"
#
# uri2 = Bundler::URI::FTP.build({:host => 'ftp.example.com',
# :path => 'ruby/src'})
# uri2.to_s # => "ftp://ftp.example.com/ruby/src"
#
def self.build(args)
# Fix the incoming path to be generic URL syntax
# FTP path -> URL path
# foo/bar /foo/bar
# /foo/bar /%2Ffoo/bar
#
if args.kind_of?(Array)
args[3] = '/' + args[3].sub(/^\//, '%2F')
else
args[:path] = '/' + args[:path].sub(/^\//, '%2F')
end
tmp = Util::make_components_hash(self, args)
if tmp[:typecode]
if tmp[:typecode].size == 1
tmp[:typecode] = TYPECODE_PREFIX + tmp[:typecode]
end
tmp[:path] << tmp[:typecode]
end
return super(tmp)
end
#
# == Description
#
# Creates a new Bundler::URI::FTP object from generic URL components with no
# syntax checking.
#
# Unlike build(), this method does not escape the path component as
# required by RFC1738; instead it is treated as per RFC2396.
#
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
# +opaque+, +query+, and +fragment+, in that order.
#
def initialize(scheme,
userinfo, host, port, registry,
path, opaque,
query,
fragment,
parser = nil,
arg_check = false)
raise InvalidURIError unless path
path = path.sub(/^\//,'')
path.sub!(/^%2F/,'/')
super(scheme, userinfo, host, port, registry, path, opaque,
query, fragment, parser, arg_check)
@typecode = nil
if tmp = @path.index(TYPECODE_PREFIX)
typecode = @path[tmp + TYPECODE_PREFIX.size..-1]
@path = @path[0..tmp - 1]
if arg_check
self.typecode = typecode
else
self.set_typecode(typecode)
end
end
end
# typecode accessor.
#
# See Bundler::URI::FTP::COMPONENT.
attr_reader :typecode
# Validates typecode +v+,
# returns +true+ or +false+.
#
def check_typecode(v)
if TYPECODE.include?(v)
return true
else
raise InvalidComponentError,
"bad typecode(expected #{TYPECODE.join(', ')}): #{v}"
end
end
private :check_typecode
# Private setter for the typecode +v+.
#
# See also Bundler::URI::FTP.typecode=.
#
def set_typecode(v)
@typecode = v
end
protected :set_typecode
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the typecode +v+
# (with validation).
#
# See also Bundler::URI::FTP.check_typecode.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("ftp://john@ftp.example.com/my_file.img")
# #=> #
# uri.typecode = "i"
# uri
# #=> #
#
def typecode=(typecode)
check_typecode(typecode)
set_typecode(typecode)
typecode
end
def merge(oth) # :nodoc:
tmp = super(oth)
if self != tmp
tmp.set_typecode(oth.typecode)
end
return tmp
end
# Returns the path from an FTP Bundler::URI.
#
# RFC 1738 specifically states that the path for an FTP Bundler::URI does not
# include the / which separates the Bundler::URI path from the Bundler::URI host. Example:
#
# ftp://ftp.example.com/pub/ruby
#
# The above Bundler::URI indicates that the client should connect to
# ftp.example.com then cd to pub/ruby from the initial login directory.
#
# If you want to cd to an absolute directory, you must include an
# escaped / (%2F) in the path. Example:
#
# ftp://ftp.example.com/%2Fpub/ruby
#
# This method will then return "/pub/ruby".
#
def path
return @path.sub(/^\//,'').sub(/^%2F/,'/')
end
# Private setter for the path of the Bundler::URI::FTP.
def set_path(v)
super("/" + v.sub(/^\//, "%2F"))
end
protected :set_path
# Returns a String representation of the Bundler::URI::FTP.
def to_s
save_path = nil
if @typecode
save_path = @path
@path = @path + TYPECODE_PREFIX + @typecode
end
str = super
if @typecode
@path = save_path
end
return str
end
end
@@schemes['FTP'] = FTP
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/version.rb 0000644 0000041 0000041 00000000237 13606335352 023065 0 ustar www-data www-data module Bundler::URI
# :stopdoc:
VERSION_CODE = '001000'.freeze
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
# :startdoc:
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb 0000644 0000041 0000041 00000014521 13606335352 024061 0 ustar www-data www-data # frozen_string_literal: false
module Bundler::URI
class RFC3986_Parser # :nodoc:
# Bundler::URI defined in RFC3986
# this regexp is modified not to host is not empty string
RFC3986_URI = /\A(?(?[A-Za-z][+\-.0-9A-Za-z]*):(?\/\/(?(?:(?(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?(?\[(?:(?(?:\h{1,4}:){6}(?\h{1,4}:\h{1,4}|(?(?[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g\.\g\.\g))|::(?:\h{1,4}:){5}\g|\h{1,4}?::(?:\h{1,4}:){4}\g|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g|(?(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?\d*))?)(?(?:\/(?(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?\/(?:(?(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g)*)?)|(?\g(?:\/\g)*)|(?))(?:\?(?[^#]*))?(?:\#(?(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
RFC3986_relative_ref = /\A(?(?\/\/(?(?:(?(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?(?\[(?(?:\h{1,4}:){6}(?\h{1,4}:\h{1,4}|(?(?[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g\.\g\.\g))|::(?:\h{1,4}:){5}\g|\h{1,4}?::(?:\h{1,4}:){4}\g|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g|(?(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?\d*))?)(?(?:\/(?(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?\/(?:(?(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g)*)?)|(?(?(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g)*)|(?))(?:\?(?[^#]*))?(?:\#(?(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
attr_reader :regexp
def initialize
@regexp = default_regexp.each_value(&:freeze).freeze
end
def split(uri) #:nodoc:
begin
uri = uri.to_str
rescue NoMethodError
raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
end
uri.ascii_only? or
raise InvalidURIError, "Bundler::URI must be ascii only #{uri.dump}"
if m = RFC3986_URI.match(uri)
query = m["query".freeze]
scheme = m["scheme".freeze]
opaque = m["path-rootless".freeze]
if opaque
opaque << "?#{query}" if query
[ scheme,
nil, # userinfo
nil, # host
nil, # port
nil, # registry
nil, # path
opaque,
nil, # query
m["fragment".freeze]
]
else # normal
[ scheme,
m["userinfo".freeze],
m["host".freeze],
m["port".freeze],
nil, # registry
(m["path-abempty".freeze] ||
m["path-absolute".freeze] ||
m["path-empty".freeze]),
nil, # opaque
query,
m["fragment".freeze]
]
end
elsif m = RFC3986_relative_ref.match(uri)
[ nil, # scheme
m["userinfo".freeze],
m["host".freeze],
m["port".freeze],
nil, # registry,
(m["path-abempty".freeze] ||
m["path-absolute".freeze] ||
m["path-noscheme".freeze] ||
m["path-empty".freeze]),
nil, # opaque
m["query".freeze],
m["fragment".freeze]
]
else
raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
end
end
def parse(uri) # :nodoc:
scheme, userinfo, host, port,
registry, path, opaque, query, fragment = self.split(uri)
scheme_list = Bundler::URI.scheme_list
if scheme && scheme_list.include?(uc = scheme.upcase)
scheme_list[uc].new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment, self)
else
Generic.new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment, self)
end
end
def join(*uris) # :nodoc:
uris[0] = convert_to_uri(uris[0])
uris.inject :merge
end
@@to_s = Kernel.instance_method(:to_s)
def inspect
@@to_s.bind_call(self)
end
private
def default_regexp # :nodoc:
{
SCHEME: /\A[A-Za-z][A-Za-z0-9+\-.]*\z/,
USERINFO: /\A(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*\z/,
HOST: /\A(?:(?\[(?:(?(?:\h{1,4}:){6}(?\h{1,4}:\h{1,4}|(?(?[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g\.\g\.\g))|::(?:\h{1,4}:){5}\g|\h{,4}::(?:\h{1,4}:){4}\g|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g|(?(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*))\z/,
ABS_PATH: /\A\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
REL_PATH: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
OPAQUE: /\A(?:[^\/].*)?\z/,
PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
}
end
def convert_to_uri(uri)
if uri.is_a?(Bundler::URI::Generic)
uri
elsif uri = String.try_convert(uri)
parse(uri)
else
raise ArgumentError,
"bad argument (expected Bundler::URI object or Bundler::URI string)"
end
end
end # class Parser
end # module Bundler::URI
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/http.rb 0000644 0000041 0000041 00000004736 13606335352 022367 0 ustar www-data www-data # frozen_string_literal: false
# = uri/http.rb
#
# Author:: Akira Yamada
# License:: You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
# See Bundler::URI for general documentation
#
require_relative 'generic'
module Bundler::URI
#
# The syntax of HTTP URIs is defined in RFC1738 section 3.3.
#
# Note that the Ruby Bundler::URI library allows HTTP URLs containing usernames and
# passwords. This is not legal as per the RFC, but used to be
# supported in Internet Explorer 5 and 6, before the MS04-004 security
# update. See .
#
class HTTP < Generic
# A Default port of 80 for Bundler::URI::HTTP.
DEFAULT_PORT = 80
# An Array of the available components for Bundler::URI::HTTP.
COMPONENT = %i[
scheme
userinfo host port
path
query
fragment
].freeze
#
# == Description
#
# Creates a new Bundler::URI::HTTP object from components, with syntax checking.
#
# The components accepted are userinfo, host, port, path, query, and
# fragment.
#
# The components should be provided either as an Array, or as a Hash
# with keys formed by preceding the component names with a colon.
#
# If an Array is used, the components must be passed in the
# order [userinfo, host, port, path, query, fragment]
.
#
# Example:
#
# uri = Bundler::URI::HTTP.build(host: 'www.example.com', path: '/foo/bar')
#
# uri = Bundler::URI::HTTP.build([nil, "www.example.com", nil, "/path",
# "query", 'fragment'])
#
# Currently, if passed userinfo components this method generates
# invalid HTTP URIs as per RFC 1738.
#
def self.build(args)
tmp = Util.make_components_hash(self, args)
super(tmp)
end
#
# == Description
#
# Returns the full path for an HTTP request, as required by Net::HTTP::Get.
#
# If the Bundler::URI contains a query, the full path is Bundler::URI#path + '?' + Bundler::URI#query.
# Otherwise, the path is simply Bundler::URI#path.
#
# Example:
#
# uri = Bundler::URI::HTTP.build(path: '/foo/bar', query: 'test=true')
# uri.request_uri # => "/foo/bar?test=true"
#
def request_uri
return unless @path
url = @query ? "#@path?#@query" : @path.dup
url.start_with?(?/.freeze) ? url : ?/ + url
end
end
@@schemes['HTTP'] = HTTP
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/https.rb 0000644 0000041 0000041 00000001137 13606335352 022542 0 ustar www-data www-data # frozen_string_literal: false
# = uri/https.rb
#
# Author:: Akira Yamada
# License:: You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
# See Bundler::URI for general documentation
#
require_relative 'http'
module Bundler::URI
# The default port for HTTPS URIs is 443, and the scheme is 'https:' rather
# than 'http:'. Other than that, HTTPS URIs are identical to HTTP URIs;
# see Bundler::URI::HTTP.
class HTTPS < HTTP
# A Default port of 443 for Bundler::URI::HTTPS
DEFAULT_PORT = 443
end
@@schemes['HTTPS'] = HTTPS
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/generic.rb 0000644 0000041 0000041 00000113326 13606335352 023020 0 ustar www-data www-data # frozen_string_literal: true
# = uri/generic.rb
#
# Author:: Akira Yamada
# License:: You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
# See Bundler::URI for general documentation
#
require_relative 'common'
autoload :IPSocket, 'socket'
autoload :IPAddr, 'ipaddr'
module Bundler::URI
#
# Base class for all Bundler::URI classes.
# Implements generic Bundler::URI syntax as per RFC 2396.
#
class Generic
include Bundler::URI
#
# A Default port of nil for Bundler::URI::Generic.
#
DEFAULT_PORT = nil
#
# Returns default port.
#
def self.default_port
self::DEFAULT_PORT
end
#
# Returns default port.
#
def default_port
self.class.default_port
end
#
# An Array of the available components for Bundler::URI::Generic.
#
COMPONENT = [
:scheme,
:userinfo, :host, :port, :registry,
:path, :opaque,
:query,
:fragment
].freeze
#
# Components of the Bundler::URI in the order.
#
def self.component
self::COMPONENT
end
USE_REGISTRY = false # :nodoc:
def self.use_registry # :nodoc:
self::USE_REGISTRY
end
#
# == Synopsis
#
# See ::new.
#
# == Description
#
# At first, tries to create a new Bundler::URI::Generic instance using
# Bundler::URI::Generic::build. But, if exception Bundler::URI::InvalidComponentError is raised,
# then it does Bundler::URI::Escape.escape all Bundler::URI components and tries again.
#
def self.build2(args)
begin
return self.build(args)
rescue InvalidComponentError
if args.kind_of?(Array)
return self.build(args.collect{|x|
if x.is_a?(String)
DEFAULT_PARSER.escape(x)
else
x
end
})
elsif args.kind_of?(Hash)
tmp = {}
args.each do |key, value|
tmp[key] = if value
DEFAULT_PARSER.escape(value)
else
value
end
end
return self.build(tmp)
end
end
end
#
# == Synopsis
#
# See ::new.
#
# == Description
#
# Creates a new Bundler::URI::Generic instance from components of Bundler::URI::Generic
# with check. Components are: scheme, userinfo, host, port, registry, path,
# opaque, query, and fragment. You can provide arguments either by an Array or a Hash.
# See ::new for hash keys to use or for order of array items.
#
def self.build(args)
if args.kind_of?(Array) &&
args.size == ::Bundler::URI::Generic::COMPONENT.size
tmp = args.dup
elsif args.kind_of?(Hash)
tmp = ::Bundler::URI::Generic::COMPONENT.collect do |c|
if args.include?(c)
args[c]
else
nil
end
end
else
component = self.class.component rescue ::Bundler::URI::Generic::COMPONENT
raise ArgumentError,
"expected Array of or Hash of components of #{self.class} (#{component.join(', ')})"
end
tmp << nil
tmp << true
return self.new(*tmp)
end
#
# == Args
#
# +scheme+::
# Protocol scheme, i.e. 'http','ftp','mailto' and so on.
# +userinfo+::
# User name and password, i.e. 'sdmitry:bla'.
# +host+::
# Server host name.
# +port+::
# Server port.
# +registry+::
# Registry of naming authorities.
# +path+::
# Path on server.
# +opaque+::
# Opaque part.
# +query+::
# Query data.
# +fragment+::
# Part of the Bundler::URI after '#' character.
# +parser+::
# Parser for internal use [Bundler::URI::DEFAULT_PARSER by default].
# +arg_check+::
# Check arguments [false by default].
#
# == Description
#
# Creates a new Bundler::URI::Generic instance from ``generic'' components without check.
#
def initialize(scheme,
userinfo, host, port, registry,
path, opaque,
query,
fragment,
parser = DEFAULT_PARSER,
arg_check = false)
@scheme = nil
@user = nil
@password = nil
@host = nil
@port = nil
@path = nil
@query = nil
@opaque = nil
@fragment = nil
@parser = parser == DEFAULT_PARSER ? nil : parser
if arg_check
self.scheme = scheme
self.userinfo = userinfo
self.hostname = host
self.port = port
self.path = path
self.query = query
self.opaque = opaque
self.fragment = fragment
else
self.set_scheme(scheme)
self.set_userinfo(userinfo)
self.set_host(host)
self.set_port(port)
self.set_path(path)
self.query = query
self.set_opaque(opaque)
self.fragment=(fragment)
end
if registry
raise InvalidURIError,
"the scheme #{@scheme} does not accept registry part: #{registry} (or bad hostname?)"
end
@scheme&.freeze
self.set_path('') if !@path && !@opaque # (see RFC2396 Section 5.2)
self.set_port(self.default_port) if self.default_port && !@port
end
#
# Returns the scheme component of the Bundler::URI.
#
# Bundler::URI("http://foo/bar/baz").scheme #=> "http"
#
attr_reader :scheme
# Returns the host component of the Bundler::URI.
#
# Bundler::URI("http://foo/bar/baz").host #=> "foo"
#
# It returns nil if no host component exists.
#
# Bundler::URI("mailto:foo@example.org").host #=> nil
#
# The component does not contain the port number.
#
# Bundler::URI("http://foo:8080/bar/baz").host #=> "foo"
#
# Since IPv6 addresses are wrapped with brackets in URIs,
# this method returns IPv6 addresses wrapped with brackets.
# This form is not appropriate to pass to socket methods such as TCPSocket.open.
# If unwrapped host names are required, use the #hostname method.
#
# Bundler::URI("http://[::1]/bar/baz").host #=> "[::1]"
# Bundler::URI("http://[::1]/bar/baz").hostname #=> "::1"
#
attr_reader :host
# Returns the port component of the Bundler::URI.
#
# Bundler::URI("http://foo/bar/baz").port #=> 80
# Bundler::URI("http://foo:8080/bar/baz").port #=> 8080
#
attr_reader :port
def registry # :nodoc:
nil
end
# Returns the path component of the Bundler::URI.
#
# Bundler::URI("http://foo/bar/baz").path #=> "/bar/baz"
#
attr_reader :path
# Returns the query component of the Bundler::URI.
#
# Bundler::URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar"
#
attr_reader :query
# Returns the opaque part of the Bundler::URI.
#
# Bundler::URI("mailto:foo@example.org").opaque #=> "foo@example.org"
# Bundler::URI("http://foo/bar/baz").opaque #=> nil
#
# The portion of the path that does not make use of the slash '/'.
# The path typically refers to an absolute path or an opaque part.
# (See RFC2396 Section 3 and 5.2.)
#
attr_reader :opaque
# Returns the fragment component of the Bundler::URI.
#
# Bundler::URI("http://foo/bar/baz?search=FooBar#ponies").fragment #=> "ponies"
#
attr_reader :fragment
# Returns the parser to be used.
#
# Unless a Bundler::URI::Parser is defined, DEFAULT_PARSER is used.
#
def parser
if !defined?(@parser) || !@parser
DEFAULT_PARSER
else
@parser || DEFAULT_PARSER
end
end
# Replaces self by other Bundler::URI object.
#
def replace!(oth)
if self.class != oth.class
raise ArgumentError, "expected #{self.class} object"
end
component.each do |c|
self.__send__("#{c}=", oth.__send__(c))
end
end
private :replace!
#
# Components of the Bundler::URI in the order.
#
def component
self.class.component
end
#
# Checks the scheme +v+ component against the Bundler::URI::Parser Regexp for :SCHEME.
#
def check_scheme(v)
if v && parser.regexp[:SCHEME] !~ v
raise InvalidComponentError,
"bad component(expected scheme component): #{v}"
end
return true
end
private :check_scheme
# Protected setter for the scheme component +v+.
#
# See also Bundler::URI::Generic.scheme=.
#
def set_scheme(v)
@scheme = v&.downcase
end
protected :set_scheme
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the scheme component +v+
# (with validation).
#
# See also Bundler::URI::Generic.check_scheme.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com")
# uri.scheme = "https"
# uri.to_s #=> "https://my.example.com"
#
def scheme=(v)
check_scheme(v)
set_scheme(v)
v
end
#
# Checks the +user+ and +password+.
#
# If +password+ is not provided, then +user+ is
# split, using Bundler::URI::Generic.split_userinfo, to
# pull +user+ and +password.
#
# See also Bundler::URI::Generic.check_user, Bundler::URI::Generic.check_password.
#
def check_userinfo(user, password = nil)
if !password
user, password = split_userinfo(user)
end
check_user(user)
check_password(password, user)
return true
end
private :check_userinfo
#
# Checks the user +v+ component for RFC2396 compliance
# and against the Bundler::URI::Parser Regexp for :USERINFO.
#
# Can not have a registry or opaque component defined,
# with a user component defined.
#
def check_user(v)
if @opaque
raise InvalidURIError,
"can not set user with opaque"
end
return v unless v
if parser.regexp[:USERINFO] !~ v
raise InvalidComponentError,
"bad component(expected userinfo component or user component): #{v}"
end
return true
end
private :check_user
#
# Checks the password +v+ component for RFC2396 compliance
# and against the Bundler::URI::Parser Regexp for :USERINFO.
#
# Can not have a registry or opaque component defined,
# with a user component defined.
#
def check_password(v, user = @user)
if @opaque
raise InvalidURIError,
"can not set password with opaque"
end
return v unless v
if !user
raise InvalidURIError,
"password component depends user component"
end
if parser.regexp[:USERINFO] !~ v
raise InvalidComponentError,
"bad password component"
end
return true
end
private :check_password
#
# Sets userinfo, argument is string like 'name:pass'.
#
def userinfo=(userinfo)
if userinfo.nil?
return nil
end
check_userinfo(*userinfo)
set_userinfo(*userinfo)
# returns userinfo
end
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the +user+ component
# (with validation).
#
# See also Bundler::URI::Generic.check_user.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://john:S3nsit1ve@my.example.com")
# uri.user = "sam"
# uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com"
#
def user=(user)
check_user(user)
set_user(user)
# returns user
end
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the +password+ component
# (with validation).
#
# See also Bundler::URI::Generic.check_password.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://john:S3nsit1ve@my.example.com")
# uri.password = "V3ry_S3nsit1ve"
# uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com"
#
def password=(password)
check_password(password)
set_password(password)
# returns password
end
# Protected setter for the +user+ component, and +password+ if available
# (with validation).
#
# See also Bundler::URI::Generic.userinfo=.
#
def set_userinfo(user, password = nil)
unless password
user, password = split_userinfo(user)
end
@user = user
@password = password if password
[@user, @password]
end
protected :set_userinfo
# Protected setter for the user component +v+.
#
# See also Bundler::URI::Generic.user=.
#
def set_user(v)
set_userinfo(v, @password)
v
end
protected :set_user
# Protected setter for the password component +v+.
#
# See also Bundler::URI::Generic.password=.
#
def set_password(v)
@password = v
# returns v
end
protected :set_password
# Returns the userinfo +ui+ as [user, password]
# if properly formatted as 'user:password'.
def split_userinfo(ui)
return nil, nil unless ui
user, password = ui.split(':', 2)
return user, password
end
private :split_userinfo
# Escapes 'user:password' +v+ based on RFC 1738 section 3.1.
def escape_userpass(v)
parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
end
private :escape_userpass
# Returns the userinfo, either as 'user' or 'user:password'.
def userinfo
if @user.nil?
nil
elsif @password.nil?
@user
else
@user + ':' + @password
end
end
# Returns the user component.
def user
@user
end
# Returns the password component.
def password
@password
end
#
# Checks the host +v+ component for RFC2396 compliance
# and against the Bundler::URI::Parser Regexp for :HOST.
#
# Can not have a registry or opaque component defined,
# with a host component defined.
#
def check_host(v)
return v unless v
if @opaque
raise InvalidURIError,
"can not set host with registry or opaque"
elsif parser.regexp[:HOST] !~ v
raise InvalidComponentError,
"bad component(expected host component): #{v}"
end
return true
end
private :check_host
# Protected setter for the host component +v+.
#
# See also Bundler::URI::Generic.host=.
#
def set_host(v)
@host = v
end
protected :set_host
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the host component +v+
# (with validation).
#
# See also Bundler::URI::Generic.check_host.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com")
# uri.host = "foo.com"
# uri.to_s #=> "http://foo.com"
#
def host=(v)
check_host(v)
set_host(v)
v
end
# Extract the host part of the Bundler::URI and unwrap brackets for IPv6 addresses.
#
# This method is the same as Bundler::URI::Generic#host except
# brackets for IPv6 (and future IP) addresses are removed.
#
# uri = Bundler::URI("http://[::1]/bar")
# uri.hostname #=> "::1"
# uri.host #=> "[::1]"
#
def hostname
v = self.host
/\A\[(.*)\]\z/ =~ v ? $1 : v
end
# Sets the host part of the Bundler::URI as the argument with brackets for IPv6 addresses.
#
# This method is the same as Bundler::URI::Generic#host= except
# the argument can be a bare IPv6 address.
#
# uri = Bundler::URI("http://foo/bar")
# uri.hostname = "::1"
# uri.to_s #=> "http://[::1]/bar"
#
# If the argument seems to be an IPv6 address,
# it is wrapped with brackets.
#
def hostname=(v)
v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v
self.host = v
end
#
# Checks the port +v+ component for RFC2396 compliance
# and against the Bundler::URI::Parser Regexp for :PORT.
#
# Can not have a registry or opaque component defined,
# with a port component defined.
#
def check_port(v)
return v unless v
if @opaque
raise InvalidURIError,
"can not set port with registry or opaque"
elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
raise InvalidComponentError,
"bad component(expected port component): #{v.inspect}"
end
return true
end
private :check_port
# Protected setter for the port component +v+.
#
# See also Bundler::URI::Generic.port=.
#
def set_port(v)
v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Integer)
@port = v
end
protected :set_port
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the port component +v+
# (with validation).
#
# See also Bundler::URI::Generic.check_port.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com")
# uri.port = 8080
# uri.to_s #=> "http://my.example.com:8080"
#
def port=(v)
check_port(v)
set_port(v)
port
end
def check_registry(v) # :nodoc:
raise InvalidURIError, "can not set registry"
end
private :check_registry
def set_registry(v) #:nodoc:
raise InvalidURIError, "can not set registry"
end
protected :set_registry
def registry=(v)
raise InvalidURIError, "can not set registry"
end
#
# Checks the path +v+ component for RFC2396 compliance
# and against the Bundler::URI::Parser Regexp
# for :ABS_PATH and :REL_PATH.
#
# Can not have a opaque component defined,
# with a path component defined.
#
def check_path(v)
# raise if both hier and opaque are not nil, because:
# absoluteURI = scheme ":" ( hier_part | opaque_part )
# hier_part = ( net_path | abs_path ) [ "?" query ]
if v && @opaque
raise InvalidURIError,
"path conflicts with opaque"
end
# If scheme is ftp, path may be relative.
# See RFC 1738 section 3.2.2, and RFC 2396.
if @scheme && @scheme != "ftp"
if v && v != '' && parser.regexp[:ABS_PATH] !~ v
raise InvalidComponentError,
"bad component(expected absolute path component): #{v}"
end
else
if v && v != '' && parser.regexp[:ABS_PATH] !~ v &&
parser.regexp[:REL_PATH] !~ v
raise InvalidComponentError,
"bad component(expected relative path component): #{v}"
end
end
return true
end
private :check_path
# Protected setter for the path component +v+.
#
# See also Bundler::URI::Generic.path=.
#
def set_path(v)
@path = v
end
protected :set_path
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the path component +v+
# (with validation).
#
# See also Bundler::URI::Generic.check_path.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com/pub/files")
# uri.path = "/faq/"
# uri.to_s #=> "http://my.example.com/faq/"
#
def path=(v)
check_path(v)
set_path(v)
v
end
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the query component +v+.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com/?id=25")
# uri.query = "id=1"
# uri.to_s #=> "http://my.example.com/?id=1"
#
def query=(v)
return @query = nil unless v
raise InvalidURIError, "query conflicts with opaque" if @opaque
x = v.to_str
v = x.dup if x.equal? v
v.encode!(Encoding::UTF_8) rescue nil
v.delete!("\t\r\n")
v.force_encoding(Encoding::ASCII_8BIT)
raise InvalidURIError, "invalid percent escape: #{$1}" if /(%\H\H)/n.match(v)
v.gsub!(/(?!%\h\h|[!$-&(-;=?-_a-~])./n.freeze){'%%%02X' % $&.ord}
v.force_encoding(Encoding::US_ASCII)
@query = v
end
#
# Checks the opaque +v+ component for RFC2396 compliance and
# against the Bundler::URI::Parser Regexp for :OPAQUE.
#
# Can not have a host, port, user, or path component defined,
# with an opaque component defined.
#
def check_opaque(v)
return v unless v
# raise if both hier and opaque are not nil, because:
# absoluteURI = scheme ":" ( hier_part | opaque_part )
# hier_part = ( net_path | abs_path ) [ "?" query ]
if @host || @port || @user || @path # userinfo = @user + ':' + @password
raise InvalidURIError,
"can not set opaque with host, port, userinfo or path"
elsif v && parser.regexp[:OPAQUE] !~ v
raise InvalidComponentError,
"bad component(expected opaque component): #{v}"
end
return true
end
private :check_opaque
# Protected setter for the opaque component +v+.
#
# See also Bundler::URI::Generic.opaque=.
#
def set_opaque(v)
@opaque = v
end
protected :set_opaque
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the opaque component +v+
# (with validation).
#
# See also Bundler::URI::Generic.check_opaque.
#
def opaque=(v)
check_opaque(v)
set_opaque(v)
v
end
#
# Checks the fragment +v+ component against the Bundler::URI::Parser Regexp for :FRAGMENT.
#
#
# == Args
#
# +v+::
# String
#
# == Description
#
# Public setter for the fragment component +v+
# (with validation).
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com/?id=25#time=1305212049")
# uri.fragment = "time=1305212086"
# uri.to_s #=> "http://my.example.com/?id=25#time=1305212086"
#
def fragment=(v)
return @fragment = nil unless v
x = v.to_str
v = x.dup if x.equal? v
v.encode!(Encoding::UTF_8) rescue nil
v.delete!("\t\r\n")
v.force_encoding(Encoding::ASCII_8BIT)
v.gsub!(/(?!%\h\h|[!-~])./n){'%%%02X' % $&.ord}
v.force_encoding(Encoding::US_ASCII)
@fragment = v
end
#
# Returns true if Bundler::URI is hierarchical.
#
# == Description
#
# Bundler::URI has components listed in order of decreasing significance from left to right,
# see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com/")
# uri.hierarchical?
# #=> true
# uri = Bundler::URI.parse("mailto:joe@example.com")
# uri.hierarchical?
# #=> false
#
def hierarchical?
if @path
true
else
false
end
end
#
# Returns true if Bundler::URI has a scheme (e.g. http:// or https://) specified.
#
def absolute?
if @scheme
true
else
false
end
end
alias absolute absolute?
#
# Returns true if Bundler::URI does not have a scheme (e.g. http:// or https://) specified.
#
def relative?
!absolute?
end
#
# Returns an Array of the path split on '/'.
#
def split_path(path)
path.split("/", -1)
end
private :split_path
#
# Merges a base path +base+, with relative path +rel+,
# returns a modified base path.
#
def merge_path(base, rel)
# RFC2396, Section 5.2, 5)
# RFC2396, Section 5.2, 6)
base_path = split_path(base)
rel_path = split_path(rel)
# RFC2396, Section 5.2, 6), a)
base_path << '' if base_path.last == '..'
while i = base_path.index('..')
base_path.slice!(i - 1, 2)
end
if (first = rel_path.first) and first.empty?
base_path.clear
rel_path.shift
end
# RFC2396, Section 5.2, 6), c)
# RFC2396, Section 5.2, 6), d)
rel_path.push('') if rel_path.last == '.' || rel_path.last == '..'
rel_path.delete('.')
# RFC2396, Section 5.2, 6), e)
tmp = []
rel_path.each do |x|
if x == '..' &&
!(tmp.empty? || tmp.last == '..')
tmp.pop
else
tmp << x
end
end
add_trailer_slash = !tmp.empty?
if base_path.empty?
base_path = [''] # keep '/' for root directory
elsif add_trailer_slash
base_path.pop
end
while x = tmp.shift
if x == '..'
# RFC2396, Section 4
# a .. or . in an absolute path has no special meaning
base_path.pop if base_path.size > 1
else
# if x == '..'
# valid absolute (but abnormal) path "/../..."
# else
# valid absolute path
# end
base_path << x
tmp.each {|t| base_path << t}
add_trailer_slash = false
break
end
end
base_path.push('') if add_trailer_slash
return base_path.join('/')
end
private :merge_path
#
# == Args
#
# +oth+::
# Bundler::URI or String
#
# == Description
#
# Destructive form of #merge.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com")
# uri.merge!("/main.rbx?page=1")
# uri.to_s # => "http://my.example.com/main.rbx?page=1"
#
def merge!(oth)
t = merge(oth)
if self == t
nil
else
replace!(t)
self
end
end
#
# == Args
#
# +oth+::
# Bundler::URI or String
#
# == Description
#
# Merges two URIs.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com")
# uri.merge("/main.rbx?page=1")
# # => "http://my.example.com/main.rbx?page=1"
#
def merge(oth)
rel = parser.send(:convert_to_uri, oth)
if rel.absolute?
#raise BadURIError, "both Bundler::URI are absolute" if absolute?
# hmm... should return oth for usability?
return rel
end
unless self.absolute?
raise BadURIError, "both Bundler::URI are relative"
end
base = self.dup
authority = rel.userinfo || rel.host || rel.port
# RFC2396, Section 5.2, 2)
if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
base.fragment=(rel.fragment) if rel.fragment
return base
end
base.query = nil
base.fragment=(nil)
# RFC2396, Section 5.2, 4)
if !authority
base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path
else
# RFC2396, Section 5.2, 4)
base.set_path(rel.path) if rel.path
end
# RFC2396, Section 5.2, 7)
base.set_userinfo(rel.userinfo) if rel.userinfo
base.set_host(rel.host) if rel.host
base.set_port(rel.port) if rel.port
base.query = rel.query if rel.query
base.fragment=(rel.fragment) if rel.fragment
return base
end # merge
alias + merge
# :stopdoc:
def route_from_path(src, dst)
case dst
when src
# RFC2396, Section 4.2
return ''
when %r{(?:\A|/)\.\.?(?:/|\z)}
# dst has abnormal absolute path,
# like "/./", "/../", "/x/../", ...
return dst.dup
end
src_path = src.scan(%r{[^/]*/})
dst_path = dst.scan(%r{[^/]*/?})
# discard same parts
while !dst_path.empty? && dst_path.first == src_path.first
src_path.shift
dst_path.shift
end
tmp = dst_path.join
# calculate
if src_path.empty?
if tmp.empty?
return './'
elsif dst_path.first.include?(':') # (see RFC2396 Section 5)
return './' + tmp
else
return tmp
end
end
return '../' * src_path.size + tmp
end
private :route_from_path
# :startdoc:
# :stopdoc:
def route_from0(oth)
oth = parser.send(:convert_to_uri, oth)
if self.relative?
raise BadURIError,
"relative Bundler::URI: #{self}"
end
if oth.relative?
raise BadURIError,
"relative Bundler::URI: #{oth}"
end
if self.scheme != oth.scheme
return self, self.dup
end
rel = Bundler::URI::Generic.new(nil, # it is relative Bundler::URI
self.userinfo, self.host, self.port,
nil, self.path, self.opaque,
self.query, self.fragment, parser)
if rel.userinfo != oth.userinfo ||
rel.host.to_s.downcase != oth.host.to_s.downcase ||
rel.port != oth.port
if self.userinfo.nil? && self.host.nil?
return self, self.dup
end
rel.set_port(nil) if rel.port == oth.default_port
return rel, rel
end
rel.set_userinfo(nil)
rel.set_host(nil)
rel.set_port(nil)
if rel.path && rel.path == oth.path
rel.set_path('')
rel.query = nil if rel.query == oth.query
return rel, rel
elsif rel.opaque && rel.opaque == oth.opaque
rel.set_opaque('')
rel.query = nil if rel.query == oth.query
return rel, rel
end
# you can modify `rel', but can not `oth'.
return oth, rel
end
private :route_from0
# :startdoc:
#
# == Args
#
# +oth+::
# Bundler::URI or String
#
# == Description
#
# Calculates relative path from oth to self.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse('http://my.example.com/main.rbx?page=1')
# uri.route_from('http://my.example.com')
# #=> #
#
def route_from(oth)
# you can modify `rel', but can not `oth'.
begin
oth, rel = route_from0(oth)
rescue
raise $!.class, $!.message
end
if oth == rel
return rel
end
rel.set_path(route_from_path(oth.path, self.path))
if rel.path == './' && self.query
# "./?foo" -> "?foo"
rel.set_path('')
end
return rel
end
alias - route_from
#
# == Args
#
# +oth+::
# Bundler::URI or String
#
# == Description
#
# Calculates relative path to oth from self.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse('http://my.example.com')
# uri.route_to('http://my.example.com/main.rbx?page=1')
# #=> #
#
def route_to(oth)
parser.send(:convert_to_uri, oth).route_from(self)
end
#
# Returns normalized Bundler::URI.
#
# require 'bundler/vendor/uri/lib/uri'
#
# Bundler::URI("HTTP://my.EXAMPLE.com").normalize
# #=> #
#
# Normalization here means:
#
# * scheme and host are converted to lowercase,
# * an empty path component is set to "/".
#
def normalize
uri = dup
uri.normalize!
uri
end
#
# Destructive version of #normalize.
#
def normalize!
if path&.empty?
set_path('/')
end
if scheme && scheme != scheme.downcase
set_scheme(self.scheme.downcase)
end
if host && host != host.downcase
set_host(self.host.downcase)
end
end
#
# Constructs String from Bundler::URI.
#
def to_s
str = ''.dup
if @scheme
str << @scheme
str << ':'
end
if @opaque
str << @opaque
else
if @host || %w[file postgres].include?(@scheme)
str << '//'
end
if self.userinfo
str << self.userinfo
str << '@'
end
if @host
str << @host
end
if @port && @port != self.default_port
str << ':'
str << @port.to_s
end
str << @path
if @query
str << '?'
str << @query
end
end
if @fragment
str << '#'
str << @fragment
end
str
end
#
# Compares two URIs.
#
def ==(oth)
if self.class == oth.class
self.normalize.component_ary == oth.normalize.component_ary
else
false
end
end
def hash
self.component_ary.hash
end
def eql?(oth)
self.class == oth.class &&
parser == oth.parser &&
self.component_ary.eql?(oth.component_ary)
end
=begin
--- Bundler::URI::Generic#===(oth)
=end
# def ===(oth)
# raise NotImplementedError
# end
=begin
=end
# Returns an Array of the components defined from the COMPONENT Array.
def component_ary
component.collect do |x|
self.send(x)
end
end
protected :component_ary
# == Args
#
# +components+::
# Multiple Symbol arguments defined in Bundler::URI::HTTP.
#
# == Description
#
# Selects specified components from Bundler::URI.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse('http://myuser:mypass@my.example.com/test.rbx')
# uri.select(:userinfo, :host, :path)
# # => ["myuser:mypass", "my.example.com", "/test.rbx"]
#
def select(*components)
components.collect do |c|
if component.include?(c)
self.send(c)
else
raise ArgumentError,
"expected of components of #{self.class} (#{self.class.component.join(', ')})"
end
end
end
def inspect
"#<#{self.class} #{self}>"
end
#
# == Args
#
# +v+::
# Bundler::URI or String
#
# == Description
#
# Attempts to parse other Bundler::URI +oth+,
# returns [parsed_oth, self].
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://my.example.com")
# uri.coerce("http://foo.com")
# #=> [#, #]
#
def coerce(oth)
case oth
when String
oth = parser.parse(oth)
else
super
end
return oth, self
end
# Returns a proxy Bundler::URI.
# The proxy Bundler::URI is obtained from environment variables such as http_proxy,
# ftp_proxy, no_proxy, etc.
# If there is no proper proxy, nil is returned.
#
# If the optional parameter +env+ is specified, it is used instead of ENV.
#
# Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.)
# are examined, too.
#
# But http_proxy and HTTP_PROXY is treated specially under CGI environment.
# It's because HTTP_PROXY may be set by Proxy: header.
# So HTTP_PROXY is not used.
# http_proxy is not used too if the variable is case insensitive.
# CGI_HTTP_PROXY can be used instead.
def find_proxy(env=ENV)
raise BadURIError, "relative Bundler::URI: #{self}" if self.relative?
name = self.scheme.downcase + '_proxy'
proxy_uri = nil
if name == 'http_proxy' && env.include?('REQUEST_METHOD') # CGI?
# HTTP_PROXY conflicts with *_proxy for proxy settings and
# HTTP_* for header information in CGI.
# So it should be careful to use it.
pairs = env.reject {|k, v| /\Ahttp_proxy\z/i !~ k }
case pairs.length
when 0 # no proxy setting anyway.
proxy_uri = nil
when 1
k, _ = pairs.shift
if k == 'http_proxy' && env[k.upcase] == nil
# http_proxy is safe to use because ENV is case sensitive.
proxy_uri = env[name]
else
proxy_uri = nil
end
else # http_proxy is safe to use because ENV is case sensitive.
proxy_uri = env.to_hash[name]
end
if !proxy_uri
# Use CGI_HTTP_PROXY. cf. libwww-perl.
proxy_uri = env["CGI_#{name.upcase}"]
end
elsif name == 'http_proxy'
unless proxy_uri = env[name]
if proxy_uri = env[name.upcase]
warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
end
end
else
proxy_uri = env[name] || env[name.upcase]
end
if proxy_uri.nil? || proxy_uri.empty?
return nil
end
if self.hostname
begin
addr = IPSocket.getaddress(self.hostname)
return nil if /\A127\.|\A::1\z/ =~ addr
rescue SocketError
end
end
name = 'no_proxy'
if no_proxy = env[name] || env[name.upcase]
return nil unless Bundler::URI::Generic.use_proxy?(self.hostname, addr, self.port, no_proxy)
end
Bundler::URI.parse(proxy_uri)
end
def self.use_proxy?(hostname, addr, port, no_proxy) # :nodoc:
hostname = hostname.downcase
dothostname = ".#{hostname}"
no_proxy.scan(/([^:,\s]+)(?::(\d+))?/) {|p_host, p_port|
if !p_port || port == p_port.to_i
if p_host.start_with?('.')
return false if hostname.end_with?(p_host.downcase)
else
return false if dothostname.end_with?(".#{p_host.downcase}")
end
if addr
begin
return false if IPAddr.new(p_host).include?(addr)
rescue IPAddr::InvalidAddressError
next
end
end
end
}
true
end
end
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/common.rb 0000644 0000041 0000041 00000050655 13606335352 022701 0 ustar www-data www-data # frozen_string_literal: true
#--
# = uri/common.rb
#
# Author:: Akira Yamada
# Revision:: $Id$
# License::
# You can redistribute it and/or modify it under the same term as Ruby.
#
# See Bundler::URI for general documentation
#
require_relative "rfc2396_parser"
require_relative "rfc3986_parser"
module Bundler::URI
REGEXP = RFC2396_REGEXP
Parser = RFC2396_Parser
RFC3986_PARSER = RFC3986_Parser.new
# Bundler::URI::Parser.new
DEFAULT_PARSER = Parser.new
DEFAULT_PARSER.pattern.each_pair do |sym, str|
unless REGEXP::PATTERN.const_defined?(sym)
REGEXP::PATTERN.const_set(sym, str)
end
end
DEFAULT_PARSER.regexp.each_pair do |sym, str|
const_set(sym, str)
end
module Util # :nodoc:
def make_components_hash(klass, array_hash)
tmp = {}
if array_hash.kind_of?(Array) &&
array_hash.size == klass.component.size - 1
klass.component[1..-1].each_index do |i|
begin
tmp[klass.component[i + 1]] = array_hash[i].clone
rescue TypeError
tmp[klass.component[i + 1]] = array_hash[i]
end
end
elsif array_hash.kind_of?(Hash)
array_hash.each do |key, value|
begin
tmp[key] = value.clone
rescue TypeError
tmp[key] = value
end
end
else
raise ArgumentError,
"expected Array of or Hash of components of #{klass} (#{klass.component[1..-1].join(', ')})"
end
tmp[:scheme] = klass.to_s.sub(/\A.*::/, '').downcase
return tmp
end
module_function :make_components_hash
end
# Module for escaping unsafe characters with codes.
module Escape
#
# == Synopsis
#
# Bundler::URI.escape(str [, unsafe])
#
# == Args
#
# +str+::
# String to replaces in.
# +unsafe+::
# Regexp that matches all symbols that must be replaced with codes.
# By default uses UNSAFE.
# When this argument is a String, it represents a character set.
#
# == Description
#
# Escapes the string, replacing all unsafe characters with codes.
#
# This method is obsolete and should not be used. Instead, use
# CGI.escape, Bundler::URI.encode_www_form or Bundler::URI.encode_www_form_component
# depending on your specific use case.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
# # => "http://example.com/?a=%09%0D"
#
# Bundler::URI.unescape(enc_uri)
# # => "http://example.com/?a=\t\r"
#
# Bundler::URI.escape("@?@!", "!?")
# # => "@%3F@%21"
#
def escape(*arg)
warn "Bundler::URI.escape is obsolete", uplevel: 1
DEFAULT_PARSER.escape(*arg)
end
alias encode escape
#
# == Synopsis
#
# Bundler::URI.unescape(str)
#
# == Args
#
# +str+::
# String to unescape.
#
# == Description
#
# This method is obsolete and should not be used. Instead, use
# CGI.unescape, Bundler::URI.decode_www_form or Bundler::URI.decode_www_form_component
# depending on your specific use case.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
# # => "http://example.com/?a=%09%0D"
#
# Bundler::URI.unescape(enc_uri)
# # => "http://example.com/?a=\t\r"
#
def unescape(*arg)
warn "Bundler::URI.unescape is obsolete", uplevel: 1
DEFAULT_PARSER.unescape(*arg)
end
alias decode unescape
end # module Escape
extend Escape
include REGEXP
@@schemes = {}
# Returns a Hash of the defined schemes.
def self.scheme_list
@@schemes
end
#
# Base class for all Bundler::URI exceptions.
#
class Error < StandardError; end
#
# Not a Bundler::URI.
#
class InvalidURIError < Error; end
#
# Not a Bundler::URI component.
#
class InvalidComponentError < Error; end
#
# Bundler::URI is valid, bad usage is not.
#
class BadURIError < Error; end
#
# == Synopsis
#
# Bundler::URI::split(uri)
#
# == Args
#
# +uri+::
# String with Bundler::URI.
#
# == Description
#
# Splits the string on following parts and returns array with result:
#
# * Scheme
# * Userinfo
# * Host
# * Port
# * Registry
# * Path
# * Opaque
# * Query
# * Fragment
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# Bundler::URI.split("http://www.ruby-lang.org/")
# # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
#
def self.split(uri)
RFC3986_PARSER.split(uri)
end
#
# == Synopsis
#
# Bundler::URI::parse(uri_str)
#
# == Args
#
# +uri_str+::
# String with Bundler::URI.
#
# == Description
#
# Creates one of the Bundler::URI's subclasses instance from the string.
#
# == Raises
#
# Bundler::URI::InvalidURIError::
# Raised if Bundler::URI given is not a correct one.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("http://www.ruby-lang.org/")
# # => #
# uri.scheme
# # => "http"
# uri.host
# # => "www.ruby-lang.org"
#
# It's recommended to first ::escape the provided +uri_str+ if there are any
# invalid Bundler::URI characters.
#
def self.parse(uri)
RFC3986_PARSER.parse(uri)
end
#
# == Synopsis
#
# Bundler::URI::join(str[, str, ...])
#
# == Args
#
# +str+::
# String(s) to work with, will be converted to RFC3986 URIs before merging.
#
# == Description
#
# Joins URIs.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# Bundler::URI.join("http://example.com/","main.rbx")
# # => #
#
# Bundler::URI.join('http://example.com', 'foo')
# # => #
#
# Bundler::URI.join('http://example.com', '/foo', '/bar')
# # => #
#
# Bundler::URI.join('http://example.com', '/foo', 'bar')
# # => #
#
# Bundler::URI.join('http://example.com', '/foo/', 'bar')
# # => #
#
def self.join(*str)
RFC3986_PARSER.join(*str)
end
#
# == Synopsis
#
# Bundler::URI::extract(str[, schemes][,&blk])
#
# == Args
#
# +str+::
# String to extract URIs from.
# +schemes+::
# Limit Bundler::URI matching to specific schemes.
#
# == Description
#
# Extracts URIs from a string. If block given, iterates through all matched URIs.
# Returns nil if block given or array with matches.
#
# == Usage
#
# require "bundler/vendor/uri/lib/uri"
#
# Bundler::URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
# # => ["http://foo.example.com/bla", "mailto:test@example.com"]
#
def self.extract(str, schemes = nil, &block)
warn "Bundler::URI.extract is obsolete", uplevel: 1 if $VERBOSE
DEFAULT_PARSER.extract(str, schemes, &block)
end
#
# == Synopsis
#
# Bundler::URI::regexp([match_schemes])
#
# == Args
#
# +match_schemes+::
# Array of schemes. If given, resulting regexp matches to URIs
# whose scheme is one of the match_schemes.
#
# == Description
#
# Returns a Regexp object which matches to Bundler::URI-like strings.
# The Regexp object returned by this method includes arbitrary
# number of capture group (parentheses). Never rely on it's number.
#
# == Usage
#
# require 'bundler/vendor/uri/lib/uri'
#
# # extract first Bundler::URI from html_string
# html_string.slice(Bundler::URI.regexp)
#
# # remove ftp URIs
# html_string.sub(Bundler::URI.regexp(['ftp']), '')
#
# # You should not rely on the number of parentheses
# html_string.scan(Bundler::URI.regexp) do |*matches|
# p $&
# end
#
def self.regexp(schemes = nil)
warn "Bundler::URI.regexp is obsolete", uplevel: 1 if $VERBOSE
DEFAULT_PARSER.make_regexp(schemes)
end
TBLENCWWWCOMP_ = {} # :nodoc:
256.times do |i|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
end
TBLENCWWWCOMP_[' '] = '+'
TBLENCWWWCOMP_.freeze
TBLDECWWWCOMP_ = {} # :nodoc:
256.times do |i|
h, l = i>>4, i&15
TBLDECWWWCOMP_[-('%%%X%X' % [h, l])] = -i.chr
TBLDECWWWCOMP_[-('%%%x%X' % [h, l])] = -i.chr
TBLDECWWWCOMP_[-('%%%X%x' % [h, l])] = -i.chr
TBLDECWWWCOMP_[-('%%%x%x' % [h, l])] = -i.chr
end
TBLDECWWWCOMP_['+'] = ' '
TBLDECWWWCOMP_.freeze
# Encodes given +str+ to URL-encoded form data.
#
# This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
# (ASCII space) to + and converts others to %XX.
#
# If +enc+ is given, convert +str+ to the encoding before percent encoding.
#
# This is an implementation of
# http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
#
# See Bundler::URI.decode_www_form_component, Bundler::URI.encode_www_form.
def self.encode_www_form_component(str, enc=nil)
str = str.to_s.dup
if str.encoding != Encoding::ASCII_8BIT
if enc && enc != Encoding::ASCII_8BIT
str.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace)
str.encode!(enc, fallback: ->(x){"#{x.ord};"})
end
str.force_encoding(Encoding::ASCII_8BIT)
end
str.gsub!(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_)
str.force_encoding(Encoding::US_ASCII)
end
# Decodes given +str+ of URL-encoded form data.
#
# This decodes + to SP.
#
# See Bundler::URI.encode_www_form_component, Bundler::URI.decode_www_form.
def self.decode_www_form_component(str, enc=Encoding::UTF_8)
raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/ =~ str
str.b.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
end
# Generates URL-encoded form data from given +enum+.
#
# This generates application/x-www-form-urlencoded data defined in HTML5
# from given an Enumerable object.
#
# This internally uses Bundler::URI.encode_www_form_component(str).
#
# This method doesn't convert the encoding of given items, so convert them
# before calling this method if you want to send data as other than original
# encoding or mixed encoding data. (Strings which are encoded in an HTML5
# ASCII incompatible encoding are converted to UTF-8.)
#
# This method doesn't handle files. When you send a file, use
# multipart/form-data.
#
# This refers http://url.spec.whatwg.org/#concept-urlencoded-serializer
#
# Bundler::URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
# #=> "q=ruby&lang=en"
# Bundler::URI.encode_www_form("q" => "ruby", "lang" => "en")
# #=> "q=ruby&lang=en"
# Bundler::URI.encode_www_form("q" => ["ruby", "perl"], "lang" => "en")
# #=> "q=ruby&q=perl&lang=en"
# Bundler::URI.encode_www_form([["q", "ruby"], ["q", "perl"], ["lang", "en"]])
# #=> "q=ruby&q=perl&lang=en"
#
# See Bundler::URI.encode_www_form_component, Bundler::URI.decode_www_form.
def self.encode_www_form(enum, enc=nil)
enum.map do |k,v|
if v.nil?
encode_www_form_component(k, enc)
elsif v.respond_to?(:to_ary)
v.to_ary.map do |w|
str = encode_www_form_component(k, enc)
unless w.nil?
str << '='
str << encode_www_form_component(w, enc)
end
end.join('&')
else
str = encode_www_form_component(k, enc)
str << '='
str << encode_www_form_component(v, enc)
end
end.join('&')
end
# Decodes URL-encoded form data from given +str+.
#
# This decodes application/x-www-form-urlencoded data
# and returns an array of key-value arrays.
#
# This refers http://url.spec.whatwg.org/#concept-urlencoded-parser,
# so this supports only &-separator, and doesn't support ;-separator.
#
# ary = Bundler::URI.decode_www_form("a=1&a=2&b=3")
# ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
# ary.assoc('a').last #=> '1'
# ary.assoc('b').last #=> '3'
# ary.rassoc('a').last #=> '2'
# Hash[ary] #=> {"a"=>"2", "b"=>"3"}
#
# See Bundler::URI.decode_www_form_component, Bundler::URI.encode_www_form.
def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
raise ArgumentError, "the input of #{self.name}.#{__method__} must be ASCII only string" unless str.ascii_only?
ary = []
return ary if str.empty?
enc = Encoding.find(enc)
str.b.each_line(separator) do |string|
string.chomp!(separator)
key, sep, val = string.partition('=')
if isindex
if sep.empty?
val = key
key = +''
end
isindex = false
end
if use__charset_ and key == '_charset_' and e = get_encoding(val)
enc = e
use__charset_ = false
end
key.gsub!(/\+|%\h\h/, TBLDECWWWCOMP_)
if val
val.gsub!(/\+|%\h\h/, TBLDECWWWCOMP_)
else
val = +''
end
ary << [key, val]
end
ary.each do |k, v|
k.force_encoding(enc)
k.scrub!
v.force_encoding(enc)
v.scrub!
end
ary
end
private
=begin command for WEB_ENCODINGS_
curl https://encoding.spec.whatwg.org/encodings.json|
ruby -rjson -e 'H={}
h={
"shift_jis"=>"Windows-31J",
"euc-jp"=>"cp51932",
"iso-2022-jp"=>"cp50221",
"x-mac-cyrillic"=>"macCyrillic",
}
JSON($<.read).map{|x|x["encodings"]}.flatten.each{|x|
Encoding.find(n=h.fetch(n=x["name"].downcase,n))rescue next
x["labels"].each{|y|H[y]=n}
}
puts "{"
H.each{|k,v|puts %[ #{k.dump}=>#{v.dump},]}
puts "}"
'
=end
WEB_ENCODINGS_ = {
"unicode-1-1-utf-8"=>"utf-8",
"utf-8"=>"utf-8",
"utf8"=>"utf-8",
"866"=>"ibm866",
"cp866"=>"ibm866",
"csibm866"=>"ibm866",
"ibm866"=>"ibm866",
"csisolatin2"=>"iso-8859-2",
"iso-8859-2"=>"iso-8859-2",
"iso-ir-101"=>"iso-8859-2",
"iso8859-2"=>"iso-8859-2",
"iso88592"=>"iso-8859-2",
"iso_8859-2"=>"iso-8859-2",
"iso_8859-2:1987"=>"iso-8859-2",
"l2"=>"iso-8859-2",
"latin2"=>"iso-8859-2",
"csisolatin3"=>"iso-8859-3",
"iso-8859-3"=>"iso-8859-3",
"iso-ir-109"=>"iso-8859-3",
"iso8859-3"=>"iso-8859-3",
"iso88593"=>"iso-8859-3",
"iso_8859-3"=>"iso-8859-3",
"iso_8859-3:1988"=>"iso-8859-3",
"l3"=>"iso-8859-3",
"latin3"=>"iso-8859-3",
"csisolatin4"=>"iso-8859-4",
"iso-8859-4"=>"iso-8859-4",
"iso-ir-110"=>"iso-8859-4",
"iso8859-4"=>"iso-8859-4",
"iso88594"=>"iso-8859-4",
"iso_8859-4"=>"iso-8859-4",
"iso_8859-4:1988"=>"iso-8859-4",
"l4"=>"iso-8859-4",
"latin4"=>"iso-8859-4",
"csisolatincyrillic"=>"iso-8859-5",
"cyrillic"=>"iso-8859-5",
"iso-8859-5"=>"iso-8859-5",
"iso-ir-144"=>"iso-8859-5",
"iso8859-5"=>"iso-8859-5",
"iso88595"=>"iso-8859-5",
"iso_8859-5"=>"iso-8859-5",
"iso_8859-5:1988"=>"iso-8859-5",
"arabic"=>"iso-8859-6",
"asmo-708"=>"iso-8859-6",
"csiso88596e"=>"iso-8859-6",
"csiso88596i"=>"iso-8859-6",
"csisolatinarabic"=>"iso-8859-6",
"ecma-114"=>"iso-8859-6",
"iso-8859-6"=>"iso-8859-6",
"iso-8859-6-e"=>"iso-8859-6",
"iso-8859-6-i"=>"iso-8859-6",
"iso-ir-127"=>"iso-8859-6",
"iso8859-6"=>"iso-8859-6",
"iso88596"=>"iso-8859-6",
"iso_8859-6"=>"iso-8859-6",
"iso_8859-6:1987"=>"iso-8859-6",
"csisolatingreek"=>"iso-8859-7",
"ecma-118"=>"iso-8859-7",
"elot_928"=>"iso-8859-7",
"greek"=>"iso-8859-7",
"greek8"=>"iso-8859-7",
"iso-8859-7"=>"iso-8859-7",
"iso-ir-126"=>"iso-8859-7",
"iso8859-7"=>"iso-8859-7",
"iso88597"=>"iso-8859-7",
"iso_8859-7"=>"iso-8859-7",
"iso_8859-7:1987"=>"iso-8859-7",
"sun_eu_greek"=>"iso-8859-7",
"csiso88598e"=>"iso-8859-8",
"csisolatinhebrew"=>"iso-8859-8",
"hebrew"=>"iso-8859-8",
"iso-8859-8"=>"iso-8859-8",
"iso-8859-8-e"=>"iso-8859-8",
"iso-ir-138"=>"iso-8859-8",
"iso8859-8"=>"iso-8859-8",
"iso88598"=>"iso-8859-8",
"iso_8859-8"=>"iso-8859-8",
"iso_8859-8:1988"=>"iso-8859-8",
"visual"=>"iso-8859-8",
"csisolatin6"=>"iso-8859-10",
"iso-8859-10"=>"iso-8859-10",
"iso-ir-157"=>"iso-8859-10",
"iso8859-10"=>"iso-8859-10",
"iso885910"=>"iso-8859-10",
"l6"=>"iso-8859-10",
"latin6"=>"iso-8859-10",
"iso-8859-13"=>"iso-8859-13",
"iso8859-13"=>"iso-8859-13",
"iso885913"=>"iso-8859-13",
"iso-8859-14"=>"iso-8859-14",
"iso8859-14"=>"iso-8859-14",
"iso885914"=>"iso-8859-14",
"csisolatin9"=>"iso-8859-15",
"iso-8859-15"=>"iso-8859-15",
"iso8859-15"=>"iso-8859-15",
"iso885915"=>"iso-8859-15",
"iso_8859-15"=>"iso-8859-15",
"l9"=>"iso-8859-15",
"iso-8859-16"=>"iso-8859-16",
"cskoi8r"=>"koi8-r",
"koi"=>"koi8-r",
"koi8"=>"koi8-r",
"koi8-r"=>"koi8-r",
"koi8_r"=>"koi8-r",
"koi8-ru"=>"koi8-u",
"koi8-u"=>"koi8-u",
"dos-874"=>"windows-874",
"iso-8859-11"=>"windows-874",
"iso8859-11"=>"windows-874",
"iso885911"=>"windows-874",
"tis-620"=>"windows-874",
"windows-874"=>"windows-874",
"cp1250"=>"windows-1250",
"windows-1250"=>"windows-1250",
"x-cp1250"=>"windows-1250",
"cp1251"=>"windows-1251",
"windows-1251"=>"windows-1251",
"x-cp1251"=>"windows-1251",
"ansi_x3.4-1968"=>"windows-1252",
"ascii"=>"windows-1252",
"cp1252"=>"windows-1252",
"cp819"=>"windows-1252",
"csisolatin1"=>"windows-1252",
"ibm819"=>"windows-1252",
"iso-8859-1"=>"windows-1252",
"iso-ir-100"=>"windows-1252",
"iso8859-1"=>"windows-1252",
"iso88591"=>"windows-1252",
"iso_8859-1"=>"windows-1252",
"iso_8859-1:1987"=>"windows-1252",
"l1"=>"windows-1252",
"latin1"=>"windows-1252",
"us-ascii"=>"windows-1252",
"windows-1252"=>"windows-1252",
"x-cp1252"=>"windows-1252",
"cp1253"=>"windows-1253",
"windows-1253"=>"windows-1253",
"x-cp1253"=>"windows-1253",
"cp1254"=>"windows-1254",
"csisolatin5"=>"windows-1254",
"iso-8859-9"=>"windows-1254",
"iso-ir-148"=>"windows-1254",
"iso8859-9"=>"windows-1254",
"iso88599"=>"windows-1254",
"iso_8859-9"=>"windows-1254",
"iso_8859-9:1989"=>"windows-1254",
"l5"=>"windows-1254",
"latin5"=>"windows-1254",
"windows-1254"=>"windows-1254",
"x-cp1254"=>"windows-1254",
"cp1255"=>"windows-1255",
"windows-1255"=>"windows-1255",
"x-cp1255"=>"windows-1255",
"cp1256"=>"windows-1256",
"windows-1256"=>"windows-1256",
"x-cp1256"=>"windows-1256",
"cp1257"=>"windows-1257",
"windows-1257"=>"windows-1257",
"x-cp1257"=>"windows-1257",
"cp1258"=>"windows-1258",
"windows-1258"=>"windows-1258",
"x-cp1258"=>"windows-1258",
"x-mac-cyrillic"=>"macCyrillic",
"x-mac-ukrainian"=>"macCyrillic",
"chinese"=>"gbk",
"csgb2312"=>"gbk",
"csiso58gb231280"=>"gbk",
"gb2312"=>"gbk",
"gb_2312"=>"gbk",
"gb_2312-80"=>"gbk",
"gbk"=>"gbk",
"iso-ir-58"=>"gbk",
"x-gbk"=>"gbk",
"gb18030"=>"gb18030",
"big5"=>"big5",
"big5-hkscs"=>"big5",
"cn-big5"=>"big5",
"csbig5"=>"big5",
"x-x-big5"=>"big5",
"cseucpkdfmtjapanese"=>"cp51932",
"euc-jp"=>"cp51932",
"x-euc-jp"=>"cp51932",
"csiso2022jp"=>"cp50221",
"iso-2022-jp"=>"cp50221",
"csshiftjis"=>"Windows-31J",
"ms932"=>"Windows-31J",
"ms_kanji"=>"Windows-31J",
"shift-jis"=>"Windows-31J",
"shift_jis"=>"Windows-31J",
"sjis"=>"Windows-31J",
"windows-31j"=>"Windows-31J",
"x-sjis"=>"Windows-31J",
"cseuckr"=>"euc-kr",
"csksc56011987"=>"euc-kr",
"euc-kr"=>"euc-kr",
"iso-ir-149"=>"euc-kr",
"korean"=>"euc-kr",
"ks_c_5601-1987"=>"euc-kr",
"ks_c_5601-1989"=>"euc-kr",
"ksc5601"=>"euc-kr",
"ksc_5601"=>"euc-kr",
"windows-949"=>"euc-kr",
"utf-16be"=>"utf-16be",
"utf-16"=>"utf-16le",
"utf-16le"=>"utf-16le",
} # :nodoc:
# :nodoc:
# return encoding or nil
# http://encoding.spec.whatwg.org/#concept-encoding-get
def self.get_encoding(label)
Encoding.find(WEB_ENCODINGS_[label.to_str.strip.downcase]) rescue nil
end
end # module Bundler::URI
module Bundler
#
# Returns +uri+ converted to an Bundler::URI object.
#
def URI(uri)
if uri.is_a?(Bundler::URI::Generic)
uri
elsif uri = String.try_convert(uri)
Bundler::URI.parse(uri)
else
raise ArgumentError,
"bad argument (expected Bundler::URI object or Bundler::URI string)"
end
end
module_function :URI
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/file.rb 0000644 0000041 0000041 00000004245 13606335352 022322 0 ustar www-data www-data # frozen_string_literal: true
require_relative 'generic'
module Bundler::URI
#
# The "file" Bundler::URI is defined by RFC8089.
#
class File < Generic
# A Default port of nil for Bundler::URI::File.
DEFAULT_PORT = nil
#
# An Array of the available components for Bundler::URI::File.
#
COMPONENT = [
:scheme,
:host,
:path
].freeze
#
# == Description
#
# Creates a new Bundler::URI::File object from components, with syntax checking.
#
# The components accepted are +host+ and +path+.
#
# The components should be provided either as an Array, or as a Hash
# with keys formed by preceding the component names with a colon.
#
# If an Array is used, the components must be passed in the
# order [host, path]
.
#
# Examples:
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri1 = Bundler::URI::File.build(['host.example.com', '/path/file.zip'])
# uri1.to_s # => "file://host.example.com/path/file.zip"
#
# uri2 = Bundler::URI::File.build({:host => 'host.example.com',
# :path => '/ruby/src'})
# uri2.to_s # => "file://host.example.com/ruby/src"
#
def self.build(args)
tmp = Util::make_components_hash(self, args)
super(tmp)
end
# Protected setter for the host component +v+.
#
# See also Bundler::URI::Generic.host=.
#
def set_host(v)
v = "" if v.nil? || v == "localhost"
@host = v
end
# do nothing
def set_port(v)
end
# raise InvalidURIError
def check_userinfo(user)
raise Bundler::URI::InvalidURIError, "can not set userinfo for file Bundler::URI"
end
# raise InvalidURIError
def check_user(user)
raise Bundler::URI::InvalidURIError, "can not set user for file Bundler::URI"
end
# raise InvalidURIError
def check_password(user)
raise Bundler::URI::InvalidURIError, "can not set password for file Bundler::URI"
end
# do nothing
def set_userinfo(v)
end
# do nothing
def set_user(v)
end
# do nothing
def set_password(v)
end
end
@@schemes['FILE'] = File
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/ldaps.rb 0000644 0000041 0000041 00000001036 13606335352 022501 0 ustar www-data www-data # frozen_string_literal: false
# = uri/ldap.rb
#
# License:: You can redistribute it and/or modify it under the same term as Ruby.
#
# See Bundler::URI for general documentation
#
require_relative 'ldap'
module Bundler::URI
# The default port for LDAPS URIs is 636, and the scheme is 'ldaps:' rather
# than 'ldap:'. Other than that, LDAPS URIs are identical to LDAP URIs;
# see Bundler::URI::LDAP.
class LDAPS < LDAP
# A Default port of 636 for Bundler::URI::LDAPS
DEFAULT_PORT = 636
end
@@schemes['LDAPS'] = LDAPS
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/mailto.rb 0000644 0000041 0000041 00000020060 13606335352 022661 0 ustar www-data www-data # frozen_string_literal: false
# = uri/mailto.rb
#
# Author:: Akira Yamada
# License:: You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
# See Bundler::URI for general documentation
#
require_relative 'generic'
module Bundler::URI
#
# RFC6068, the mailto URL scheme.
#
class MailTo < Generic
include REGEXP
# A Default port of nil for Bundler::URI::MailTo.
DEFAULT_PORT = nil
# An Array of the available components for Bundler::URI::MailTo.
COMPONENT = [ :scheme, :to, :headers ].freeze
# :stopdoc:
# "hname" and "hvalue" are encodings of an RFC 822 header name and
# value, respectively. As with "to", all URL reserved characters must
# be encoded.
#
# "#mailbox" is as specified in RFC 822 [RFC822]. This means that it
# consists of zero or more comma-separated mail addresses, possibly
# including "phrase" and "comment" components. Note that all URL
# reserved characters in "to" must be encoded: in particular,
# parentheses, commas, and the percent sign ("%"), which commonly occur
# in the "mailbox" syntax.
#
# Within mailto URLs, the characters "?", "=", "&" are reserved.
# ; RFC 6068
# hfields = "?" hfield *( "&" hfield )
# hfield = hfname "=" hfvalue
# hfname = *qchar
# hfvalue = *qchar
# qchar = unreserved / pct-encoded / some-delims
# some-delims = "!" / "$" / "'" / "(" / ")" / "*"
# / "+" / "," / ";" / ":" / "@"
#
# ; RFC3986
# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
# pct-encoded = "%" HEXDIG HEXDIG
HEADER_REGEXP = /\A(?(?:%\h\h|[!$'-.0-;@-Z_a-z~])*=(?:%\h\h|[!$'-.0-;@-Z_a-z~])*)(?:&\g)*\z/
# practical regexp for email address
# https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
EMAIL_REGEXP = /\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/
# :startdoc:
#
# == Description
#
# Creates a new Bundler::URI::MailTo object from components, with syntax checking.
#
# Components can be provided as an Array or Hash. If an Array is used,
# the components must be supplied as [to, headers]
.
#
# If a Hash is used, the keys are the component names preceded by colons.
#
# The headers can be supplied as a pre-encoded string, such as
# "subject=subscribe&cc=address"
, or as an Array of Arrays
# like [['subject', 'subscribe'], ['cc', 'address']]
.
#
# Examples:
#
# require 'bundler/vendor/uri/lib/uri'
#
# m1 = Bundler::URI::MailTo.build(['joe@example.com', 'subject=Ruby'])
# m1.to_s # => "mailto:joe@example.com?subject=Ruby"
#
# m2 = Bundler::URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]])
# m2.to_s # => "mailto:john@example.com?Subject=Ruby&Cc=jack@example.com"
#
# m3 = Bundler::URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]})
# m3.to_s # => "mailto:listman@example.com?subject=subscribe"
#
def self.build(args)
tmp = Util.make_components_hash(self, args)
case tmp[:to]
when Array
tmp[:opaque] = tmp[:to].join(',')
when String
tmp[:opaque] = tmp[:to].dup
else
tmp[:opaque] = ''
end
if tmp[:headers]
query =
case tmp[:headers]
when Array
tmp[:headers].collect { |x|
if x.kind_of?(Array)
x[0] + '=' + x[1..-1].join
else
x.to_s
end
}.join('&')
when Hash
tmp[:headers].collect { |h,v|
h + '=' + v
}.join('&')
else
tmp[:headers].to_s
end
unless query.empty?
tmp[:opaque] << '?' << query
end
end
super(tmp)
end
#
# == Description
#
# Creates a new Bundler::URI::MailTo object from generic URL components with
# no syntax checking.
#
# This method is usually called from Bundler::URI::parse, which checks
# the validity of each component.
#
def initialize(*arg)
super(*arg)
@to = nil
@headers = []
# The RFC3986 parser does not normally populate opaque
@opaque = "?#{@query}" if @query && !@opaque
unless @opaque
raise InvalidComponentError,
"missing opaque part for mailto URL"
end
to, header = @opaque.split('?', 2)
# allow semicolon as a addr-spec separator
# http://support.microsoft.com/kb/820868
unless /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ =~ to
raise InvalidComponentError,
"unrecognised opaque part for mailtoURL: #{@opaque}"
end
if arg[10] # arg_check
self.to = to
self.headers = header
else
set_to(to)
set_headers(header)
end
end
# The primary e-mail address of the URL, as a String.
attr_reader :to
# E-mail headers set by the URL, as an Array of Arrays.
attr_reader :headers
# Checks the to +v+ component.
def check_to(v)
return true unless v
return true if v.size == 0
v.split(/[,;]/).each do |addr|
# check url safety as path-rootless
if /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*\z/ !~ addr
raise InvalidComponentError,
"an address in 'to' is invalid as Bundler::URI #{addr.dump}"
end
# check addr-spec
# don't s/\+/ /g
addr.gsub!(/%\h\h/, Bundler::URI::TBLDECWWWCOMP_)
if EMAIL_REGEXP !~ addr
raise InvalidComponentError,
"an address in 'to' is invalid as uri-escaped addr-spec #{addr.dump}"
end
end
true
end
private :check_to
# Private setter for to +v+.
def set_to(v)
@to = v
end
protected :set_to
# Setter for to +v+.
def to=(v)
check_to(v)
set_to(v)
v
end
# Checks the headers +v+ component against either
# * HEADER_REGEXP
def check_headers(v)
return true unless v
return true if v.size == 0
if HEADER_REGEXP !~ v
raise InvalidComponentError,
"bad component(expected opaque component): #{v}"
end
true
end
private :check_headers
# Private setter for headers +v+.
def set_headers(v)
@headers = []
if v
v.split('&').each do |x|
@headers << x.split(/=/, 2)
end
end
end
protected :set_headers
# Setter for headers +v+.
def headers=(v)
check_headers(v)
set_headers(v)
v
end
# Constructs String from Bundler::URI.
def to_s
@scheme + ':' +
if @to
@to
else
''
end +
if @headers.size > 0
'?' + @headers.collect{|x| x.join('=')}.join('&')
else
''
end +
if @fragment
'#' + @fragment
else
''
end
end
# Returns the RFC822 e-mail text equivalent of the URL, as a String.
#
# Example:
#
# require 'bundler/vendor/uri/lib/uri'
#
# uri = Bundler::URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr")
# uri.to_mailtext
# # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
#
def to_mailtext
to = Bundler::URI.decode_www_form_component(@to)
head = ''
body = ''
@headers.each do |x|
case x[0]
when 'body'
body = Bundler::URI.decode_www_form_component(x[1])
when 'to'
to << ', ' + Bundler::URI.decode_www_form_component(x[1])
else
head << Bundler::URI.decode_www_form_component(x[0]).capitalize + ': ' +
Bundler::URI.decode_www_form_component(x[1]) + "\n"
end
end
"To: #{to}
#{head}
#{body}
"
end
alias to_rfc822text to_mailtext
end
@@schemes['MAILTO'] = MailTo
end
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb 0000644 0000041 0000041 00000043462 13606335352 024061 0 ustar www-data www-data # frozen_string_literal: false
#--
# = uri/common.rb
#
# Author:: Akira Yamada
# Revision:: $Id$
# License::
# You can redistribute it and/or modify it under the same term as Ruby.
#
# See Bundler::URI for general documentation
#
module Bundler::URI
#
# Includes Bundler::URI::REGEXP::PATTERN
#
module RFC2396_REGEXP
#
# Patterns used to parse Bundler::URI's
#
module PATTERN
# :stopdoc:
# RFC 2396 (Bundler::URI Generic Syntax)
# RFC 2732 (IPv6 Literal Addresses in URL's)
# RFC 2373 (IPv6 Addressing Architecture)
# alpha = lowalpha | upalpha
ALPHA = "a-zA-Z"
# alphanum = alpha | digit
ALNUM = "#{ALPHA}\\d"
# hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
# "a" | "b" | "c" | "d" | "e" | "f"
HEX = "a-fA-F\\d"
# escaped = "%" hex hex
ESCAPED = "%[#{HEX}]{2}"
# mark = "-" | "_" | "." | "!" | "~" | "*" | "'" |
# "(" | ")"
# unreserved = alphanum | mark
UNRESERVED = "\\-_.!~*'()#{ALNUM}"
# reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
# "$" | ","
# reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
# "$" | "," | "[" | "]" (RFC 2732)
RESERVED = ";/?:@&=+$,\\[\\]"
# domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
DOMLABEL = "(?:[#{ALNUM}](?:[-#{ALNUM}]*[#{ALNUM}])?)"
# toplabel = alpha | alpha *( alphanum | "-" ) alphanum
TOPLABEL = "(?:[#{ALPHA}](?:[-#{ALNUM}]*[#{ALNUM}])?)"
# hostname = *( domainlabel "." ) toplabel [ "." ]
HOSTNAME = "(?:#{DOMLABEL}\\.)*#{TOPLABEL}\\.?"
# :startdoc:
end # PATTERN
# :startdoc:
end # REGEXP
# Class that parses String's into Bundler::URI's.
#
# It contains a Hash set of patterns and Regexp's that match and validate.
#
class RFC2396_Parser
include RFC2396_REGEXP
#
# == Synopsis
#
# Bundler::URI::Parser.new([opts])
#
# == Args
#
# The constructor accepts a hash as options for parser.
# Keys of options are pattern names of Bundler::URI components
# and values of options are pattern strings.
# The constructor generates set of regexps for parsing URIs.
#
# You can use the following keys:
#
# * :ESCAPED (Bundler::URI::PATTERN::ESCAPED in default)
# * :UNRESERVED (Bundler::URI::PATTERN::UNRESERVED in default)
# * :DOMLABEL (Bundler::URI::PATTERN::DOMLABEL in default)
# * :TOPLABEL (Bundler::URI::PATTERN::TOPLABEL in default)
# * :HOSTNAME (Bundler::URI::PATTERN::HOSTNAME in default)
#
# == Examples
#
# p = Bundler::URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
# u = p.parse("http://example.jp/%uABCD") #=> #
# Bundler::URI.parse(u.to_s) #=> raises Bundler::URI::InvalidURIError
#
# s = "http://example.com/ABCD"
# u1 = p.parse(s) #=> #
# u2 = Bundler::URI.parse(s) #=> #
# u1 == u2 #=> true
# u1.eql?(u2) #=> false
#
def initialize(opts = {})
@pattern = initialize_pattern(opts)
@pattern.each_value(&:freeze)
@pattern.freeze
@regexp = initialize_regexp(@pattern)
@regexp.each_value(&:freeze)
@regexp.freeze
end
# The Hash of patterns.
#
# See also Bundler::URI::Parser.initialize_pattern.
attr_reader :pattern
# The Hash of Regexp.
#
# See also Bundler::URI::Parser.initialize_regexp.
attr_reader :regexp
# Returns a split Bundler::URI against regexp[:ABS_URI].
def split(uri)
case uri
when ''
# null uri
when @regexp[:ABS_URI]
scheme, opaque, userinfo, host, port,
registry, path, query, fragment = $~[1..-1]
# Bundler::URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
# absoluteURI = scheme ":" ( hier_part | opaque_part )
# hier_part = ( net_path | abs_path ) [ "?" query ]
# opaque_part = uric_no_slash *uric
# abs_path = "/" path_segments
# net_path = "//" authority [ abs_path ]
# authority = server | reg_name
# server = [ [ userinfo "@" ] hostport ]
if !scheme
raise InvalidURIError,
"bad Bundler::URI(absolute but no scheme): #{uri}"
end
if !opaque && (!path && (!host && !registry))
raise InvalidURIError,
"bad Bundler::URI(absolute but no path): #{uri}"
end
when @regexp[:REL_URI]
scheme = nil
opaque = nil
userinfo, host, port, registry,
rel_segment, abs_path, query, fragment = $~[1..-1]
if rel_segment && abs_path
path = rel_segment + abs_path
elsif rel_segment
path = rel_segment
elsif abs_path
path = abs_path
end
# Bundler::URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
# relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
# net_path = "//" authority [ abs_path ]
# abs_path = "/" path_segments
# rel_path = rel_segment [ abs_path ]
# authority = server | reg_name
# server = [ [ userinfo "@" ] hostport ]
else
raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri}"
end
path = '' if !path && !opaque # (see RFC2396 Section 5.2)
ret = [
scheme,
userinfo, host, port, # X
registry, # X
path, # Y
opaque, # Y
query,
fragment
]
return ret
end
#
# == Args
#
# +uri+::
# String
#
# == Description
#
# Parses +uri+ and constructs either matching Bundler::URI scheme object
# (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or Bundler::URI::Generic.
#
# == Usage
#
# p = Bundler::URI::Parser.new
# p.parse("ldap://ldap.example.com/dc=example?user=john")
# #=> #
#
def parse(uri)
scheme, userinfo, host, port,
registry, path, opaque, query, fragment = self.split(uri)
if scheme && Bundler::URI.scheme_list.include?(scheme.upcase)
Bundler::URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment, self)
else
Generic.new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment, self)
end
end
#
# == Args
#
# +uris+::
# an Array of Strings
#
# == Description
#
# Attempts to parse and merge a set of URIs.
#
def join(*uris)
uris[0] = convert_to_uri(uris[0])
uris.inject :merge
end
#
# :call-seq:
# extract( str )
# extract( str, schemes )
# extract( str, schemes ) {|item| block }
#
# == Args
#
# +str+::
# String to search
# +schemes+::
# Patterns to apply to +str+
#
# == Description
#
# Attempts to parse and merge a set of URIs.
# If no +block+ given, then returns the result,
# else it calls +block+ for each element in result.
#
# See also Bundler::URI::Parser.make_regexp.
#
def extract(str, schemes = nil)
if block_given?
str.scan(make_regexp(schemes)) { yield $& }
nil
else
result = []
str.scan(make_regexp(schemes)) { result.push $& }
result
end
end
# Returns Regexp that is default self.regexp[:ABS_URI_REF],
# unless +schemes+ is provided. Then it is a Regexp.union with self.pattern[:X_ABS_URI].
def make_regexp(schemes = nil)
unless schemes
@regexp[:ABS_URI_REF]
else
/(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x
end
end
#
# :call-seq:
# escape( str )
# escape( str, unsafe )
#
# == Args
#
# +str+::
# String to make safe
# +unsafe+::
# Regexp to apply. Defaults to self.regexp[:UNSAFE]
#
# == Description
#
# Constructs a safe String from +str+, removing unsafe characters,
# replacing them with codes.
#
def escape(str, unsafe = @regexp[:UNSAFE])
unless unsafe.kind_of?(Regexp)
# perhaps unsafe is String object
unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false)
end
str.gsub(unsafe) do
us = $&
tmp = ''
us.each_byte do |uc|
tmp << sprintf('%%%02X', uc)
end
tmp
end.force_encoding(Encoding::US_ASCII)
end
#
# :call-seq:
# unescape( str )
# unescape( str, escaped )
#
# == Args
#
# +str+::
# String to remove escapes from
# +escaped+::
# Regexp to apply. Defaults to self.regexp[:ESCAPED]
#
# == Description
#
# Removes escapes from +str+.
#
def unescape(str, escaped = @regexp[:ESCAPED])
enc = str.encoding
enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end
@@to_s = Kernel.instance_method(:to_s)
def inspect
@@to_s.bind_call(self)
end
private
# Constructs the default Hash of patterns.
def initialize_pattern(opts = {})
ret = {}
ret[:ESCAPED] = escaped = (opts.delete(:ESCAPED) || PATTERN::ESCAPED)
ret[:UNRESERVED] = unreserved = opts.delete(:UNRESERVED) || PATTERN::UNRESERVED
ret[:RESERVED] = reserved = opts.delete(:RESERVED) || PATTERN::RESERVED
ret[:DOMLABEL] = opts.delete(:DOMLABEL) || PATTERN::DOMLABEL
ret[:TOPLABEL] = opts.delete(:TOPLABEL) || PATTERN::TOPLABEL
ret[:HOSTNAME] = hostname = opts.delete(:HOSTNAME)
# RFC 2396 (Bundler::URI Generic Syntax)
# RFC 2732 (IPv6 Literal Addresses in URL's)
# RFC 2373 (IPv6 Addressing Architecture)
# uric = reserved | unreserved | escaped
ret[:URIC] = uric = "(?:[#{unreserved}#{reserved}]|#{escaped})"
# uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
# "&" | "=" | "+" | "$" | ","
ret[:URIC_NO_SLASH] = uric_no_slash = "(?:[#{unreserved};?:@&=+$,]|#{escaped})"
# query = *uric
ret[:QUERY] = query = "#{uric}*"
# fragment = *uric
ret[:FRAGMENT] = fragment = "#{uric}*"
# hostname = *( domainlabel "." ) toplabel [ "." ]
# reg-name = *( unreserved / pct-encoded / sub-delims ) # RFC3986
unless hostname
ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-.]|%\\h\\h)+"
end
# RFC 2373, APPENDIX B:
# IPv6address = hexpart [ ":" IPv4address ]
# IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
# hexpart = hexseq | hexseq "::" [ hexseq ] | "::" [ hexseq ]
# hexseq = hex4 *( ":" hex4)
# hex4 = 1*4HEXDIG
#
# XXX: This definition has a flaw. "::" + IPv4address must be
# allowed too. Here is a replacement.
#
# IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
ret[:IPV4ADDR] = ipv4addr = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
# hex4 = 1*4HEXDIG
hex4 = "[#{PATTERN::HEX}]{1,4}"
# lastpart = hex4 | IPv4address
lastpart = "(?:#{hex4}|#{ipv4addr})"
# hexseq1 = *( hex4 ":" ) hex4
hexseq1 = "(?:#{hex4}:)*#{hex4}"
# hexseq2 = *( hex4 ":" ) lastpart
hexseq2 = "(?:#{hex4}:)*#{lastpart}"
# IPv6address = hexseq2 | [ hexseq1 ] "::" [ hexseq2 ]
ret[:IPV6ADDR] = ipv6addr = "(?:#{hexseq2}|(?:#{hexseq1})?::(?:#{hexseq2})?)"
# IPv6prefix = ( hexseq1 | [ hexseq1 ] "::" [ hexseq1 ] ) "/" 1*2DIGIT
# unused
# ipv6reference = "[" IPv6address "]" (RFC 2732)
ret[:IPV6REF] = ipv6ref = "\\[#{ipv6addr}\\]"
# host = hostname | IPv4address
# host = hostname | IPv4address | IPv6reference (RFC 2732)
ret[:HOST] = host = "(?:#{hostname}|#{ipv4addr}|#{ipv6ref})"
# port = *digit
ret[:PORT] = port = '\d*'
# hostport = host [ ":" port ]
ret[:HOSTPORT] = hostport = "#{host}(?::#{port})?"
# userinfo = *( unreserved | escaped |
# ";" | ":" | "&" | "=" | "+" | "$" | "," )
ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,]|#{escaped})*"
# pchar = unreserved | escaped |
# ":" | "@" | "&" | "=" | "+" | "$" | ","
pchar = "(?:[#{unreserved}:@&=+$,]|#{escaped})"
# param = *pchar
param = "#{pchar}*"
# segment = *pchar *( ";" param )
segment = "#{pchar}*(?:;#{param})*"
# path_segments = segment *( "/" segment )
ret[:PATH_SEGMENTS] = path_segments = "#{segment}(?:/#{segment})*"
# server = [ [ userinfo "@" ] hostport ]
server = "(?:#{userinfo}@)?#{hostport}"
# reg_name = 1*( unreserved | escaped | "$" | "," |
# ";" | ":" | "@" | "&" | "=" | "+" )
ret[:REG_NAME] = reg_name = "(?:[#{unreserved}$,;:@&=+]|#{escaped})+"
# authority = server | reg_name
authority = "(?:#{server}|#{reg_name})"
# rel_segment = 1*( unreserved | escaped |
# ";" | "@" | "&" | "=" | "+" | "$" | "," )
ret[:REL_SEGMENT] = rel_segment = "(?:[#{unreserved};@&=+$,]|#{escaped})+"
# scheme = alpha *( alpha | digit | "+" | "-" | "." )
ret[:SCHEME] = scheme = "[#{PATTERN::ALPHA}][\\-+.#{PATTERN::ALPHA}\\d]*"
# abs_path = "/" path_segments
ret[:ABS_PATH] = abs_path = "/#{path_segments}"
# rel_path = rel_segment [ abs_path ]
ret[:REL_PATH] = rel_path = "#{rel_segment}(?:#{abs_path})?"
# net_path = "//" authority [ abs_path ]
ret[:NET_PATH] = net_path = "//#{authority}(?:#{abs_path})?"
# hier_part = ( net_path | abs_path ) [ "?" query ]
ret[:HIER_PART] = hier_part = "(?:#{net_path}|#{abs_path})(?:\\?(?:#{query}))?"
# opaque_part = uric_no_slash *uric
ret[:OPAQUE_PART] = opaque_part = "#{uric_no_slash}#{uric}*"
# absoluteURI = scheme ":" ( hier_part | opaque_part )
ret[:ABS_URI] = abs_uri = "#{scheme}:(?:#{hier_part}|#{opaque_part})"
# relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
ret[:REL_URI] = rel_uri = "(?:#{net_path}|#{abs_path}|#{rel_path})(?:\\?#{query})?"
# Bundler::URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
ret[:URI_REF] = "(?:#{abs_uri}|#{rel_uri})?(?:##{fragment})?"
ret[:X_ABS_URI] = "
(#{scheme}): (?# 1: scheme)
(?:
(#{opaque_part}) (?# 2: opaque)
|
(?:(?:
//(?:
(?:(?:(#{userinfo})@)? (?# 3: userinfo)
(?:(#{host})(?::(\\d*))?))? (?# 4: host, 5: port)
|
(#{reg_name}) (?# 6: registry)
)
|
(?!//)) (?# XXX: '//' is the mark for hostport)
(#{abs_path})? (?# 7: path)
)(?:\\?(#{query}))? (?# 8: query)
)
(?:\\#(#{fragment}))? (?# 9: fragment)
"
ret[:X_REL_URI] = "
(?:
(?:
//
(?:
(?:(#{userinfo})@)? (?# 1: userinfo)
(#{host})?(?::(\\d*))? (?# 2: host, 3: port)
|
(#{reg_name}) (?# 4: registry)
)
)
|
(#{rel_segment}) (?# 5: rel_segment)
)?
(#{abs_path})? (?# 6: abs_path)
(?:\\?(#{query}))? (?# 7: query)
(?:\\#(#{fragment}))? (?# 8: fragment)
"
ret
end
# Constructs the default Hash of Regexp's.
def initialize_regexp(pattern)
ret = {}
# for Bundler::URI::split
ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
# for Bundler::URI::extract
ret[:URI_REF] = Regexp.new(pattern[:URI_REF])
ret[:ABS_URI_REF] = Regexp.new(pattern[:X_ABS_URI], Regexp::EXTENDED)
ret[:REL_URI_REF] = Regexp.new(pattern[:X_REL_URI], Regexp::EXTENDED)
# for Bundler::URI::escape/unescape
ret[:ESCAPED] = Regexp.new(pattern[:ESCAPED])
ret[:UNSAFE] = Regexp.new("[^#{pattern[:UNRESERVED]}#{pattern[:RESERVED]}]")
# for Generic#initialize
ret[:SCHEME] = Regexp.new("\\A#{pattern[:SCHEME]}\\z")
ret[:USERINFO] = Regexp.new("\\A#{pattern[:USERINFO]}\\z")
ret[:HOST] = Regexp.new("\\A#{pattern[:HOST]}\\z")
ret[:PORT] = Regexp.new("\\A#{pattern[:PORT]}\\z")
ret[:OPAQUE] = Regexp.new("\\A#{pattern[:OPAQUE_PART]}\\z")
ret[:REGISTRY] = Regexp.new("\\A#{pattern[:REG_NAME]}\\z")
ret[:ABS_PATH] = Regexp.new("\\A#{pattern[:ABS_PATH]}\\z")
ret[:REL_PATH] = Regexp.new("\\A#{pattern[:REL_PATH]}\\z")
ret[:QUERY] = Regexp.new("\\A#{pattern[:QUERY]}\\z")
ret[:FRAGMENT] = Regexp.new("\\A#{pattern[:FRAGMENT]}\\z")
ret
end
def convert_to_uri(uri)
if uri.is_a?(Bundler::URI::Generic)
uri
elsif uri = String.try_convert(uri)
parse(uri)
else
raise ArgumentError,
"bad argument (expected Bundler::URI object or Bundler::URI string)"
end
end
end # class Parser
end # module Bundler::URI
bundler-2.1.4/lib/bundler/vendor/uri/lib/uri/ldap.rb 0000644 0000041 0000041 00000013573 13606335352 022327 0 ustar www-data www-data # frozen_string_literal: false
# = uri/ldap.rb
#
# Author::
# Takaaki Tateishi
# Akira Yamada
# License::
# Bundler::URI::LDAP is copyrighted free software by Takaaki Tateishi and Akira Yamada.
# You can redistribute it and/or modify it under the same term as Ruby.
# Revision:: $Id$
#
# See Bundler::URI for general documentation
#
require_relative 'generic'
module Bundler::URI
#
# LDAP Bundler::URI SCHEMA (described in RFC2255).
#--
# ldap:///[?[?[?[?]]]]
#++
class LDAP < Generic
# A Default port of 389 for Bundler::URI::LDAP.
DEFAULT_PORT = 389
# An Array of the available components for Bundler::URI::LDAP.
COMPONENT = [
:scheme,
:host, :port,
:dn,
:attributes,
:scope,
:filter,
:extensions,
].freeze
# Scopes available for the starting point.
#
# * SCOPE_BASE - the Base DN
# * SCOPE_ONE - one level under the Base DN, not including the base DN and
# not including any entries under this
# * SCOPE_SUB - subtrees, all entries at all levels
#
SCOPE = [
SCOPE_ONE = 'one',
SCOPE_SUB = 'sub',
SCOPE_BASE = 'base',
].freeze
#
# == Description
#
# Creates a new Bundler::URI::LDAP object from components, with syntax checking.
#
# The components accepted are host, port, dn, attributes,
# scope, filter, and extensions.
#
# The components should be provided either as an Array, or as a Hash
# with keys formed by preceding the component names with a colon.
#
# If an Array is used, the components must be passed in the
# order [host, port, dn, attributes, scope, filter, extensions]
.
#
# Example:
#
# uri = Bundler::URI::LDAP.build({:host => 'ldap.example.com',
# :dn => '/dc=example'})
#
# uri = Bundler::URI::LDAP.build(["ldap.example.com", nil,
# "/dc=example;dc=com", "query", nil, nil, nil])
#
def self.build(args)
tmp = Util::make_components_hash(self, args)
if tmp[:dn]
tmp[:path] = tmp[:dn]
end
query = []
[:extensions, :filter, :scope, :attributes].collect do |x|
next if !tmp[x] && query.size == 0
query.unshift(tmp[x])
end
tmp[:query] = query.join('?')
return super(tmp)
end
#
# == Description
#
# Creates a new Bundler::URI::LDAP object from generic Bundler::URI components as per
# RFC 2396. No LDAP-specific syntax checking is performed.
#
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
# +opaque+, +query+, and +fragment+, in that order.
#
# Example:
#
# uri = Bundler::URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil,
# "/dc=example;dc=com", nil, "query", nil)
#
# See also Bundler::URI::Generic.new.
#
def initialize(*arg)
super(*arg)
if @fragment
raise InvalidURIError, 'bad LDAP URL'
end
parse_dn
parse_query
end
# Private method to cleanup +dn+ from using the +path+ component attribute.
def parse_dn
@dn = @path[1..-1]
end
private :parse_dn
# Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+
# from using the +query+ component attribute.
def parse_query
@attributes = nil
@scope = nil
@filter = nil
@extensions = nil
if @query
attrs, scope, filter, extensions = @query.split('?')
@attributes = attrs if attrs && attrs.size > 0
@scope = scope if scope && scope.size > 0
@filter = filter if filter && filter.size > 0
@extensions = extensions if extensions && extensions.size > 0
end
end
private :parse_query
# Private method to assemble +query+ from +attributes+, +scope+, +filter+, and +extensions+.
def build_path_query
@path = '/' + @dn
query = []
[@extensions, @filter, @scope, @attributes].each do |x|
next if !x && query.size == 0
query.unshift(x)
end
@query = query.join('?')
end
private :build_path_query
# Returns dn.
def dn
@dn
end
# Private setter for dn +val+.
def set_dn(val)
@dn = val
build_path_query
@dn
end
protected :set_dn
# Setter for dn +val+.
def dn=(val)
set_dn(val)
val
end
# Returns attributes.
def attributes
@attributes
end
# Private setter for attributes +val+.
def set_attributes(val)
@attributes = val
build_path_query
@attributes
end
protected :set_attributes
# Setter for attributes +val+.
def attributes=(val)
set_attributes(val)
val
end
# Returns scope.
def scope
@scope
end
# Private setter for scope +val+.
def set_scope(val)
@scope = val
build_path_query
@scope
end
protected :set_scope
# Setter for scope +val+.
def scope=(val)
set_scope(val)
val
end
# Returns filter.
def filter
@filter
end
# Private setter for filter +val+.
def set_filter(val)
@filter = val
build_path_query
@filter
end
protected :set_filter
# Setter for filter +val+.
def filter=(val)
set_filter(val)
val
end
# Returns extensions.
def extensions
@extensions
end
# Private setter for extensions +val+.
def set_extensions(val)
@extensions = val
build_path_query
@extensions
end
protected :set_extensions
# Setter for extensions +val+.
def extensions=(val)
set_extensions(val)
val
end
# Checks if Bundler::URI has a path.
# For Bundler::URI::LDAP this will return +false+.
def hierarchical?
false
end
end
@@schemes['LDAP'] = LDAP
end
bundler-2.1.4/lib/bundler/vendor/net-http-persistent/ 0000755 0000041 0000041 00000000000 13606335352 022646 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/ 0000755 0000041 0000041 00000000000 13606335352 023414 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/ 0000755 0000041 0000041 00000000000 13606335352 024202 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/http/ 0000755 0000041 0000041 00000000000 13606335352 025161 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb 0000644 0000041 0000041 00000075075 13606335352 027724 0 ustar www-data www-data require 'net/http'
require_relative '../../../../uri/lib/uri'
require 'cgi' # for escaping
require_relative '../../../../connection_pool/lib/connection_pool'
autoload :OpenSSL, 'openssl'
##
# Persistent connections for Net::HTTP
#
# Bundler::Persistent::Net::HTTP::Persistent maintains persistent connections across all the
# servers you wish to talk to. For each host:port you communicate with a
# single persistent connection is created.
#
# Multiple Bundler::Persistent::Net::HTTP::Persistent objects will share the same set of
# connections.
#
# For each thread you start a new connection will be created. A
# Bundler::Persistent::Net::HTTP::Persistent connection will not be shared across threads.
#
# You can shut down the HTTP connections when done by calling #shutdown. You
# should name your Bundler::Persistent::Net::HTTP::Persistent object if you intend to call this
# method.
#
# Example:
#
# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
#
# uri = Bundler::URI 'http://example.com/awesome/web/service'
#
# http = Bundler::Persistent::Net::HTTP::Persistent.new name: 'my_app_name'
#
# # perform a GET
# response = http.request uri
#
# # or
#
# get = Net::HTTP::Get.new uri.request_uri
# response = http.request get
#
# # create a POST
# post_uri = uri + 'create'
# post = Net::HTTP::Post.new post_uri.path
# post.set_form_data 'some' => 'cool data'
#
# # perform the POST, the Bundler::URI is always required
# response http.request post_uri, post
#
# Note that for GET, HEAD and other requests that do not have a body you want
# to use Bundler::URI#request_uri not Bundler::URI#path. The request_uri contains the query
# params which are sent in the body for other requests.
#
# == SSL
#
# SSL connections are automatically created depending upon the scheme of the
# Bundler::URI. SSL connections are automatically verified against the default
# certificate store for your computer. You can override this by changing
# verify_mode or by specifying an alternate cert_store.
#
# Here are the SSL settings, see the individual methods for documentation:
#
# #certificate :: This client's certificate
# #ca_file :: The certificate-authorities
# #ca_path :: Directory with certificate-authorities
# #cert_store :: An SSL certificate store
# #ciphers :: List of SSl ciphers allowed
# #private_key :: The client's SSL private key
# #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
# connection
# #ssl_timeout :: SSL session lifetime
# #ssl_version :: Which specific SSL version to use
# #verify_callback :: For server certificate verification
# #verify_depth :: Depth of certificate verification
# #verify_mode :: How connections should be verified
#
# == Proxies
#
# A proxy can be set through #proxy= or at initialization time by providing a
# second argument to ::new. The proxy may be the Bundler::URI of the proxy server or
# :ENV
which will consult environment variables.
#
# See #proxy= and #proxy_from_env for details.
#
# == Headers
#
# Headers may be specified for use in every request. #headers are appended to
# any headers on the request. #override_headers replace existing headers on
# the request.
#
# The difference between the two can be seen in setting the User-Agent. Using
# http.headers['User-Agent'] = 'MyUserAgent'
will send "Ruby,
# MyUserAgent" while http.override_headers['User-Agent'] =
# 'MyUserAgent'
will send "MyUserAgent".
#
# == Tuning
#
# === Segregation
#
# By providing an application name to ::new you can separate your connections
# from the connections of other applications.
#
# === Idle Timeout
#
# If a connection hasn't been used for this number of seconds it will automatically be
# reset upon the next use to avoid attempting to send to a closed connection.
# The default value is 5 seconds. nil means no timeout. Set through #idle_timeout.
#
# Reducing this value may help avoid the "too many connection resets" error
# when sending non-idempotent requests while increasing this value will cause
# fewer round-trips.
#
# === Read Timeout
#
# The amount of time allowed between reading two chunks from the socket. Set
# through #read_timeout
#
# === Max Requests
#
# The number of requests that should be made before opening a new connection.
# Typically many keep-alive capable servers tune this to 100 or less, so the
# 101st request will fail with ECONNRESET. If unset (default), this value has no
# effect, if set, connections will be reset on the request after max_requests.
#
# === Open Timeout
#
# The amount of time to wait for a connection to be opened. Set through
# #open_timeout.
#
# === Socket Options
#
# Socket options may be set on newly-created connections. See #socket_options
# for details.
#
# === Non-Idempotent Requests
#
# By default non-idempotent requests will not be retried per RFC 2616. By
# setting retry_change_requests to true requests will automatically be retried
# once.
#
# Only do this when you know that retrying a POST or other non-idempotent
# request is safe for your application and will not create duplicate
# resources.
#
# The recommended way to handle non-idempotent requests is the following:
#
# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
#
# uri = Bundler::URI 'http://example.com/awesome/web/service'
# post_uri = uri + 'create'
#
# http = Bundler::Persistent::Net::HTTP::Persistent.new name: 'my_app_name'
#
# post = Net::HTTP::Post.new post_uri.path
# # ... fill in POST request
#
# begin
# response = http.request post_uri, post
# rescue Bundler::Persistent::Net::HTTP::Persistent::Error
#
# # POST failed, make a new request to verify the server did not process
# # the request
# exists_uri = uri + '...'
# response = http.get exists_uri
#
# # Retry if it failed
# retry if response.code == '404'
# end
#
# The method of determining if the resource was created or not is unique to
# the particular service you are using. Of course, you will want to add
# protection from infinite looping.
#
# === Connection Termination
#
# If you are done using the Bundler::Persistent::Net::HTTP::Persistent instance you may shut down
# all the connections in the current thread with #shutdown. This is not
# recommended for normal use, it should only be used when it will be several
# minutes before you make another HTTP request.
#
# If you are using multiple threads, call #shutdown in each thread when the
# thread is done making requests. If you don't call shutdown, that's OK.
# Ruby will automatically garbage collect and shutdown your HTTP connections
# when the thread terminates.
class Bundler::Persistent::Net::HTTP::Persistent
##
# The beginning of Time
EPOCH = Time.at 0 # :nodoc:
##
# Is OpenSSL available? This test works with autoload
HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
##
# The default connection pool size is 1/4 the allowed open files.
if Gem.win_platform? then
DEFAULT_POOL_SIZE = 256
else
DEFAULT_POOL_SIZE = Process.getrlimit(Process::RLIMIT_NOFILE).first / 4
end
##
# The version of Bundler::Persistent::Net::HTTP::Persistent you are using
VERSION = '3.1.0'
##
# Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
# the exception list for ruby 1.x.
RETRIED_EXCEPTIONS = [ # :nodoc:
(Net::ReadTimeout if Net.const_defined? :ReadTimeout),
IOError,
EOFError,
Errno::ECONNRESET,
Errno::ECONNABORTED,
Errno::EPIPE,
(OpenSSL::SSL::SSLError if HAVE_OPENSSL),
Timeout::Error,
].compact
##
# Error class for errors raised by Bundler::Persistent::Net::HTTP::Persistent. Various
# SystemCallErrors are re-raised with a human-readable message under this
# class.
class Error < StandardError; end
##
# Use this method to detect the idle timeout of the host at +uri+. The
# value returned can be used to configure #idle_timeout. +max+ controls the
# maximum idle timeout to detect.
#
# After
#
# Idle timeout detection is performed by creating a connection then
# performing a HEAD request in a loop until the connection terminates
# waiting one additional second per loop.
#
# NOTE: This may not work on ruby > 1.9.
def self.detect_idle_timeout uri, max = 10
uri = Bundler::URI uri unless Bundler::URI::Generic === uri
uri += '/'
req = Net::HTTP::Head.new uri.request_uri
http = new 'net-http-persistent detect_idle_timeout'
http.connection_for uri do |connection|
sleep_time = 0
http = connection.http
loop do
response = http.request req
$stderr.puts "HEAD #{uri} => #{response.code}" if $DEBUG
unless Net::HTTPOK === response then
raise Error, "bad response code #{response.code} detecting idle timeout"
end
break if sleep_time >= max
sleep_time += 1
$stderr.puts "sleeping #{sleep_time}" if $DEBUG
sleep sleep_time
end
end
rescue
# ignore StandardErrors, we've probably found the idle timeout.
ensure
return sleep_time unless $!
end
##
# This client's OpenSSL::X509::Certificate
attr_reader :certificate
##
# For Net::HTTP parity
alias cert certificate
##
# An SSL certificate authority. Setting this will set verify_mode to
# VERIFY_PEER.
attr_reader :ca_file
##
# A directory of SSL certificates to be used as certificate authorities.
# Setting this will set verify_mode to VERIFY_PEER.
attr_reader :ca_path
##
# An SSL certificate store. Setting this will override the default
# certificate store. See verify_mode for more information.
attr_reader :cert_store
##
# The ciphers allowed for SSL connections
attr_reader :ciphers
##
# Sends debug_output to this IO via Net::HTTP#set_debug_output.
#
# Never use this method in production code, it causes a serious security
# hole.
attr_accessor :debug_output
##
# Current connection generation
attr_reader :generation # :nodoc:
##
# Headers that are added to every request using Net::HTTP#add_field
attr_reader :headers
##
# Maps host:port to an HTTP version. This allows us to enable version
# specific features.
attr_reader :http_versions
##
# Maximum time an unused connection can remain idle before being
# automatically closed.
attr_accessor :idle_timeout
##
# Maximum number of requests on a connection before it is considered expired
# and automatically closed.
attr_accessor :max_requests
##
# The value sent in the Keep-Alive header. Defaults to 30. Not needed for
# HTTP/1.1 servers.
#
# This may not work correctly for HTTP/1.0 servers
#
# This method may be removed in a future version as RFC 2616 does not
# require this header.
attr_accessor :keep_alive
##
# A name for this connection. Allows you to keep your connections apart
# from everybody else's.
attr_reader :name
##
# Seconds to wait until a connection is opened. See Net::HTTP#open_timeout
attr_accessor :open_timeout
##
# Headers that are added to every request using Net::HTTP#[]=
attr_reader :override_headers
##
# This client's SSL private key
attr_reader :private_key
##
# For Net::HTTP parity
alias key private_key
##
# The URL through which requests will be proxied
attr_reader :proxy_uri
##
# List of host suffixes which will not be proxied
attr_reader :no_proxy
##
# Test-only accessor for the connection pool
attr_reader :pool # :nodoc:
##
# Seconds to wait until reading one block. See Net::HTTP#read_timeout
attr_accessor :read_timeout
##
# Seconds to wait until writing one block. See Net::HTTP#write_timeout
attr_accessor :write_timeout
##
# By default SSL sessions are reused to avoid extra SSL handshakes. Set
# this to false if you have problems communicating with an HTTPS server
# like:
#
# SSL_connect [...] read finished A: unexpected message (OpenSSL::SSL::SSLError)
attr_accessor :reuse_ssl_sessions
##
# An array of options for Socket#setsockopt.
#
# By default the TCP_NODELAY option is set on sockets.
#
# To set additional options append them to this array:
#
# http.socket_options << [Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1]
attr_reader :socket_options
##
# Current SSL connection generation
attr_reader :ssl_generation # :nodoc:
##
# SSL session lifetime
attr_reader :ssl_timeout
##
# SSL version to use.
#
# By default, the version will be negotiated automatically between client
# and server. Ruby 1.9 and newer only. Deprecated since Ruby 2.5.
attr_reader :ssl_version
##
# Minimum SSL version to use, e.g. :TLS1_1
#
# By default, the version will be negotiated automatically between client
# and server. Ruby 2.5 and newer only.
attr_reader :min_version
##
# Maximum SSL version to use, e.g. :TLS1_2
#
# By default, the version will be negotiated automatically between client
# and server. Ruby 2.5 and newer only.
attr_reader :max_version
##
# Where this instance's last-use times live in the thread local variables
attr_reader :timeout_key # :nodoc:
##
# SSL verification callback. Used when ca_file or ca_path is set.
attr_reader :verify_callback
##
# Sets the depth of SSL certificate verification
attr_reader :verify_depth
##
# HTTPS verify mode. Defaults to OpenSSL::SSL::VERIFY_PEER which verifies
# the server certificate.
#
# If no ca_file, ca_path or cert_store is set the default system certificate
# store is used.
#
# You can use +verify_mode+ to override any default values.
attr_reader :verify_mode
##
# Enable retries of non-idempotent requests that change data (e.g. POST
# requests) when the server has disconnected.
#
# This will in the worst case lead to multiple requests with the same data,
# but it may be useful for some applications. Take care when enabling
# this option to ensure it is safe to POST or perform other non-idempotent
# requests to the server.
attr_accessor :retry_change_requests
##
# Creates a new Bundler::Persistent::Net::HTTP::Persistent.
#
# Set +name+ to keep your connections apart from everybody else's. Not
# required currently, but highly recommended. Your library name should be
# good enough. This parameter will be required in a future version.
#
# +proxy+ may be set to a Bundler::URI::HTTP or :ENV to pick up proxy options from
# the environment. See proxy_from_env for details.
#
# In order to use a Bundler::URI for the proxy you may need to do some extra work
# beyond Bundler::URI parsing if the proxy requires a password:
#
# proxy = Bundler::URI 'http://proxy.example'
# proxy.user = 'AzureDiamond'
# proxy.password = 'hunter2'
#
# Set +pool_size+ to limit the maximum number of connections allowed.
# Defaults to 1/4 the number of allowed file handles. You can have no more
# than this many threads with active HTTP transactions.
def initialize name: nil, proxy: nil, pool_size: DEFAULT_POOL_SIZE
@name = name
@debug_output = nil
@proxy_uri = nil
@no_proxy = []
@headers = {}
@override_headers = {}
@http_versions = {}
@keep_alive = 30
@open_timeout = nil
@read_timeout = nil
@write_timeout = nil
@idle_timeout = 5
@max_requests = nil
@socket_options = []
@ssl_generation = 0 # incremented when SSL session variables change
@socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
Socket.const_defined? :TCP_NODELAY
@pool = Bundler::Persistent::Net::HTTP::Persistent::Pool.new size: pool_size do |http_args|
Bundler::Persistent::Net::HTTP::Persistent::Connection.new Net::HTTP, http_args, @ssl_generation
end
@certificate = nil
@ca_file = nil
@ca_path = nil
@ciphers = nil
@private_key = nil
@ssl_timeout = nil
@ssl_version = nil
@min_version = nil
@max_version = nil
@verify_callback = nil
@verify_depth = nil
@verify_mode = nil
@cert_store = nil
@generation = 0 # incremented when proxy Bundler::URI changes
if HAVE_OPENSSL then
@verify_mode = OpenSSL::SSL::VERIFY_PEER
@reuse_ssl_sessions = OpenSSL::SSL.const_defined? :Session
end
@retry_change_requests = false
self.proxy = proxy if proxy
end
##
# Sets this client's OpenSSL::X509::Certificate
def certificate= certificate
@certificate = certificate
reconnect_ssl
end
# For Net::HTTP parity
alias cert= certificate=
##
# Sets the SSL certificate authority file.
def ca_file= file
@ca_file = file
reconnect_ssl
end
##
# Sets the SSL certificate authority path.
def ca_path= path
@ca_path = path
reconnect_ssl
end
##
# Overrides the default SSL certificate store used for verifying
# connections.
def cert_store= store
@cert_store = store
reconnect_ssl
end
##
# The ciphers allowed for SSL connections
def ciphers= ciphers
@ciphers = ciphers
reconnect_ssl
end
##
# Creates a new connection for +uri+
def connection_for uri
use_ssl = uri.scheme.downcase == 'https'
net_http_args = [uri.hostname, uri.port]
if @proxy_uri and not proxy_bypass? uri.hostname, uri.port then
net_http_args.concat @proxy_args
else
net_http_args.concat [nil, nil, nil, nil]
end
connection = @pool.checkout net_http_args
http = connection.http
connection.ressl @ssl_generation if
connection.ssl_generation != @ssl_generation
if not http.started? then
ssl http if use_ssl
start http
elsif expired? connection then
reset connection
end
http.read_timeout = @read_timeout if @read_timeout
http.write_timeout = @write_timeout if @write_timeout && http.respond_to?(:write_timeout=)
http.keep_alive_timeout = @idle_timeout if @idle_timeout
return yield connection
rescue Errno::ECONNREFUSED
address = http.proxy_address || http.address
port = http.proxy_port || http.port
raise Error, "connection refused: #{address}:#{port}"
rescue Errno::EHOSTDOWN
address = http.proxy_address || http.address
port = http.proxy_port || http.port
raise Error, "host down: #{address}:#{port}"
ensure
@pool.checkin net_http_args
end
##
# Returns an error message containing the number of requests performed on
# this connection
def error_message connection
connection.requests -= 1 # fixup
age = Time.now - connection.last_use
"after #{connection.requests} requests on #{connection.http.object_id}, " \
"last used #{age} seconds ago"
end
##
# Bundler::URI::escape wrapper
def escape str
CGI.escape str if str
end
##
# Bundler::URI::unescape wrapper
def unescape str
CGI.unescape str if str
end
##
# Returns true if the connection should be reset due to an idle timeout, or
# maximum request count, false otherwise.
def expired? connection
return true if @max_requests && connection.requests >= @max_requests
return false unless @idle_timeout
return true if @idle_timeout.zero?
Time.now - connection.last_use > @idle_timeout
end
##
# Starts the Net::HTTP +connection+
def start http
http.set_debug_output @debug_output if @debug_output
http.open_timeout = @open_timeout if @open_timeout
http.start
socket = http.instance_variable_get :@socket
if socket then # for fakeweb
@socket_options.each do |option|
socket.io.setsockopt(*option)
end
end
end
##
# Finishes the Net::HTTP +connection+
def finish connection
connection.finish
connection.http.instance_variable_set :@ssl_session, nil unless
@reuse_ssl_sessions
end
##
# Returns the HTTP protocol version for +uri+
def http_version uri
@http_versions["#{uri.host}:#{uri.port}"]
end
##
# Is +req+ idempotent according to RFC 2616?
def idempotent? req
case req.method
when 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE' then
true
end
end
##
# Is the request +req+ idempotent or is retry_change_requests allowed.
def can_retry? req
@retry_change_requests && !idempotent?(req)
end
##
# Adds "http://" to the String +uri+ if it is missing.
def normalize_uri uri
(uri =~ /^https?:/) ? uri : "http://#{uri}"
end
##
# Sets this client's SSL private key
def private_key= key
@private_key = key
reconnect_ssl
end
# For Net::HTTP parity
alias key= private_key=
##
# Sets the proxy server. The +proxy+ may be the Bundler::URI of the proxy server,
# the symbol +:ENV+ which will read the proxy from the environment or nil to
# disable use of a proxy. See #proxy_from_env for details on setting the
# proxy from the environment.
#
# If the proxy Bundler::URI is set after requests have been made, the next request
# will shut-down and re-open all connections.
#
# The +no_proxy+ query parameter can be used to specify hosts which shouldn't
# be reached via proxy; if set it should be a comma separated list of
# hostname suffixes, optionally with +:port+ appended, for example
# example.com,some.host:8080.
def proxy= proxy
@proxy_uri = case proxy
when :ENV then proxy_from_env
when Bundler::URI::HTTP then proxy
when nil then # ignore
else raise ArgumentError, 'proxy must be :ENV or a Bundler::URI::HTTP'
end
@no_proxy.clear
if @proxy_uri then
@proxy_args = [
@proxy_uri.host,
@proxy_uri.port,
unescape(@proxy_uri.user),
unescape(@proxy_uri.password),
]
@proxy_connection_id = [nil, *@proxy_args].join ':'
if @proxy_uri.query then
@no_proxy = CGI.parse(@proxy_uri.query)['no_proxy'].join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? }
end
end
reconnect
reconnect_ssl
end
##
# Creates a Bundler::URI for an HTTP proxy server from ENV variables.
#
# If +HTTP_PROXY+ is set a proxy will be returned.
#
# If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Bundler::URI is given the
# indicated user and password unless HTTP_PROXY contains either of these in
# the Bundler::URI.
#
# The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
# be reached via proxy; if set it should be a comma separated list of
# hostname suffixes, optionally with +:port+ appended, for example
# example.com,some.host:8080. When set to * no proxy will
# be returned.
#
# For Windows users, lowercase ENV variables are preferred over uppercase ENV
# variables.
def proxy_from_env
env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
return nil if env_proxy.nil? or env_proxy.empty?
uri = Bundler::URI normalize_uri env_proxy
env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
# '*' is special case for always bypass
return nil if env_no_proxy == '*'
if env_no_proxy then
uri.query = "no_proxy=#{escape(env_no_proxy)}"
end
unless uri.user or uri.password then
uri.user = escape ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER']
uri.password = escape ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS']
end
uri
end
##
# Returns true when proxy should by bypassed for host.
def proxy_bypass? host, port
host = host.downcase
host_port = [host, port].join ':'
@no_proxy.each do |name|
return true if host[-name.length, name.length] == name or
host_port[-name.length, name.length] == name
end
false
end
##
# Forces reconnection of HTTP connections.
def reconnect
@generation += 1
end
##
# Forces reconnection of SSL connections.
def reconnect_ssl
@ssl_generation += 1
end
##
# Finishes then restarts the Net::HTTP +connection+
def reset connection
http = connection.http
finish connection
start http
rescue Errno::ECONNREFUSED
e = Error.new "connection refused: #{http.address}:#{http.port}"
e.set_backtrace $@
raise e
rescue Errno::EHOSTDOWN
e = Error.new "host down: #{http.address}:#{http.port}"
e.set_backtrace $@
raise e
end
##
# Makes a request on +uri+. If +req+ is nil a Net::HTTP::Get is performed
# against +uri+.
#
# If a block is passed #request behaves like Net::HTTP#request (the body of
# the response will not have been read).
#
# +req+ must be a Net::HTTPGenericRequest subclass (see Net::HTTP for a list).
#
# If there is an error and the request is idempotent according to RFC 2616
# it will be retried automatically.
def request uri, req = nil, &block
retried = false
bad_response = false
uri = Bundler::URI uri
req = request_setup req || uri
response = nil
connection_for uri do |connection|
http = connection.http
begin
connection.requests += 1
response = http.request req, &block
if req.connection_close? or
(response.http_version <= '1.0' and
not response.connection_keep_alive?) or
response.connection_close? then
finish connection
end
rescue Net::HTTPBadResponse => e
message = error_message connection
finish connection
raise Error, "too many bad responses #{message}" if
bad_response or not can_retry? req
bad_response = true
retry
rescue *RETRIED_EXCEPTIONS => e
request_failed e, req, connection if
retried or not can_retry? req
reset connection
retried = true
retry
rescue Errno::EINVAL, Errno::ETIMEDOUT => e # not retried on ruby 2
request_failed e, req, connection if retried or not can_retry? req
reset connection
retried = true
retry
rescue Exception => e
finish connection
raise
ensure
connection.last_use = Time.now
end
end
@http_versions["#{uri.host}:#{uri.port}"] ||= response.http_version
response
end
##
# Raises an Error for +exception+ which resulted from attempting the request
# +req+ on the +connection+.
#
# Finishes the +connection+.
def request_failed exception, req, connection # :nodoc:
due_to = "(due to #{exception.message} - #{exception.class})"
message = "too many connection resets #{due_to} #{error_message connection}"
finish connection
raise Error, message, exception.backtrace
end
##
# Creates a GET request if +req_or_uri+ is a Bundler::URI and adds headers to the
# request.
#
# Returns the request.
def request_setup req_or_uri # :nodoc:
req = if Bundler::URI === req_or_uri then
Net::HTTP::Get.new req_or_uri.request_uri
else
req_or_uri
end
@headers.each do |pair|
req.add_field(*pair)
end
@override_headers.each do |name, value|
req[name] = value
end
unless req['Connection'] then
req.add_field 'Connection', 'keep-alive'
req.add_field 'Keep-Alive', @keep_alive
end
req
end
##
# Shuts down all connections
#
# *NOTE*: Calling shutdown for can be dangerous!
#
# If any thread is still using a connection it may cause an error! Call
# #shutdown when you are completely done making requests!
def shutdown
@pool.shutdown { |http| http.finish }
end
##
# Enables SSL on +connection+
def ssl connection
connection.use_ssl = true
connection.ciphers = @ciphers if @ciphers
connection.ssl_timeout = @ssl_timeout if @ssl_timeout
connection.ssl_version = @ssl_version if @ssl_version
connection.min_version = @min_version if @min_version
connection.max_version = @max_version if @max_version
connection.verify_depth = @verify_depth
connection.verify_mode = @verify_mode
if OpenSSL::SSL::VERIFY_PEER == OpenSSL::SSL::VERIFY_NONE and
not Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then
warn <<-WARNING
!!!SECURITY WARNING!!!
The SSL HTTP connection to:
#{connection.address}:#{connection.port}
!!!MAY NOT BE VERIFIED!!!
On your platform your OpenSSL implementation is broken.
There is no difference between the values of VERIFY_NONE and VERIFY_PEER.
This means that attempting to verify the security of SSL connections may not
work. This exposes you to man-in-the-middle exploits, snooping on the
contents of your connection and other dangers to the security of your data.
To disable this warning define the following constant at top-level in your
application:
I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG = nil
WARNING
end
connection.ca_file = @ca_file if @ca_file
connection.ca_path = @ca_path if @ca_path
if @ca_file or @ca_path then
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
connection.verify_callback = @verify_callback if @verify_callback
end
if @certificate and @private_key then
connection.cert = @certificate
connection.key = @private_key
end
connection.cert_store = if @cert_store then
@cert_store
else
store = OpenSSL::X509::Store.new
store.set_default_paths
store
end
end
##
# SSL session lifetime
def ssl_timeout= ssl_timeout
@ssl_timeout = ssl_timeout
reconnect_ssl
end
##
# SSL version to use
def ssl_version= ssl_version
@ssl_version = ssl_version
reconnect_ssl
end
##
# Minimum SSL version to use
def min_version= min_version
@min_version = min_version
reconnect_ssl
end
##
# maximum SSL version to use
def max_version= max_version
@max_version = max_version
reconnect_ssl
end
##
# Sets the depth of SSL certificate verification
def verify_depth= verify_depth
@verify_depth = verify_depth
reconnect_ssl
end
##
# Sets the HTTPS verify mode. Defaults to OpenSSL::SSL::VERIFY_PEER.
#
# Setting this to VERIFY_NONE is a VERY BAD IDEA and should NEVER be used.
# Securely transfer the correct certificate and update the default
# certificate store or set the ca file instead.
def verify_mode= verify_mode
@verify_mode = verify_mode
reconnect_ssl
end
##
# SSL verification callback.
def verify_callback= callback
@verify_callback = callback
reconnect_ssl
end
end
require_relative 'persistent/connection'
require_relative 'persistent/pool'
bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ 0000755 0000041 0000041 00000000000 13606335352 027361 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb 0000644 0000041 0000041 00000001310 13606335352 032040 0 ustar www-data www-data ##
# A Net::HTTP connection wrapper that holds extra information for managing the
# connection's lifetime.
class Bundler::Persistent::Net::HTTP::Persistent::Connection # :nodoc:
attr_accessor :http
attr_accessor :last_use
attr_accessor :requests
attr_accessor :ssl_generation
def initialize http_class, http_args, ssl_generation
@http = http_class.new(*http_args)
@ssl_generation = ssl_generation
reset
end
def finish
@http.finish
rescue IOError
ensure
reset
end
def reset
@last_use = Bundler::Persistent::Net::HTTP::Persistent::EPOCH
@requests = 0
end
def ressl ssl_generation
@ssl_generation = ssl_generation
finish
end
end
bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb 0000644 0000041 0000041 00000003146 13606335352 033413 0 ustar www-data www-data class Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti < Bundler::ConnectionPool::TimedStack # :nodoc:
##
# Returns a new hash that has arrays for keys
#
# Using a class method to limit the bindings referenced by the hash's
# default_proc
def self.hash_of_arrays # :nodoc:
Hash.new { |h,k| h[k] = [] }
end
def initialize(size = 0, &block)
super
@enqueued = 0
@ques = self.class.hash_of_arrays
@lru = {}
@key = :"connection_args-#{object_id}"
end
def empty?
(@created - @enqueued) >= @max
end
def length
@max - @created + @enqueued
end
private
def connection_stored? options = {} # :nodoc:
!@ques[options[:connection_args]].empty?
end
def fetch_connection options = {} # :nodoc:
connection_args = options[:connection_args]
@enqueued -= 1
lru_update connection_args
@ques[connection_args].pop
end
def lru_update connection_args # :nodoc:
@lru.delete connection_args
@lru[connection_args] = true
end
def shutdown_connections # :nodoc:
@ques.each_key do |key|
super connection_args: key
end
end
def store_connection obj, options = {} # :nodoc:
@ques[options[:connection_args]].push obj
@enqueued += 1
end
def try_create options = {} # :nodoc:
connection_args = options[:connection_args]
if @created >= @max && @enqueued >= 1
oldest, = @lru.first
@lru.delete oldest
@ques[oldest].pop
@created -= 1
end
if @created < @max
@created += 1
lru_update connection_args
return @create_block.call(connection_args)
end
end
end
bundler-2.1.4/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb 0000644 0000041 0000041 00000002205 13606335352 030656 0 ustar www-data www-data class Bundler::Persistent::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool # :nodoc:
attr_reader :available # :nodoc:
attr_reader :key # :nodoc:
def initialize(options = {}, &block)
super
@available = Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti.new(@size, &block)
@key = "current-#{@available.object_id}"
end
def checkin net_http_args
stack = Thread.current[@key][net_http_args] ||= []
raise Bundler::ConnectionPool::Error, 'no connections are checked out' if
stack.empty?
conn = stack.pop
if stack.empty?
@available.push conn, connection_args: net_http_args
Thread.current[@key].delete(net_http_args)
Thread.current[@key] = nil if Thread.current[@key].empty?
end
nil
end
def checkout net_http_args
stacks = Thread.current[@key] ||= {}
stack = stacks[net_http_args] ||= []
if stack.empty? then
conn = @available.pop connection_args: net_http_args
else
conn = stack.last
end
stack.push conn
conn
end
def shutdown
Thread.current[@key] = nil
super
end
end
require_relative 'timed_stack_multi'
bundler-2.1.4/lib/bundler/vendor/thor/ 0000755 0000041 0000041 00000000000 13606335352 017661 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/thor/lib/ 0000755 0000041 0000041 00000000000 13606335352 020427 5 ustar www-data www-data bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb 0000644 0000041 0000041 00000040567 13606335352 021744 0 ustar www-data www-data require "set"
require_relative "thor/base"
class Bundler::Thor
class << self
# Allows for custom "Command" package naming.
#
# === Parameters
# name
# options
#
def package_name(name, _ = {})
@package_name = name.nil? || name == "" ? nil : name
end
# Sets the default command when thor is executed without an explicit command to be called.
#
# ==== Parameters
# meth:: name of the default command
#
def default_command(meth = nil)
if meth
@default_command = meth == :none ? "help" : meth.to_s
else
@default_command ||= from_superclass(:default_command, "help")
end
end
alias_method :default_task, :default_command
# Registers another Bundler::Thor subclass as a command.
#
# ==== Parameters
# klass:: Bundler::Thor subclass to register
# command:: Subcommand name to use
# usage:: Short usage for the subcommand
# description:: Description for the subcommand
def register(klass, subcommand_name, usage, description, options = {})
if klass <= Bundler::Thor::Group
desc usage, description, options
define_method(subcommand_name) { |*args| invoke(klass, args) }
else
desc usage, description, options
subcommand subcommand_name, klass
end
end
# Defines the usage and the description of the next command.
#
# ==== Parameters
# usage
# description