使用 rbenv 所以创建一个新应用的过程有点复杂:
- 创建目录
- 光盘目录
- 设置 ruby 版本:(
rbenv local 1.9.3-p125
或其他版本) - 镶嵌宝石:
echo project-name > .rbenv-gemsets
gem install rails -v 3.2.2 --no-rdoc --no-ri
(例如)rbenv rehash
echo "gem 'rails', '3.2.2'" > Gemfile
bundle
rails new .
(输入 y 覆盖)bundle
这以前有效,但这次我在rails new .
命令上遇到错误:
...
...
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
b/gems/bundler-1.2.1/lib/bundler/resolver.rb:287:in `resolve': Could not find gem 'jquery-rails (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
第二次跑rails new .
会抛出
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
如果不可能,初始化新的 Rails 应用程序的最佳方法是什么rails new app-name
?
如何只创建 Gemfile?如果我有正确的 Rails Gemfile,那么bundle
应该rails new .
可以工作......