Permalink
Browse files

support multi-application

  • Loading branch information...
1 parent b0a2485 commit 7f35a544e31f1c1223d062c781afd9991bd4dd94 @hsbt committed Mar 8, 2012
Showing with 25 additions and 25 deletions.
  1. +14 −16 lib/generators/heroku_scale_scheduler/templates/heroku_ps.yml
  2. +11 −9 lib/heroku_scale_scheduler/client.rb
@@ -1,19 +1,17 @@
-app: example_app
-
# bomboo stack
-# dynos:
-# 900: 2
-# 2200: 1
-
-# workers:
-# 900: 1
-# 2200: 0
+# example_app:
+# dynos:
+# 900: 2
+# 2200: 1
+# workers:
+# 900: 1
+# 2200: 0
# cedar stack
-web:
- 900: 2
- 2200: 1
-
-worker:
- 900: 1
- 2200: 0
+example_app:
+ web:
+ 900: 2
+ 2200: 1
+ worker:
+ 900: 1
+ 2200: 0
@@ -7,15 +7,17 @@ def run(type = :ps)
config = HerokuScaleScheduler::Config.read_config
run_at = (Time.now.strftime('%H%M').to_i / 10) * 10
- if type != :ps && qty = config[type.to_s][run_at]
- case type
- when :dynos then client.set_dynos(config['app'], qty)
- when :workers then client.set_workers(config['app'], qty)
- end
- else
- config.keys.each do |ps|
- if qty = config[ps][run_at]
- client.ps_scale(config['app'], :type => ps, :qty => qty)
+ config.keys.each do |app|
+ if type != :ps && qty = config[app][type.to_s][run_at]
+ case type
+ when :dynos then client.set_dynos(app, qty)
+ when :workers then client.set_workers(app, qty)
+ end
+ else
+ config[app].keys.each do |ps|
+ if qty = config[app][ps][run_at]
+ client.ps_scale(app, :type => ps, :qty => qty)
+ end
end
end
end

0 comments on commit 7f35a54

Please sign in to comment.