Raise an error if invalid value for database is provided.
This commit is contained in:
parent
6619357f75
commit
090de591fc
@ -7,6 +7,9 @@
|
||||
|
||||
module Rails
|
||||
module Generators
|
||||
class Error < Thor::Error
|
||||
end
|
||||
|
||||
class Base < Thor::Group
|
||||
include Rails::Generators::Actions
|
||||
include Thor::Actions
|
||||
|
@ -45,6 +45,13 @@ class App < Base
|
||||
class_option :help, :type => :boolean, :aliases => "-h", :group => :rails,
|
||||
:desc => "Show this help message and quit"
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
if !options[:no_activerecord] && !DATABASES.include?(options[:database])
|
||||
raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
|
||||
end
|
||||
end
|
||||
|
||||
def create_root
|
||||
self.root = File.expand_path(app_path, root)
|
||||
empty_directory '.'
|
||||
|
Loading…
Reference in New Issue
Block a user