Use singleton in various classes

This commit is contained in:
Alex Ling
2020-05-04 16:18:16 +00:00
parent 09b297cd8e
commit 1bec9f0108
16 changed files with 178 additions and 117 deletions
+3 -14
View File
@@ -1,5 +1,5 @@
require "./config"
require "./server"
require "./context"
require "./mangadex/*"
require "option_parser"
@@ -24,18 +24,7 @@ OptionParser.parse do |parser|
end
end
config = Config.load config_path
logger = Logger.new config.log_level
storage = Storage.new config.db_path, logger
library = Library.new config.library_path, config.scan_interval, logger, storage
queue = MangaDex::Queue.new config.mangadex["download_queue_db_path"].to_s,
logger
api = MangaDex::API.new config.mangadex["api_url"].to_s
MangaDex::Downloader.new queue, api, config.library_path,
config.mangadex["download_wait_seconds"].to_i,
config.mangadex["download_retries"].to_i, logger
Config.load(config_path).set_current
context = Context.new config, logger, library, storage, queue
server = Server.new context
server = Server.new
server.start