diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-28 21:01:10 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-28 21:01:10 +0000 |
commit | 8995483106c60c7b4d73fa20ca6a08d94efdea14 (patch) | |
tree | ab400cd7b0414964c2284be09b5012ee062d51e3 /railties/lib/rails_generator | |
parent | a974b9e3c29e879d2c9247122dce958a5972419c (diff) | |
download | rails-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/lib/rails_generator')
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/app_generator.rb | 3 |
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 |