Class: SidekiqClientCLI
- Inherits:
-
Object
- Object
- SidekiqClientCLI
- Defined in:
- lib/sidekiq_client_cli.rb,
lib/sidekiq_client_cli/parser.rb,
lib/sidekiq_client_cli/version.rb
Defined Under Namespace
Classes: Parser
Constant Summary collapse
- COMMANDS =
%w{push}
- DEFAULT_CONFIG_PATH =
"config/initializers/sidekiq.rb"
- VERSION =
"0.1.7"
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Class Method Summary collapse
Instance Method Summary collapse
- #parse ⇒ Object
-
#push ⇒ Object
Returns true if all args can be pushed successfully.
- #run ⇒ Object
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
9 10 11 |
# File 'lib/sidekiq_client_cli.rb', line 9 def settings @settings end |
Class Method Details
.cast_retry_option(retry_option) ⇒ Object
15 16 17 18 19 |
# File 'lib/sidekiq_client_cli.rb', line 15 def self.cast_retry_option(retry_option) return true if !!retry_option.match(/^(true|t|yes|y)$/i) return false if !!retry_option.match(/^(false|f|no|n|0)$/i) return retry_option.to_i if !!retry_option.match(/^\d+$/) end |
Instance Method Details
#parse ⇒ Object
11 12 13 |
# File 'lib/sidekiq_client_cli.rb', line 11 def parse @settings = Parser.new.parse end |
#push ⇒ Object
Returns true if all args can be pushed successfully. Returns false if at least one exception occured.
34 35 36 37 38 |
# File 'lib/sidekiq_client_cli.rb', line 34 def push settings.command_args.inject(true) do |success, arg| push_argument arg end end |
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sidekiq_client_cli.rb', line 21 def run # load the config file load settings.config_path if File.exists?(settings.config_path) # set queue or retry if they are not given settings.queue ||= Sidekiq.['queue'] settings.retry = Sidekiq.['retry'] if settings.retry.nil? self.send settings.command.to_sym end |