class BotConsole::Manager
Constants
- START_INTERVAL_SEC
Attributes
Public Class Methods
Source
# File lib/bot_console.rb, line 30 def initialize(root:, env: {}) @root = root @env = env @registry = DisabledRegistry.new(root) @bots = Config.discover_bots(root).map do |entry| bot = BotProcess.new(entry: entry, root: root, env: env) bot.disable! if @registry.disabled?(entry[:id]) bot end end
Public Instance Methods
Source
# File lib/bot_console.rb, line 75 def disable_bot(id) bot = find(id) return unless bot bot.disable! @registry.disable(id) end
Source
# File lib/bot_console.rb, line 45 def disabled_bots @bots.reject(&:enabled?) end
Source
# File lib/bot_console.rb, line 83 def enable_bot(id, start: false) bot = find(id) return unless bot @registry.enable(id) bot.enable! bot.start if start end
Source
# File lib/bot_console.rb, line 41 def enabled_bots @bots.select(&:enabled?) end
Source
# File lib/bot_console.rb, line 49 def find(id) @bots.find { |bot| bot.id == id.to_s } end
Source
# File lib/bot_console.rb, line 71 def reload_plugins_all_enabled enabled_bots.select(&:running?).each(&:reload_plugins) end
Source
# File lib/bot_console.rb, line 61 def restart_all_enabled bots = bots_by_level(enabled_bots) bots.each(&:stop) start_bots_sequentially(bots) end
Source
# File lib/bot_console.rb, line 57 def shutdown_all @bots.each(&:shutdown) end
Source
# File lib/bot_console.rb, line 67 def start_all_stopped_enabled start_bots_sequentially(enabled_bots.reject(&:running?)) end
Source
# File lib/bot_console.rb, line 53 def start_enabled_bots start_bots_sequentially(enabled_bots) end