Sha256: 9b2d77dd997f14ad9a4d26f2d8cdf4bb5f144ca919eb999ea93ee0b93cc059d4

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

# frozen-string-literal: true

module Rodbot
  class CLI
    module Commands
      class Start < Rodbot::CLI::Command
        desc 'Start Rodbot or parts of it'
        argument :service, values: Rodbot::SERVICES, desc: 'Which service to start or all by default'
        argument :extension, desc: 'Which service extension to start or all by default (only if SERVICE is relay)'
        option :daemonize, type: :boolean, desc: "Whether to daemonize and supervise processes, default: true (all services) or false (one service)"
        option :debugger, type: :boolean, default: false, desc: "Whether to load the debugger"

        def rescued_call(service: nil, extension: nil, daemonize: false, debugger: false, **)
          require 'debug' if debugger
          daemonize = true unless service
          Rodbot::Services.new.then do |services|
            (service ? [service] : Rodbot::SERVICES).each do |service|
              services.register(service, extension: extension)
            end
            services.run(daemonize: daemonize)
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rodbot-0.4.5 lib/rodbot/cli/commands/start.rb
rodbot-0.4.4 lib/rodbot/cli/commands/start.rb
rodbot-0.4.3 lib/rodbot/cli/commands/start.rb
rodbot-0.4.2 lib/rodbot/cli/commands/start.rb
rodbot-0.4.1 lib/rodbot/cli/commands/start.rb
rodbot-0.4.0 lib/rodbot/cli/commands/start.rb
rodbot-0.3.4 lib/rodbot/cli/commands/start.rb
rodbot-0.3.3 lib/rodbot/cli/commands/start.rb
rodbot-0.3.2 lib/rodbot/cli/commands/start.rb
rodbot-0.3.1 lib/rodbot/cli/commands/start.rb
rodbot-0.3.0 lib/rodbot/cli/commands/start.rb
rodbot-0.2.0 lib/rodbot/cli/commands/start.rb
rodbot-0.1.1 lib/rodbot/cli/commands/start.rb
rodbot-0.1.0 lib/rodbot/cli/commands/start.rb