Before running the Rails Composer tool, you need to install:
你需要安装以下环境:
- The Ruby language (version 2.2)
- Rails (versions 4.2)
Check that appropriate versions of Ruby and Rails are installed in your development environment:
你可以通过以下指令,查看你当前环境是否满足:
$ ruby -v
$ rails -v
Be sure to read the article Installing Rails to make sure your development environment is set up properly.
你确定是否阅读了 安装 这篇文章,确保你的开发环境。
Currently, only Rails 4.2 is supported.
现在,只支持4.2+。
To build a Rails application using the Mindpin Rails Composer tool:
通过 Mindpin Rails Composer 创建Rails应用(-O选项为mongoid必须选项):
$ rails new myapp -O -m https://raw.github.com/destinyd/rails-composer-1/master/composer.rb
Replace myapp
with the name of your application.
将 myapp
替换成你的应用名称.
$
是命令行提示符; 不要一起执行.
In general, you’ll avoid problems if you create your application using RVM as described in the next section.
一般情况下,如果你使用RVM,不会遇见问题。
编辑~/.railsrc,添加如下代码并保存
-m https://raw.github.com/destinyd/rails-composer-1/master/composer.rb
以后用Rails创建新项目,都会根据最新的Mindpin Rails Composer模板创建项目。
Mindpin基本所有项目都使用weibo oauth2,来进行登录。需要修改生成项目的 config/application.yml
下的配置。
SINA_APP_KEY: 'test' SINA_APP_SERCET: 'test' SINA_REDIRECT_URI: 'http://localhost:3000/users/auth/weibo/callback'
SINA_APP_KEY、SINA_APP_SERCET在http://open.weibo.com 申请后获取
SINA_REDIRECT_URI: 为微博回调链接,用于weibo_2,将localhost:3000改为对应的网址即可。