耗时4小时终于把第一个demo给运行起来了。下载 railsinstaller-2.1.0 (1).exe,
然后就是安装。
我在bundle install 遇到下面的错误。
这个时候只需要安装turn,然后看到提示表示安装成功。如果提示连接不上,可能需要通过VPN的方式了
来安装本地的gem包
- rails new demo --skip-bundle //可以避免bundle install去验证是否有最新的更新,节约bundle install 的时间
- cd demo
- bundle install --local //使用本地的
- rails server
我在bundle install 遇到下面的错误。
- Could not find gem 'turn (>= 0) x86-mingw32' in any of the gem sources listed in
- your Gemfile.
这个时候只需要安装turn,然后看到提示表示安装成功。如果提示连接不上,可能需要通过VPN的方式了
- bundle install turn
- C:\demo>bundle install turn
- Fetching source index for http://rubygems.org/
- Installing rake (0.9.2.2)
- Installing multi_json (1.0.4)
- Installing activesupport (3.1.1)
- Installing builder (3.0.0)
- Installing i18n (0.6.0)
- Installing activemodel (3.1.1)
- Installing erubis (2.7.0)
- Installing rack (1.3.6)
- Installing rack-cache (1.1)
- Installing rack-mount (0.8.3)
- Installing rack-test (0.6.1)
- Installing hike (1.2.1)
- Installing tilt (1.3.3)
- Installing sprockets (2.0.3)
- Installing actionpack (3.1.1)
- Installing mime-types (1.17.2)
- Installing polyglot (0.3.3)
- Installing treetop (1.4.10)
- Installing mail (2.3.0)
- Installing actionmailer (3.1.1)
- Installing arel (2.2.1)
- Installing tzinfo (0.3.31)
- Installing activerecord (3.1.1)
- Installing activeresource (3.1.1)
- Installing ansi (1.4.2)
- Using bundler (1.0.21)
- Installing coffee-script-source (1.2.0)
- Installing execjs (1.3.0)
- Installing coffee-script (2.2.0)
- Installing rack-ssl (1.3.2)
- Installing json (1.6.5) with native extensions
- Installing rdoc (3.12)
- Installing thor (0.14.6)
- Installing railties (3.1.1)
- Installing coffee-rails (3.1.1)
- Installing jquery-rails (1.0.19)
- Installing rails (3.1.1)
- Installing sass (3.1.15)
- Installing sass-rails (3.1.5)
- Installing sqlite3 (1.3.5)
- Installing turn (0.9.2)
- Installing uglifier (1.2.3)
- Your bundle is complete! It was installed into ./turn
- The path argument to `bundle install` is deprecated. It will be removed in versi
- on 1.1. Please use `bundle install --path turn` instead.
- C:\demo>bundle install --local
- Using rake (0.9.2.2)
- Using multi_json (1.0.4)
- Using activesupport (3.1.1)
- Using builder (3.0.0)
- Using i18n (0.6.0)
- Using activemodel (3.1.1)
- Using erubis (2.7.0)
- Using rack (1.3.6)
- Using rack-cache (1.1)
- Using rack-mount (0.8.3)
- Using rack-test (0.6.1)
- Using hike (1.2.1)
- Using tilt (1.3.3)
- Using sprockets (2.0.3)
- Using actionpack (3.1.1)
- Using mime-types (1.17.2)
- Using polyglot (0.3.3)
- Using treetop (1.4.10)
- Using mail (2.3.0)
- Using actionmailer (3.1.1)
- Using arel (2.2.1)
- Using tzinfo (0.3.31)
- Using activerecord (3.1.1)
- Using activeresource (3.1.1)
- Using ansi (1.4.2)
- Using bundler (1.0.21)
- Using coffee-script-source (1.2.0)
- Using execjs (1.3.0)
- Using coffee-script (2.2.0)
- Using rack-ssl (1.3.2)
- Using json (1.6.5)
- Using rdoc (3.12)
- Using thor (0.14.6)
- Using railties (3.1.1)
- Using coffee-rails (3.1.1)
- Using jquery-rails (1.0.19)
- Using rails (3.1.1)
- Using sass (3.1.15)
- Using sass-rails (3.1.5)
- Using sqlite3 (1.3.5)
- Using turn (0.9.2)
- Using uglifier (1.2.3)
- Your bundle is complete! It was installed into ./turn
- C:\demo>rails server
- => Booting WEBrick
- => Rails 3.1.1 application starting in development on http://0.0.0.0:3000
- => Call with -d to detach
- => Ctrl-C to shutdown server
- [2012-02-16 13:39:38] INFO WEBrick 1.3.1
- [2012-02-16 13:39:38] INFO ruby 1.9.2 (2011-07-09) [i386-mingw32]
- [2012-02-16 13:39:38] INFO WEBrick::HTTPServer#start: pid=6364 port=3000
1. 设置源地址 ,就在工程目录下的Gemfile中,内网,还是用http://rubygems.org吧
2. 代理 set http_proxy=http://*.*.com.cn:80 或命令后加-p
而rails开发经常需要 更新和 安装新的gem包。怎么进行gem包的离线安装和更新?
用下面的命令来打包。
bundle package --all
相关 网站介绍 http://bundler.io/bundle_package.html
使用案例:
进入rails 项目,使用 bundle package --all 命令。将会把所有使用到得 gem 包 放入
vendor/cache
目录下。
然后复制到生产机环境。
在生产机环境下用
bundle install --local # 本地安装gem
#或者
gem install vendor/cache/*
#或者再限制一下
gem install vendor/cache/*.gem
InstantRails