安装Gem

2018-10-22 09:37 更新

安装Gem

每次你修改Gemfile,或者更具体地说,如果你的附属插件没有安装,调用安装命令来确保你的所有的Gemfile插件可以使用你Rails的应用。

1 $ bundle install
2 Fetching gem metadata from https://rubygems.org/.........
3 Fetching gem metadata from https://rubygems.org/..
4 Fetching git://github.com/rails/rails.git
5 Fetching git://github.com/rails/activerecord-deprecated_finders.git
6 Fetching git://github.com/rails/arel.git
7 Fetching git://github.com/rails/coffee-rails.git
8 Fetching git://github.com/rails/sprockets-rails.git
9 Fetching git://github.com/rails/sass-rails.git
10 Installing rake (10.0.3)
11 Installing i18n (0.6.1)
12 Installing minitest (4.5.0)
13 Installing multi_json (1.5.0)
14 Installing atomic (1.0.1)
15 Installing thread_safe (0.1.0)
16 Installing tzinfo (0.3.35)
17 Using activesupport (4.0.0.beta) from git://github.com/rails/rails.git
18 (at master)
19 Installing builder (3.1.4)
20 Installing erubis (2.7.0)
21 Installing rack (1.5.0)
22 Installing rack-test (0.6.2)
23 Using actionpack (4.0.0.beta) from git://github.com/rails/rails.git
24 (at master)
25 Installing mime-types (1.19)
26 Installing polyglot (0.3.3)
27 Installing treetop (1.4.12)
28 Installing mail (2.5.3)
29 Using actionmailer (4.0.0.beta) from git://github.com/rails/rails.git
30 (at master)
31 Using activemodel (4.0.0.beta) from git://github.com/rails/rails.git
32 (at master)
33 Using activerecord-deprecated_finders (0.0.3) from
34 git://github.com/rails/activerecord-deprecated_finders.git (at master)
35 Using arel (3.0.2.20120819075748) from git://github.com/rails/arel.git36 (at master)
37 Using activerecord (4.0.0.beta) from git://github.com/rails/rails.git
38 (at master)
39 Installing coffee-script-source (1.4.0)
40 Installing execjs (1.4.0)
41 Installing coffee-script (2.2.0)
42 Installing json (1.7.6)
43 Installing rdoc (3.12)
44 Installing thor (0.17.0)
45 Using railties (4.0.0.beta) from git://github.com/rails/rails.git
46 (at master)
47 Using coffee-rails (4.0.0.beta) from
48 git://github.com/rails/coffee-rails.git (at master)
49 Installing hike (1.2.1)
50 Installing jbuilder (1.0.2)
51 Installing jquery-rails (2.2.0)
52 Using bundler (1.3.0.pre.7)
53 Installing tilt (1.3.3)
54 Installing sprockets (2.8.2)
55 Using sprockets-rails (2.0.0.rc2) from
56 git://github.com/rails/sprockets-rails.git (at master)
57 Using rails (4.0.0.beta) from git://github.com/rails/rails.git
58 (at master)
59 Installing sass (3.2.5)
60 Using sass-rails (4.0.0.beta) from
61 git://github.com/rails/sass-rails.git (at master)
62 Installing sqlite3 (1.3.7)
63 Installing turbolinks (1.0.0)
64 Installing uglifier (1.3.0)
65 Your bundle is complete! Use `bundle show [gemname]` to see where a
66 bundled gem is installed.

安装命令更新所有依赖Gemfile的文件更新到最新版本,不与其他依赖关系的冲突。

您可以选择安装依赖关系,除非这些制定的组不需要依靠选项设置。

1 $ bundle install --without development test
2 $ bundle install --without test

锁定Gem

每次安装或更新,Bundler都会计算应用和存储的依赖关系 。在一个名为gemfile.lock的结果当中。Bundle只能加载特定版本的gems。你此刻用的Gemfile应该是锁着的,对应的版本才会很好地为应用而服务。

打包Gem

您可以在vendor/cache目录中打包所有的gems的应用程序。
1 $ bundle package

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号