chef-server-api 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +201 -0
- data/README.rdoc +92 -0
- data/Rakefile +59 -0
- data/app/controllers/application.rb +289 -0
- data/app/controllers/clients.rb +111 -0
- data/app/controllers/cookbooks.rb +213 -0
- data/app/controllers/data.rb +75 -0
- data/app/controllers/data_item.rb +108 -0
- data/app/controllers/exceptions.rb +40 -0
- data/app/controllers/main.rb +18 -0
- data/app/controllers/nodes.rb +102 -0
- data/app/controllers/roles.rb +73 -0
- data/app/controllers/search.rb +60 -0
- data/app/controllers/users.rb +77 -0
- data/app/helpers/application_helper.rb +163 -0
- data/app/helpers/exceptions_helper.rb +6 -0
- data/app/helpers/global_helpers.rb +25 -0
- data/app/helpers/nodes_helper.rb +26 -0
- data/app/helpers/roles_helper.rb +5 -0
- data/app/helpers/tarball_helper.rb +82 -0
- data/app/views/exceptions/bad_request.json.erb +1 -0
- data/app/views/exceptions/internal_server_error.html.erb +216 -0
- data/app/views/exceptions/not_acceptable.html.haml +5 -0
- data/app/views/exceptions/not_found.html.erb +47 -0
- data/app/views/exceptions/standard_error.html.erb +217 -0
- data/app/views/layout/chef_server_api.html.haml +23 -0
- data/app/views/main/index.html.haml +5 -0
- data/config/init.rb +45 -0
- data/config/router.rb +6 -0
- data/lib/chef-server-api.rb +158 -0
- data/lib/chef-server-api/merbtasks.rb +103 -0
- data/lib/chef-server-api/slicetasks.rb +20 -0
- data/lib/chef-server-api/spectasks.rb +53 -0
- data/public/images/avatar.png +0 -0
- data/public/images/indicator.gif +0 -0
- data/public/images/merb.jpg +0 -0
- data/public/stylesheets/base.css +336 -0
- data/public/stylesheets/chef.css +157 -0
- data/public/stylesheets/themes/bec-green/style.css +290 -0
- data/public/stylesheets/themes/bec/style.css +301 -0
- data/public/stylesheets/themes/blue/style.css +280 -0
- data/public/stylesheets/themes/default/style.css +267 -0
- data/public/stylesheets/themes/djime-cerulean/style.css +298 -0
- data/public/stylesheets/themes/kathleene/style.css +272 -0
- data/public/stylesheets/themes/orange/style.css +263 -0
- data/public/stylesheets/themes/reidb-greenish/style.css +301 -0
- data/stubs/app/controllers/application.rb +2 -0
- data/stubs/app/controllers/main.rb +2 -0
- metadata +193 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
module Merb
|
20
|
+
module ChefServerApi
|
21
|
+
|
22
|
+
module GlobalHelpers
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: AJ Christensen (<aj@junglist.gen.nz>)
|
4
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Merb
|
21
|
+
module ChefServerApi
|
22
|
+
module NodesHelper
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Christopher Walters (<cw@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
module Merb
|
20
|
+
module ChefServerApi
|
21
|
+
module TarballHelper
|
22
|
+
|
23
|
+
class FileParameterException < StandardError ; end
|
24
|
+
|
25
|
+
def validate_file_parameter(cookbook_name, file_param)
|
26
|
+
raise FileParameterException, "missing required parameter: file" unless file_param
|
27
|
+
raise FileParameterException, "invalid parameter: file must be a File" unless file_param.respond_to?(:has_key?) && file_param[:tempfile].respond_to?(:read)
|
28
|
+
tarball_path = file_param[:tempfile].path
|
29
|
+
raise FileParameterException, "invalid tarball: (try creating with 'tar czf cookbook.tar.gz cookbook/')" unless system("tar", "tzf", tarball_path)
|
30
|
+
entry_roots = `tar tzf #{tarball_path}`.split("\n").map{|e|(e.split('/')-['.']).first}.uniq
|
31
|
+
raise FileParameterException, "invalid tarball: tarball root must contain #{cookbook_name}" unless entry_roots.include?(cookbook_name)
|
32
|
+
end
|
33
|
+
|
34
|
+
def cookbook_base
|
35
|
+
[Chef::Config.cookbook_path].flatten.first
|
36
|
+
end
|
37
|
+
|
38
|
+
def cookbook_location(cookbook_name)
|
39
|
+
File.join(cookbook_base, cookbook_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
def cookbook_tarball_location(cookbook_name)
|
43
|
+
File.join(Chef::Config.cookbook_tarball_path, "#{cookbook_name}.tar.gz")
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_or_create_cookbook_tarball_location(cookbook_name)
|
47
|
+
tarball_location = cookbook_tarball_location(cookbook_name)
|
48
|
+
unless File.exists? tarball_location
|
49
|
+
args = ["tar", "-C", cookbook_base, "-czf", tarball_location, cookbook_name]
|
50
|
+
Chef::Log.debug("Tarball for #{cookbook_name} not found, so creating at #{tarball_location} with '#{args.join(' ')}'")
|
51
|
+
FileUtils.mkdir_p(Chef::Config.cookbook_tarball_path)
|
52
|
+
system(*args)
|
53
|
+
end
|
54
|
+
tarball_location
|
55
|
+
end
|
56
|
+
|
57
|
+
def expand_tarball_and_put_in_repository(cookbook_name, file)
|
58
|
+
# untar cookbook tarball into tempdir
|
59
|
+
tempdir = File.join("#{file.path}.data")
|
60
|
+
Chef::Log.debug("Creating #{tempdir} and untarring #{file.path} into it")
|
61
|
+
FileUtils.mkdir_p(tempdir)
|
62
|
+
raise "Could not untar file" unless system("tar", "xzf", file.path, "-C", tempdir)
|
63
|
+
|
64
|
+
cookbook_path = cookbook_location(cookbook_name)
|
65
|
+
tarball_path = cookbook_tarball_location(cookbook_name)
|
66
|
+
|
67
|
+
# clear any existing cookbook components and move tempdir into the repository
|
68
|
+
Chef::Log.debug("Moving #{tempdir} to #{cookbook_path}")
|
69
|
+
FileUtils.rm_rf(cookbook_path)
|
70
|
+
FileUtils.mkdir_p(cookbook_path)
|
71
|
+
Dir[File.join(tempdir, cookbook_name, "*")].each{|e| FileUtils.mv(e, cookbook_path)}
|
72
|
+
|
73
|
+
# clear the existing tarball (if exists) and move the downloaded tarball to the cache
|
74
|
+
Chef::Log.debug("Moving #{file.path} to #{tarball_path}")
|
75
|
+
FileUtils.mkdir_p(Chef::Config.cookbook_tarball_path)
|
76
|
+
FileUtils.rm_f(tarball_path)
|
77
|
+
FileUtils.mv(file.path, tarball_path)
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= { :error => params[:exception], :code => 400 }.to_json %>
|
@@ -0,0 +1,216 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
4
|
+
<title><%= @exception_name %></title>
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
body {
|
7
|
+
font-family:arial;
|
8
|
+
font-size:11px;
|
9
|
+
}
|
10
|
+
h1 {
|
11
|
+
font-size:48px;
|
12
|
+
letter-spacing:-4px;
|
13
|
+
margin:0;
|
14
|
+
line-height:36px;
|
15
|
+
color:#333;
|
16
|
+
}
|
17
|
+
h1 sup {
|
18
|
+
font-size: 0.5em;
|
19
|
+
}
|
20
|
+
h1 sup.error_500, h1 sup.error_400 {
|
21
|
+
color:#990E05;
|
22
|
+
}
|
23
|
+
h1 sup.error_100, h1 sup.error_200 {
|
24
|
+
color:#00BF10;
|
25
|
+
}
|
26
|
+
h1 sup.error_300 {
|
27
|
+
/* pretty sure you cant 'see' status 300
|
28
|
+
errors but if you could I think they
|
29
|
+
would be blue */
|
30
|
+
color:#1B2099;
|
31
|
+
}
|
32
|
+
h2 {
|
33
|
+
font-size:36px;
|
34
|
+
letter-spacing:-3px;
|
35
|
+
margin:0;
|
36
|
+
line-height:28px;
|
37
|
+
color:#444;
|
38
|
+
}
|
39
|
+
a, a:visited {
|
40
|
+
color:#00BF10;
|
41
|
+
}
|
42
|
+
.internalError {
|
43
|
+
width:800px;
|
44
|
+
margin:50px auto;
|
45
|
+
}
|
46
|
+
.header {
|
47
|
+
border-bottom:10px solid #333;
|
48
|
+
margin-bottom:1px;
|
49
|
+
background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7");
|
50
|
+
padding:20px;
|
51
|
+
}
|
52
|
+
table.trace {
|
53
|
+
width:100%;
|
54
|
+
font-family:courier, monospace;
|
55
|
+
letter-spacing:-1px;
|
56
|
+
border-collapse: collapse;
|
57
|
+
border-spacing:0;
|
58
|
+
}
|
59
|
+
table.trace tr td{
|
60
|
+
padding:0;
|
61
|
+
height:26px;
|
62
|
+
font-size:13px;
|
63
|
+
vertical-align:middle;
|
64
|
+
}
|
65
|
+
table.trace tr.file{
|
66
|
+
border-top:2px solid #fff;
|
67
|
+
background-color:#F3F3F3;
|
68
|
+
}
|
69
|
+
table.trace tr.source {
|
70
|
+
background-color:#F8F8F8;
|
71
|
+
display:none;
|
72
|
+
}
|
73
|
+
table.trace .open tr.source {
|
74
|
+
display:table-row;
|
75
|
+
}
|
76
|
+
table.trace tr.file td.expand {
|
77
|
+
width:23px;
|
78
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=);
|
79
|
+
background-position:top left;
|
80
|
+
background-repeat:no-repeat;
|
81
|
+
}
|
82
|
+
table.trace .open tr.file td.expand {
|
83
|
+
width:19px;
|
84
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC);
|
85
|
+
background-position:top left;
|
86
|
+
background-repeat:no-repeat;
|
87
|
+
}
|
88
|
+
table.trace tr.source td.collapse {
|
89
|
+
width:19px;
|
90
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==);
|
91
|
+
background-position:bottom left;
|
92
|
+
background-repeat:no-repeat;
|
93
|
+
background-color:#6F706F;
|
94
|
+
}
|
95
|
+
table.trace tr td.path {
|
96
|
+
padding-left:10px;
|
97
|
+
}
|
98
|
+
table.trace tr td.code {
|
99
|
+
padding-left:35px;
|
100
|
+
white-space: pre;
|
101
|
+
line-height:9px;
|
102
|
+
padding-bottom:10px;
|
103
|
+
}
|
104
|
+
table.trace tr td.code em {
|
105
|
+
font-weight:bold;
|
106
|
+
color:#00BF10;
|
107
|
+
}
|
108
|
+
table.trace tr td.code a {
|
109
|
+
width: 20px;
|
110
|
+
float: left;
|
111
|
+
}
|
112
|
+
table.trace tr td.code .more {
|
113
|
+
color:#666;
|
114
|
+
}
|
115
|
+
table.trace tr td.line {
|
116
|
+
width:30px;
|
117
|
+
text-align:right;
|
118
|
+
padding-right:4px;
|
119
|
+
}
|
120
|
+
.footer {
|
121
|
+
margin-top:5px;
|
122
|
+
font-size:11px;
|
123
|
+
color:#444;
|
124
|
+
text-align:right;
|
125
|
+
}
|
126
|
+
</style>
|
127
|
+
</head>
|
128
|
+
<body>
|
129
|
+
<div class="internalError">
|
130
|
+
|
131
|
+
<div class="header">
|
132
|
+
<h1><%= @exception_name %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1>
|
133
|
+
<% if show_details = ::Merb::Config[:exception_details] -%>
|
134
|
+
<h2><%= @exception.message %></h2>
|
135
|
+
<% else -%>
|
136
|
+
<h2>Sorry about that...</h2>
|
137
|
+
<% end -%>
|
138
|
+
<h3>Parameters</h3>
|
139
|
+
<ul>
|
140
|
+
<% params[:original_params].each do |param, value| %>
|
141
|
+
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
|
142
|
+
<% end %>
|
143
|
+
<%= "<li>None</li>" if params[:original_params].empty? %>
|
144
|
+
</ul>
|
145
|
+
|
146
|
+
<h3>Session</h3>
|
147
|
+
<ul>
|
148
|
+
<% params[:original_session].each do |param, value| %>
|
149
|
+
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
|
150
|
+
<% end %>
|
151
|
+
<%= "<li>None</li>" if params[:original_session].empty? %>
|
152
|
+
</ul>
|
153
|
+
|
154
|
+
<h3>Cookies</h3>
|
155
|
+
<ul>
|
156
|
+
<% params[:original_cookies].each do |param, value| %>
|
157
|
+
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
|
158
|
+
<% end %>
|
159
|
+
<%= "<li>None</li>" if params[:original_cookies].empty? %>
|
160
|
+
</ul>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<% if show_details %>
|
164
|
+
<table class="trace">
|
165
|
+
<% @exception.backtrace.each_with_index do |line, index| %>
|
166
|
+
<tbody class="close">
|
167
|
+
<tr class="file">
|
168
|
+
<td class="expand">
|
169
|
+
</td>
|
170
|
+
<td class="path">
|
171
|
+
<%= (line.match(/^([^:]+)/)[1] rescue 'unknown').sub(/\/((opt|usr)\/local\/lib\/(ruby\/)?(gems\/)?(1.8\/)?(gems\/)?|.+\/app\/)/, '') %>
|
172
|
+
<% unless line.match(/\.erb:/) %>
|
173
|
+
in "<strong><%= line.match(/:in `(.+)'$/)[1] rescue '?' %></strong>"
|
174
|
+
<% else %>
|
175
|
+
(<strong>ERB Template</strong>)
|
176
|
+
<% end %>
|
177
|
+
</td>
|
178
|
+
<td class="line">
|
179
|
+
<a href="txmt://open?url=file://<%=file = (line.match(/^([^:]+)/)[1] rescue 'unknown')%>&line=<%= lineno = line.match(/:([0-9]+):/)[1] rescue '?' %>"><%=lineno%></a>
|
180
|
+
</td>
|
181
|
+
</tr>
|
182
|
+
<tr class="source">
|
183
|
+
<td class="collapse">
|
184
|
+
</td>
|
185
|
+
<td class="code" colspan="2"><% (__caller_lines__(file, lineno, 5) rescue []).each do |llineno, lcode, lcurrent| %>
|
186
|
+
<a href="txmt://open?url=file://<%=file%>&line=<%=llineno%>"><%= llineno %></a><%='<em>' if llineno==lineno.to_i %><%= lcode.size > 90 ? CGI.escapeHTML(lcode[0..90])+'<span class="more">......</span>' : CGI.escapeHTML(lcode) %><%='</em>' if llineno==lineno.to_i %>
|
187
|
+
<% end %>
|
188
|
+
|
189
|
+
</td>
|
190
|
+
</tr>
|
191
|
+
</tbody>
|
192
|
+
<% end %>
|
193
|
+
</table>
|
194
|
+
<script type="text/javascript" charset="utf-8">
|
195
|
+
// swop the open & closed classes
|
196
|
+
els = document.getElementsByTagName('td');
|
197
|
+
for(i=0; i<els.length; i++){
|
198
|
+
if(els[i].className=='expand' || els[i].className=='collapse'){
|
199
|
+
els[i].onclick = function(e){
|
200
|
+
tbody = this.parentNode.parentNode;
|
201
|
+
if(tbody.className=='open'){
|
202
|
+
tbody.className='closed';
|
203
|
+
}else{
|
204
|
+
tbody.className='open';
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
</script>
|
210
|
+
<% end %>
|
211
|
+
<div class="footer">
|
212
|
+
lots of love, from <a href="#">merb</a>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</body>
|
216
|
+
</html>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div id="container">
|
2
|
+
<div id="header-container">
|
3
|
+
<img src="/images/merb.jpg" />
|
4
|
+
<!-- <h1>Mongrel + Erb</h1> -->
|
5
|
+
<h2>pocket rocket web framework</h2>
|
6
|
+
<hr />
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div id="left-container">
|
10
|
+
<h3>Exception:</h3>
|
11
|
+
<p><%= params[:exception] %></p>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div id="main-container">
|
15
|
+
<h3>Welcome to Merb!</h3>
|
16
|
+
<p>Merb is a light-weight MVC framework written in Ruby. We hope you enjoy it.</p>
|
17
|
+
|
18
|
+
<h3>Where can I find help?</h3>
|
19
|
+
<p>If you have any questions or if you can't figure something out, please take a
|
20
|
+
look at our <a href="http://merbivore.com/"> project page</a>,
|
21
|
+
feel free to come chat at irc.freenode.net, channel #merb,
|
22
|
+
or post to <a href="http://groups.google.com/group/merb">merb mailing list</a>
|
23
|
+
on Google Groups.</p>
|
24
|
+
|
25
|
+
<h3>What if I've found a bug?</h3>
|
26
|
+
<p>If you want to file a bug or make your own contribution to Merb,
|
27
|
+
feel free to register and create a ticket at our
|
28
|
+
<a href="http://merb.lighthouseapp.com/">project development page</a>
|
29
|
+
on Lighthouse.</p>
|
30
|
+
|
31
|
+
<h3>How do I edit this page?</h3>
|
32
|
+
<p>You're seeing this page because you need to edit the following files:
|
33
|
+
<ul>
|
34
|
+
<li>config/router.rb <strong><em>(recommended)</em></strong></li>
|
35
|
+
<li>app/views/exceptions/not_found.html.erb <strong><em>(recommended)</em></strong></li>
|
36
|
+
<li>app/views/layout/application.html.erb <strong><em>(change this layout)</em></strong></li>
|
37
|
+
</ul>
|
38
|
+
</p>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="footer-container">
|
42
|
+
<hr />
|
43
|
+
<div class="left"></div>
|
44
|
+
<div class="right">© 2007 the merb dev team</div>
|
45
|
+
<p> </p>
|
46
|
+
</div>
|
47
|
+
</div>
|
@@ -0,0 +1,217 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
4
|
+
<title><%= @exception_name %></title>
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
body {
|
7
|
+
font-family:arial;
|
8
|
+
font-size:11px;
|
9
|
+
}
|
10
|
+
h1 {
|
11
|
+
font-size:48px;
|
12
|
+
letter-spacing:-4px;
|
13
|
+
margin:0;
|
14
|
+
line-height:36px;
|
15
|
+
color:#333;
|
16
|
+
}
|
17
|
+
h1 sup {
|
18
|
+
font-size: 0.5em;
|
19
|
+
}
|
20
|
+
h1 sup.error_500, h1 sup.error_400 {
|
21
|
+
color:#990E05;
|
22
|
+
}
|
23
|
+
h1 sup.error_100, h1 sup.error_200 {
|
24
|
+
color:#00BF10;
|
25
|
+
}
|
26
|
+
h1 sup.error_300 {
|
27
|
+
/* pretty sure you cant 'see' status 300
|
28
|
+
errors but if you could I think they
|
29
|
+
would be blue */
|
30
|
+
color:#1B2099;
|
31
|
+
}
|
32
|
+
h2 {
|
33
|
+
font-size:36px;
|
34
|
+
letter-spacing:-3px;
|
35
|
+
margin:0;
|
36
|
+
line-height:28px;
|
37
|
+
color:#444;
|
38
|
+
}
|
39
|
+
a, a:visited {
|
40
|
+
color:#00BF10;
|
41
|
+
}
|
42
|
+
.internalError {
|
43
|
+
width:800px;
|
44
|
+
margin:50px auto;
|
45
|
+
}
|
46
|
+
.header {
|
47
|
+
border-bottom:10px solid #333;
|
48
|
+
margin-bottom:1px;
|
49
|
+
background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7");
|
50
|
+
padding:20px;
|
51
|
+
}
|
52
|
+
table.trace {
|
53
|
+
width:100%;
|
54
|
+
font-family:courier, monospace;
|
55
|
+
letter-spacing:-1px;
|
56
|
+
border-collapse: collapse;
|
57
|
+
border-spacing:0;
|
58
|
+
}
|
59
|
+
table.trace tr td{
|
60
|
+
padding:0;
|
61
|
+
height:26px;
|
62
|
+
font-size:13px;
|
63
|
+
vertical-align:middle;
|
64
|
+
}
|
65
|
+
table.trace tr.file{
|
66
|
+
border-top:2px solid #fff;
|
67
|
+
background-color:#F3F3F3;
|
68
|
+
}
|
69
|
+
table.trace tr.source {
|
70
|
+
background-color:#F8F8F8;
|
71
|
+
display:none;
|
72
|
+
}
|
73
|
+
table.trace .open tr.source {
|
74
|
+
display:table-row;
|
75
|
+
}
|
76
|
+
table.trace tr.file td.expand {
|
77
|
+
width:23px;
|
78
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=);
|
79
|
+
background-position:top left;
|
80
|
+
background-repeat:no-repeat;
|
81
|
+
}
|
82
|
+
table.trace .open tr.file td.expand {
|
83
|
+
width:19px;
|
84
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC);
|
85
|
+
background-position:top left;
|
86
|
+
background-repeat:no-repeat;
|
87
|
+
}
|
88
|
+
table.trace tr.source td.collapse {
|
89
|
+
width:19px;
|
90
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==);
|
91
|
+
background-position:bottom left;
|
92
|
+
background-repeat:no-repeat;
|
93
|
+
background-color:#6F706F;
|
94
|
+
}
|
95
|
+
table.trace tr td.path {
|
96
|
+
padding-left:10px;
|
97
|
+
}
|
98
|
+
table.trace tr td.code {
|
99
|
+
padding-left:35px;
|
100
|
+
white-space: pre;
|
101
|
+
line-height:9px;
|
102
|
+
padding-bottom:10px;
|
103
|
+
}
|
104
|
+
table.trace tr td.code em {
|
105
|
+
font-weight:bold;
|
106
|
+
color:#00BF10;
|
107
|
+
}
|
108
|
+
table.trace tr td.code a {
|
109
|
+
width: 20px;
|
110
|
+
float: left;
|
111
|
+
}
|
112
|
+
table.trace tr td.code .more {
|
113
|
+
color:#666;
|
114
|
+
}
|
115
|
+
table.trace tr td.line {
|
116
|
+
width:30px;
|
117
|
+
text-align:right;
|
118
|
+
padding-right:4px;
|
119
|
+
}
|
120
|
+
.footer {
|
121
|
+
margin-top:5px;
|
122
|
+
font-size:11px;
|
123
|
+
color:#444;
|
124
|
+
text-align:right;
|
125
|
+
}
|
126
|
+
</style>
|
127
|
+
</head>
|
128
|
+
<body>
|
129
|
+
<div class="internalError">
|
130
|
+
|
131
|
+
<div class="header">
|
132
|
+
<h1><%= @exception_name %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1>
|
133
|
+
<% if show_details = ::Merb::Config[:exception_details] -%>
|
134
|
+
<h2><%= @exception.message %></h2>
|
135
|
+
<% else -%>
|
136
|
+
<h2>Sorry about that...</h2>
|
137
|
+
<% end -%>
|
138
|
+
<h3>Parameters</h3>
|
139
|
+
<ul>
|
140
|
+
<% params[:original_params].each do |param, value| %>
|
141
|
+
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
|
142
|
+
<% end %>
|
143
|
+
<%= "<li>None</li>" if params[:original_params].empty? %>
|
144
|
+
</ul>
|
145
|
+
|
146
|
+
<h3>Session</h3>
|
147
|
+
<ul>
|
148
|
+
<% params[:original_session].each do |param, value| %>
|
149
|
+
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
|
150
|
+
<% end %>
|
151
|
+
<%= "<li>None</li>" if params[:original_session].empty? %>
|
152
|
+
</ul>
|
153
|
+
|
154
|
+
<h3>Cookies</h3>
|
155
|
+
<ul>
|
156
|
+
<% params[:original_cookies].each do |param, value| %>
|
157
|
+
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
|
158
|
+
<% end %>
|
159
|
+
<%= "<li>None</li>" if params[:original_cookies].empty? %>
|
160
|
+
</ul>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<% if show_details %>
|
164
|
+
<table class="trace">
|
165
|
+
<% @exception.backtrace.each_with_index do |line, index| %>
|
166
|
+
<tbody class="close">
|
167
|
+
<tr class="file">
|
168
|
+
<td class="expand">
|
169
|
+
</td>
|
170
|
+
<td class="path">
|
171
|
+
<%= (line.match(/^([^:]+)/)[1] rescue 'unknown').sub(/\/((opt|usr)\/local\/lib\/(ruby\/)?(gems\/)?(1.8\/)?(gems\/)?|.+\/app\/)/, '') %>
|
172
|
+
<% unless line.match(/\.erb:/) %>
|
173
|
+
in "<strong><%= line.match(/:in `(.+)'$/)[1] rescue '?' %></strong>"
|
174
|
+
<% else %>
|
175
|
+
(<strong>ERB Template</strong>)
|
176
|
+
<% end %>
|
177
|
+
</td>
|
178
|
+
<td class="line">
|
179
|
+
<a href="txmt://open?url=file://<%=file = (line.match(/^([^:]+)/)[1] rescue 'unknown')%>&line=<%= lineno = line.match(/:([0-9]+):/)[1] rescue '?' %>"><%=lineno%></a>
|
180
|
+
</td>
|
181
|
+
</tr>
|
182
|
+
<tr class="source">
|
183
|
+
<td class="collapse">
|
184
|
+
</td>
|
185
|
+
<td class="code" colspan="2"><% (__caller_lines__(file, lineno, 5) rescue []).each do |llineno, lcode, lcurrent| %>
|
186
|
+
<a href="txmt://open?url=file://<%=file%>&line=<%=llineno%>"><%= llineno %></a><%='<em>' if llineno==lineno.to_i %><%= lcode.size > 90 ? CGI.escapeHTML(lcode[0..90])+'<span class="more">......</span>' : CGI.escapeHTML(lcode) %><%='</em>' if llineno==lineno.to_i %>
|
187
|
+
<% end %>
|
188
|
+
|
189
|
+
</td>
|
190
|
+
</tr>
|
191
|
+
</tbody>
|
192
|
+
<% end %>
|
193
|
+
</table>
|
194
|
+
<script type="text/javascript" charset="utf-8">
|
195
|
+
// swop the open & closed classes
|
196
|
+
els = document.getElementsByTagName('td');
|
197
|
+
for(i=0; i<els.length; i++){
|
198
|
+
if(els[i].className=='expand' || els[i].className=='collapse'){
|
199
|
+
els[i].onclick = function(e){
|
200
|
+
tbody = this.parentNode.parentNode;
|
201
|
+
if(tbody.className=='open'){
|
202
|
+
tbody.className='closed';
|
203
|
+
}else{
|
204
|
+
tbody.className='open';
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
</script>
|
210
|
+
<% end %>
|
211
|
+
<div class="footer">
|
212
|
+
lots of love, from <a href="#">merb</a>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</body>
|
216
|
+
</html>
|
217
|
+
|