merb-gen 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/LICENSE +20 -0
  2. data/README +10 -0
  3. data/Rakefile +47 -0
  4. data/TODO +4 -0
  5. data/app_generators/merb/USAGE +0 -0
  6. data/app_generators/merb/merb_generator.rb +36 -0
  7. data/app_generators/merb/templates/Rakefile +126 -0
  8. data/app_generators/merb/templates/app/controllers/application.rb +2 -0
  9. data/app_generators/merb/templates/app/controllers/exceptions.rb +13 -0
  10. data/app_generators/merb/templates/app/helpers/global_helpers.rb +5 -0
  11. data/app_generators/merb/templates/app/views/exceptions/internal_server_error.html.erb +216 -0
  12. data/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb +55 -0
  13. data/app_generators/merb/templates/app/views/exceptions/not_found.html.erb +39 -0
  14. data/app_generators/merb/templates/app/views/layout/application.html.erb +11 -0
  15. data/app_generators/merb/templates/autotest/discover.rb +1 -0
  16. data/app_generators/merb/templates/autotest/merb.rb +149 -0
  17. data/app_generators/merb/templates/autotest/merb_rspec.rb +202 -0
  18. data/app_generators/merb/templates/config/environments/development.rb +6 -0
  19. data/app_generators/merb/templates/config/environments/production.rb +5 -0
  20. data/app_generators/merb/templates/config/environments/rake.rb +7 -0
  21. data/app_generators/merb/templates/config/environments/test.rb +5 -0
  22. data/app_generators/merb/templates/config/init.rb +58 -0
  23. data/app_generators/merb/templates/config/rack.rb +1 -0
  24. data/app_generators/merb/templates/config/router.rb +35 -0
  25. data/app_generators/merb/templates/public/images/merb.jpg +0 -0
  26. data/app_generators/merb/templates/public/merb.fcgi +22 -0
  27. data/app_generators/merb/templates/public/stylesheets/master.css +119 -0
  28. data/app_generators/merb/templates/spec/spec.opts +0 -0
  29. data/app_generators/merb/templates/spec/spec_helper.rb +11 -0
  30. data/app_generators/merb/templates/test/test_helper.rb +14 -0
  31. data/app_generators/merb_flat/merb_flat_generator.rb +22 -0
  32. data/app_generators/merb_flat/templates/README.txt +10 -0
  33. data/app_generators/merb_flat/templates/application.rb +15 -0
  34. data/app_generators/merb_flat/templates/config/framework.rb +5 -0
  35. data/app_generators/merb_flat/templates/config/init.rb +19 -0
  36. data/app_generators/merb_flat/templates/views/foo.html.erb +3 -0
  37. data/app_generators/merb_plugin/merb_plugin_generator.rb +22 -0
  38. data/app_generators/merb_plugin/templates/LICENSE +20 -0
  39. data/app_generators/merb_plugin/templates/README +4 -0
  40. data/app_generators/merb_plugin/templates/Rakefile +44 -0
  41. data/app_generators/merb_plugin/templates/TODO +5 -0
  42. data/app_generators/merb_plugin/templates/lib/%base_name%.rb +18 -0
  43. data/app_generators/merb_plugin/templates/lib/%base_name%/merbtasks.rb +6 -0
  44. data/app_generators/merb_plugin/templates/spec/%base_name%_spec.rb +7 -0
  45. data/app_generators/merb_plugin/templates/spec/spec_helper.rb +2 -0
  46. data/app_generators/merb_plugin/templates/test/%base_name%_test.rb +0 -0
  47. data/app_generators/merb_plugin/templates/test/test_helper.rb +2 -0
  48. data/app_generators/merb_very_flat/merb_very_flat_generator.rb +37 -0
  49. data/app_generators/merb_very_flat/templates/%app_file_name%.rb +15 -0
  50. data/app_generators/merb_very_flat/templates/README.txt +9 -0
  51. data/bin/merb-gen +103 -0
  52. data/lib/merb-gen.rb +38 -0
  53. data/lib/merb-gen/base.rb +62 -0
  54. data/lib/merb-gen/helpers.rb +108 -0
  55. data/merb_default_generators/model/USAGE +0 -0
  56. data/merb_default_generators/model/model_generator.rb +40 -0
  57. data/merb_default_generators/model/templates/app/models/%model_file_name%.rb +5 -0
  58. data/merb_default_generators/resource_controller/USAGE +0 -0
  59. data/merb_default_generators/resource_controller/resource_controller_generator.rb +74 -0
  60. data/merb_default_generators/resource_controller/templates/app/controllers/%controller_file_name%.rb +46 -0
  61. data/merb_default_generators/resource_controller/templates/app/helpers/%controller_file_name%_helper.rb +16 -0
  62. data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/delete.html.erb +3 -0
  63. data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/edit.html.erb +3 -0
  64. data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/index.html.erb +3 -0
  65. data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/new.html.erb +3 -0
  66. data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/show.html.erb +3 -0
  67. data/merb_generators/controller/USAGE +0 -0
  68. data/merb_generators/controller/controller_generator.rb +59 -0
  69. data/merb_generators/controller/templates/app/controllers/%controller_file_name%.rb +18 -0
  70. data/merb_generators/controller/templates/app/helpers/%controller_file_name%_helper.rb +16 -0
  71. data/merb_generators/controller/templates/app/views/%controller_file_name%/index.html.erb +1 -0
  72. data/merb_generators/freezer/USAGE +0 -0
  73. data/merb_generators/freezer/freezer_generator.rb +25 -0
  74. data/merb_generators/freezer/templates/script/frozen-merb +43 -0
  75. data/merb_generators/part_controller/USAGE +0 -0
  76. data/merb_generators/part_controller/part_controller_generator.rb +58 -0
  77. data/merb_generators/part_controller/templates/app/helpers/%controller_file_name%_part_helper.rb +16 -0
  78. data/merb_generators/part_controller/templates/app/parts/%controller_file_name%_part.rb +18 -0
  79. data/merb_generators/part_controller/templates/app/parts/views/%controller_file_name%_part/index.html.erb +3 -0
  80. data/merb_generators/resource/USAGE +0 -0
  81. data/merb_generators/resource/resource_generator.rb +48 -0
  82. data/rspec_generators/merb_controller_test/merb_controller_test_generator.rb +49 -0
  83. data/rspec_generators/merb_controller_test/templates/spec/controllers/%controller_full_file_path%_spec.rb +7 -0
  84. data/rspec_generators/merb_controller_test/templates/spec/helpers/%controller_full_file_path%_helper_spec.rb +5 -0
  85. data/rspec_generators/merb_model_test/merb_model_test_generator.rb +35 -0
  86. data/rspec_generators/merb_model_test/templates/spec/models/%model_file_name%_spec.rb +7 -0
  87. data/rspec_generators/merb_resource_controller_test/merb_resource_controller_test_generator.rb +49 -0
  88. data/rspec_generators/merb_resource_controller_test/templates/spec/controllers/%controller_full_file_path%_spec.rb +7 -0
  89. data/rspec_generators/merb_resource_controller_test/templates/spec/helpers/%controller_full_file_path%_helpers.rb +5 -0
  90. data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/delete.html.erb_spec.rb +1 -0
  91. data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/edit.html.erb_spec.rb +1 -0
  92. data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/index.html.erb_spec.rb +1 -0
  93. data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/new.html.erb_spec.rb +1 -0
  94. data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/show.html.erb_spec.rb +1 -0
  95. data/test_unit_generators/merb_controller_test/merb_controller_test_generator.rb +47 -0
  96. data/test_unit_generators/merb_controller_test/templates/test/functional/%controller_full_file_path%_test.rb +17 -0
  97. data/test_unit_generators/merb_model_test/merb_model_test_generator.rb +34 -0
  98. data/test_unit_generators/merb_model_test/templates/test/unit/%model_file_name%_test.rb +9 -0
  99. data/test_unit_generators/merb_resource_controller_test/merb_resource_controller_test_generator.rb +31 -0
  100. metadata +253 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Yehuda Katz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,10 @@
