aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/generators/rails/app/app_generator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/generators/rails/app/app_generator.rb')
-rw-r--r--railties/lib/generators/rails/app/app_generator.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb
index c439ed89f5..92e0d37436 100644
--- a/railties/lib/generators/rails/app/app_generator.rb
+++ b/railties/lib/generators/rails/app/app_generator.rb
@@ -7,6 +7,10 @@ module Rails::Generators
# can change in Ruby 1.8.7 when we FileUtils.cd.
RAILS_DEV_PATH = File.expand_path("../../../../..", File.dirname(__FILE__))
+ RESERVED_NAMES = %w[generate console server dbconsole
+ application destroy benchmarker profiler
+ plugin runner test]
+
class AppGenerator < Base
DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
@@ -134,8 +138,11 @@ module Rails::Generators
end
def create_prototype_files
- return if options[:skip_prototype]
- directory "public/javascripts"
+ unless options[:skip_prototype]
+ directory "public/javascripts"
+ else
+ empty_directory_with_gitkeep "public/javascripts"
+ end
end
def create_script_files
@@ -209,9 +216,10 @@ module Rails::Generators
end
def valid_app_const?
- case app_const
- when /^\d/
+ if app_const =~ /^\d/
raise Error, "Invalid application name #{app_name}. Please give a name which does not start with numbers."
+ elsif RESERVED_NAMES.include?(app_name)
+ raise Error, "Invalid application name #{app_name}. Please give a name which does not match one of the reserved rails words."
end
end