Class: Testjour::CLI::MysqlDrop

Inherits:
BaseCommand show all
Defined in:
lib/testjour/commands/mysql_drop.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#non_options, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

detailed_help, help, inherited, #option_parser, options, #testjour_bin_path

Constructor Details

#initialize(*args) ⇒ MysqlDrop

Returns a new instance of MysqlDrop.


13
14
15
16
17
18
19
# File 'lib/testjour/commands/mysql_drop.rb', line 13

def initialize(*args)
  super
  Testjour.logger.debug "Runner command #{self.class}..."
  
  ENV["RAILS_ENV"] ||= "test"
  require File.expand_path("./config/environment")
end

Class Method Details

.commandObject


9
10
11
# File 'lib/testjour/commands/mysql_drop.rb', line 9

def self.command
  "mysql:drop"
end

Instance Method Details

#runObject


21
22
23
24
25
26
# File 'lib/testjour/commands/mysql_drop.rb', line 21

def run
  database_name = @non_options.shift
  mysql = MysqlDatabaseSetup.new(database_name)
  mysql.connect
  mysql.drop_database
end