1
+ ==== merb-gen
2
+
3
+ merb-gen is a part of the Merb More package. It provides application and plugin generators for Merb.
4
+
5
+ ==== Usage
6
+
7
+ To generate a new merb app, run merb-gen &lt;path&gt;. For instance, <tt>merb-gen foo</tt> would create
8
+ a new merb app inside of the foo directory.
9
+
10
+ To generate a new merb plugin, run merb-gen plugin &lt;path&gt;.
@@ -0,0 +1,47 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+
4
+ GEM = "merb-gen"
5
+ VERSION = "0.9.2"
6
+ AUTHOR = "Yehuda Katz"
7
+ EMAIL = "wycats@gmail.com"
8
+ HOMEPAGE = "http://www.merbivore.com"
9
+ SUMMARY = "Merb More: Merb's Application and Plugin Generators"
10
+
11
+ spec = Gem::Specification.new do |s|
12
+ s.name = GEM
13
+ s.version = VERSION
14
+ s.platform = Gem::Platform::RUBY
15
+ s.has_rdoc = true
16
+ s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
17
+ s.summary = SUMMARY
18
+ s.description = s.summary
19
+ s.author = AUTHOR
20
+ s.email = EMAIL
21
+ s.homepage = HOMEPAGE
22
+ s.bindir = "bin"
23
+ s.executables = %w( merb-gen )
24
+
25
+ # Uncomment this to add a dependency
26
+ s.add_dependency "merb-core", ">= 0.9.2"
27
+ s.add_dependency "rubigen", ">= 1.2.4"
28
+
29
+ s.require_path = 'lib'
30
+ s.autorequire = GEM
31
+ s.files = %w(LICENSE README Rakefile TODO) +
32
+ Dir.glob("{lib,bin,spec,app_generators,merb_default_generators,merb_generators,rspec_generators,test_unit_generators}/**/*")
33
+ end
34
+
35
+ Rake::GemPackageTask.new(spec) do |pkg|
36
+ pkg.gem_spec = spec
37
+ end
38
+
39
+ namespace :jruby do
40
+ task :install do
41
+ sh %{sudo jruby -S gem install pkg/#{GEM}-#{VERSION} --no-update-sources}
42
+ end
43
+ end
44
+
45
+ task :install => [:package] do
46
+ sh %{sudo gem install pkg/#{GEM}-#{VERSION} --no-update-sources}
47
+ end
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/<%= name %>.rb
File without changes
@@ -0,0 +1,36 @@
1
+ require "merb-gen/helpers"
2
+ require "merb-gen/base"
3
+
4
+ class MerbGenerator < Merb::GeneratorBase
5
+
6
+ def initialize(args, runtime_options = {})
7
+ @base = File.dirname(__FILE__)
8
+ @name = args.first
9
+ super
10
+ @destination_root = @name
11
+ end
12
+
13
+ protected
14
+ def banner
15
+ <<-EOS.split("\n").map{|x| x.strip}.join("\n")
16
+ Creates a Merb application stub.
17
+
18
+ USAGE: #{spec.name} -g path
19
+
20
+ Set environment variable MERB_ORM=[activerecord|datamapper|sequel]
21
+ to pre-enabled an ORM.
22
+ EOS
23
+ end
24
+
25
+ def default_orm?(orm)
26
+ ENV['MERB_ORM'] == orm.to_s
27
+ end
28
+
29
+ def default_test_suite?(suite)
30
+ return ENV['MERB_TEST_SUITE'] == suite.to_s if ENV['MERB_TEST_SUITE']
31
+ options[suite]
32
+ end
33
+
34
+ def display_framework_selections
35
+ end
36
+ end
@@ -0,0 +1,126 @@
1
+ require 'rubygems'
2
+ Gem.clear_paths
3
+ Gem.path.unshift(File.join(File.dirname(__FILE__), "gems"))
4
+
5
+ require 'rake'
6
+ require 'rake/rdoctask'
7
+ require 'rake/testtask'
8
+ require 'spec/rake/spectask'
9
+ require 'fileutils'
10
+ require 'merb-core'
11
+ require 'rubigen'
12
+ include FileUtils
13
+
14
+ # Load the basic runtime dependencies; this will include
15
+ # any plugins and therefore plugin rake tasks.
16
+ init_env = ENV['MERB_ENV'] || 'rake'
17
+ Merb.load_dependencies(:environment => init_env)
18
+
19
+ # Get Merb plugins and dependencies
20
+ Merb::Plugins.rakefiles.each { |r| require r }
21
+
22
+ desc "start runner environment"
23
+ task :merb_env do
24
+ Merb.start_environment(:environment => init_env, :adapter => 'runner')
25
+ end
26
+
27
+ ##############################################################################
28
+ # ADD YOUR CUSTOM TASKS BELOW
29
+ ##############################################################################
30
+
31
+ desc "Add new files to subversion"
32
+ task :svn_add do
33
+ system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
34
+ end
35
+
36
+
37
+ class Freezer
38
+
39
+ class << self
40
+
41
+ def components
42
+ {
43
+ "core" => "git://github.com/wycats/merb-core.git",
44
+ "more" => "git://github.com/wycats/merb-more.git",
45
+ "plugins" => "git://github.com/wycats/merb-plugins.git"
46
+ }
47
+ end
48
+
49
+ def framework_dir
50
+ # Should allow customization of this directory's location?
51
+ File.join(File.dirname(__FILE__), "framework")
52
+ end
53
+
54
+ def gitmodules
55
+ File.join(File.dirname(__FILE__), ".gitmodules")
56
+ end
57
+
58
+ def freeze(component, update = false)
59
+ new(component, update).freeze
60
+ end
61
+
62
+ end
63
+
64
+ def initialize(component, update)
65
+ @component = "merb-" + component
66
+ @update = update
67
+ end
68
+
69
+ def freeze
70
+ # Ensure that required git commands are available
71
+ %w(git-pull git-submodule).each do |bin|
72
+ next if in_path?(bin)
73
+ $stderr.puts "ERROR: #{bin} must be avaible in PATH"
74
+ exit 1
75
+ end
76
+
77
+ unless File.directory?(framework_dir)
78
+ puts "Creating framework directory ..."
79
+ FileUtils.mkdir_p(framework_dir)
80
+ end
81
+
82
+ if managed?
83
+ puts "#{@component} seems to be already managed by git-submodule."
84
+ if @update
85
+ puts "Trying to update #{@component} ..."
86
+ sh "cd #{framework_dir}/#{@component} && git-pull"
87
+ end
88
+ else
89
+ puts "Creating submodule for #{@component} ..."
90
+ sh "git-submodule --quiet add #{components[@component.gsub("merb-", '')]} #{File.basename(framework_dir)}/#{@component}"
91
+ if $?.success?
92
+ sh("git-submodule init")
93
+ else
94
+ # Should this instead be a raise?
95
+ $stderr.puts("ERROR: unable to create submodule for #{@component}")
96
+ end
97
+ end
98
+ end
99
+
100
+ protected
101
+
102
+ def in_submodule?
103
+ return false unless File.exists?(gitmodules)
104
+ File.read(gitmodules) =~ %r![submodule "#{framework_dir}/#{@component}"]!
105
+ end
106
+
107
+ def managed?
108
+ File.directory?(File.join(framework_dir, @component)) || in_submodule?
109
+ end
110
+
111
+ def in_path?(bin)
112
+ `which #{bin}`
113
+ !$?.nil? && $?.success?
114
+ end
115
+
116
+ end
117
+
118
+ task :freeze => Freezer.components.keys.map { |component| "freeze:#{component}" }
119
+ namespace :freeze do
120
+ Freezer.components.each do |component, git_repository|
121
+ desc "Freeze #{component} from #{git_repository}"
122
+ task component do
123
+ Freezer.freeze(component, ENV["UPDATE"])
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,2 @@
1
+ class Application < Merb::Controller
2
+ end
@@ -0,0 +1,13 @@
1
+ class Exceptions < Application
2
+
3
+ # handle NotFound exceptions (404)
4
+ def not_found
5
+ render :format => :html
6
+ end
7
+
8
+ # handle NotAcceptable exceptions (406)
9
+ def not_acceptable
10
+ render :format => :html
11
+ end
12
+
13
+ end
@@ -0,0 +1,5 @@
1
+ module Merb
2
+ module GlobalHelpers
3
+ # helpers defined here available to all views.
4
+ end
5
+ end
@@ -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')%>&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>