Class: Teleport::SidekiqGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/teleport/sidekiq.rb

Instance Method Summary collapse

Instance Method Details

#add_gemsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/teleport/sidekiq.rb', line 3

def add_gems
  gem 'sidekiq'
  gem 'sidetiq'

  Bundler.with_clean_env do
    run "bundle install"
  end

  copy_file 'sidekiq/_sidekiq_example_worker.rb',
            'app/workers/_sidekiq_example_worker.rb'
  copy_file 'sidekiq/_sidetiq_example_worker.rb',
            'app/workers/_sidetiq_example_worker.rb'


  prepend_to_file "app/config/routes.rb",
                   %q{
require 'sidekiq/web'
require 'sidetiq/web'
                     }

                     route %q{
  authenticate :user, ->(u) { u.admin? } do
mount Sidekiq::Web => '/sidekiq'
  end
                     }
end