Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RoR 'new' command hangs

I am just starting ruby on rails. In terminal, I entered "rails new TestApp", and this is what happens at terminal:

  create  
  create  README
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/images/rails.png
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/mailers
  create  app/models
  create  app/views/layouts/application.html.erb
  create  app/mailers/.gitkeep
  create  app/models/.gitkeep
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  doc
  create  doc/README_FOR_APP
  create  lib
  create  lib/tasks
  create  lib/tasks/.gitkeep
  create  lib/assets
  create  lib/assets/.gitkeep
  create  log
  create  log/.gitkeep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/index.html
  create  public/robots.txt
  create  script
  create  script/rails
  create  test/fixtures
  create  test/fixtures/.gitkeep
  create  test/functional
  create  test/functional/.gitkeep
  create  test/integration
  create  test/integration/.gitkeep
  create  test/unit
  create  test/unit/.gitkeep
  create  test/performance/browsing_test.rb
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.gitkeep
  create  vendor/plugins
  create  vendor/plugins/.gitkeep
     run  bundle install

And it hangs there. Should I just exit it and continue with the app? Why doesn't it give me back the control to terminal? Thanks.

UPDATE: it asked me for my password and installed some gems. But it does that every time i create a new rails project. is this normal? Thanks.

like image 230
0xSina Avatar asked Nov 11 '11 05:11

0xSina


3 Answers

The system is "hanging" because it is installing all the gems, via bundle install in the Gemfile that rails new <project> generates. This is the intended behavior. It asks for your password so that it may install some files that it will need sudo access to write (most likely placing the rail executable in your path).

You can skip the bundle install step when calling rails new by passing it the --skip-bundle argument. You will still have to call bundle install before you can run your application, but at least you can control when it happens.

It is useful to use the --skip-bundle when you know that you are going to change the Gemfile, so that you don't have to wait for bundler to install all the gems before running it again within a few minutes

like image 112
Dan McClain Avatar answered Nov 14 '22 00:11

Dan McClain


This is a fairly stale question, but for what it's worth this seems to now be fixed. If you update rails (gem update rails) it should fix the issue.

like image 29
cmwright Avatar answered Nov 14 '22 00:11

cmwright


As most of the comments mentioned its good to have rvm to control your gems. This hangup is most probably because of a permission issue,

You may try to install the gem in the normal way and see if it works

gem install <gem name>

and following is a basic write up on using rvm with gem sets (which I wrote some time back) (http://keepthingssimple.tumblr.com/post/11274588229/using-rvm-to-keep-things-simple)

like image 1
sameera207 Avatar answered Nov 13 '22 23:11

sameera207