noah 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/noah/helpers.rb +9 -0
- data/lib/noah/models/link.rb +1 -1
- data/lib/noah/routes/links.rb +9 -4
- data/lib/noah/version.rb +1 -1
- data/views/index.haml +10 -9
- metadata +2 -2
data/lib/noah/helpers.rb
CHANGED
@@ -82,6 +82,15 @@ module Noah
|
|
82
82
|
r.to_json
|
83
83
|
end
|
84
84
|
|
85
|
+
def find_named_link(path)
|
86
|
+
link = Noah::Link.find(:path => "/"+path).first
|
87
|
+
if link.nil?
|
88
|
+
# try finding it wihtout the slash
|
89
|
+
link = Noah::Link.find(:path => path).first
|
90
|
+
(halt 404) if link.nil?
|
91
|
+
end
|
92
|
+
return link
|
93
|
+
end
|
85
94
|
def add_config_to_app(appname, config_hash)
|
86
95
|
begin
|
87
96
|
config = Noah::Configuration.find_or_create(config_hash)
|
data/lib/noah/models/link.rb
CHANGED
data/lib/noah/routes/links.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
class Noah::App
|
2
2
|
|
3
|
+
get '/:link_name/:model_name/:item/?' do |path, model, item|
|
4
|
+
link_name = find_named_link(path)
|
5
|
+
(halt 404) if link_name.to_hash.has_key?(model.to_sym) == false
|
6
|
+
(halt 404) if link_name.to_hash[model.to_sym].has_key?(item) == false
|
7
|
+
link_name.to_hash[model.to_sym][item].merge({:name => item}).to_json
|
8
|
+
end
|
9
|
+
|
3
10
|
get '/:link_name/:model_name/?' do |path, model|
|
4
|
-
link_name =
|
5
|
-
(halt 404) if link_name.nil?
|
11
|
+
link_name = find_named_link(path)
|
6
12
|
(halt 404) if link_name.to_hash.has_key?(model.to_sym) == false
|
7
13
|
link_name.to_hash[model.to_sym].to_json
|
8
14
|
end
|
9
15
|
|
10
16
|
get '/:link_name/?' do |path|
|
11
|
-
link_name =
|
12
|
-
(halt 404) if link_name.nil?
|
17
|
+
link_name = find_named_link(path)
|
13
18
|
link_name.to_json
|
14
19
|
end
|
15
20
|
|
data/lib/noah/version.rb
CHANGED
data/views/index.haml
CHANGED
@@ -4,6 +4,11 @@
|
|
4
4
|
|
5
5
|
#header
|
6
6
|
%h1 Sample links
|
7
|
+
%p If these links return 404 messages, that simply means the sample data has not been populated.
|
8
|
+
%p You can click the "All" links on each category to see if there is any data for those object types.
|
9
|
+
%p The best way to interact with Noah is via API calls.
|
10
|
+
%a{:href => "http://goo.gl/jYqp2"} Documentation
|
11
|
+
|
7
12
|
%h2 System Information
|
8
13
|
%ul
|
9
14
|
%li
|
@@ -18,7 +23,7 @@
|
|
18
23
|
%li
|
19
24
|
%a{:href => "hosts/localhost"} localhost (this server)
|
20
25
|
%li
|
21
|
-
%a{:href => "hosts/localhost/noah"} localhost noah service
|
26
|
+
%a{:href => "hosts/localhost/services/noah"} localhost noah service
|
22
27
|
#header
|
23
28
|
%h2 Services
|
24
29
|
%ul
|
@@ -36,22 +41,18 @@
|
|
36
41
|
%li
|
37
42
|
%a{:href => "applications/noah"} Noah Application entry
|
38
43
|
%li
|
39
|
-
%a{:href => "applications/noah/
|
44
|
+
%a{:href => "applications/noah/configurations/redis_url"} Noah Redis configuration entry
|
40
45
|
#header
|
41
46
|
%h2 Configurations
|
42
47
|
%ul
|
43
48
|
%li
|
44
49
|
%a{:href => "configurations/"} All registered Configurations
|
45
50
|
%li
|
46
|
-
%a{:href => "configurations/
|
47
|
-
%li
|
48
|
-
%a{:href => "configurations/myrailsapp1"} myrailsapp1 Configuration entry
|
49
|
-
%li
|
50
|
-
%a{:href => "configurations/myrestapp1"} myrestapp1 Configuration entry
|
51
|
+
%a{:href => "configurations/redis_url"} A Redis URL Configuration entry
|
51
52
|
%li
|
52
|
-
%a{:href => "configurations/
|
53
|
+
%a{:href => "configurations/database.yml"} database.yml file (most likely will return JSON representation. Send "Accept: application/octet" headers for raw version)
|
53
54
|
%li
|
54
|
-
%a{:href => "configurations/
|
55
|
+
%a{:href => "configurations/config.json"} config.json file (see above note about headers)
|
55
56
|
#header
|
56
57
|
%h2 Links
|
57
58
|
%ul
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: noah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John E. Vincent
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-03 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|