eye 0.2.1 → 0.2.2

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -17
  3. data/bin/eye +5 -0
  4. data/examples/notify.eye +18 -0
  5. data/examples/process_thin.rb +29 -0
  6. data/examples/sidekiq.eye +5 -1
  7. data/examples/test.eye +24 -17
  8. data/examples/thin-farm.eye +29 -0
  9. data/examples/unicorn.eye +2 -0
  10. data/eye.gemspec +1 -1
  11. data/lib/eye.rb +1 -1
  12. data/lib/eye/checker.rb +3 -5
  13. data/lib/eye/checker/http.rb +1 -2
  14. data/lib/eye/checker/socket.rb +2 -2
  15. data/lib/eye/controller/commands.rb +2 -0
  16. data/lib/eye/controller/send_command.rb +8 -2
  17. data/lib/eye/dsl.rb +1 -0
  18. data/lib/eye/dsl/opts.rb +36 -2
  19. data/lib/eye/dsl/pure_opts.rb +17 -39
  20. data/lib/eye/{checker → dsl}/validation.rb +15 -5
  21. data/lib/eye/group.rb +13 -4
  22. data/lib/eye/group/chain.rb +11 -0
  23. data/lib/eye/notify.rb +1 -1
  24. data/lib/eye/notify/mail.rb +1 -1
  25. data/lib/eye/process/child.rb +0 -2
  26. data/lib/eye/process/commands.rb +11 -14
  27. data/lib/eye/process/monitor.rb +10 -16
  28. data/lib/eye/process/scheduler.rb +8 -3
  29. data/lib/eye/process/states.rb +1 -2
  30. data/lib/eye/process/system.rb +38 -7
  31. data/lib/eye/process/watchers.rb +3 -3
  32. data/lib/eye/settings.rb +1 -1
  33. data/lib/eye/system.rb +33 -16
  34. data/lib/eye/trigger.rb +1 -1
  35. data/lib/eye/utils/celluloid_chain.rb +2 -0
  36. data/spec/checker/cpu_spec.rb +1 -1
  37. data/spec/checker/http_spec.rb +2 -2
  38. data/spec/checker/memory_spec.rb +2 -2
  39. data/spec/checker_spec.rb +1 -1
  40. data/spec/controller/controller_spec.rb +6 -0
  41. data/spec/controller/find_objects_spec.rb +6 -0
  42. data/spec/controller/intergration_spec.rb +24 -0
  43. data/spec/dsl/checks_spec.rb +2 -2
  44. data/spec/dsl/notify_spec.rb +12 -3
  45. data/spec/dsl/with_server_spec.rb +26 -2
  46. data/spec/process/checks/child_checks_spec.rb +1 -1
  47. data/spec/process/checks/memory_spec.rb +14 -0
  48. data/spec/process/scheduler_spec.rb +8 -0
  49. data/spec/process/system_spec.rb +27 -4
  50. data/spec/spec_helper.rb +3 -1
  51. data/spec/system_spec.rb +12 -5
  52. data/spec/utils/celluloid_chain_spec.rb +8 -0
  53. metadata +8 -5
@@ -9,6 +9,13 @@ describe "Eye::System" do
9
9
  Eye::System.pid_alive?(nil).should == false
10
10
  end
11
11
 
12
+ it "check_pid_alive" do
13
+ Eye::System.check_pid_alive($$).should == {:result => true}
14
+ Eye::System.check_pid_alive(123456)[:error].class.should == Errno::ESRCH
15
+ Eye::System.check_pid_alive(-122)[:error].class.should == Errno::ESRCH
16
+ Eye::System.check_pid_alive(nil).should == {:result => false}
17
+ end
18
+
12
19
  it "ps_aux" do
13
20
  h = Eye::System.ps_aux
14
21
  h.size.should > 10
@@ -86,13 +93,13 @@ describe "Eye::System" do
86
93
 
87
94
  describe "send signal" do
88
95
  it "send_signal to spec" do
89
- Eye::System.send_signal($$, 0)[:status].should == :ok
96
+ Eye::System.send_signal($$, 0)[:result].should == :ok
90
97
  end
91
98
 
92
99
  it "send_signal to unexisted process" do
93
100
  res = Eye::System.send_signal(-12234)
94
- res[:status].should == :error
95
- res[:message].should include("not found")
101
+ res[:status].should == nil
102
+ res[:error].message.should include("No such process")
96
103
  end
97
104
 
98
105
  it "send_signal to daemon" do
@@ -101,7 +108,7 @@ describe "Eye::System" do
101
108
  # process should be alive
102
109
  Eye::System.pid_alive?(@pid).should == true
103
110
 
104
- Eye::System.send_signal(@pid, :term)[:status].should == :ok
111
+ Eye::System.send_signal(@pid, :term)[:result].should == :ok
105
112
  sleep 0.2
106
113
 
107
114
  Eye::System.pid_alive?(@pid).should == false
@@ -113,7 +120,7 @@ describe "Eye::System" do
113
120
 
114
121
  sleep 4
115
122
 
116
- Eye::System.send_signal(@pid, :usr1)[:status].should == :ok
123
+ Eye::System.send_signal(@pid, :usr1)[:result].should == :ok
117
124
 
118
125
  sleep 0.5
119
126
 
@@ -78,4 +78,12 @@ describe "Eye::Utils::CelluloidChain" do
78
78
  @t.m.should == [:a, :b, :c, :a, :c]
79
79
  end
80
80
 
81
+ it "#clear_pending_list" do
82
+ 10.times{ @c.add :a }
83
+ sleep 0.5
84
+ @c.clear_pending_list
85
+ sleep 0.5
86
+ @t.m.size.should < 6
87
+ end
88
+
81
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Makarchev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-17 00:00:00.000000000 Z
11
+ date: 2013-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - '>='
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: 1.0.3
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - '>='
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: 1.0.3
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: sinatra
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -251,6 +251,8 @@ files:
251
251
  - Rakefile
252
252
  - bin/eye
253
253
  - bin/loader_eye
254
+ - examples/notify.eye
255
+ - examples/process_thin.rb
254
256
  - examples/processes/em.rb
255
257
  - examples/processes/forking.rb
256
258
  - examples/processes/sample.rb
@@ -259,6 +261,7 @@ files:
259
261
  - examples/rbenv.eye
260
262
  - examples/sidekiq.eye
261
263
  - examples/test.eye
264
+ - examples/thin-farm.eye
262
265
  - examples/unicorn.eye
263
266
  - eye.gemspec
264
267
  - lib/eye.rb
@@ -270,7 +273,6 @@ files:
270
273
  - lib/eye/checker/http.rb
271
274
  - lib/eye/checker/memory.rb
272
275
  - lib/eye/checker/socket.rb
273
- - lib/eye/checker/validation.rb
274
276
  - lib/eye/child_process.rb
275
277
  - lib/eye/client.rb
276
278
  - lib/eye/control.rb
@@ -292,6 +294,7 @@ files:
292
294
  - lib/eye/dsl/process_opts.rb
293
295
  - lib/eye/dsl/pure_opts.rb
294
296
  - lib/eye/dsl/validate.rb
297
+ - lib/eye/dsl/validation.rb
295
298
  - lib/eye/group.rb
296
299
  - lib/eye/group/chain.rb
297
300
  - lib/eye/io/unix_server.rb