whacamole 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Njk4YWU0NWQyMzZjMjg4OWJhZGRlNTczYzIzNTllZmIyMmZkNDVmNQ==
5
- data.tar.gz: !binary |-
6
- NWU5OTM2Zjg0ZTY3ZDJkNzczMDg4MWMxODYzZTk5YzRlN2FiMTg3OA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZGY2MDllNzU4ZDg0Y2E5YTY4ODlhMTE3NTJmZDE5NjY0ZmJlZWY2OTVlZDgx
10
- ZmUyZGU1ZTBhMWQ3MWVkZmMxZGU1OTEyZTIwZGVkMTdjYjM2M2IxZGRiNTgz
11
- ZjBlOTM5MjVhNzQ0NzRlMTg2MGVhYTI5MzYxNzk1ZTg5MDA4YWQ=
12
- data.tar.gz: !binary |-
13
- OTY4MTM5NTU5NWJmMTQzOWQ5NzY1N2VlMWY2MDcyNjk2YjlkMWJmY2QyMGU4
14
- MDNjYjkxYzZmNzcwMGJjMTk1ZjcxNjUzMzdiMjliNGQ2OGIzZWVlYjA1NTJh
15
- NmQwNDRjZTRmOGZmMTA5ODVjN2EwM2FmYzMxODA1MmE4MzE0YjI=
2
+ SHA1:
3
+ metadata.gz: 00e6b158132b671bdc17f983bf0919f9a981d62a
4
+ data.tar.gz: 70079b35b4eed6b1dee7ded5012db9d70c8f8ca2
5
+ SHA512:
6
+ metadata.gz: 9d96f5c7fcd67e3d8995ba5cf2b025eedca6bcb304b7093e130c5e499a44437e48f3f79b0cb67ca110ef1e3ae69b9dee9c07ee9c629b8ca4ab0dc297f0ed2362
7
+ data.tar.gz: c56a3ad96897a8a1d1b79fedf88ca1a2e5ebc9699fff0521bc81e0be5c2aedeeeb98eda9f6d0cd3f3ee7629a2e0f1939a9c598b241f33f219b355d1fcd9f6b0d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whacamole (0.2.0)
4
+ whacamole (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -20,7 +20,7 @@ module Whacamole
20
20
 
21
21
  while true
22
22
  stream_url = heroku.create_log_session
23
- Stream.new(stream_url, heroku, &config.event_handler).watch
23
+ Stream.new(stream_url, heroku, config.restart_threshold, &config.event_handler).watch
24
24
  end
25
25
  end
26
26
  end
@@ -1,11 +1,15 @@
1
1
  module Whacamole
2
2
  class Config
3
- attr_accessor :app_name, :api_token, :event_handler, :dynos
3
+
4
+ RESTART_THRESHOLD = 1000
5
+
6
+ attr_accessor :app_name, :api_token, :event_handler, :dynos, :restart_threshold
4
7
 
5
8
  def initialize(app_name)
6
9
  self.app_name = app_name
7
10
  self.event_handler ||= lambda { |e| puts e.inspect.to_s }
8
11
  self.dynos ||= %w{web}
12
+ self.restart_threshold ||= RESTART_THRESHOLD
9
13
  end
10
14
  end
11
15
  end
@@ -4,13 +4,12 @@ module Whacamole
4
4
 
5
5
  class Stream
6
6
 
7
- RESTART_THRESHOLD = 1000
8
-
9
- def initialize(url, restart_handler, &blk)
7
+ def initialize(url, restart_handler, config_restart_threshold, &blk)
10
8
  @url = url
11
9
  @restart_handler = restart_handler
12
10
  @dynos = restart_handler.dynos
13
11
  @event_handler = blk
12
+ @restart_threshold = config_restart_threshold
14
13
  end
15
14
 
16
15
  def watch
@@ -85,7 +84,7 @@ module Whacamole
85
84
  end
86
85
 
87
86
  def restart_threshold
88
- RESTART_THRESHOLD
87
+ @restart_threshold
89
88
  end
90
89
  end
91
90
  end
@@ -1,4 +1,4 @@
1
1
  module Whacamole
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
4
4
 
@@ -11,5 +11,10 @@ describe Whacamole::Config do
11
11
  c = Whacamole::Config.new("production")
12
12
  c.dynos.should == %w{web}
13
13
  end
14
+
15
+ it "has a default restart_threshold" do
16
+ c = Whacamole::Config.new("production")
17
+ c.restart_threshold.should == 1000
18
+ end
14
19
  end
15
20
  end
@@ -26,7 +26,7 @@ describe Whacamole::Stream do
26
26
  let(:eh) { EventHandler.new }
27
27
  let(:restart_handler) { RestartHandler.new }
28
28
  let(:stream) do
29
- Whacamole::Stream.new("https://api.heroku.com/path/to/stream/stream", restart_handler) do |event|
29
+ Whacamole::Stream.new("https://api.heroku.com/path/to/stream/stream", restart_handler, 1000) do |event|
30
30
  eh.process(event)
31
31
  end
32
32
  end
@@ -28,6 +28,19 @@ describe Whacamole do
28
28
  config.api_token.should == "prod token"
29
29
  end
30
30
  end
31
+
32
+ it "accepts a threshold override per config" do
33
+ Whacamole.configure("production") do |config|
34
+ config.api_token = "prod token"
35
+ config.restart_threshold.should == 1000
36
+ config.restart_threshold = 500
37
+ end
38
+ Whacamole.configure("production") do |config|
39
+ config.api_token = "prod token"
40
+ config.restart_threshold.should == 500
41
+ end
42
+
43
+ end
31
44
  end
32
45
  end
33
46
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whacamole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Doyle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -75,17 +75,17 @@ require_paths:
75
75
  - lib
76
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ! '>='
78
+ - - '>='
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ! '>='
83
+ - - '>='
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
87
  rubyforge_project:
88
- rubygems_version: 2.0.7
88
+ rubygems_version: 2.4.2
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: restart heroku dynos that run out of RAM instead of swapping to disk