lib/ardb/adapter/sqlite.rb in ardb-0.27.3 vs lib/ardb/adapter/sqlite.rb in ardb-0.28.0

- old
+ new

@@ -1,20 +1,15 @@ -require 'pathname' require 'fileutils' require 'ardb' require 'ardb/adapter/base' -class Ardb::Adapter +module Ardb::Adapter class Sqlite < Base def db_file_path - if (path = Pathname.new(self.database)).absolute? - path.to_s - else - Ardb.config.root_path.join(path).to_s - end + File.expand_path(self.database, self.config.root_path) end def validate! if File.exist?(self.db_file_path) raise RuntimeError, "`#{self.database}` already exists" @@ -22,10 +17,10 @@ end def create_db validate! FileUtils.mkdir_p File.dirname(self.db_file_path) - ActiveRecord::Base.establish_connection(self.config_settings) + ActiveRecord::Base.establish_connection(self.connect_hash) end def drop_db FileUtils.rm(self.db_file_path) if File.exist?(self.db_file_path) end