aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-06-03 23:47:44 +1000
committerMikel Lindsaar <raasdnil@gmail.com>2010-06-03 23:47:44 +1000
commit06892c34213659ed8734ac250ee5846273e277d6 (patch)
tree8d7f9d8348bdb286693af8e8212bf79637664163
parentab34b7bde1c981f8e65b80b82d7d34cf24ea2b83 (diff)
downloadrails-06892c34213659ed8734ac250ee5846273e277d6.tar.gz
rails-06892c34213659ed8734ac250ee5846273e277d6.tar.bz2
rails-06892c34213659ed8734ac250ee5846273e277d6.zip
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. http://rails.lighthouseapp.com/projects/8994/tickets/4665
-rw-r--r--railties/lib/rails/commands.rb6
-rw-r--r--railties/lib/rails/commands/application.rb7
-rw-r--r--railties/lib/rails/generators/rails/app/USAGE4
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb3
4 files changed, 15 insertions, 5 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index de93a87615..aad1170b56 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -38,6 +38,10 @@ when 'dbconsole'
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 @@ The most common rails commands are:
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
diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb
index 8a8143e00e..a3a5aed399 100644
--- a/railties/lib/rails/commands/application.rb
+++ b/railties/lib/rails/commands/application.rb
@@ -4,7 +4,12 @@ if %w(--version -v).include? ARGV.first
exit(0)
end
-ARGV << "--help" if ARGV.empty?
+if ARGV.first != "new" || ARGV.empty?
+ ARGV[0] = "--help"
+else
+ ARGV.shift
+end
+
require 'rubygems' if ARGV.include?("--dev")
require 'rails/generators'
diff --git a/railties/lib/rails/generators/rails/app/USAGE b/railties/lib/rails/generators/rails/app/USAGE
index 36d6061a59..9e7a78d132 100644
--- a/railties/lib/rails/generators/rails/app/USAGE
+++ b/railties/lib/rails/generators/rails/app/USAGE
@@ -1,9 +1,9 @@
Description:
- 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.
Example:
- 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.
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index cd4a3dce4e..fc971907df 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -149,8 +149,7 @@ module Rails
# can change in Ruby 1.8.7 when we FileUtils.cd.
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