Class: Resque::Plugins::HerokuScaler::Manager::Heroku
- Inherits:
-
Object
- Object
- Resque::Plugins::HerokuScaler::Manager::Heroku
- Defined in:
- lib/resque/plugins/heroku_scaler/manager/heroku.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Heroku
constructor
A new instance of Heroku.
- #workers ⇒ Object
- #workers=(qty) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Heroku
Returns a new instance of Heroku.
9 10 11 |
# File 'lib/resque/plugins/heroku_scaler/manager/heroku.rb', line 9 def initialize(={}) @heroku = ::Heroku::Client.new(ENV['HEROKU_USERNAME'], ENV['HEROKU_PASSWORD']) end |
Instance Method Details
#workers ⇒ Object
13 14 15 |
# File 'lib/resque/plugins/heroku_scaler/manager/heroku.rb', line 13 def workers @heroku.ps(ENV['HEROKU_APP']).count { |p| p["process"] =~ /worker\.\d?/ } end |
#workers=(qty) ⇒ Object
17 18 19 |
# File 'lib/resque/plugins/heroku_scaler/manager/heroku.rb', line 17 def workers=(qty) @heroku.ps_scale(ENV['HEROKU_APP'], :type => 'worker', :qty => qty) end |