Class: Testjour::CLI::MysqlCreate

Inherits:
BaseCommand show all
Defined in:
lib/testjour/commands/mysql_create.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) ⇒ MysqlCreate

Returns a new instance of MysqlCreate.



13
14
15
16
17
18
19
# File 'lib/testjour/commands/mysql_create.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_create.rb', line 9

def self.command
  "mysql:create"
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
29
# File 'lib/testjour/commands/mysql_create.rb', line 21

def run
  mysql = MysqlDatabaseSetup.new
  mysql.create_database
  mysql.connect
  mysql.load_schema

  ENV["TESTJOUR_DB"] = mysql.runner_database_name
  puts mysql.runner_database_name
end