Bundler简介
来源:互联网 发布:男黑头知乎 编辑:程序博客网 时间:2024/06/16 06:46
最近接触一个ROR项目,在进入项目根目录安装依赖项的时候,简直就郁闷死了,一百多个依赖项,比如mail v2.3.3
虽然装了Rails v3.2.7,但是mail v.2.4.4的版本太高,不符合要求。
开始的时候我还手动的一个个的用gem安装,后来一边安装一边找了资料看看,原来完全不必这么麻烦。
使用bundler可以替我们解决这些烦恼。
进入到项目根目录,运行:
bundle intall
Bundler会根据gemfile自动的安装相关的依赖项。
安装bundle:
$ gem install bundler
Bundler manages an application's dependencies through its entire life across many machines systematically and repeatably.
Getting Started
$ gem install bundler
source "http://rubygems.org"gem "nokogiri"gem "rack", "~>1.1"gem "rspec", :require => "spec"Learn More: Gemfiles
$ bundle install$ git add Gemfile Gemfile.lockLearn More: bundle install
require "rubygems"require "bundler/setup"# require your gems as usualrequire "nokogiri"Learn More: Bundler.setup
$ bundle exec rspec spec/models
In some cases, running executables without bundle exec
may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.
However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
$ bundle install --binstubs$ bin/rspec spec/models
bin
are scoped to the bundle and will always workUsing Bundler with Rails
Checking Out an Application With a Gemfile for Development
$ bundle installLearn More: bundle install
Updating Your Dependencies
# changegem "nokogiri", "1.4.2"# togem "nokogiri", "1.4.3"
$ bundle install
After making a change to your Gemfile
, the next bundle install
will try to update the gems in your snapshot (Gemfile.lock
) without forcing an update to any of the other gems in your Gemfile.
This will usually work for simple dependencies, like nokogiri
or sqlite3
. On the other hand, updating Rails will usually require an update to some other component, because of the amount of dependencies it has.
Gemfile
)$ bundle update railsLearn More: bundle update
$ bundle update
Deploying Your Application
$ bundle install --deployment
--deployment
flag turns on defaults that are appropriate for a deployment environment. Gems are installed to vendor/bundle
and the Gemfile.lock
must be checked in and up to date before Bundler is run.Digging Further
$ bundle packageLearn More: bundle package
group :development do gem "wirble"endLearn more: Groups
.gemspec
at its root. Bundler will make the executables available to bundle exec
and compile C extensionsgem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"Learn more: Git
gem "nokogiri", :path => "~/Code/nokogiri"
$ bundle install --path vendor
- Bundler简介
- . Bundler简介
- Bundler
- Bundler
- Bundler 用户指南
- bundler使用
- Bundler.setup vs. Bundler.require
- 如何编译安装Bundler
- Bundler Photogrammetry Package
- Bundler学习总结
- 如何编译安装Bundler
- Bundler源码研读笔记
- Bundler工具 常用命令
- android bundler机制
- Windows安装Bundler
- [linux] Bundler 安装过程
- 如何编译安装Bundler
- bundler编译和配置
- PuTTY 中文教程
- Android TextView 多行时居中办法
- 嵌入式数据库sqlite
- 从底层逐层的开始打印出二叉树的节点数据
- Xilinx 网站资源导读
- Bundler简介
- Php中一些好用的函数(二)
- 详解Oracle创建用户权限全过程
- ColorMatrixFilter--颜色矩阵滤镜
- iOS应用审核的通关秘籍
- Android心得1.3--Android一些常见设置和错误处理
- sql server 日期函数
- 学习笔记:用于事件多路分离和分派的reactor体系结构模式
- [转]一个男人关心的东西决定了他的层次