lib/arql/app.rb in arql-0.1.28 vs lib/arql/app.rb in arql-0.1.29

- old
+ new

@@ -34,15 +34,16 @@ connect_conf end def load_initializer! return unless effective_config[:initializer] - unless File.exists?(effective_config[:initializer]) + initializer_file = File.expand_path(effective_config[:initializer]) + unless File.exists?(initializer_file) STDERR.puts "Specified initializer file not found, #{effective_config[:initializer]}" exit(1) end - load(effective_config[:initializer]) + load(initializer_file) end def start_ssh_proxy! ssh_config = effective_config[:ssh] local_ssh_proxy_port = Arql::SSHProxy.connect(ssh_config.slice(:host, :user, :port, :password).merge( @@ -54,17 +55,19 @@ port: local_ssh_proxy_port } end def config - @config ||= YAML.load(IO.read(@options.config_file)).with_indifferent_access + @config ||= YAML.load(IO.read(File.expand_path(@options.config_file))).with_indifferent_access end def selected_config if @options.env.present? && !config[@options.env].present? STDERR.puts "Specified ENV `#{@options.env}' not exists" end - config[@options.env] + sc = config[@options.env] + sc[:database] = File.expand_path(sc[:database]) if sc[:adapter] == 'sqlite3' + sc end def effective_config @@effective_config ||= selected_config.deep_merge(@options.to_h) end