Class: Wordmove::Doctor::Mysql

Inherits:
Object
  • Object
show all
Defined in:
lib/wordmove/doctor/mysql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(movefile_name = nil, movefile_dir = '.') ⇒ Mysql

Returns a new instance of Mysql.



6
7
8
9
10
11
12
13
# File 'lib/wordmove/doctor/mysql.rb', line 6

def initialize(movefile_name = nil, movefile_dir = '.')
  @logger = Logger.new(STDOUT).tap { |l| l.level = Logger::INFO }
  begin
    @config = Wordmove::Movefile.new(movefile_name, movefile_dir).fetch[:local][:database]
  rescue Psych::SyntaxError
    return
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/wordmove/doctor/mysql.rb', line 4

def config
  @config
end

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/wordmove/doctor/mysql.rb', line 4

def logger
  @logger
end

Instance Method Details

#check!Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/wordmove/doctor/mysql.rb', line 15

def check!
  logger.task "Checking local database commands and connection"

  return logger.error "Can't connect to mysql using your movefile.yml" if config.nil?

  mysql_client_doctor
  mysqldump_doctor
  mysql_server_doctor
  mysql_database_doctor
end