Module: Capistrano::Sidekiq::Helpers
- Included in:
- Systemd
- Defined in:
- lib/capistrano/sidekiq/helpers.rb
Instance Method Summary collapse
- #expanded_bundle_path ⇒ Object
- #sidekiq_concurrency ⇒ Object
- #sidekiq_config ⇒ Object
- #sidekiq_logfile ⇒ Object
- #sidekiq_queues ⇒ Object
- #sidekiq_require ⇒ Object
- #sidekiq_user(role = nil) ⇒ Object
- #switch_user(role, &block) ⇒ Object
Instance Method Details
#expanded_bundle_path ⇒ Object
49 50 51 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 49 def backend.capture(:echo, SSHKit.config.command_map[:bundle]).strip end |
#sidekiq_concurrency ⇒ Object
14 15 16 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 14 def sidekiq_concurrency "--concurrency #{fetch(:sidekiq_concurrency)}" if fetch(:sidekiq_concurrency) end |
#sidekiq_config ⇒ Object
10 11 12 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 10 def sidekiq_config "--config #{fetch(:sidekiq_config)}" if fetch(:sidekiq_config) end |
#sidekiq_logfile ⇒ Object
24 25 26 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 24 def sidekiq_logfile fetch(:sidekiq_log) end |
#sidekiq_queues ⇒ Object
18 19 20 21 22 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 18 def sidekiq_queues Array(fetch(:sidekiq_queue)).map do |queue| "--queue #{queue}" end.join(' ') end |
#sidekiq_require ⇒ Object
6 7 8 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 6 def sidekiq_require "--require #{fetch(:sidekiq_require)}" if fetch(:sidekiq_require) end |
#sidekiq_user(role = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 37 def sidekiq_user(role = nil) if role.nil? fetch(:sidekiq_user) else properties = role.properties properties.fetch(:sidekiq_user) || # local property for sidekiq only fetch(:sidekiq_user) || properties.fetch(:run_as) || # global property across multiple capistrano gems role.user end end |
#switch_user(role, &block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/capistrano/sidekiq/helpers.rb', line 28 def switch_user(role, &block) su_user = sidekiq_user(role) if su_user == role.user yield else as su_user, &block end end |