class CIHelper::Commands::CheckSidekiqSchedulerConfig

Public Instance Methods

call() click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 8
def call
  return 0 if job_constants.empty?

  create_and_migrate_database! if with_database?
  cmd = craft_jobs_const_get_cmd
  execute_with_rails_runner(cmd)
  0
end

Private Instance Methods

config() click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 39
def config
  @config ||= YAML.load_file(options[:config_path])
end
craft_jobs_const_get_cmd() click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 27
def craft_jobs_const_get_cmd
  "#{job_constants}.each { |x| Object.const_get(x) }"
end
env() click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 19
def env
  :development
end
execute_with_rails_runner(cmd) click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 23
def execute_with_rails_runner(cmd)
  execute("bundle exec rails runner '#{cmd}'")
end
job_constants() click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 31
def job_constants
  @job_constants ||= config.values.reject(&:nil?).flat_map(&:keys).uniq
end
with_database?() click to toggle source
# File lib/ci_helper/commands/check_sidekiq_scheduler_config.rb, line 35
def with_database?
  boolean_option(:with_database)
end