rails项目本地运行
2015-10-13 21:17
435 查看
由于网上有很多搭建ruby 、rails的教程,因此不再重复纪录。这里默认rails搭建完成。环境为mac oxs10.10.5
1.首先获得rails项目代码,解压代码包,放入磁盘中
2.运行:bundle install。
命令行进入改项目代码文件根目录,运行该命令,此步骤是为了安装gem所需要的各种包。
此步骤我在安装的过程中遇到很多问题。
a.不断有包需要安装
Using rspec-expectations 3.3.1
Using rspec-mocks 3.3.2
Using rspec-rails 3.3.3
Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/sass-3.4.16.gem)
An error occurred while installing sass (3.4.16), and Bundler cannot continue.
Make sure that `gem install sass -v '3.4.16'` succeeds before bundling.
不断会提示需要安装新的包。我是依次按照提示一步步安装的。亲测总会安装完的,不过我花了很长时间。现在还不知道到底问题出在了哪儿,更好的解决方案,只想到了可以自己写shell脚本来一个个安装。但是还没有找到根本原因。如果知道的童鞋希望能给我解惑一下。
b.安装pg的时候失败
解决方案:执行:brew install Postgresql
3.完成bundle安装
成功执行了bundle后基本后面没什么问题了。
4.运行“rake db:migrate” 构建本地数据
5.运行"rake db:seed"生成实例
这里对应的数据库文件已经编写好了后执行的上述4,5命令
6.执行“rails server”开启rails服务器,默认开启端口3000
7.在浏览器中输入http://local:3000/app名称即可访问
1.首先获得rails项目代码,解压代码包,放入磁盘中
2.运行:bundle install。
命令行进入改项目代码文件根目录,运行该命令,此步骤是为了安装gem所需要的各种包。
此步骤我在安装的过程中遇到很多问题。
a.不断有包需要安装
Using rspec-expectations 3.3.1
Using rspec-mocks 3.3.2
Using rspec-rails 3.3.3
Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/sass-3.4.16.gem)
An error occurred while installing sass (3.4.16), and Bundler cannot continue.
Make sure that `gem install sass -v '3.4.16'` succeeds before bundling.
不断会提示需要安装新的包。我是依次按照提示一步步安装的。亲测总会安装完的,不过我花了很长时间。现在还不知道到底问题出在了哪儿,更好的解决方案,只想到了可以自己写shell脚本来一个个安装。但是还没有找到根本原因。如果知道的童鞋希望能给我解惑一下。
b.安装pg的时候失败
解决方案:执行:brew install Postgresql
3.完成bundle安装
成功执行了bundle后基本后面没什么问题了。
4.运行“rake db:migrate” 构建本地数据
5.运行"rake db:seed"生成实例
这里对应的数据库文件已经编写好了后执行的上述4,5命令
6.执行“rails server”开启rails服务器,默认开启端口3000
7.在浏览器中输入http://local:3000/app名称即可访问
相关文章推荐
- 红宝石(Ruby)史话
- 浅谈Rails 4 中Strong Parameters机制
- Ruby on Rails中的ActiveResource使用详解
- 关于Ruby on Rails视图编写的一些建议
- Ruby on Rails中的ActiveRecord编程指南
- 简单对比分析Ruby on Rails 和 Laravel
- 在 Ubuntu 12.04 Server 上安装部署 Ruby on Rails 应用
- Ruby on Rails下的图像处理入门教程
- 详解Ruby on Rails中的Cucumber使用
- rails创建应用程序实例
- 浅谈Ruby on Rails的国际化
- Rails Routes中new、collection、member的区别浅析
- web 应用中常用的各种 cache详解
- Ruby on Rails迁移时的一些注意事项
- win7安装ruby on rails开发环境
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- rails "No route matches" 错误的解决方法
- Rails link_to 详解
- Ruby rails 页面跳转(render和redirect_to)
- 快速正确的安装 Ruby, Rails 运行环境