noah 0.0.5 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +9 -0
  3. data/LICENSE +201 -0
  4. data/README.md +68 -212
  5. data/Rakefile +70 -41
  6. data/TODO.md +59 -0
  7. data/bin/noah +2 -1
  8. data/bin/noah-watcher.rb +93 -0
  9. data/config.ru +6 -3
  10. data/config/warble.rb +18 -0
  11. data/examples/README.md +116 -0
  12. data/examples/cluster.ru +2 -0
  13. data/examples/custom-watcher.rb +10 -0
  14. data/examples/httpclient-server.rb +7 -0
  15. data/examples/httpclient.rb +12 -0
  16. data/examples/httpclient2.rb +28 -0
  17. data/examples/js/FABridge.js +1452 -0
  18. data/examples/js/WebSocketMain.swf +830 -0
  19. data/examples/js/swfobject.js +851 -0
  20. data/examples/js/web_socket.js +312 -0
  21. data/examples/logger.rb +11 -0
  22. data/examples/reconfiguring-sinatra-watcher.rb +11 -0
  23. data/examples/reconfiguring-sinatra.rb +32 -0
  24. data/examples/simple-post.rb +17 -0
  25. data/examples/websocket.html +24 -0
  26. data/examples/websocket.rb +41 -0
  27. data/lib/noah.rb +5 -8
  28. data/lib/noah/app.rb +20 -268
  29. data/lib/noah/application_routes.rb +70 -0
  30. data/lib/noah/ark.rb +0 -0
  31. data/lib/noah/configuration_routes.rb +81 -0
  32. data/lib/noah/ephemeral_routes.rb +19 -0
  33. data/lib/noah/helpers.rb +12 -14
  34. data/lib/noah/host_routes.rb +69 -0
  35. data/lib/noah/models.rb +86 -5
  36. data/lib/noah/models/applications.rb +41 -0
  37. data/lib/noah/models/configurations.rb +49 -0
  38. data/lib/noah/models/ephemerals.rb +33 -0
  39. data/lib/noah/models/hosts.rb +56 -0
  40. data/lib/noah/models/services.rb +54 -0
  41. data/lib/noah/models/watchers.rb +54 -0
  42. data/lib/noah/passthrough.rb +11 -0
  43. data/lib/noah/service_routes.rb +71 -0
  44. data/lib/noah/validations.rb +1 -0
  45. data/lib/noah/validations/watcher_validations.rb +48 -0
  46. data/lib/noah/version.rb +1 -1
  47. data/lib/noah/watcher.rb +75 -0
  48. data/lib/noah/watcher_routes.rb +12 -0
  49. data/lib/vendor/em-hiredis/Gemfile +4 -0
  50. data/lib/vendor/em-hiredis/README.md +61 -0
  51. data/lib/vendor/em-hiredis/Rakefile +2 -0
  52. data/lib/vendor/em-hiredis/em-hiredis-0.0.1.gem +0 -0
  53. data/lib/vendor/em-hiredis/em-hiredis.gemspec +23 -0
  54. data/lib/vendor/em-hiredis/lib/em-hiredis.rb +22 -0
  55. data/lib/vendor/em-hiredis/lib/em-hiredis/client.rb +131 -0
  56. data/lib/vendor/em-hiredis/lib/em-hiredis/connection.rb +61 -0
  57. data/lib/vendor/em-hiredis/lib/em-hiredis/event_emitter.rb +29 -0
  58. data/lib/vendor/em-hiredis/lib/em-hiredis/version.rb +5 -0
  59. data/noah.gemspec +21 -17
  60. data/spec/application_spec.rb +30 -30
  61. data/spec/configuration_spec.rb +81 -14
  62. data/spec/ephemeral_spec.rb +52 -0
  63. data/spec/host_spec.rb +21 -21
  64. data/spec/noahapp_application_spec.rb +6 -6
  65. data/spec/noahapp_configuration_spec.rb +3 -3
  66. data/spec/noahapp_host_spec.rb +2 -2
  67. data/spec/noahapp_service_spec.rb +9 -9
  68. data/spec/noahapp_watcher_spec.rb +34 -0
  69. data/spec/service_spec.rb +27 -27
  70. data/spec/spec_helper.rb +13 -22
  71. data/spec/support/db/.keep +0 -0
  72. data/spec/support/test-redis.conf +8 -0
  73. data/spec/watcher_spec.rb +62 -0
  74. data/views/index.haml +21 -15
  75. metadata +124 -148
  76. data/Gemfile.lock +0 -85
  77. data/doc/coverage/index.html +0 -138
  78. data/doc/coverage/jquery-1.3.2.min.js +0 -19
  79. data/doc/coverage/jquery.tablesorter.min.js +0 -15
  80. data/doc/coverage/lib-helpers_rb.html +0 -393
  81. data/doc/coverage/lib-models_rb.html +0 -1449
  82. data/doc/coverage/noah_rb.html +0 -2019
  83. data/doc/coverage/print.css +0 -12
  84. data/doc/coverage/rcov.js +0 -42
  85. data/doc/coverage/screen.css +0 -270
  86. data/lib/noah/applications.rb +0 -46
  87. data/lib/noah/configurations.rb +0 -49
  88. data/lib/noah/hosts.rb +0 -54
  89. data/lib/noah/services.rb +0 -57
  90. data/lib/noah/watchers.rb +0 -18
data/lib/noah/services.rb DELETED
@@ -1,57 +0,0 @@
1
- class Service < Ohm::Model
2
- include Ohm::Typecast
3
- include Ohm::Timestamping
4
- include Ohm::Callbacks
5
- include Ohm::ExtraValidations
6
-
7
- attribute :name
8
- attribute :status
9
- reference :host, Host
10
-
11
- index :name
12
- index :status
13
-
14
- def validate
15
- assert_present :name
16
- assert_present :status
17
- assert_present :host_id
18
- assert_unique [:name, :host_id]
19
- assert_member :status, ["up", "down", "pending"]
20
- end
21
-
22
- def to_hash
23
- super.merge(:name => name, :status => status, :updated_at => updated_at, :host => Host[host_id].name)
24
- end
25
-
26
- def is_new?
27
- self.created_at == self.updated_at
28
- end
29
-
30
- class << self
31
- def find_or_create(opts = {})
32
- begin
33
- # convert passed host object to host_id if passed
34
- if opts.has_key?(:host)
35
- opts.merge!({:host_id => opts[:host].id})
36
- opts.reject!{|key, value| key == :host}
37
- end
38
- # exclude requested status from lookup
39
- s = find(opts.reject{|key,value| key == :status}).first
40
- service = s.nil? ? create(opts) : s
41
- service.status = opts[:status]
42
- if service.valid?
43
- service.save
44
- end
45
- service
46
- rescue Exception => e
47
- e.message
48
- end
49
- end
50
- end
51
- end
52
-
53
- class Services
54
- def self.all(options = {})
55
- options.empty? ? Service.all.sort : Service.find(options).sort
56
- end
57
- end
data/lib/noah/watchers.rb DELETED
@@ -1,18 +0,0 @@
1
- class Watcher < Ohm::Model #NYI
2
- include Ohm::Typecast
3
- include Ohm::Timestamping
4
- include Ohm::Callbacks
5
-
6
- attribute :client
7
- attribute :endpoint
8
- attribute :event
9
- attribute :action
10
-
11
- index :client
12
- index :event
13
-
14
- def validate
15
- assert_present :client, :endpoint, :event, :action
16
- assert_unique [:client, :endpoint, :event, :action]
17
- end
18
- end