mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-05 20:35:35 -04:00
Optionally pass in db path for testing
This commit is contained in:
parent
049bd3ab2c
commit
7448592216
@ -80,7 +80,7 @@ module MangaDex
|
|||||||
|
|
||||||
class Queue
|
class Queue
|
||||||
property downloader : Downloader?
|
property downloader : Downloader?
|
||||||
@path : String = Config.current.mangadex["download_queue_db_path"].to_s
|
@path : String
|
||||||
|
|
||||||
def self.default
|
def self.default
|
||||||
unless @@default
|
unless @@default
|
||||||
@ -89,7 +89,8 @@ module MangaDex
|
|||||||
@@default.not_nil!
|
@@default.not_nil!
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize
|
def initialize(db_path : String? = nil)
|
||||||
|
@path = db_path || Config.current.mangadex["download_queue_db_path"].to_s
|
||||||
dir = File.dirname @path
|
dir = File.dirname @path
|
||||||
unless Dir.exists? dir
|
unless Dir.exists? dir
|
||||||
Logger.info "The queue DB directory #{dir} does not exist. " \
|
Logger.info "The queue DB directory #{dir} does not exist. " \
|
||||||
|
@ -13,7 +13,7 @@ def verify_password(hash, pw)
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Storage
|
class Storage
|
||||||
@path : String = Config.current.db_path
|
@path : String
|
||||||
|
|
||||||
def self.default
|
def self.default
|
||||||
unless @@default
|
unless @@default
|
||||||
@ -22,7 +22,8 @@ class Storage
|
|||||||
@@default.not_nil!
|
@@default.not_nil!
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize
|
def initialize(db_path : String? = nil)
|
||||||
|
@path = db_path || Config.current.db_path
|
||||||
dir = File.dirname @path
|
dir = File.dirname @path
|
||||||
unless Dir.exists? dir
|
unless Dir.exists? dir
|
||||||
Logger.info "The DB directory #{dir} does not exist. " \
|
Logger.info "The DB directory #{dir} does not exist. " \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user