Bundle Install Command

Source: Internet
Author: User
Tags require shebang

Bundle Introduction:

The bundle is introduced in Rails 3 to manage all gem dependencies in the project, which can only be executed in a directory containing gemfile, such as the root of a rails 3 project.


About Gemfile and Gemfile.lock

The trust packs for all Ruby projects are configured in Gemfile and are no longer found by require as they were before. In Rails 3, if you need to require a gem package, you must manage it by modifying the Gemfile file.

Gemfile.lock is used to record all the currently dependent Ruby gems and their versions of the machine. It is strongly recommended that you put this file in the version controller to ensure that you work in the same environment.


The bundle command is detailed:


# Show All dependent packages
$ bundle Show


# Displays the installation location of the specified gem package
$ bundle Show [Gemname]


# Check the system for gems packages that have been missing from those projects
# Note: If the package exists for all items in the system, it will be output: The Gemfile's dependencies is satisfied
$ bundle Check


# all Gem packages that the installation project relies on
# Note: This command will attempt to update a gem package that already exists on the system
$ bundle Install


# Install the specified gem package
$ bundle Install [Gemname]


# Update the project dependency package that exists in the system and update the project Gemfile.lock file at the same time
$ bundle Update


# Update the GEM package information specified in the system and update the package information specified in Project Gemfile.lock
$ bundle Update [Gemname]

# Add a new gem package reference to your project
$ gem [gemname], [ver]


# You can also specify package dependencies
$ gem [gemname],: require = [Dependence_gemname]


# You can even specify the git source for the gem package
$ gem [gemname],: git = [Git_source_url]


# Lock the current environment
# You can use bundle lock to lock the current environment so that the version of the dependent package cannot be updated with the bundle update, ensuring a unified environment
$ bundle Lock


# Unlock Lock
$ bundle Unlock


# Packaging Environment
The bundle package will place all the currently trusted packages in the./vendor/cache/directory, which can be used to guarantee package version consistency when published.
$ bundle Package


Make sure all dependencies in your gemfile is available to your application.

$ bundle Install [--binstubs=path] [--clean] [--deployment] [--frozen]
                 [--full-index] [--gemfile=file] [--local] [- -no-cache] [
                 --no-prune] [--path=path] [--quiet] [--shebang=string]
                 [--standalone=array] [--system] [-- Without=group GROUP]
                 [--trust-policy=securitylevel]

Options:

--binstubs:generate bin stubs for bundled gems to./bin

--clean:run Bundle clean automatically after install

--deployment:install using defaults tuned for deployment environments

--frozen:do not allow the Gemfile.lock to is updated after this install

--full-index:use the RubyGems modern index instead of the API endpoint

--gemfile:use the specified gemfile instead of Gemfile

--jobs:install Gems using parallel workers.

--local:do not attempt to fetch gems remotely and use the GEM cache instead

--no-cache:don ' t update the existing gem cache.

--no-prune:don ' t remove stale gems from the cache.

--path:specify a different path than the system default ($BUNDLE _path or $GEM _home). Bundler would remember this value for the future installs on the

--quiet:only output warnings and errors.

--retry:retry Network and GIT requests that has failed.

--shebang:specify a different shebang executable name than the default (usually ' Ruby ')

--standalone:make a bundle that can work without the Bundler runtime

--system:install to the system location ($BUNDLE _path or $GEM _home) even if the BUNDLE is previously installed somewhere else for this application

--trust-policy:sets level of security when dealing with signed gems. Accepts ' lowsecurity ', ' mediumsecurity ' and ' highsecurity ' as values.

--without:exclude gems that is part of the specified named group.

Gems is installed to your the default system location for Gems. If your system gems is stored in a root-owned location (such as in Mac OSX), bundle would ask for your root password Stall them there.

While installing Gems, bundler would check Vendor/cache and then your system ' s gems. If a gem isn ' t cached or installed, Bundler would try to install it from the sources you had declared in your gemfile.

The--system option is the default. Pass it to switch back after using the--path option as described below. Install your dependencies, even gems that is already installed to your system gems, to a location other than your system ' S gem Repository. In the case, install the them to Vendor/bundle.

$ bundle Install--path Vendor/bundle
Further bundle commands or calls to Bundler.setup or Bundler.require would remember this location. Learn More:Bundler.setup Learn More:Bundler.require Install all dependencies except those in groups that is explicitly Excluded.
$ bundle Install--without development test
Learn more:groups Install all dependencies on to a production server. Do notUse the this flag on a development machine.
$ bundle Install--deployment

The--deployment flag activates a number of deployment-friendly conventions:isolate all gems into Vendor/bundle Require a N Up-to-date gemfile.lock If bundle package is run, do not fetch gems from rubygems.org. Instead, only with gems in the checked in Vendor/cache learn more:deploying Install gems parallely by starting the number of workers specificed.

$ bundle Install--jobs 4
Retry failed network or GIT requests.
$ bundle Install--retry 3





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.