Ruby on Rails - Doesn't Create Script/Server

Ruby on Rails - Doesn't create script/server

If you've done gem install rails then it will have grabbed v3.0.6 rails which changed (at v3) to use rails server to start the server.

rails script/server doesn't start the server

Prior to Rails 3, the job of the rails script was simply to create a new RoR app, which is all you're doing: Creating a new Rails app in the script/server directory.

You want to run ruby script/server to invoke the server script with the Ruby interpreter.

In Rails 3, the rails script is also responsible for invoking other scripts within your app: ruby script/server has become rails server, ruby script/generate has become rails generate and so on.

Ruby on Rails. There is no script folder in the project

nowadays it is used rails instead of ruby script/, so try rails server or rails generate scaffold

RoR Question: Where's script/server?

If you're running Rails 3, it's now:

./script/rails server

All of the separate rails scripts in the scripts directory run through the single ./script/rails dispatcher now. This works for the console and other things you may be looking for as well (ie: ./script/rails console).

script/rails was not found, when running rails server (Rails 4)?

Currently this is fixed on the master branch, and most likely the fix will be available in 5.X EAP during the next couple of weeks.

A quick workaround is:

You can copy "rails" script from "bin" to "script" folder as a workaround.
NOTE: if u don't have "script" folder under your project root then please create new folder and name it as "script"(For Rails 4). Then copy "rails" from "bin" folder to it.

Credit goes to community support(Dennis Ushako)

Reference: http://youtrack.jetbrains.com/issue/RUBY-13234

Why does Ruby script/generate return No such file or directory?

Rails 3 is your problem (or rather the cause of). Since rails 3 all of the "script/whatever" commands have been replaced with "rails whatever".

So now you want "rails generate ..." or "rails server" instead.

Be sure to watch version numbers or post dates when looking at tutorials :)
linkage:
Missing script/generate in Rails 3

Can't create a file via shell code in Rails app

Maybe you are not sending the right path to the script, asume you have script.rb inside lib:

%x( ruby #{Rails.root.join('lib', 'script.rb')} )

I think you need to send the full path, but I need more information to know the exact error.

ruby script/server not reading RAILS_ENV option

script/server doesn't use RAILS_ENV.

Try ruby script/server -e production

rails server on existing working application not starting

In Rails 3.x, this will occur when script/rails is missing. The file could accidentally have been deleted or it may have never been committed to source control if you've just cloned the project to another machine. You'll need to find or regenerate it.

Rails determines if it's actually "in" a Rails project by checking if script/rails exists. If it doesn't find that file, it assumes it's not a Rails project:
https://github.com/rails/rails/blob/v3.2.21/railties/lib/rails/script_rails_loader.rb#L21-L23

There is an option you can pass 'rails new' to ignore files that already exist:

rails new APPNAME -s

You could try running that over your existing project to replace any missing files.

See also:
http://guides.rubyonrails.org/v3.2.13/initialization.html



Related Topics



Leave a reply



Submit