noah 0.0.5-jruby → 0.1-jruby
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/.gemtest +0 -0
- data/.gitignore +10 -0
- data/LICENSE +201 -0
- data/README.md +68 -212
- data/Rakefile +65 -41
- data/TODO.md +65 -0
- data/bin/noah +2 -1
- data/bin/noah-watcher.rb +103 -0
- data/config.ru +6 -3
- data/config/warble.rb +18 -0
- data/examples/README.md +116 -0
- data/examples/cluster.ru +2 -0
- data/examples/custom-watcher.rb +10 -0
- data/examples/httpclient-server.rb +7 -0
- data/examples/httpclient.rb +12 -0
- data/examples/httpclient2.rb +28 -0
- data/examples/js/FABridge.js +1452 -0
- data/examples/js/WebSocketMain.swf +830 -0
- data/examples/js/swfobject.js +851 -0
- data/examples/js/web_socket.js +312 -0
- data/examples/logger.rb +11 -0
- data/examples/reconfiguring-sinatra-watcher.rb +11 -0
- data/examples/reconfiguring-sinatra.rb +33 -0
- data/examples/simple-post.rb +17 -0
- data/examples/websocket.html +24 -0
- data/examples/websocket.rb +41 -0
- data/lib/noah.rb +6 -8
- data/lib/noah/app.rb +20 -268
- data/lib/noah/application_routes.rb +70 -0
- data/lib/noah/ark.rb +0 -0
- data/lib/noah/configuration_routes.rb +81 -0
- data/lib/noah/custom_watcher.rb +79 -0
- data/lib/noah/ephemeral_routes.rb +47 -0
- data/lib/noah/helpers.rb +37 -14
- data/lib/noah/host_routes.rb +69 -0
- data/lib/noah/models.rb +86 -5
- data/lib/noah/models/applications.rb +41 -0
- data/lib/noah/models/configurations.rb +49 -0
- data/lib/noah/models/ephemerals.rb +54 -0
- data/lib/noah/models/hosts.rb +56 -0
- data/lib/noah/models/services.rb +54 -0
- data/lib/noah/models/watchers.rb +62 -0
- data/lib/noah/passthrough.rb +11 -0
- data/lib/noah/service_routes.rb +71 -0
- data/lib/noah/validations.rb +1 -0
- data/lib/noah/validations/watcher_validations.rb +48 -0
- data/lib/noah/version.rb +1 -1
- data/lib/noah/watcher_routes.rb +45 -0
- data/noah.gemspec +25 -17
- data/spec/application_spec.rb +30 -30
- data/spec/configuration_spec.rb +78 -14
- data/spec/ephemeral_spec.rb +59 -0
- data/spec/host_spec.rb +21 -21
- data/spec/noahapp_application_spec.rb +6 -6
- data/spec/noahapp_configuration_spec.rb +5 -5
- data/spec/noahapp_ephemeral_spec.rb +115 -0
- data/spec/noahapp_host_spec.rb +3 -3
- data/spec/noahapp_service_spec.rb +10 -10
- data/spec/noahapp_watcher_spec.rb +123 -0
- data/spec/service_spec.rb +27 -27
- data/spec/spec_helper.rb +13 -22
- data/spec/support/db/.keep +0 -0
- data/spec/support/test-redis.conf +8 -0
- data/spec/watcher_spec.rb +62 -0
- data/views/index.haml +21 -15
- metadata +189 -146
- data/Gemfile.lock +0 -83
- data/doc/coverage/index.html +0 -138
- data/doc/coverage/jquery-1.3.2.min.js +0 -19
- data/doc/coverage/jquery.tablesorter.min.js +0 -15
- data/doc/coverage/lib-helpers_rb.html +0 -393
- data/doc/coverage/lib-models_rb.html +0 -1449
- data/doc/coverage/noah_rb.html +0 -2019
- data/doc/coverage/print.css +0 -12
- data/doc/coverage/rcov.js +0 -42
- data/doc/coverage/screen.css +0 -270
- data/lib/noah/applications.rb +0 -46
- data/lib/noah/configurations.rb +0 -49
- data/lib/noah/hosts.rb +0 -54
- data/lib/noah/services.rb +0 -57
- 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
|