Method: Mysql2psql::Config#initialize

Defined in:
lib/mysql2psql/config.rb

#initialize(configfilepath, generate_default_if_not_found = true) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mysql2psql/config.rb', line 7

def initialize(configfilepath, generate_default_if_not_found = true)
  unless File.exists?(configfilepath)
    reset_configfile(configfilepath) if generate_default_if_not_found
    if File.exists?(configfilepath) 
      raise Mysql2psql::ConfigurationFileInitialized.new("\n
No configuration file found.
A new file has been initialized at: #{configfilepath}
Please review the configuration and retry..\n\n\n")
    else
      raise Mysql2psql::ConfigurationFileNotFound.new("cannot load config file #{configfilepath}")
    end
  end
  super(configfilepath)
end