aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-28 21:01:10 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-28 21:01:10 +0000
commit8995483106c60c7b4d73fa20ca6a08d94efdea14 (patch)
treeab400cd7b0414964c2284be09b5012ee062d51e3 /railties
parenta974b9e3c29e879d2c9247122dce958a5972419c (diff)
downloadrails-8995483106c60c7b4d73fa20ca6a08d94efdea14.tar.gz
rails-8995483106c60c7b4d73fa20ca6a08d94efdea14.tar.bz2
rails-8995483106c60c7b4d73fa20ca6a08d94efdea14.zip
Guard against app generation if the database specified isnt supported for preconfiguration [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3711 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 6f55084c34..80b2e3440a 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -4,12 +4,15 @@ class AppGenerator < Rails::Generator::Base
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
Config::CONFIG['ruby_install_name'])
+ DATABASES = %w( mysql sqlite2 sqlite3 postgresql )
+
default_options :db => "mysql", :shebang => DEFAULT_SHEBANG
mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
def initialize(runtime_args, runtime_options = {})
super
usage if args.empty?
+ usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db]))
@destination_root = args.shift
end