Sha256: c83ed8cb43764e038dd287266fde07b6067a67a24a529e063807a3fc7c5ec2c6
Contents?: true
Size: 992 Bytes
Versions: 9
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true def file_contains?(filename, string) File.foreach(filename).detect { |line| line.include?(string) } end run "bundle add sidekiq" run "bundle add redis" unless file_contains? "Gemfile", "Gem 'redis'" Bundler.with_unbundled_env { run "bundle install" } # rubocop:disable Naming/HeredocDelimiterNaming application do <<~EOF config.active_job.queue_adapter = :sidekiq EOF end inject_into_file "config/routes.rb" do <<~EOF require "sidekiq/web" if Rails.env.production? Sidekiq::Web.use Rack::Auth::Basic do |username, password| ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_USERNAME"])) & ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_PASSWORD"])) end end EOF end # rubocop:enable Naming/HeredocDelimiterNaming route 'mount Sidekiq::Web => "/sidekiq"'
Version data entries
9 entries across 9 versions & 1 rubygems