Reputation:
When I enter:
$ rails server
I get this returned for and rails commands entered:
Usage:
rails new APP_PATH [options]
Options:
[--edge] # Setup the application with Gemfile pointing to Rails repository
[--dev] # Setup the application with Gemfile pointing to your Rails checkout
-G, [--skip-git] # Skip Git ignores and keeps
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL)
-b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL)
[--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9
[--skip-gemfile] # Don't create a Gemfile
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
-O, [--skip-active-record] # Skip Active Record files
[--skip-bundle] # Don't run bundle install
-T, [--skip-test-unit] # Skip Test::Unit files
-S, [--skip-sprockets] # Skip Sprockets files
-j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
# Default: jquery
-J, [--skip-javascript] # Skip JavaScript files
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/bin/ruby1.8
Runtime options:
-s, [--skip] # Skip files that already exist
-f, [--force] # Overwrite files that already exist
-p, [--pretend] # Run but do not make any changes
-q, [--quiet] # Supress status output
Rails options:
-h, [--help] # Show this help message and quit
-v, [--version] # Show Rails version number and quit
Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
Example:
rails new ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
Why doesn't it initiate the server? To me this appears to be a rails helpDoc or some such. Similar also happens for:
$ rails generate
Is there anything i can do to get these commands to initiate properly...
I'm using Rails version 3.1.3, on Ubuntu.
BTW: I am entering these from within the directory of myapp i.e.
chuckles@.......:~/Blog/new$
I did get the server to start by running:
$ script/server
from /new/
Upvotes: 4
Views: 2383
Reputation: 1377
Check your bin directory in rails app root directory, I have removed that and It was causing problem for me. Create a bin directory and copy these files at least.
bundle rails rake
from any other rails project.
Upvotes: 0
Reputation: 1811
I had this issue. Turns out I created a gemset to use with my app, then when I switched to the app folder in terminal it reverted to the default gemset which didn't support my application.
You can check which gemset your using by doing
rvm gemset list
So inside of my app folder I switched to the appropriate gemset using.
rvm gemset use [your gemset name]
Then
bundle install
to update the gem files.
Everything worked fine afterwards.
Upvotes: 3
Reputation: 30995
If you have 'script/server', then you probably have rails 2.x application, instead of 3.x. Make sure (rails -v
) that you run rails 3.x.x gem, instead of 2.x.
EDIT:
I wasn't clear enough probably. From informations you provided I see:
script/server
script, and you can verify that your application is for older rails by looking at config/environment.rb
file)This combination won't work. You need to do something with it. If you need this old application, then you could uninstall rails 3.x gem and install 2.x verison. It would be even better if you could migrate this application to run with bundler (then you don't need to uninstall rails 3.x gem), but if it's not possible, you can take a look at rvm's gemsets.
What I do when I need to start old application:
rvm use ree
- if my application uses Ruby Enterprise Edition on server, otherwise rvm use [ruby version here]
, depending which versionrvm gemset create [application name here]
- to make gemset specific for this applicationrvm alias create [application name here] ree@[gemset name here]
- to make sure I can get back to this gemset quickrvm use [alias name here]
- to switch to application ruby-gemset combinationThen whenever I go back to developing this application:
rvm use [alias name here]
./script/server
- to start applicationYou also need to look for tutorial and documentation for Rails 2.x if you want to develop with this version.
Upvotes: 2
Reputation: 10004
You can only run these commands from inside an existing rails project folder. Check out the bottom of the output where it gives you an example command to create the skeleton structure of a rails project.
Alternatively, run through this tutorial http://guides.rubyonrails.org/getting_started.html
Upvotes: 1
Reputation: 434
You need to be inside a rails project directory to run these commands. First, create a new project:
rails new myapp
then you can move into it and run the server or other commands.
cd myapp
rails server
Upvotes: 0