安装使用railscasts(Rails3)


railscasts.com是著名的Rails视频播客网站,大概每周出一期节目。从2007年3月份至今已经出了270多集,作者Ryan Bates (rbates on Twitter and ryanb on GitHub)持之不懈的工作着实让人钦佩。我也是陆陆续续看过一些,今日再次光顾railscasts.com网站,发现已经改版,令人欣喜的是其About介绍页里也提供了源代码的链接,细看时发现已经升级到Rails3了,一时手痒决定安装测试下。下面是安装测试过程:

1、前提

RVM、Ruby1.9.2已经安装。由于我的虚拟机在早前就已经安装了Rails3的环境,此处也就略去了。需要的同学可搜索相关文章。

2、下载:使用git工具

代码仓库地址:https://github.com/ryanb/railscasts

$ cd projects

$ git clone https://github.com/ryanb/railscasts.git

3、安装

3.1 生成配置文件,执行"script/setup"。

3.2 安装项目依赖gem包:

首先安装bundler,然后使用bundler自动安装其它依赖包。

  1. Ubuntu@ip-10-48-111-136:~/projects/railscasts$ gem install bundler  
  2. Successfully installed bundler-1.0.15  
  3. 1 gem installed  
以下是完整的安装日志:
  1. ubuntu@ip-10-48-111-136:~/projects/railscasts$ bundle install  
  2. Fetching git://github.com/rails/exception_notification.git  
  3. remote: Counting objects: 303, done.  
  4. remote: Compressing objects: 100% (174/174), done.  
  5. remote: Total 303 (delta 140), reused 234 (delta 105)  
  6. Receiving objects: 100% (303/303), 38.75 KiB, done.  
  7. Resolving deltas: 100% (140/140), done.  
  8. Fetching git://github.com/ryanb/cancan.git  
  9. remote: Counting objects: 2527, done.  
  10. remote: Compressing objects: 100% (1120/1120), done.  
  11. remote: Total 2527 (delta 1707), reused 2177 (delta 1380)  
  12. Receiving objects: 100% (2527/2527), 323.91 KiB, done.  
  13. Resolving deltas: 100% (1707/1707), done.  
  14. Fetching git://github.com/jnicklas/capybara.git  
  15. remote: Counting objects: 6685, done.  
  16. remote: Compressing objects: 100% (2657/2657), done.  
  17. remote: Total 6685 (delta 4481), reused 6103 (delta 3984)  
  18. Receiving objects: 100% (6685/6685), 5.75 MiB | 2.56 MiB/s, done.  
  19. Resolving deltas: 100% (4481/4481), done.  
  20. Fetching source index for http://rubygems.org/  
  21. Using rake (0.8.7)  
  22. Installing aaronh-chronic (0.3.9)  
  23. Installing abstract (1.0.0)  
  24. Installing activesupport (3.0.7)  
  25. Installing builder (2.1.2)  
  26. Installing i18n (0.5.0)  
  27. Installing activemodel (3.0.7)  
  28. Installing erubis (2.6.6)  
  29. Installing rack (1.2.2)  
  30. Installing rack-mount (0.6.14)  
  31. Installing rack-test (0.5.7)  
  32. Installing tzinfo (0.3.27)  
  33. Installing actionpack (3.0.7)  
  34. Installing mime-types (1.16)  
  35. Installing polyglot (0.3.1)  
  36. Installing treetop (1.4.9)  
  37. Installing mail (2.2.19)  
  38. Installing actionmailer (3.0.7)  
  39. Installing arel (2.0.9)  
  40. Installing activerecord (3.0.7)  
  41. Installing activeresource (3.0.7)  
  42. Installing acts_as_list (0.1.2)  
  43. Installing addressable (2.2.5)  
  44. Installing ancestry (1.2.3)  
  45. Using bundler (1.0.15)  
  46. Using cancan (1.6.3) from git://github.com/ryanb/cancan.git (at 2.0)  
  47. Installing highline (1.6.1)  
  48. Installing net-ssh (2.1.4)  
  49. Installing net-scp (1.0.4)  
  50. Installing net-sftp (2.0.5)  
  51. Installing net-ssh-gateway (1.1.0)  
  52. Installing capistrano (2.6.0)  
  53. Installing nokogiri (1.4.4) with native extensions  
  54. Installing ffi (1.0.7) with native extensions  
  55. Installing childprocess (0.1.8)  
  56. Installing json_pure (1.5.1)  
  57. Installing rubyzip (0.9.4)  
  58. Installing selenium-webdriver (0.1.4)  
  59. Installing xpath (0.1.3)  
  60. Using capybara (0.4.1.1) from git://github.com/jnicklas/capybara.git (at master)  
  61. Installing coderay (0.9.5)  
  62. Installing configuration (1.2.0)  
  63. Installing daemons (1.1.2)  
  64. Installing database_cleaner (0.6.7)  
  65. Installing diff-lcs (1.1.2)  
  66. Installing eventmachine (0.12.10) with native extensions  
  67. Using exception_notification (1.0.0) from git://github.com/rails/exception_notification.git (at master)  
  68. Installing factory_girl (1.3.2)  
  69. Installing thor (0.14.6)  
  70. Installing railties (3.0.7)  
  71. Installing rails (3.0.7)  
  72. Installing factory_girl_rails (1.0)  
  73. Installing fakeweb (1.3.0)  
  74. Installing multipart-post (1.1.0)  
  75. Installing faraday (0.6.1)  
  76. Installing guard (0.3.4)  
  77. Installing guard-rspec (0.3.1)  
  78. Installing jquery-rails (0.2.5)  
  79. Installing launchy (0.4.0)  
  80. Installing multi_json (0.0.5)  
  81. Installing mysql2 (0.2.6) with native extensions  
  82. Installing net-ldap (0.1.1)  
  83. Installing nifty-generators (0.4.2)  
  84. Installing oa-core (0.2.2)  
  85. Installing rest-client (1.6.1)  
  86. Installing oa-basic (0.2.2)  
  87. Installing pyu-ruby-sasl (0.0.3.2)  
  88. Installing rubyntlm (0.1.1)  
  89. Installing oa-enterprise (0.2.2)  
  90. Installing oa-more (0.2.2)  
  91. Installing oauth (0.4.4)  
  92. Installing oauth2 (0.3.0)  
  93. Installing oa-oauth (0.2.2)  
  94. Installing ruby-openid (2.1.8)  
  95. Installing rack-openid (1.2.0)  
  96. Installing ruby-openid-apps-discovery (1.2.0)  
  97. Installing oa-openid (0.2.2)  
  98. Installing omniauth (0.2.2)  
  99. Installing paper_trail (2.2.5)  
  100. Installing redcarpet (1.17.2) with native extensions  
  101. Installing riddle (1.2.1)  
  102. Installing rspec-core (2.6.3)  
  103. Installing rspec-expectations (2.6.0)  
  104. Installing rspec-mocks (2.6.0)  
  105. Installing rspec (2.6.0)  
  106. Installing rspec-rails (2.6.1)  
  107. Installing simplecov-html (0.4.4)  
  108. Installing simplecov (0.4.2)  
  109. Installing thin (1.2.11) with native extensions  
  110. Installing thinking-sphinx (2.0.1)  
  111. Installing whenever (0.6.2)  
  112. Installing will_paginate (3.0.pre2)  
  113. Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.  

4、配置

主要是修改config/database.yml文件中的数据库用户名与口令。

5、运行

独立测试运行:rails s,然后通过浏览器访问:http://<IP>:3000。正式使用时可在Apache2或nginx下通过passenger来部署运行。

相关内容