sinatra-bundles 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/Rakefile +2 -1
  2. data/VERSION +1 -1
  3. data/lib/sinatra/bundles/bundle.rb +36 -0
  4. data/lib/sinatra/bundles/helpers.rb +22 -0
  5. data/lib/sinatra/bundles/javascript_bundle.rb +37 -0
  6. data/lib/sinatra/bundles/stylesheet_bundle.rb +36 -0
  7. data/lib/sinatra/bundles.rb +4 -114
  8. data/sinatra-bundles.gemspec +11 -58
  9. data/spec/app.rb +1 -1
  10. data/spec/production_app.rb +1 -1
  11. data/spec/public/javascripts/eval.js +5 -0
  12. data/spec/sinatra-bundles_spec.rb +10 -1
  13. data/spec/spec_helper.rb +5 -6
  14. metadata +17 -57
  15. data/vendor/cache/sinatra-0.10.1.gem +0 -0
  16. data/vendor/gems/sinatra-0.10.1/AUTHORS +0 -43
  17. data/vendor/gems/sinatra-0.10.1/CHANGES +0 -467
  18. data/vendor/gems/sinatra-0.10.1/LICENSE +0 -22
  19. data/vendor/gems/sinatra-0.10.1/README.jp.rdoc +0 -552
  20. data/vendor/gems/sinatra-0.10.1/README.rdoc +0 -622
  21. data/vendor/gems/sinatra-0.10.1/Rakefile +0 -129
  22. data/vendor/gems/sinatra-0.10.1/lib/sinatra/base.rb +0 -1143
  23. data/vendor/gems/sinatra-0.10.1/lib/sinatra/images/404.png +0 -0
  24. data/vendor/gems/sinatra-0.10.1/lib/sinatra/images/500.png +0 -0
  25. data/vendor/gems/sinatra-0.10.1/lib/sinatra/main.rb +0 -28
  26. data/vendor/gems/sinatra-0.10.1/lib/sinatra/showexceptions.rb +0 -303
  27. data/vendor/gems/sinatra-0.10.1/lib/sinatra/tilt.rb +0 -509
  28. data/vendor/gems/sinatra-0.10.1/lib/sinatra.rb +0 -7
  29. data/vendor/gems/sinatra-0.10.1/sinatra.gemspec +0 -86
  30. data/vendor/gems/sinatra-0.10.1/test/base_test.rb +0 -160
  31. data/vendor/gems/sinatra-0.10.1/test/builder_test.rb +0 -65
  32. data/vendor/gems/sinatra-0.10.1/test/contest.rb +0 -64
  33. data/vendor/gems/sinatra-0.10.1/test/erb_test.rb +0 -81
  34. data/vendor/gems/sinatra-0.10.1/test/erubis_test.rb +0 -82
  35. data/vendor/gems/sinatra-0.10.1/test/extensions_test.rb +0 -100
  36. data/vendor/gems/sinatra-0.10.1/test/filter_test.rb +0 -195
  37. data/vendor/gems/sinatra-0.10.1/test/haml_test.rb +0 -90
  38. data/vendor/gems/sinatra-0.10.1/test/helper.rb +0 -76
  39. data/vendor/gems/sinatra-0.10.1/test/helpers_test.rb +0 -573
  40. data/vendor/gems/sinatra-0.10.1/test/mapped_error_test.rb +0 -186
  41. data/vendor/gems/sinatra-0.10.1/test/middleware_test.rb +0 -68
  42. data/vendor/gems/sinatra-0.10.1/test/request_test.rb +0 -33
  43. data/vendor/gems/sinatra-0.10.1/test/response_test.rb +0 -42
  44. data/vendor/gems/sinatra-0.10.1/test/result_test.rb +0 -98
  45. data/vendor/gems/sinatra-0.10.1/test/route_added_hook_test.rb +0 -59
  46. data/vendor/gems/sinatra-0.10.1/test/routing_test.rb +0 -878
  47. data/vendor/gems/sinatra-0.10.1/test/sass_test.rb +0 -79
  48. data/vendor/gems/sinatra-0.10.1/test/server_test.rb +0 -47
  49. data/vendor/gems/sinatra-0.10.1/test/sinatra_test.rb +0 -13
  50. data/vendor/gems/sinatra-0.10.1/test/static_test.rb +0 -87
  51. data/vendor/gems/sinatra-0.10.1/test/templates_test.rb +0 -155
  52. data/vendor/gems/sinatra-0.10.1/test/views/error.builder +0 -3
  53. data/vendor/gems/sinatra-0.10.1/test/views/error.erb +0 -3
  54. data/vendor/gems/sinatra-0.10.1/test/views/error.erubis +0 -3
  55. data/vendor/gems/sinatra-0.10.1/test/views/error.haml +0 -3
  56. data/vendor/gems/sinatra-0.10.1/test/views/error.sass +0 -2
  57. data/vendor/gems/sinatra-0.10.1/test/views/foo/hello.test +0 -1
  58. data/vendor/gems/sinatra-0.10.1/test/views/hello.builder +0 -1
  59. data/vendor/gems/sinatra-0.10.1/test/views/hello.erb +0 -1
  60. data/vendor/gems/sinatra-0.10.1/test/views/hello.erubis +0 -1
  61. data/vendor/gems/sinatra-0.10.1/test/views/hello.haml +0 -1
  62. data/vendor/gems/sinatra-0.10.1/test/views/hello.sass +0 -2
  63. data/vendor/gems/sinatra-0.10.1/test/views/hello.test +0 -1
  64. data/vendor/gems/sinatra-0.10.1/test/views/layout2.builder +0 -3
  65. data/vendor/gems/sinatra-0.10.1/test/views/layout2.erb +0 -2
  66. data/vendor/gems/sinatra-0.10.1/test/views/layout2.erubis +0 -2
  67. data/vendor/gems/sinatra-0.10.1/test/views/layout2.haml +0 -2
  68. data/vendor/gems/sinatra-0.10.1/test/views/layout2.test +0 -1
  69. data/vendor/specifications/sinatra-0.10.1.gemspec +0 -40
