mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Raise an error if invalid value for database is provided.
This commit is contained in:
@@ -7,6 +7,9 @@ require 'thor'
|
||||
|
||||
module Rails
|
||||
module Generators
|
||||
class Error < Thor::Error
|
||||
end
|
||||
|
||||
class Base < Thor::Group
|
||||
include Rails::Generators::Actions
|
||||
include Thor::Actions
|
||||
|
||||
@@ -45,6 +45,13 @@ module Rails::Generators
|
||||
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 '.'
|
||||
|
||||
Reference in New Issue
Block a user