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
fd57abd9
Commit
fd57abd9
authored
Mar 23, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finally fleshing out links
parent
f3813529
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
noah.rb
lib/noah.rb
+6
-6
link.rb
lib/noah/models/link.rb
+2
-4
link_member.rb
lib/noah/models/link_member.rb
+18
-0
No files found.
lib/noah.rb
View file @
fd57abd9
module
Noah
PROTECTED_PATHS
=
%w[applications configurations hosts services watches ark noah]
PATH_MAPPING
=
{
"
Noah::Application"
=>
"//noah/a
pplication"
,
"
Noah::Service"
=>
"//noah/s
ervice"
,
"
Noah::Configuration"
=>
"//noah/c
onfiguration"
,
"
Noah::Host"
=>
"//noah/h
ost"
,
"
Noah::Tag"
=>
"//noah/t
ag"
,
"
Noah::Ephemeral"
=>
"//noah/e
phemeral"
}
PATH_MAPPING
=
{
"
applications"
=>
"A
pplication"
,
"
services"
=>
"S
ervice"
,
"
configurations"
=>
"C
onfiguration"
,
"
hosts"
=>
"H
ost"
,
"
tags"
=>
"T
ag"
,
"
ephemeral"
=>
"E
phemeral"
}
end
begin
require
'yajl'
...
...
lib/noah/models/link.rb
View file @
fd57abd9
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'link_member'
)
module
Noah
class
Link
<
Model
attribute
:path
attribute
:source
list
:nodes
,
LinkMember
index
:path
index
:source
def
validate
super
assert_present
:path
assert_present
:source
assert_unique
[
:path
,
:source
]
end
# Nothing to see yet.
# This will be for creating "overlays" or "link" relationships
...
...
lib/noah/models/link_member.rb
0 → 100644
View file @
fd57abd9
module
Noah
class
LinkMember
class
<<
self
def
create
(
path
)
path_to_instance
(
path
)
end
protected
def
path_to_instance
(
path
)
p
=
path
.
split
(
'/'
)
model
,
name
=
p
[
1
],
p
[
2
]
x
=
instance_eval
(
Noah
::
PATH_MAPPING
[
model
])
x
.
find
(
:name
=>
name
).
first
end
end
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