原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://blackanger.blog.51cto.com/140924/355320
--转载请注明出处
Rails3里多了个Bundler工具。
它是一个Library管理工具,它提供了好的工具来管理你rails3项目依赖的gems。
$> bundle
这个命令会列出bundler提供给你的一些工具。
Tasks:
bundle check # Checks if the dependencies listed in Gemfile are satisfied by currently installed gems
bundle exec # Run the command in context of the bundle
bundle help [TASK] # Describe available tasks or one specific task
bundle init # Generates a Gemfile into the current working directory
bundle install # Install the current environment to the system
bundle lock # Locks the bundle to the current set of dependencies, including all child dependencies.
bundle pack # Packs all the gems to vendor/cache
bundle show # Shows all gems that are part of the bundle.
bundle unlock # Unlock the bundle. This allows gem versions to be changed
你只要在你的Gemfile文件里添加你项目所需的gems就可以了。
$> bundle pack
这个命令可以打包你的gems到vendor/cache目录下。然后你把项目给别的开发者,别人就可以使用:
$> bundle install
来安装项目依赖的gems了。
但是当你想把项目部署到生产环境的话,假如gems出现新版本,可能导致项目出现错误,这个时候,我们就需要锁定gem的版本。
$> bundle lock
这个命令会在rails的根目录下生成一个Gemfile.lock文件。类似于这样的:
---
dependencies:
- rails: = 3.0.0.beta
- sqlite3-ruby: ">= 0"
- pg: ">= 0"
specs:
- text-hyphen:
version: 1.0.0
- builder:
version: 2.1.2
- i18n:
version: 0.3.3
当你在Gemfile文件里增加了一个新的gem,比如“hpricot”你运行:
$> bundle check
You changed your Gemfile after locking. Please relock using `bundle unlock`
想修改Gemfile必须先解锁Gemfile文件:
$> bundle unlock
然后才能修改,修改完再锁定。
$> bundle install
这条命令会自动安装Gemfile里的所有gem。
然后我们再检测:
$>bundle check
The Gemfile's dependencies are satisfied
这就安全了。
然后我们可以打包了:
$> bundle pack
Copying .gem files into vendor/cache
...
打包完以后,锁定我们的gems:
$> bundle lock
这下你就可以安全部署你的app了。
gem的写法可以具体参照:http://github.com/carlhuda/bundler
Bundler官网:http://gembundler.com
本文出自 “{ :Alex Space => &..” 博客,请务必保留此出处http://blackanger.blog.51cto.com/140924/355320
分享到:
相关推荐
npm-rails, 通过像DSL这样的Bundler支持 Rails的NPM npm Rails 项目的NPM支持。 它允许你使用bundler像DSL和rake任务来包括npm包。 这个基于Browserify的gem,用于捆绑包和解析依赖关系。安装将此行添加到你的应用...
rails-assets, 在 Rails 中,资产管理的解决 Rails 资产 Bundler 到 Bower 代理本自述文件涉及项目的开发方面。 访问站点了解如何在你的应用程序中使用 Rails 资产。 插件开发设置git clone git@github.com:tenex/r
有了rbenv来管理多版本的ruby环境,我们还需要一个能管理多版本gem(比如rails)的工具,那就是bundler了,项目背景不细说了,需要了解的直接到官网http://bundler.io/,这里只讲一些实际使用经验。 安装 gem install ...
如果您使用的是Bundler,则可以将codemirror-rails添加到Gemfile中: gem 'codemirror-rails' 或手动安装codemirror-rails gem: gem install codemirror-rails Rails的CodeMirror> = 3.1 最新稳定的CodeMirror...
安装 gem install i18n_tools用法如果您在 Rails 中使用 bundler,请将以下内容添加到您的Gemfile : group :development do gem 'i18n_tools'end 如果您在 Rails 之外使用 bundler,请使用 gem 'i18n_tools' , :...
)Ruby Rails Bundler纱线SQL 入门 要启动并运行本地副本,请遵循以下简单的示例步骤: 打开您的终端 克隆此项目git clone https://github.com/bashforger/rails-capstone 转到项目文件夹cd rails-capstone 安装 ...
对于rails和bundler: gem install rails bundler 对于节点: brew install node或brew upgrade node 指示 在项目目录中,运行bundle install 运行npm install 运行rails db:setup (事先运行了postgres应用程序...
铁路探空仪在debian上安装rbenv,ruby,bundler和rails。 Usage: railsondeb <command> []Some useful railsondeb commands are: help Display this information version Display railsondeb version install ...
或者如果你使用 bundler 把它放在你的Gemfile gem 'rubocop-rails' , require : false 用法 您需要告诉 RuboCop 加载 Rails 扩展。 有三种方法可以做到这一点: RuboCop 配置文件 把它放到你的.rubocop.yml 。 ...
readers should already be familiar with a few important Rails components such as bundler, migrations, models, views, and controllers. Basic knowledge of relational databases such as Ruby, HTML, and ...
Ruby,Rails,Bundler ( ftw!) 吉特 其他插件使用了一些核心内容。 为了使它们起作用,您需要安装以下软件包: 卷曲,xclip for Ack for 铛的 为了满足要求,运行(仅Ubuntu): sudo apt-get install ...
themes_on_rails, 向 Rails 3/4/5 应用程序添加多个主题支持 ThemesOnRails 安装安装最简单的方法是使用 Bundler 。将这里 gem 添加到你的Gemfile:gem 'themes_on_rails'如果要对 liquid 模板使用
使用Ruby On Rails开发时经常需要Bundle Install 但有些环境网络太慢或无法连接外网的时候就需要离线Bundle 该压缩包包括52个gem 其中有sqlite3,tzinfo-data等等
使用bundler bundler install安装依赖项。 使用此命令重命名项目rails g rename:into New-Name 创建数据库并迁移rails db:create db:migrate 与主密钥文件EDITOR="nano" rails credentials:edit一起创建凭证文件...
使用一个 rc.d 脚本运行多个 rails 应用程序 rails 应用程序使用bundle exec unicorn运行 #快速设置 将unicorn文件复制到/usr/local/etc/rc.d并使用chmod a+x unicorn将其标记为可执行文件。 编辑你的rc.conf 。 ...
suitor 是一个 Rails 应用程序(使用 Rails 4.1 构建,主要在 OS X 上使用 Ruby 2.1 开发),因此您需要安装 。 之后,运行: gem install bundler rails 安装 bundler 和 rails。 之后,检查suitor并安装它的依赖...
果汁冰糕 一组使与Ruby on Rails无缝配合的工具。 该gem添加了一些Rake任务,以为Rails生成的动态方法生成Ruby接口(RBI)文件。... 将sorbet-rails添加到您的Gemfile中,然后使用Bundler安装它们。 # -- Gemfile --
Bundler installation完成后,运行rails webpacker:install来安装应用程序的Javascript环境。 最后,请记住使用rails db:create db:migrate命令创建和迁移应用程序的数据库。 最后,运行rails serv
使用以下命令检查本地计算机上是否安装了rbenv,node,yarn,bundler,ruby,rails rbenv --version node --version yarn --version bundler --version ruby --version rails --version 在本地计算机上安装rbenv,...