merb-gen 0.9.9 → 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. data/Rakefile +1 -1
  2. data/lib/generators/merb/merb_stack.rb +8 -0
  3. data/lib/generators/resource.rb +1 -1
  4. data/lib/generators/resource_controller.rb +12 -0
  5. data/lib/generators/templates/application/common/merb.thor +77 -32
  6. data/lib/generators/templates/application/merb_core/app/controllers/exceptions.rb +1 -1
  7. data/lib/generators/templates/application/merb_core/config/init.rb +19 -183
  8. data/lib/generators/templates/application/merb_flat/config/init.rb +10 -112
  9. data/lib/generators/templates/application/merb_plugin/LICENSE +1 -1
  10. data/lib/generators/templates/application/merb_stack/app/controllers/exceptions.rb +1 -1
  11. data/lib/generators/templates/application/merb_stack/app/models/user.rb +1 -1
  12. data/lib/generators/templates/application/merb_stack/config/dependencies.rb +22 -14
  13. data/lib/generators/templates/application/merb_stack/config/init.rb +3 -3
  14. data/lib/generators/templates/application/merb_stack/merb/merb-auth/setup.rb +1 -1
  15. data/lib/generators/templates/component/resource_controller/app/views/%file_name%/edit.html.erb +2 -1
  16. data/lib/generators/templates/component/resource_controller/app/views/%file_name%/index.html.erb +2 -1
  17. data/lib/generators/templates/component/resource_controller/app/views/%file_name%/new.html.erb +2 -1
  18. data/lib/generators/templates/component/resource_controller/app/views/%file_name%/show.html.erb +2 -1
  19. data/lib/generators/templates/component/resource_controller/spec/requests/%file_name%_spec.rb +73 -4
  20. metadata +4 -6
  21. data/lib/generators/templates/application/merb_core/app/views/exceptions/internal_server_error.html.erb +0 -216
  22. data/lib/generators/templates/application/merb_stack/app/views/exceptions/internal_server_error.html.erb +0 -216
@@ -5,7 +5,7 @@
5
5
  # You'll need to setup your db as per the salted_user mixin, and you'll need
6
6
  # To use :password, and :password_confirmation when creating a user
7
7
  #
8
- # see config/merb-auth/setup.rb to see how to disable the salted_user mixin
8
+ # see merb/merb-auth/setup.rb to see how to disable the salted_user mixin
9
9
  #
10
10
  # You will need to setup your database and create a user.
11
11
  class User
@@ -1,15 +1,23 @@
1
- dependency "merb-action-args", "0.9.9" # Provides support for querystring arguments to be passed in to controller actions
2
- dependency "merb-assets", "0.9.9" # Provides link_to, asset_path, auto_link, image_tag methods (and lots more)
3
- dependency "merb-cache", "0.9.9" # Provides your application with caching functions
4
- dependency "merb-helpers", "0.9.9" # Provides the form, date/time, and other helpers
5
- dependency "merb-mailer", "0.9.9" # Integrates mail support via Merb Mailer
6
- dependency "merb-slices", "0.9.9" # Provides a mechanism for letting plugins provide controllers, views, etc. to your app
7
- dependency "merb-auth", "0.9.9" # An authentication slice (Merb's equivalent to Rails' restful authentication)
8
- dependency "merb-param-protection", "0.9.9"
1
+ # dependencies are generated using a strict version, don't forget to edit the dependency versions when upgrading.
2
+ merb_gems_version = "<%= merb_gems_version %>"
3
+ dm_gems_version = "<%= dm_gems_version %>"
4
+
5
+ # For more information about each component, please read http://wiki.merbivore.com/faqs/merb_components
6
+ dependency "merb-action-args", merb_gems_version
7
+ dependency "merb-assets", merb_gems_version
8
+ dependency "merb-cache", merb_gems_version
9
+ dependency "merb-helpers", merb_gems_version
10
+ dependency "merb-mailer", merb_gems_version
11
+ dependency "merb-slices", merb_gems_version
12
+ dependency "merb-auth-core", merb_gems_version
13
+ dependency "merb-auth-more", merb_gems_version
14
+ dependency "merb-auth-slice-password", merb_gems_version
15
+ dependency "merb-param-protection", merb_gems_version
16
+ dependency "merb-exceptions", merb_gems_version
9
17
 
