heroku-qc-autoscale 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -24,7 +24,8 @@ Create config/initializers/qc_autoscale.rb
24
24
 
25
25
  Autoscale.config do |c|
26
26
  c.api_key = ENV['HEROKU_API_KEY']
27
- c.app = ENV['HEROKU_APP']
27
+ c.app = ENV['AUTOSCALE_APP']
28
+ c.min = ENV['AUTOSCALE_MIN']
28
29
  c.scale = [1, 15, 30, 40, 50]
29
30
  end
30
31
 
@@ -26,8 +26,8 @@ module Autoscale
26
26
  # shutdown if no jobs exist
27
27
  def down
28
28
  if job_count < 1
29
- QC.log(action: :scale, workers: 0)
30
- self.workers = 0
29
+ QC.log(action: :scale, workers: min_workers)
30
+ self.workers = min_workers
31
31
  end
32
32
  end
33
33
 
@@ -52,6 +52,10 @@ module Autoscale
52
52
  Autoscale.scale || [1, 15, 30, 40, 50]
53
53
  end
54
54
 
55
+ def min_workers
56
+ Autoscale.min || 0
57
+ end
58
+
55
59
  # heroku api client
56
60
  def client
57
61
  @@client ||= ::Heroku::API.new( params )
@@ -1,7 +1,7 @@
1
1
  module Heroku
2
2
  module QC
3
3
  module Autoscale
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
@@ -9,7 +9,7 @@ require "autoscale/queue_classic/callbacks"
9
9
  require "heroku-qc-autoscale/version"
10
10
 
11
11
  module Autoscale
12
- mattr_accessor :api_key, :app, :mock, :scale
12
+ mattr_accessor :api_key, :app, :mock, :scale, :min
13
13
 
14
14
  # config and activate QC bindings
15
15
  def self.config(&block)
@@ -15,4 +15,8 @@ describe Autoscale do
15
15
  subject.scale.must_equal [1, 15, 30, 40, 50]
16
16
  end
17
17
 
18
+ it "should have min workers" do
19
+ subject.min.must_equal 0
20
+ end
21
+
18
22
  end
data/test/test_helper.rb CHANGED
@@ -17,6 +17,7 @@ Autoscale.config do |c|
17
17
  c.app = "racehq-test"
18
18
  c.mock = true
19
19
  c.scale = [1, 15, 30, 40, 50]
20
+ c.min = 0
20
21
  end
21
22
 
22
23
  Autoscale.activate!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-qc-autoscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-08 00:00:00.000000000 Z
12
+ date: 2012-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: heroku-api
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  segments:
162
162
  - 0
163
- hash: 3252771501108507673
163
+ hash: 2325346798596805280
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  none: false
166
166
  requirements:
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  segments:
171
171
  - 0
172
- hash: 3252771501108507673
172
+ hash: 2325346798596805280
173
173
  requirements: []
174
174
  rubyforge_project: heroku-qc-autoscale
175
175
  rubygems_version: 1.8.21