Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
9bcf0599
Commit
9bcf0599
authored
Feb 25, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving name back to models in prep for watchers
parent
89005432
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
12 deletions
+24
-12
models.rb
lib/noah/models.rb
+0
-6
applications.rb
lib/noah/models/applications.rb
+8
-1
configurations.rb
lib/noah/models/configurations.rb
+3
-0
hosts.rb
lib/noah/models/hosts.rb
+3
-0
services.rb
lib/noah/models/services.rb
+3
-0
watchers.rb
lib/noah/models/watchers.rb
+7
-5
No files found.
lib/noah/models.rb
View file @
9bcf0599
...
...
@@ -9,8 +9,6 @@ module Noah
model
.
send
:include
,
Ohm
::
Callbacks
model
.
send
:include
,
Ohm
::
ExtraValidations
model
.
attribute
:name
model
.
index
:name
model
.
after
:save
,
:notify_via_redis_save
model
.
after
:create
,
:notify_via_redis_create
model
.
after
:update
,
:notify_via_redis_update
...
...
@@ -21,10 +19,6 @@ module Noah
end
module
ModelClassMethods
def
validate
super
assert_present
:name
end
def
is_new?
self
.
created_at
==
self
.
updated_at
...
...
lib/noah/models/applications.rb
View file @
9bcf0599
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'configurations'
)
module
Noah
class
Application
<
Model
attribute
:name
collection
:configurations
,
Configuration
index
:name
def
validate
super
assert_present
:name
end
def
to_hash
arr
=
[]
configurations
.
sort
.
each
{
|
c
|
arr
<<
c
.
to_hash
}
...
...
lib/noah/models/configurations.rb
View file @
9bcf0599
module
Noah
class
Configuration
<
Model
attribute
:name
attribute
:format
attribute
:body
attribute
:new_record
reference
:application
,
Application
index
:name
index
:format
index
:body
def
validate
super
assert_present
:name
assert_present
:format
assert_present
:body
assert_present
:application_id
...
...
lib/noah/models/hosts.rb
View file @
9bcf0599
...
...
@@ -4,13 +4,16 @@ module Noah
# Host model
# @return {Host} a {Host} object
attribute
:name
attribute
:status
collection
:services
,
Service
index
:name
index
:status
def
validate
super
assert_present
:name
assert_present
:status
assert_unique
:name
assert_member
:status
,
[
"up"
,
"down"
,
"pending"
]
...
...
lib/noah/models/services.rb
View file @
9bcf0599
...
...
@@ -2,13 +2,16 @@ module Noah
class
Service
<
Model
attribute
:name
attribute
:status
reference
:host
,
Host
index
:name
index
:status
def
validate
super
assert_present
:name
assert_present
:status
assert_present
:host_id
assert_unique
[
:name
,
:host_id
]
...
...
lib/noah/models/watchers.rb
View file @
9bcf0599
module
Noah
class
Watcher
<
Model
#NYI
# This is a "special rainbow" of a class
attribute
:client
attribute
:pattern
attribute
:endpoint
attribute
:event
attribute
:action
index
:client
index
:event
index
:pattern
index
:endpoint
def
validate
assert_present
:client
,
:endpoint
,
:event
,
:action
assert_unique
[
:client
,
:endpoint
,
:event
,
:action
]
super
assert_present
:client
,
:endpoint
,
:pattern
assert_unique
[
:client
,
:endpoint
,
:pattern
]
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment