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
f2f3bfc7
Commit
f2f3bfc7
authored
Jan 22, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup/DRY/exception handling changes
parent
54564437
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
166 additions
and
186 deletions
+166
-186
app.rb
app.rb
+143
-180
config.ru
config.ru
+3
-2
helpers.rb
helpers.rb
+12
-4
404.erb
views/404.erb
+4
-0
500.erb
views/500.erb
+4
-0
No files found.
app.rb
View file @
f2f3bfc7
This diff is collapsed.
Click to expand it.
config.ru
View file @
f2f3bfc7
...
...
@@ -7,8 +7,9 @@ require File.join(File.dirname(__FILE__), 'app')
set
:env
,
:development
set
:root
,
File
.
dirname
(
__FILE__
)
set
:server
,
%[thin mongrel webrick]
set
:logging
,
true
if
development?
set
:raise_errors
,
true
if
development?
set
:logging
,
true
set
:raise_errors
,
false
set
:show_exceptions
,
false
disable
:run
run
Sinatra
::
Application
helpers.rb
View file @
f2f3bfc7
...
...
@@ -16,13 +16,21 @@ helpers do
end
def
host_service
(
hostname
,
servicename
)
id
=
Host
.
find
(
:name
=>
hostname
).
first
.
id
Service
.
find
(
:host_id
=>
id
,
:name
=>
servicename
).
first
h
=
Host
.
find
(
:name
=>
hostname
).
first
if
h
.
nil?
nil
else
Service
.
find
(
:host_id
=>
h
.
id
,
:name
=>
servicename
).
first
end
end
def
host_services
(
hostname
)
id
=
Host
.
find
(
:name
=>
hostname
).
first
.
id
Services
.
all
(
:host_id
=>
id
)
h
=
Host
.
find
(
:name
=>
hostname
).
first
if
h
.
nil?
nil
else
Services
.
all
(
:host_id
=>
id
)
end
end
def
application
(
opts
=
{})
...
...
views/404.erb
0 → 100644
View file @
f2f3bfc7
{
"result":"failure",
"error_message":"Resource not found"
}
views/500.erb
0 → 100644
View file @
f2f3bfc7
{
"result":"failure",
"error_message":"
<%=
request
.
env
[
'sinatra.error'
].
message
%>
"
}
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