class Daiku::Plugins::Sidekiq::CLI

Public Class Methods

source_root() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 12
def self.source_root
  File.expand_path('../', __FILE__)
end

Public Instance Methods

bootrb() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 16
def bootrb
  insert_into_file "#{app}/lib/boot.rb", "require File.join($app_root, 'config/sidekiq')\n", after: "# jobs\n"
end
config() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 20
def config
  template('_templates/sidekiq.rb.tt', "#{app}/config/sidekiq.rb")
  empty_directory("#{app}/lib/jobs")
  create_file("#{app}/lib/jobs/.gitkeep", "")
end
dotenv() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 26
def dotenv
  append_to_file "#{app}/.env", "SIDEKIQ_USERNAME=#{app}\n"
  append_to_file "#{app}/.env", "SIDEKIQ_PASSWORD=#{app}\n"
end
gemfile() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 31
def gemfile
  insert_into_file "#{app}/Gemfile", "gem 'sidekiq'\n", after: "gem 'puma', require: false\n"
end
procfile() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 35
def procfile
  append_to_file "#{app}/Procfile", "sidekiq: bundle exec sidekiq -q default -r ./lib/boot.rb\n"
end
rackup() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 39
        def rackup
          content = <<-SKMW.strip_heredoc
            require 'sidekiq/web'
            map '/sidekiq' do
              Sidekiq::Web.use Rack::Auth::Basic do |username, password|
                username == ENV['SIDEKIQ_USERNAME'] && password == ENV['SIDEKIQ_PASSWORD']
              end
              run Sidekiq::Web\n
            end
          SKMW
          append_to_file "#{app}/config.ru", content
        end
spechelper() click to toggle source
# File lib/daiku/plugins/sidekiq/cli.rb, line 52
def spechelper
  insert_into_file "#{app}/spec/spec_helper.rb", "require 'sidekiq/testing'\n", before: "require 'minitest/autorun'\n"
end