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
c34fadbb
Commit
c34fadbb
authored
May 03, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating sample index page with modified links
parent
bc9007be
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
23 deletions
+30
-23
helpers.rb
lib/noah/helpers.rb
+9
-0
links.rb
lib/noah/routes/links.rb
+10
-13
version.rb
lib/noah/version.rb
+1
-1
index.haml
views/index.haml
+10
-9
No files found.
lib/noah/helpers.rb
View file @
c34fadbb
...
...
@@ -82,6 +82,15 @@ module Noah
r
.
to_json
end
def
find_named_link
(
path
)
link
=
Noah
::
Link
.
find
(
:path
=>
"/"
+
path
).
first
if
link
.
nil?
# try finding it wihtout the slash
link
=
Noah
::
Link
.
find
(
:path
=>
path
).
first
(
halt
404
)
if
link
.
nil?
end
return
link
end
def
add_config_to_app
(
appname
,
config_hash
)
begin
config
=
Noah
::
Configuration
.
find_or_create
(
config_hash
)
...
...
lib/noah/routes/links.rb
View file @
c34fadbb
class
Noah
::
App
get
'/:link_name/:model_name/:item/?'
do
|
path
,
model
,
item
|
link_name
=
find_named_link
(
path
)
(
halt
404
)
if
link_name
.
to_hash
.
has_key?
(
model
.
to_sym
)
==
false
(
halt
404
)
if
link_name
.
to_hash
[
model
.
to_sym
].
has_key?
(
item
)
==
false
link_name
.
to_hash
[
model
.
to_sym
][
item
].
merge
({
:name
=>
item
}).
to_json
end
get
'/:link_name/:model_name/?'
do
|
path
,
model
|
link_name
=
Noah
::
Link
.
find
(
:path
=>
"/"
+
path
).
first
if
link_name
.
nil?
# So maybe they forgot to add the path with a leading slash?
link_name
=
Noah
::
Link
.
find
(
:path
=>
path
).
first
(
halt
404
)
if
link_name
.
nil?
end
link_name
=
find_named_link
(
path
)
(
halt
404
)
if
link_name
.
to_hash
.
has_key?
(
model
.
to_sym
)
==
false
link_name
.
to_hash
[
model
.
to_sym
].
to_json
end
get
'/:link_name/?'
do
|
link
|
link_name
=
Noah
::
Link
.
find
(
:path
=>
"/"
+
link
).
first
if
link_name
.
nil?
# So maybe they forgot to add the path with a leading slash?
link_name
=
Noah
::
Link
.
find
(
:path
=>
link
).
first
(
halt
404
)
if
link_name
.
nil?
end
get
'/:link_name/?'
do
|
path
|
link_name
=
find_named_link
(
path
)
link_name
.
to_json
end
...
...
lib/noah/version.rb
View file @
c34fadbb
module
Noah
VERSION
=
"0.8.
1
"
VERSION
=
"0.8.
2
"
end
views/index.haml
View file @
c34fadbb
...
...
@@ -4,6 +4,11 @@
#header
%h1
Sample links
%p
If these links return 404 messages, that simply means the sample data has not been populated.
%p
You can click the "All" links on each category to see if there is any data for those object types.
%p
The best way to interact with Noah is via API calls.
%a
{
:href
=>
"http://goo.gl/jYqp2"
}
Documentation
%h2
System Information
%ul
%li
...
...
@@ -18,7 +23,7 @@
%li
%a
{
:href
=>
"hosts/localhost"
}
localhost (this server)
%li
%a
{
:href
=>
"hosts/localhost/noah"
}
localhost noah service
%a
{
:href
=>
"hosts/localhost/
services/
noah"
}
localhost noah service
#header
%h2
Services
%ul
...
...
@@ -36,22 +41,18 @@
%li
%a
{
:href
=>
"applications/noah"
}
Noah Application entry
%li
%a
{
:href
=>
"applications/noah/
redis
"
}
Noah Redis configuration entry
%a
{
:href
=>
"applications/noah/
configurations/redis_url
"
}
Noah Redis configuration entry
#header
%h2
Configurations
%ul
%li
%a
{
:href
=>
"configurations/"
}
All registered Configurations
%li
%a
{
:href
=>
"configurations/noah"
}
Noah Configuration entry
%li
%a
{
:href
=>
"configurations/myrailsapp1"
}
myrailsapp1 Configuration entry
%li
%a
{
:href
=>
"configurations/myrestapp1"
}
myrestapp1 Configuration entry
%a
{
:href
=>
"configurations/redis_url"
}
A Redis URL Configuration entry
%li
%a
{
:href
=>
"configurations/
myrailsapp1/database.yml"
}
database.yml file for myrailsapp1 (should return the proper content-type
)
%a
{
:href
=>
"configurations/
database.yml"
}
database.yml file (most likely will return JSON representation. Send "Accept: application/octet" headers for raw version
)
%li
%a
{
:href
=>
"configurations/
myrestapp1/config.json"
}
config.json file for myrestapp1
%a
{
:href
=>
"configurations/
config.json"
}
config.json file (see above note about headers)
#header
%h2
Links
%ul
...
...
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