10
- dependency "dm-core", "0.9.6" # The datamapper ORM
11
- dependency "dm-aggregates", "0.9.6" # Provides your DM models with count, sum, avg, min, max, etc.
12
- dependency "dm-migrations", "0.9.6" # Make incremental changes to your database.
13
- dependency "dm-timestamps", "0.9.6" # Automatically populate created_at, created_on, etc. when those properties are present.
14
- dependency "dm-types", "0.9.6" # Provides additional types, including csv, json, yaml.
15
- dependency "dm-validations", "0.9.6" # Validation framework
18
+ dependency "dm-core", dm_gems_version
19
+ dependency "dm-aggregates", dm_gems_version
20
+ dependency "dm-migrations", dm_gems_version
21
+ dependency "dm-timestamps", dm_gems_version
22
+ dependency "dm-types", dm_gems_version
23
+ dependency "dm-validations", dm_gems_version
@@ -3,15 +3,15 @@
3
3
  require 'config/dependencies.rb'
4
4
 
5
5
  use_orm :datamapper
6
- use_test :rspec
7
- use_template_engine :erb
6
+ use_test :<%= testing_framework %>
7
+ use_template_engine :<%= template_engine %>
8
8
 
9
9
  Merb::Config.use do |c|
10
10
  c[:use_mutex] = false
11
11
  c[:session_store] = 'cookie' # can also be 'memory', 'memcache', 'container', 'datamapper
12
12
 
13
13
  # cookie session store configuration
14
- c[:session_secret_key] = '1205346b9baa87cf8e49f78124c8d17a31ac0971' # required for cookie session store
14
+ c[:session_secret_key] = '<%= SHA1.new(rand(100000000000).to_s).to_s %>' # required for cookie session store
15
15
  # c[:session_id_key] = '_session_id' # cookie session id key, defaults to "_session_id"
16
16
  end
17
17
 
@@ -37,7 +37,7 @@ rescue
37
37
 
38
38
  If you want to fully customize your authentication you should use merb-core directly.
39
39
 
40
- See lib/authentication/setup.rb and strategies.rb to customize your setup
40
+ See merb/merb-auth/setup.rb and strategies.rb to customize your setup
41
41
 
42
42
  TEXT
43
43
  end
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, edit action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/edit.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/edit.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, index action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/index.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/index.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, new action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/new.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/new.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,3 +1,4 @@
1
1
  <h1><%= class_name %> controller, show action</h1>
2
2
 
3
- <p>Edit this file in <tt>app/views/<%= file_name %>/show.html.erb</tt></p>
3
+ <p>Edit this file in <tt>app/views/<%= file_name %>/show.html.erb</tt></p>
4
+ <p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
@@ -1,22 +1,27 @@
1
1
  require File.join(File.dirname(__FILE__), <%= go_up(modules.size + 1) %>, 'spec_helper.rb')
2
2
 
3
3
  given "a <%= singular_model %> exists" do
4
+ <%- if orm.to_sym == :datamapper -%>
5
+ <%= model_class_name %>.all.destroy!
6
+ <%-elsif orm.to_sym == :activerecord -%>
7
+ <%= model_class_name %>.delete_all
8
+ <% end -%>
4
9
  request(resource(:<%= plural_model %>), :method => "POST",
5
- :params => { :<%= singular_model %> => { }})
10
+ :params => { :<%= singular_model %> => { :id => nil }})
6
11
  end
7
12
 
8
13
  describe "resource(:<%= plural_model %>)" do
9
14
  describe "GET" do
10
15
 
11
16
  before(:each) do
12
- @response = request(resource(:<%= singular_model %>s))
17
+ @response = request(resource(:<%= plural_model %>))
13
18
  end
14
19
 
15
20
  it "responds successfully" do
16
21
  @response.should be_successful
17
22
  end
18
23
 
19
- it "contains a list of speakers" do
24
+ it "contains a list of <%= plural_model %>" do
20
25
  pending
21
26
  @response.should have_xpath("//ul")
22
27
  end
@@ -36,8 +41,13 @@ describe "resource(:<%= plural_model %>)" do
36
41
 
37
42
  describe "a successful POST" do
38
43
  before(:each) do
44
+ <%- if orm.to_sym == :datamapper -%>
45
+ <%= model_class_name %>.all.destroy!
46
+ <%-elsif orm.to_sym == :activerecord -%>
47
+ <%= model_class_name %>.delete_all
48
+ <% end -%>
39
49
  @response = request(resource(:<%= plural_model %>), :method => "POST",
40
- :params => { :<%= singular_model %> => { }})
50
+ :params => { :<%= singular_model %> => { :id => nil }})
41
51
  end
