Class: INatGet::App::Main
- Inherits:
-
Object
- Object
- INatGet::App::Main
- Includes:
- Singleton
- Defined in:
- lib/inat-get/app/application.rb
Instance Method Summary collapse
- #check_sockets!(socket, socket2) ⇒ Object private
-
#initialize ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
- #socket_alive?(socket) ⇒ Boolean private
Constructor Details
Instance Method Details
#check_sockets!(socket, socket2) ⇒ Object (private)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/inat-get/app/application.rb', line 46 def check_sockets! socket, socket2 if File.exist?(socket) if socket_alive?(socket) warn "❌ API Socket already exists!" exit Errno::EEXIST::Errno else File.delete socket end end if File.exist?(socket2) File.delete socket2 end end |
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/inat-get/app/application.rb', line 26 def run console_socket = @config.dig :socket, :console api_socket = @config.dig :socket, :api check_sockets! api_socket, console_socket INatGet::App::Maintenance::db_check @config, true console = INatGet::App::Server::Console::create console_socket api = nil api = INatGet::App::Server::API::create api_socket, console: console if !@config[:offline] tasks = @config[:tasks].map { |path| INatGet::App::Task::new path, @config, console: console, api: api } Process::warmup INatGet::App::Worker::enqueue @config, *tasks, console: console, api: api console.quit api.quit if api end |