手机版
你好,游客 登录 注册
背景:
阅读新闻

Ruby on Rails,环境安装和Gems

[日期:2012-09-09] 来源:Linux社区  作者:ABBuggy [字体:大 中 小]

使用Rails的过程中你经常需要RubyGems(gem)工具来管理以及升级依赖的库(RubyGem)。RubyGem,就是一个个用Ruby语言编写的程序软件包,Rails就是一个最著名的RubyGem。RubyGems是标准的Ruby包管理器,它的功能类似于Linux下的apt-get。

我们来使用gem查看一下RailsInstaller已经安装好的gem包:

  1. E:\greensoft\RailsInstaller>gem list  
  2.   
  3. *** LOCAL GEMS ***  
  4.   
  5. actionmailer (3.2.1)  
  6. actionpack (3.2.1)  
  7. activemodel (3.2.1)  
  8. activerecord (3.2.1)  
  9. activerecord-sqlserver-adapter (3.2.1)  
  10. activeresource (3.2.1)  
  11. activesupport (3.2.1)  
  12. arel (3.0.2)  
  13. bigdecimal (1.1.0)  
  14. builder (3.0.0)  
  15. bundler (1.0.22)  
  16. coffee-rails (3.2.2)  
  17. coffee-script (2.2.0)  
  18. coffee-script-source (1.2.0)  
  19. erubis (2.7.0)  
  20. execjs (1.3.0)  
  21. hike (1.2.1)  
  22. i18n (0.6.0)  
  23. io-console (0.3)  
  24. journey (1.0.3, 1.0.2)  
  25. jquery-rails (2.0.1)  
  26. json (1.6.5, 1.5.4)  
  27. mail (2.4.4, 2.4.1)  
  28. mime-types (1.18, 1.17.2)  
  29. minitest (2.5.1)  
  30. multi_json (1.1.0)  
  31. mysql2 (0.3.11 x86-mingw32)  
  32. pg (0.13.1 x86-mingw32)  
  33. polyglot (0.3.3)  
  34. rack (1.4.1)  
  35. rack-cache (1.2, 1.1)  
  36. rack-ssl (1.3.2)  
  37. rack-test (0.6.1)  
  38. rails (3.2.1)  
  39. railties (3.2.1)  
  40. rake (0.9.2.2)  
  41. rb-readline (0.4.2)  
  42. rdoc (3.12, 3.9.4)  
  43. rubygems-update (1.8.19)  
  44. rubyzip (0.9.6.1)  
  45. sass (3.1.15)  
  46. sass-rails (3.2.5)  
  47. sprockets (2.1.2)  
  48. sqlite3 (1.3.5 x86-mingw32)  
  49. sqlite3-ruby (1.3.3)  
  50. thor (0.14.6)  
  51. tilt (1.3.3)  
  52. tiny_tds (0.5.1 x86-mingw32)  
  53. treetop (1.4.10)  
  54. tzinfo (0.3.32, 0.3.31)  
  55. uglifier (1.2.3)  

将gem工具升级到最新版本:

  1. E:\greensoft\RailsInstaller>gem update --system  
  2. Updating rubygems-update  
  3. Fetching: rubygems-update-1.8.21.gem (100%)  
  4. Successfully installed rubygems-update-1.8.21  
  5. Installing RubyGems 1.8.21  
  6. RubyGems 1.8.21 installed  
  7.   
  8. == 1.8.21 / 2012-03-22  
  9.   
  10. * 2 bug fixes:  
  11.   
  12.   * Add workaround for buggy yaml output from 1.9.2  
  13.   * Force 1.9.1 to remove it's prelude code. Fixes #305  
  14.   
  15.   
  16. ------------------------------------------------------------------------------  
  17.   
  18. RubyGems installed the following executables:  
  19.     E:/greensoft/RailsInstaller/Ruby1.9.3/bin/gem  
  20.   
  21. RubyGems system software updated  

使用gem安装gem包:gem会访问internet,获取你希望安装的gem以及这个gem所依赖的其他gems。

  1. E:\greensoft\RailsInstaller>gem install rake  
  2. Successfully installed rake-0.9.2.2  
  3. 1 gem installed  
  4. Installing ri documentation for rake-0.9.2.2...  
  5. 活动代码页: 936  
  6. Installing RDoc documentation for rake-0.9.2.2...  

有关查看gem工具使用的更多信息:

  1. E:\greensoft\RailsInstaller>gem --help  
  2. RubyGems is a sophisticated package manager for Ruby.  This is a  
  3. basic help message containing pointers to more information.  
  4.   
  5.   Usage:  
  6.     gem -h/--help  
  7.     gem -v/--version  
  8.     gem command [arguments...] [options...]  
  9.   
  10.   Examples:  
  11.     gem install rake  
  12.     gem list --local  
  13.     gem build package.gemspec  
  14.     gem help install  
  15.   
  16.   Further help:  
  17.     gem help commands            list all 'gem' commands  
  18.     gem help examples            show some examples of usage  
  19.     gem help platforms           show information about platforms  
  20.     gem help <COMMAND>           show help on COMMAND  
  21.                                    (e.g. 'gem help install')  
  22.     gem server                   present a web page at  
  23.                                  http://localhost:8808/  
  24.                                  with info about installed gems  
  25.   Further information:  
  26.     http://rubygems.rubyforge.org 
linux
相关资讯       Ruby  Ruby on Rails 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款