lib/kit/db_sqlite3.rb in kit-0.0.4 vs lib/kit/db_sqlite3.rb in kit-0.0.5
- old
+ new
@@ -26,26 +26,31 @@
class Backend < Kit
include SQLite3Tools
- def initialize db_paths
+ attr_reader :db_paths
- db_paths.each do |key, p|
- dir = File.dirname p
- db_paths[key] = @@kit_path + p if dir == "."
+ def initialize db_paths
+ db_paths.each do |key, db|
+ name = File.basename db
+ dir = File.dirname db
+ dir = @@config_path unless [ "/", "~" ].include? dir[0]
+ db_paths[key] = "#{dir}/#{name}"
end
- dbs = db_prepare db_paths
+ @db_paths = db_paths
+
+ dbs = db_prepare @db_paths
@info_db = dbs[:info]
@action_db = dbs[:actions]
end
private
def db_prepare db_paths
def db_initialize type, db
- sql = File.read @@kit_path + "#{type}.sql"
+ sql = File.read @@kit_path + "/sqlite3_#{type}.sql"
db.execute_batch sql
end
dbs = {}
db_paths.each do |type, path|