Sha256: 762fc48f9fbf4165bc4597077c0091842ff97a7bf8a6144cac029ccf50c19a1e

Contents?: true

Size: 948 Bytes

Versions: 6

Compression:

Stored size: 948 Bytes

Contents

require 'roo_on_rails/checks/base'
require 'thor'

module RooOnRails
  module Checks
    module Sidekiq
      class Sidekiq < Base
        WORKER_PROCFILE_LINE = 'worker: bundle exec roo_on_rails sidekiq'.freeze

        def intro
          'Checking Sidekiq Setup...'
        end

        def call
          unless ENV.fetch('SIDEKIQ_ENABLED', 'true').to_s =~ /\A(YES|TRUE|ON|1)\Z/i
            pass 'SIDEKIQ_ENABLED is set to false'
            return
          end
          check_for_procfile
        end

        def fix
          if File.exist?('Procfile')
            append_to_file 'Procfile', "\n#{WORKER_PROCFILE_LINE}"
          else
            create_file 'Procfile', WORKER_PROCFILE_LINE
          end
        end

        def check_for_procfile
          return if File.exist?('Procfile') && File.read('Procfile').include?('worker')
          fail! "No Procfile found with a 'worker' command"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roo_on_rails-1.7.0 lib/roo_on_rails/checks/sidekiq/sidekiq.rb
roo_on_rails-1.6.0 lib/roo_on_rails/checks/sidekiq/sidekiq.rb
roo_on_rails-1.5.0 lib/roo_on_rails/checks/sidekiq/sidekiq.rb
roo_on_rails-1.4.0 lib/roo_on_rails/checks/sidekiq/sidekiq.rb
roo_on_rails-1.3.1 lib/roo_on_rails/checks/sidekiq/sidekiq.rb
roo_on_rails-1.3.0 lib/roo_on_rails/checks/sidekiq/sidekiq.rb