42
52
 
43
53
  it "redirects to resource(:<%= plural_model %>)" do
@@ -51,3 +61,62 @@ describe "resource(:<%= plural_model %>)" do
51
61
  end
52
62
  end
53
63
 
64
+ describe "resource(@<%= singular_model %>)" do
65
+ describe "a successful DELETE", :given => "a <%= singular_model %> exists" do
66
+ before(:each) do
67
+ @response = request(resource(<%= model_class_name %>.first), :method => "DELETE")
68
+ end
69
+
70
+ it "should redirect to the index action" do
71
+ @response.should redirect_to(resource(:<%= plural_model %>))
72
+ end
73
+
74
+ end
75
+ end
76
+
77
+ describe "resource(:<%= plural_model %>, :new)" do
78
+ before(:each) do
79
+ @response = request(resource(:<%= plural_model %>, :new))
80
+ end
81
+
82
+ it "responds successfully" do
83
+ @response.should be_successful
84
+ end
85
+ end
86
+
87
+ describe "resource(@<%= singular_model %>, :edit)", :given => "a <%= singular_model %> exists" do
88
+ before(:each) do
89
+ @response = request(resource(<%= model_class_name %>.first, :edit))
90
+ end
91
+
92
+ it "responds successfully" do
93
+ @response.should be_successful
94
+ end
95
+ end
96
+
97
+ describe "resource(@<%= singular_model %>)", :given => "a <%= singular_model %> exists" do
98
+
99
+ describe "GET" do
100
+ before(:each) do
101
+ @response = request(resource(<%= model_class_name %>.first))
102
+ end
103
+
104
+ it "responds successfully" do
105
+ @response.should be_successful
106
+ end
107
+ end
108
+
109
+ describe "PUT" do
110
+ before(:each) do
111
+ @<%= singular_model %> = <%= model_class_name %>.first
112
+ @response = request(resource(@<%= singular_model %>), :method => "PUT",
113
+ :params => { :article => {:id => @<%= singular_model %>.id} })
114
+ end
115
+
116
+ it "redirect to the article show action" do
117
+ @response.should redirect_to(resource(@<%= singular_model %>))
118
+ end
119
+ end
120
+
121
+ end
122
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-13 00:00:00 +03:00
12
+ date: 2008-10-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.9
23
+ version: 0.9.10
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: templater
@@ -81,7 +81,6 @@ files:
81
81
  - lib/generators/templates/application/merb_core/app/helpers/global_helpers.rb
82
82
  - lib/generators/templates/application/merb_core/app/views
83
83
  - lib/generators/templates/application/merb_core/app/views/exceptions
84
- - lib/generators/templates/application/merb_core/app/views/exceptions/internal_server_error.html.erb
85
84
  - lib/generators/templates/application/merb_core/app/views/exceptions/not_acceptable.html.erb
86
85
  - lib/generators/templates/application/merb_core/app/views/exceptions/not_found.html.erb
87
86
  - lib/generators/templates/application/merb_core/autotest
@@ -166,7 +165,6 @@ files:
166
165
  - lib/generators/templates/application/merb_stack/app/models/user.rb
167
166
  - lib/generators/templates/application/merb_stack/app/views
168
167
  - lib/generators/templates/application/merb_stack/app/views/exceptions
169
- - lib/generators/templates/application/merb_stack/app/views/exceptions/internal_server_error.html.erb
170
168
  - lib/generators/templates/application/merb_stack/app/views/exceptions/not_acceptable.html.erb
171
169
  - lib/generators/templates/application/merb_stack/app/views/exceptions/not_found.html.erb
172
170
  - lib/generators/templates/application/merb_stack/autotest
@@ -337,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
335
  requirements: []
338
336
 
339
337
  rubyforge_project: merb
340
- rubygems_version: 1.2.0
338
+ rubygems_version: 1.3.0
341
339
  signing_key:
342
340
  specification_version: 2
343
341
  summary: Generators suite for Merb.
@@ -1,216 +0,0 @@
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><%%=h @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')%>&amp;line=<%%= lineno = line.match(/:([0-9]+):/)[1] rescue '?' %>"><%%=lineno%></a>&nbsp;
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%>&amp;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>