noah 0.0.5-jruby → 0.1-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +10 -0
  3. data/LICENSE +201 -0
  4. data/README.md +68 -212
  5. data/Rakefile +65 -41
  6. data/TODO.md +65 -0
  7. data/bin/noah +2 -1
  8. data/bin/noah-watcher.rb +103 -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 +33 -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 +6 -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/custom_watcher.rb +79 -0
  33. data/lib/noah/ephemeral_routes.rb +47 -0
  34. data/lib/noah/helpers.rb +37 -14
  35. data/lib/noah/host_routes.rb +69 -0
  36. data/lib/noah/models.rb +86 -5
  37. data/lib/noah/models/applications.rb +41 -0
  38. data/lib/noah/models/configurations.rb +49 -0
  39. data/lib/noah/models/ephemerals.rb +54 -0
  40. data/lib/noah/models/hosts.rb +56 -0
  41. data/lib/noah/models/services.rb +54 -0
  42. data/lib/noah/models/watchers.rb +62 -0
  43. data/lib/noah/passthrough.rb +11 -0
  44. data/lib/noah/service_routes.rb +71 -0
  45. data/lib/noah/validations.rb +1 -0
  46. data/lib/noah/validations/watcher_validations.rb +48 -0
  47. data/lib/noah/version.rb +1 -1
  48. data/lib/noah/watcher_routes.rb +45 -0
  49. data/noah.gemspec +25 -17
  50. data/spec/application_spec.rb +30 -30
  51. data/spec/configuration_spec.rb +78 -14
  52. data/spec/ephemeral_spec.rb +59 -0
  53. data/spec/host_spec.rb +21 -21
  54. data/spec/noahapp_application_spec.rb +6 -6
  55. data/spec/noahapp_configuration_spec.rb +5 -5
  56. data/spec/noahapp_ephemeral_spec.rb +115 -0
  57. data/spec/noahapp_host_spec.rb +3 -3
  58. data/spec/noahapp_service_spec.rb +10 -10
  59. data/spec/noahapp_watcher_spec.rb +123 -0
  60. data/spec/service_spec.rb +27 -27
  61. data/spec/spec_helper.rb +13 -22
  62. data/spec/support/db/.keep +0 -0
  63. data/spec/support/test-redis.conf +8 -0
  64. data/spec/watcher_spec.rb +62 -0
  65. data/views/index.haml +21 -15
  66. metadata +189 -146
  67. data/Gemfile.lock +0 -83
  68. data/doc/coverage/index.html +0 -138
  69. data/doc/coverage/jquery-1.3.2.min.js +0 -19
  70. data/doc/coverage/jquery.tablesorter.min.js +0 -15
  71. data/doc/coverage/lib-helpers_rb.html +0 -393
  72. data/doc/coverage/lib-models_rb.html +0 -1449
  73. data/doc/coverage/noah_rb.html +0 -2019
  74. data/doc/coverage/print.css +0 -12
  75. data/doc/coverage/rcov.js +0 -42
  76. data/doc/coverage/screen.css +0 -270
  77. data/lib/noah/applications.rb +0 -46
  78. data/lib/noah/configurations.rb +0 -49
  79. data/lib/noah/hosts.rb +0 -54
  80. data/lib/noah/services.rb +0 -57
  81. 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