Class: Ardb::Runner::DropCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ardb/runner/drop_command.rb

Instance Method Summary collapse

Constructor Details

#initializeDropCommand

Returns a new instance of DropCommand.



6
7
8
# File 'lib/ardb/runner/drop_command.rb', line 6

def initialize
  @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ardb/runner/drop_command.rb', line 10

def run
  begin
    @adapter.drop_db
    $stdout.puts "dropped #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
  rescue Ardb::Runner::CmdError => e
    raise e
  rescue Exception => e
    $stderr.puts e
    $stderr.puts "error dropping #{Ardb.config.db.database.inspect} database"
    raise Ardb::Runner::CmdFail
  end
end