Permalink
Browse files

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
  • Loading branch information...
1 parent a974b9e commit 8995483106c60c7b4d73fa20ca6a08d94efdea14 @dhh dhh committed Feb 28, 2006
Showing with 3 additions and 0 deletions.
  1. +3 −0 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

0 comments on commit 8995483

Please sign in to comment.