Class: Ardb::CLI::CreateCommand
- Inherits:
-
Object
- Object
- Ardb::CLI::CreateCommand
- Includes:
- ValidCommand
- Defined in:
- lib/ardb/cli/commands.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.command_name ⇒ Object
96 |
# File 'lib/ardb/cli/commands.rb', line 96 def self.command_name; "create"; end |
.command_summary ⇒ Object
97 |
# File 'lib/ardb/cli/commands.rb', line 97 def self.command_summary; "Create the configured DB"; end |
Instance Method Details
#run(argv, *args) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/ardb/cli/commands.rb', line 99 def run(argv, *args) super begin Ardb.init(false) Ardb.adapter.create_db @stdout.puts "created #{Ardb.config.adapter} db #{Ardb.config.database.inspect}" rescue ActiveRecord::StatementInvalid => e @stderr.puts "error: database #{Ardb.config.database.inspect} "\ "already exists" rescue StandardError => e @stderr.puts e @stderr.puts "error creating #{Ardb.config.database.inspect} database" raise CommandExitError end end |