Browse files

Changing command line API from 'rails blog' to 'rails new blog'.

Also removed the limitation of not being able to call your new server any of
the rails commands (generate, server, dbconsole, console etc) as there is
no longer any ambiguity here.

Signed-off-by: David Heinemeier Hansson <>
  • Loading branch information...
1 parent 517f709 commit 4774680405adcbf0d3f64abbc236c7653d137fa3 @mikel mikel committed with dhh Jun 3, 2010
@@ -38,6 +38,10 @@
when 'application', 'runner'
require "rails/commands/#{command}"
+when 'new'
+ puts "Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.\n"
+ puts "Type 'rails' for help."
when '--version', '-v'
ARGV.unshift '--version'
require 'rails/commands/application'
@@ -53,6 +57,8 @@
server Start the Rails server (short-cut alias: "s")
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
+ new Create a new Rails application. "rails new my_app" creates a
+ new application called MyApp in "./my_app"
In addition to those, there are:
application Generate the Rails application code
@@ -4,7 +4,12 @@
-ARGV << "--help" if ARGV.empty?
+if ARGV.first != "new" || ARGV.empty?
+ ARGV[0] = "--help"
+ ARGV.shift
require 'rubygems' if ARGV.include?("--dev")
require 'rails/generators'
@@ -1,9 +1,9 @@
- The 'rails' command creates a new Rails application with a default
+ The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
- rails ~/Code/Ruby/weblog
+ 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.
@@ -149,8 +149,7 @@ module Generators
# can change in Ruby 1.8.7 when we
RAILS_DEV_PATH = File.expand_path("../../../../../..", File.dirname(__FILE__))
- RESERVED_NAMES = %w[generate g console c server s dbconsole db
- application destroy benchmarker profiler
+ RESERVED_NAMES = %w[application destroy benchmarker profiler
plugin runner test]
class AppGenerator < Base

0 comments on commit 4774680

Please sign in to comment.