Module: Miteru::Commands::Sidekiq

Included in:
Miteru::CLI::App
Defined in:
lib/miteru/commands/sidekiq.rb

Overview

Sidekiq sub-commands

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/miteru/commands/sidekiq.rb', line 10

def included(thor)
  thor.class_eval do
    desc "sidekiq", "Start Sidekiq"
    method_option :env, type: :string, default: "production", desc: "Environment", aliases: "-e"
    method_option :concurrency, type: :numeric, default: 5, desc: "Sidekiq concurrency", aliases: "-c"
    def sidekiq
      require "sidekiq/cli"

      ENV["APP_ENV"] ||= options["env"]
      concurrency = options["concurrency"].to_s

      cli = ::Sidekiq::CLI.instance
      cli.parse [
        "-r",
        File.expand_path(File.join(__dir__, "..", "sidekiq", "application.rb")),
        "-c",
        concurrency
      ]
      cli.run
    end
  end
end