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
@@ -0,0 +1,5 @@
1
+ class <%= model_class_name %>
2
+ <% unless model_attributes.empty? -%>
3
+ attr_accessor <%= model_attributes.map{|a| ":#{a.first}" }.compact.uniq.join(", ") %>
4
+ <% end -%>
5
+ end
@@ -0,0 +1,74 @@
1
+ class ResourceControllerGenerator < Merb::GeneratorBase
2
+
3
+ attr_reader :controller_class_name,
4
+ :controller_file_name,
5
+ :controller_base_path,
6
+ :controller_modules,
7
+ :model_class_name,
8
+ :full_controller_const,
9
+ :singular_model,
10
+ :plural_model
11
+
12
+ def initialize(args, runtime_args = {})
13
+ @base = File.dirname(__FILE__)
14
+
15
+ super
16
+ name = args.shift
17
+ nfp = name.snake_case.gsub("::", "/")
18
+ nfp = nfp.split("/")
19
+ @model_class_name = nfp.pop.singularize.to_const_string
20
+ @model_class_name = runtime_args[:model_class_name] if runtime_args[:model_class_name]
21
+ @singular_model = @model_class_name.snake_case
22
+ @plural_model = @singular_model.pluralize
23
+
24
+ nfp << @plural_model
25
+
26
+ @controller_file_name = nfp.join("/")
27
+
28
+ # Need to setup the directories
29
+ unless @controller_file_name == File.basename(@controller_file_name)
30
+ @controller_base_path = controller_file_name.split("/")[0..-2].join("/")
31
+ end
32
+
33
+ @controller_modules = @controller_file_name.to_const_string.split("::")[0..-2]
34
+ @controller_class_name = @controller_file_name.to_const_string.split("::").last
35
+
36
+ @full_controller_const = ((@controller_modules.dup || []) << @controller_class_name).join("::")
37
+ end
38
+
39
+ def manifest
40
+ record do |m|
41
+ @m = m
42
+
43
+ # Create the controller directory
44
+ m.directory File.join("app/controllers", controller_base_path) if controller_base_path
45
+
46
+ # Create the helpers directory
47
+ m.directory File.join("app/helpers", controller_base_path) if controller_base_path
48
+
49
+ @assigns = {
50
+ :controller_modules => controller_modules,
51
+ :controller_class_name => controller_class_name,
52
+ :controller_file_name => controller_file_name,
53
+ :controller_base_path => controller_base_path,
54
+ :full_controller_const => full_controller_const,
55
+ :model_class_name => model_class_name,
56
+ :singular_model => singular_model,
57
+ :plural_model => plural_model
58
+ }
59
+ copy_dirs
60
+ copy_files
61
+
62
+ m.dependency "merb_resource_controller_test", [@controller_class_name], @assigns
63
+ end
64
+ end
65
+
66
+ protected
67
+ def banner
68
+ <<-EOS.split("\n").map{|x| x.strip}.join("\n")
69
+ Creates a basic Merb resource controller.
70
+
71
+ USAGE: #{spec.name} my_resource
72
+ EOS
73
+ end
74
+ end
@@ -0,0 +1,46 @@
1
+ <% counter = 0 -%>
2
+ <% controller_modules.each_with_index do |mod, i| -%>
3
+ <%= " " * i %>module <%= mod %>
4
+ <% counter = i -%>
5
+ <% end -%>
6
+ <% counter = counter == 0 ? 0 : (counter + 1) -%>
7
+ <%= " " * counter %>class <%= controller_class_name %> < Application
8
+
9
+ <%= " " * counter %> def index
10
+ <%= " " * counter %> render
11
+ <%= " " * counter %> end
12
+
13
+ <%= " " * counter %> def show
14
+ <%= " " * counter %> render
15
+ <%= " " * counter %> end
16
+
17
+ <%= " " * counter %> def new
18
+ <%= " " * counter %> render
19
+ <%= " " * counter %> end
20
+
21
+ <%= " " * counter %> def edit
22
+ <%= " " * counter %> render
23
+ <%= " " * counter %> end
24
+
25
+ <%= " " * counter %> def delete
26
+ <%= " " * counter %> render
27
+ <%= " " * counter %> end
28
+
29
+ <%= " " * counter %> def create
30
+ <%= " " * counter %> render
31
+ <%= " " * counter %> end
32
+
33
+ <%= " " * counter %> def update
34
+ <%= " " * counter %> render
35
+ <%= " " * counter %> end
36
+
37
+ <%= " " * counter %> def destroy
38
+ <%= " " * counter %> render
39
+ <%= " " * counter %> end
40
+
41
+ <%= " " * counter %>end
42
+ <% counter = counter == 0 ? 0 : (counter - 1) -%>
43
+ <% controller_modules.reverse.each_with_index do |mod, i| -%>
44
+ <%= " " * counter %>end # <%= mod %>
45
+ <% counter = counter - 1 -%>
46
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <% counter = 1 -%>
2
+ module Merb
3
+ <% controller_modules.each_with_index do |mod, i| -%>
4
+ <%= " " * i %>module <%= mod %>
5
+ <% counter = i -%>
6
+ <% end -%>
7
+ <% counter = counter == 0 ? 0 : (counter + 1) -%>
8
+ <%= " " * counter %>module <%= controller_class_name %>Helper
9
+
10
+ <%= " " * counter %>end
11
+ <% counter = counter == 0 ? 0 : (counter - 1) -%>
12
+ <% controller_modules.reverse.each_with_index do |mod, i| -%>
13
+ <%= " " * counter %>end # <%= mod %>
14
+ <% counter = counter - 1 -%>
15
+ <% end -%>
16
+ end
@@ -0,0 +1,3 @@
1
+ <h1><%= full_controller_const %> controller, delete action</h1>
2
+
3
+ <p>Edit this file in <tt>app/views/<%= controller_file_name %>/delete.html.erb</tt></p>
@@ -0,0 +1,3 @@
1
+ <h1><%= full_controller_const %> controller, edit action</h1>
2
+
3
+ <p>Edit this file in <tt>app/views/<%= controller_file_name %>/edit.html.erb</tt></p>
@@ -0,0 +1,3 @@
1
+ <h1><%= full_controller_const %> controller, index action</h1>
2
+
3
+ <p>Edit this file in <tt>app/views/<%= controller_file_name %>/index.html.erb</tt></p>
@@ -0,0 +1,3 @@
1
+ <h1><%= full_controller_const %> controller, new action</h1>
2
+
3
+ <p>Edit this file in <tt>app/views/<%= controller_file_name %>/new.html.erb</tt></p>
@@ -0,0 +1,3 @@
1
+ <h1><%= full_controller_const %> controller, show action</h1>
2
+
3
+ <p>Edit this file in <tt>app/views/<%= controller_file_name %>/show.html.erb</tt></p>
File without changes
@@ -0,0 +1,59 @@
1
+ class ControllerGenerator < Merb::GeneratorBase
2
+
3
+ attr_reader :controller_class_name,
4
+ :controller_file_name,
5
+ :controller_base_path,
6
+ :controller_modules,
7
+ :full_controller_const
8
+
9
+ def initialize(args, runtime_args = {})
10
+ @base = File.dirname(__FILE__)
11
+ super
12
+ name = args.shift
13
+ @controller_file_name = name.snake_case.gsub("::", "/")
14
+
15
+ # Need to setup the directories
16
+ unless @controller_file_name == File.basename(@controller_file_name)
17
+ @controller_base_path = controller_file_name.split("/")[0..-2].join("/")
18
+ end
19
+
20
+ @controller_modules = @controller_file_name.to_const_string.split("::")[0..-2]
21
+ @controller_class_name = @controller_file_name.to_const_string.split("::").last
22
+
23
+ @full_controller_const = ((@controller_modules.dup || []) << @controller_class_name).join("::")
24
+ end
25
+
26
+ def manifest
27
+ record do |m|
28
+ @m = m
29
+
30
+ # Create the controller directory
31
+ m.directory File.join("app/controllers", controller_base_path) if controller_base_path
32
+
33
+ # Create the helpers directory
34
+ m.directory File.join("app/helpers", controller_base_path) if controller_base_path
35
+
36
+ @assigns = {
37
+ :controller_modules => controller_modules,
38
+ :controller_class_name => controller_class_name,
39
+ :controller_file_name => controller_file_name,
40
+ :controller_base_path => controller_base_path,
41
+ :full_controller_const => full_controller_const
42
+ }
43
+
44
+ copy_dirs
45
+ copy_files
46
+
47
+ m.dependency "merb_controller_test", [@controller_class_name], @assigns
48
+ end
49
+ end
50
+
51
+ protected
52
+ def banner
53
+ <<-EOS.split("\n").map{|x| x.strip}.join("\n")
54
+ Creates a basic Merb controller.
55
+
56
+ USAGE: #{spec.name} my_controller
57
+ EOS
58
+ end
59
+ end
@@ -0,0 +1,18 @@
1
+ <% counter = 0 -%>
2
+ <% controller_modules.each_with_index do |mod, i| -%>
3
+ <%= " " * i %>module <%= mod %>
4
+ <% counter = i -%>
5
+ <% end -%>
6
+ <% counter = counter == 0 ? 0 : (counter + 1) -%>
7
+ <%= " " * counter %>class <%= controller_class_name %> < Application
8
+
9
+ <%= " " * counter %> def index
10
+ <%= " " * counter %> render
11
+ <%= " " * counter %> end
12
+
13
+ <%= " " * counter %>end
14
+ <% counter = counter == 0 ? 0 : (counter - 1) -%>
15
+ <% controller_modules.reverse.each_with_index do |mod, i| -%>
16
+ <%= " " * counter %>end # <%= mod %>
17
+ <% counter = counter - 1 -%>
18
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <% counter = 1 -%>
2
+ module Merb
3
+ <% controller_modules.each_with_index do |mod, i| -%>
4
+ <%= " " * i %>module <%= mod %>
5
+ <% counter = i -%>
6
+ <% end -%>
7
+ <% counter = counter == 0 ? 0 : (counter + 1) -%>
8
+ <%= " " * counter %>module <%= controller_class_name %>Helper
9
+
10
+ <%= " " * counter %>end
11
+ <% counter = counter == 0 ? 0 : (counter - 1) -%>
12
+ <% controller_modules.reverse.each_with_index do |mod, i| -%>
13
+ <%= " " * counter %>end # <%= mod %>
14
+ <% counter = counter - 1 -%>
15
+ <% end -%>
16
+ end
@@ -0,0 +1 @@
1
+ You're in index of the <%= full_controller_const %>
File without changes
@@ -0,0 +1,25 @@
1
+ class FreezerGenerator < Merb::GeneratorBase
2
+
3
+ def initialize(args, runtime_args = {})
4
+ @base = File.dirname(__FILE__)
5
+ super
6
+ end
7
+
8
+ def manifest
9
+ record do |m|
10
+ @m = m
11
+ @assigns = {}
12
+ copy_dirs
13
+ m.file "script/frozen-merb", "script/frozen-merb", :chmod => 0755, :shebang => DEFAULT_SHEBANG
14
+ end
15
+ end
16
+
17
+ protected
18
+ def banner
19
+ <<-EOS.split("\n").map{|x| x.strip}.join("\n")
20
+ Creates a frozen-merb script that runs merb from framework/ or gems/
21
+
22
+ USAGE: #{spec.name} frozen-merb
23
+ EOS
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ __DIR__ = File.join(File.dirname(__FILE__),"..")
4
+
5
+ framework = File.join(__DIR__,"framework")
6
+
7
+ if File.directory?(framework)
8
+ puts "Running from frozen framework"
9
+ core = File.join(framework,"merb-core")
10
+ if File.directory?(core)
11
+ $:.push File.join(core,"lib")
12
+ end
13
+ more = File.join(framework,"merb-more")
14
+ if File.directory?(more)
15
+ Dir.new(more).select {|d| d =~ /merb-/}.each do |d|
16
+ $:.push File.join(more,d,'lib')
17
+ end
18
+ end
19
+ plugins = File.join(framework,"merb-plugins")
20
+ if File.directory?(plugins)
21
+ Dir.new(plugins).select {|d| d =~ /merb_/}.each do |d|
22
+ $:.push File.join(plugins,d,'lib')
23
+ end
24
+ end
25
+ require "merb-core/core_ext/kernel"
26
+ require "merb-core/core_ext/rubygems"
27
+ else
28
+ gem = Dir.glob(__DIR__ + "/gems/gems/merb-core-*").last
29
+ raise "Can't run frozen without framework/ or local gem" unless gem
30
+ require gem + "/lib/merb-core/core_ext/kernel"
31
+ require gem + "/lib/merb-core/core_ext/rubygems"
32
+
33
+ Gem.clear_paths
34
+ Gem.path.unshift(__DIR__+"/gems")
35
+ end
36
+
37
+ require 'merb-core'
38
+ unless %w[-a --adapter -i --irb-console -r --script-runner].any? { |o| ARGV.index(o) }
39
+ ARGV.push *%w[-a mongrel]
40
+ end
41
+
42
+ Merb.frozen!
43
+ Merb.start
File without changes
@@ -0,0 +1,58 @@
1
+ class PartControllerGenerator < Merb::GeneratorBase
2
+
3
+ attr_reader :controller_class_name,
4
+ :controller_file_name,
5
+ :controller_base_path,
6
+ :controller_modules,
7
+ :full_controller_const
8
+
9
+ def initialize(args, runtime_args = {})
10
+ @base = File.dirname(__FILE__)
11
+ super
12
+ name = args.shift
13
+ @controller_file_name = name.snake_case.gsub("::", "/")
14
+
15
+ # Need to setup the directories
16
+ unless @controller_file_name == File.basename(@controller_file_name)
17
+ @controller_base_path = controller_file_name.split("/")[0..-2].join("/")
18
+ end
19
+
20
+ @controller_modules = @controller_file_name.to_const_string.split("::")[0..-2]
21
+ @controller_class_name = @controller_file_name.to_const_string.split("::").last
22
+
23
+ @full_controller_const = ((@controller_modules.dup || []) << @controller_class_name).join("::")
24
+ end
25
+
26
+ def manifest
27
+ record do |m|
28
+ @m = m
29
+
30
+ # Create the controller directory
31
+ m.directory File.join("app/parts", controller_base_path) if controller_base_path
32
+
33
+ # Create the helpers directory
34
+ m.directory File.join("app/helpers", controller_base_path) if controller_base_path
35
+
36
+ @assigns = {
37
+ :controller_modules => controller_modules,
38
+ :controller_class_name => controller_class_name,
39
+ :controller_file_name => controller_file_name,
40
+ :controller_base_path => controller_base_path,
41
+ :full_controller_const => full_controller_const
42
+ }
43
+
44
+ copy_dirs
45
+ copy_files
46
+
47
+ end
48
+ end
49
+
50
+ protected
51
+ def banner
52
+ <<-EOS.split("\n").map{|x| x.strip}.join("\n")
53
+ Creates a basic Merb Part controller.
54
+
55
+ USAGE: #{spec.name} my_part_controller
56
+ EOS
57
+ end
58
+ end
@@ -0,0 +1,16 @@
1
+ <% counter = 1 -%>
2
+ module Merb
3
+ <% controller_modules.each_with_index do |mod, i| -%>
4
+ <%= " " * i %>module <%= mod %>
5
+ <% counter = i -%>
6
+ <% end -%>
7
+ <% counter = counter == 0 ? 0 : (counter + 1) -%>
8
+ <%= " " * counter %>module <%= controller_class_name %>PartHelper
9
+
10
+ <%= " " * counter %>end
11
+ <% counter = counter == 0 ? 0 : (counter - 1) -%>
12
+ <% controller_modules.reverse.each_with_index do |mod, i| -%>
13
+ <%= " " * counter %>end # <%= mod %>
14
+ <% counter = counter - 1 -%>
15
+ <% end -%>
16
+ end
@@ -0,0 +1,18 @@
1
+ <% counter = 0 -%>
2
+ <% controller_modules.each_with_index do |mod, i| -%>
3
+ <%= " " * i %>module <%= mod %>
4
+ <% counter = i -%>
5
+ <% end -%>
6
+ <% counter = counter == 0 ? 0 : (counter + 1) -%>
7
+ <%= " " * counter %>class <%= controller_class_name %>Part < Merb::PartController
8
+
9
+ <%= " " * counter %> def index
10
+ <%= " " * counter %> render
11
+ <%= " " * counter %> end
12
+
13
+ <%= " " * counter %>end
14
+ <% counter = counter == 0 ? 0 : (counter - 1) -%>
15
+ <% controller_modules.reverse.each_with_index do |mod, i| -%>
16
+ <%= " " * counter %>end # <%= mod %>
17
+ <% counter = counter - 1 -%>
18
+ <% end -%>