@@ -1,28 +0,0 @@
1
- require 'sinatra/base'
2
-
3
- module Sinatra
4
- class Default < Base
5
-
6
- # we assume that the first file that requires 'sinatra' is the
7
- # app_file. all other path related options are calculated based
8
- # on this path by default.
9
- set :app_file, caller_files.first || $0
10
-
11
- set :run, Proc.new { $0 == app_file }
12
-
13
- if run? && ARGV.any?
14
- require 'optparse'
15
- OptionParser.new { |op|
16
- op.on('-x') { set :lock, true }
17
- op.on('-e env') { |val| set :environment, val.to_sym }
18
- op.on('-s server') { |val| set :server, val }
19
- op.on('-p port') { |val| set :port, val.to_i }
20
- op.on('-h addr') { |val| set :host, val }
21
- }.parse!(ARGV.dup)
22
- end
23
- end
24
-
25
- at_exit { Application.run! if $!.nil? && Application.run? }
26
- end
27
-
28
- include Sinatra::Delegator
@@ -1,303 +0,0 @@
1
- require 'rack/showexceptions'
2
-
3
- module Sinatra
4
- class ShowExceptions < Rack::ShowExceptions
5
- def initialize(app)
6
- @app = app
7
- @template = ERB.new(TEMPLATE)
8
- end
9
-
10
- def frame_class(frame)
11
- if frame.filename =~ /lib\/sinatra.*\.rb/
12
- "framework"
13
- elsif (defined?(Gem) && frame.filename.include?(Gem.dir)) ||
14
- frame.filename =~ /\/bin\/(\w+)$/
15
- "system"
16
- else
17
- "app"
18
- end
19
- end
20
-
21
- TEMPLATE = <<HTML
22
- <!DOCTYPE html>
23
- <html>
24
- <head>
25
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
26
- <title><%=h exception.class %> at <%=h path %></title>
27
-
28
- <script type="text/javascript">
29
- //<!--
30
- function toggle(id) {
31
- var pre = document.getElementById("pre-" + id);
32
- var post = document.getElementById("post-" + id);
33
- var context = document.getElementById("context-" + id);
34
-
35
- if (pre.style.display == 'block') {
36
- pre.style.display = 'none';
37
- post.style.display = 'none';
38
- context.style.background = "none";
39
- } else {
40
- pre.style.display = 'block';
41
- post.style.display = 'block';
42
- context.style.background = "#fffed9";
43
- }
44
- }
45
-
46
- function toggleBacktrace(){
47
- var bt = document.getElementById("backtrace");
48
- var toggler = document.getElementById("expando");
49
-
50
- if (bt.className == 'condensed') {
51
- bt.className = 'expanded';
52
- toggler.innerHTML = "(condense)";
53
- } else {
54
- bt.className = 'condensed';
55
- toggler.innerHTML = "(expand)";
56
- }
57
- }
58
- //-->
59
- </script>
60
-
61
- <style type="text/css" media="screen">
62
- * {margin: 0; padding: 0; border: 0; outline: 0;}
63
- div.clear {clear: both;}
64
- body {background: #EEEEEE; margin: 0; padding: 0;
65
- font-family: 'Lucida Grande', 'Lucida Sans Unicode',
66
- 'Garuda';}
67
- code {font-family: 'Lucida Console', monospace;
68
- font-size: 12px;}
69
- li {height: 18px;}
70
- ul {list-style: none; margin: 0; padding: 0;}
71
- ol:hover {cursor: pointer;}
72
- ol li {white-space: pre;}
73
- #explanation {font-size: 12px; color: #666666;
74
- margin: 20px 0 0 100px;}
75
- /* WRAP */
76
- #wrap {width: 860px; background: #FFFFFF; margin: 0 auto;
77
- padding: 30px 50px 20px 50px;
78
- border-left: 1px solid #DDDDDD;
79
- border-right: 1px solid #DDDDDD;}
80
- /* HEADER */
81
- #header {margin: 0 auto 25px auto;}
82
- #header img {float: left;}
83
- #header #summary {float: left; margin: 12px 0 0 20px; width:520px;
84
- font-family: 'Lucida Grande', 'Lucida Sans Unicode';}
85
- h1 {margin: 0; font-size: 36px; color: #981919;}
86
- h2 {margin: 0; font-size: 22px; color: #333333;}
87
- #header ul {margin: 0; font-size: 12px; color: #666666;}
88
- #header ul li strong{color: #444444;}
89
- #header ul li {display: inline; padding: 0 10px;}
90
- #header ul li.first {padding-left: 0;}
91
- #header ul li.last {border: 0; padding-right: 0;}
92
- /* BODY */
93
- #backtrace,
94
- #get,
95
- #post,
96
- #cookies,
97
- #rack {width: 860px; margin: 0 auto 10px auto;}
98
- p#nav {float: right; font-size: 14px;}
99
- /* BACKTRACE */
100
- a#expando {float: left; padding-left: 5px; color: #666666;
101
- font-size: 14px; text-decoration: none; cursor: pointer;}
102
- a#expando:hover {text-decoration: underline;}
103
- h3 {float: left; width: 100px; margin-bottom: 10px;
104
- color: #981919; font-size: 14px; font-weight: bold;}
105
- #nav a {color: #666666; text-decoration: none; padding: 0 5px;}
106
- #backtrace li.frame-info {background: #f7f7f7; padding-left: 10px;
107
- font-size: 12px; color: #333333;}
108
- #backtrace ul {list-style-position: outside; border: 1px solid #E9E9E9;
109
- border-bottom: 0;}
110
- #backtrace ol {width: 808px; margin-left: 50px;
111
- font: 10px 'Lucida Console', monospace; color: #666666;}
112
- #backtrace ol li {border: 0; border-left: 1px solid #E9E9E9;
113
- padding: 2px 0;}
114
- #backtrace ol code {font-size: 10px; color: #555555; padding-left: 5px;}
115
- #backtrace-ul li {border-bottom: 1px solid #E9E9E9; height: auto;
116
- padding: 3px 0;}
117
- #backtrace-ul .code {padding: 6px 0 4px 0;}
118
- #backtrace.condensed .system,
119
- #backtrace.condensed .framework {display:none;}
120
- /* REQUEST DATA */
121
- p.no-data {padding-top: 2px; font-size: 12px; color: #666666;}
122
- table.req {width: 760px; text-align: left; font-size: 12px;
123
- color: #666666; padding: 0; border-spacing: 0;
124
- border: 1px solid #EEEEEE; border-bottom: 0;
125
- border-left: 0;}
126
- table.req tr th {padding: 2px 10px; font-weight: bold;
127
- background: #F7F7F7; border-bottom: 1px solid #EEEEEE;
128
- border-left: 1px solid #EEEEEE;}
129
- table.req tr td {padding: 2px 20px 2px 10px;
130
- border-bottom: 1px solid #EEEEEE;
131
- border-left: 1px solid #EEEEEE;}
132
- /* HIDE PRE/POST CODE AT START */
133
- .pre-context,
134
- .post-context {display: none;}
135
- </style>
136
- </head>
137
- <body>
138
- <div id="wrap">
139
- <div id="header">
140
- <img src="/__sinatra__/500.png" alt="application error" />
141
- <div id="summary">
142
- <h1><strong><%=h exception.class %></strong> at <strong><%=h path %>
143
- </strong></h1>
144
- <h2><%=h exception.message %></h2>
145
- <ul>
146
- <li class="first"><strong>file:</strong> <code>
147
- <%=h frames.first.filename.split("/").last %></code></li>
148
- <li><strong>location:</strong> <code><%=h frames.first.function %>
149
- </code></li>
150
- <li class="last"><strong>line:
151
- </strong> <%=h frames.first.lineno %></li>
152
- </ul>
153
- </div>
154
- <div class="clear"></div>
155
- </div>
156
-
157
- <div id="backtrace" class='condensed'>
158
- <h3>BACKTRACE</h3>
159
- <p><a href="#" id="expando"
160
- onclick="toggleBacktrace(); return false">(expand)</a></p>
161
- <p id="nav"><strong>JUMP TO:</strong>
162
- <a href="#get-info">GET</a>
163
- <a href="#post-info">POST</a>
164
- <a href="#cookie-info">COOKIES</a>
165
- <a href="#env-info">ENV</a>
166
- </p>
167
- <div class="clear"></div>
168
-
169
- <ul id="backtrace-ul">
170
-
171
- <% id = 1 %>
172
- <% frames.each do |frame| %>
173
- <% if frame.context_line && frame.context_line != "#" %>
174
-
175
- <li class="frame-info <%= frame_class(frame) %>">
176
- <code><%=h frame.filename %></code> in
177
- <code><strong><%=h frame.function %></strong></code>
178
- </li>
179
-
180
- <li class="code <%= frame_class(frame) %>">
181
- <% if frame.pre_context %>
182
- <ol start="<%=h frame.pre_context_lineno + 1 %>"
183
- class="pre-context" id="pre-<%= id %>"
184
- onclick="toggle(<%= id %>);">
185
- <% frame.pre_context.each do |line| %>
186
- <li class="pre-context-line"><code><%=h line %></code></li>
187
- <% end %>
188
- </ol>
189
- <% end %>
190
-
191
- <ol start="<%= frame.lineno %>" class="context" id="<%= id %>"
192
- onclick="toggle(<%= id %>);">
193
- <li class="context-line" id="context-<%= id %>"><code><%=
194
- h frame.context_line %></code></li>
195
- </ol>
196
-
197
- <% if frame.post_context %>
198
- <ol start="<%=h frame.lineno + 1 %>" class="post-context"
199
- id="post-<%= id %>" onclick="toggle(<%= id %>);">
200
- <% frame.post_context.each do |line| %>
201
- <li class="post-context-line"><code><%=h line %></code></li>
202
- <% end %>
203
- </ol>
204
- <% end %>
205
- <div class="clear"></div>
206
- </li>
207
-
208
- <% end %>
209
-
210
- <% id += 1 %>
211
- <% end %>
212
-
213
- </ul>
214
- </div> <!-- /BACKTRACE -->
215
-
216
- <div id="get">
217
- <h3 id="get-info">GET</h3>
218
- <% unless req.GET.empty? %>
219
- <table class="req">
220
- <tr>
221
- <th>Variable</th>
222
- <th>Value</th>
223
- </tr>
224
- <% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
225
- <tr>
226
- <td><%=h key %></td>
227
- <td class="code"><div><%=h val.inspect %></div></td>
228
- </tr>
229
- <% } %>
230
- </table>
231
- <% else %>
232
- <p class="no-data">No GET data.</p>
233
- <% end %>
234
- <div class="clear"></div>
235
- </div> <!-- /GET -->
236
-
237
- <div id="post">
238
- <h3 id="post-info">POST</h3>
239
- <% unless req.POST.empty? %>
240
- <table class="req">
241
- <tr>
242
- <th>Variable</th>
243
- <th>Value</th>
244
- </tr>
245
- <% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
246
- <tr>
247
- <td><%=h key %></td>
248
- <td class="code"><div><%=h val.inspect %></div></td>
249
- </tr>
250
- <% } %>
251
- </table>
252
- <% else %>
253
- <p class="no-data">No POST data.</p>
254
- <% end %>
255
- <div class="clear"></div>
256
- </div> <!-- /POST -->
257
-
258
- <div id="cookies">
259
- <h3 id="cookie-info">COOKIES</h3>
260
- <% unless req.cookies.empty? %>
261
- <table class="req">
262
- <tr>
263
- <th>Variable</th>
264
- <th>Value</th>
265
- </tr>
266
- <% req.cookies.each { |key, val| %>
267
- <tr>
268
- <td><%=h key %></td>
269
- <td class="code"><div><%=h val.inspect %></div></td>
270
- </tr>
271
- <% } %>
272
- </table>
273
- <% else %>
274
- <p class="no-data">No cookie data.</p>
275
- <% end %>
276
- <div class="clear"></div>
277
- </div> <!-- /COOKIES -->
278
-
279
- <div id="rack">
280
- <h3 id="env-info">Rack ENV</h3>
281
- <table class="req">
282
- <tr>
283
- <th>Variable</th>
284
- <th>Value</th>
285
- </tr>
286
- <% env.sort_by { |k, v| k.to_s }.each { |key, val| %>
287
- <tr>
288
- <td><%=h key %></td>
289
- <td class="code"><div><%=h val %></div></td>
290
- </tr>
291
- <% } %>
292
- </table>
293
- <div class="clear"></div>
294
- </div> <!-- /RACK ENV -->
295
-
296
- <p id="explanation">You're seeing this error because you have
297
- enabled the <code>show_exceptions</code> setting.</p>
298
- </div> <!-- /WRAP -->
299
- </body>
300
- </html>
301
- HTML
302
- end
303
- end