public
Description: Merb More: The Full Stack. Take what you need; leave what you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-more.git
Make generators more explicit: add descriptions to options and notes to 
templates.
Mon Jul 21 05:29:42 -0700 2008
commit  e3a64cb3f2e0448c75e1211e39162f2e42361219
tree    22457985f59df91e28c34c08726f8a98bfc1950f
parent  a6ee8184dc18e8407f2ad4135c22e6567474377e
...
7
8
9
10
 
11
12
13
 
14
15
 
16
17
18
...
66
67
68
69
70
 
...
7
8
9
 
10
11
12
 
13
14
 
15
16
17
18
...
66
67
68
 
69
70
0
@@ -7,12 +7,12 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This is a controller generator
0
+ Generates a new controller.
0
     DESC
0
     
0
- option :testing_framework, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
+ option :testing_framework, :desc => 'Testing framework to use (one of: spec, test_unit)'
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "controller name"
0
     
0
     invoke :helper
0
     
0
@@ -66,4 +66,4 @@ module Merb::Generators
0
   
0
   add :controller, ControllerGenerator
0
   
0
-end
0
\ No newline at end of file
0
+end
...
7
8
9
10
 
11
12
13
...
16
17
18
19
20
 
...
7
8
9
 
10
11
12
13
...
16
17
18
 
19
20
0
@@ -7,7 +7,7 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- Generates a freezer
0
+ Generates Merb freezer scripts.
0
     DESC
0
     
0
     template :freezer, 'script/frozen_merb', 'script/frozen_merb'
0
@@ -16,4 +16,4 @@ module Merb::Generators
0
   
0
   add :freezer, FreezerGenerator
0
   
0
-end
0
\ No newline at end of file
0
+end
...
7
8
9
10
 
11
12
13
 
14
15
 
16
17
18
...
50
51
52
53
54
 
...
7
8
9
 
10
11
12
 
13
14
 
15
16
17
18
...
50
51
52
 
53
54
0
@@ -7,12 +7,12 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This is a controller generator
0
+ Generates a new helper.
0
     DESC
0
     
0
- option :testing_framework, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
+ option :testing_framework, :desc => 'Testing framework to use (one of: spec, test_unit)'
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "helper name"
0
     
0
     template :helper do
0
       source('app/helpers/%file_name%_helper.rb')
0
@@ -50,4 +50,4 @@ module Merb::Generators
0
   
0
   add :helper, HelperGenerator
0
   
0
-end
0
\ No newline at end of file
0
+end
...
6
7
8
9
10
11
12
 
 
 
 
13
14
15
16
17
18
 
19
20
21
...
6
7
8
 
 
 
 
9
10
11
12
13
14
15
16
17
 
18
19
20
21
0
@@ -6,16 +6,16 @@ module Merb::Generators
0
       File.join(super, 'merb')
0
     end
0
     
0
- option :testing_framework, :default => :rspec, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
- option :orm, :default => :none, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
- option :flat, :as => :boolean
0
- option :very_flat, :as => :boolean
0
+ option :testing_framework, :default => :rspec, :desc => 'Testing framework to use (one of: spec, test_unit)'
0
+ option :orm, :default => :none, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
0
+ option :flat, :as => :boolean, :desc => "Generate a flat application: one file + configs + templates directory."
0
+ option :very_flat, :as => :boolean, :desc => "Generate a very flat, Sinatra-like one file application."
0
     
0
     desc <<-DESC
0
       This generates a full merb application
0
     DESC
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "Application name"
0
     
0
     invoke :app_full, :flat => nil, :very_flat => nil
0
     invoke :app_flat, :flat => true
...
7
8
9
10
 
 
 
11
12
13
 
14
15
16
...
7
8
9
 
10
11
12
13
14
 
15
16
17
18
0
@@ -7,10 +7,12 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This generates a flat merb application
0
+ This generates a flat merb application: all code but config files and
0
+ templates fits in one application. This is something in between Sinatra
0
+ and "regular" Merb application.
0
     DESC
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "Application name"
0
     
0
     glob!
0
 
...
6
7
8
9
10
 
 
 
 
11
12
13
 
 
14
15
16
17
18
 
19
20
21
...
6
7
8
 
 
9
10
11
12
13
14
 
15
16
17
18
19
20
 
21
22
23
24
0
@@ -6,16 +6,19 @@ module Merb::Generators
0
       File.join(super, 'merb')
0
     end
0
     
0
- option :testing_framework, :default => :rspec, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
- option :orm, :default => :none, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
+ option :testing_framework, :default => :rspec,
0
+ :desc => 'Testing framework to use (one of: spec, test_unit).'
0
+ option :orm, :default => :none,
0
+ :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel).'
0
     
0
     desc <<-DESC
0
- This generates a full merb application
0
+ This generates a Merb application with Ruby on Rails like structure.
0
+ Generator lets you configure your ORM and testing framework of choice.
0
     DESC
0
     
0
     glob!
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "Application name"
0
     
0
     def app_name
0
       self.name.snake_case
...
6
7
8
9
10
 
 
11
12
13
 
14
15
16
17
18
 
19
20
21
...
6
7
8
 
 
9
10
11
12
 
13
14
15
16
17
 
18
19
20
21
0
@@ -6,16 +6,16 @@ module Merb::Generators
0
       File.join(super, 'merb_plugin')
0
     end
0
     
0
- option :testing_framework, :default => :rspec, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
- option :orm, :default => :none, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
+ option :testing_framework, :default => :rspec, :desc => 'Testing framework to use (one of: spec, test_unit)'
0
+ option :orm, :default => :none, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
0
     
0
     desc <<-DESC
0
- This generates a plugin for merb
0
+ Merb plugin generator: lets you kick start your Merb plugin.
0
     DESC
0
     
0
     glob!
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "Plugin name"
0
     
0
     def base_name
0
       self.name.snake_case
...
7
8
9
10
 
 
11
12
13
 
14
15
16
...
7
8
9
 
10
11
12
13
 
14
15
16
17
0
@@ -7,10 +7,11 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This generates a very flat merb application
0
+ This generates a very flat merb application: the whole application
0
+ fits in one file, very much like Sinatra or Camping.
0
     DESC
0
     
0
- first_argument :name, :required => true
0
+ first_argument :name, :required => true, :desc => "Application name"
0
     
0
     template :application do
0
       source('application.rbt')
...
10
11
12
13
14
 
 
15
16
17
...
10
11
12
 
 
13
14
15
16
17
0
@@ -10,8 +10,8 @@ module Merb::Generators
0
       This is a migration generator
0
     DESC
0
     
0
- option :orm, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
- option :model, :as => :boolean, :desc => 'Set this option to generate a migration which creates a table for the provided model'
0
+ option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
0
+ option :model, :as => :boolean, :desc => 'Specify this option to generate a migration which creates a table for the provided model'
0
     
0
     first_argument :name, :required => true
0
     second_argument :attributes, :as => :hash, :default => {}
...
7
8
9
10
 
 
11
12
13
14
 
 
15
16
17
 
 
18
19
20
...
63
64
65
66
67
 
...
7
8
9
 
10
11
12
13
 
 
14
15
16
 
 
17
18
19
20
21
...
64
65
66
 
67
68
0
@@ -7,14 +7,15 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This is a model generator
0
+ Generates a new model. You can specify an ORM different from what the rest
0
+ of the application uses.
0
     DESC
0
     
0
- option :testing_framework, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
- option :orm, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
+ option :testing_framework, :desc => 'Testing framework to use (one of: spec, test_unit)'
0
+ option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
0
     
0
- first_argument :name, :required => true
0
- second_argument :attributes, :as => :hash, :default => {}
0
+ first_argument :name, :required => true, :desc => "model name"
0
+ second_argument :attributes, :as => :hash, :default => {}, :desc => "space separated model properties in form of name:type. Example: state:string"
0
     
0
     invoke :migration do |generator|
0
       generator.new(destination_root, options.merge(:model => true), name, attributes)
0
@@ -63,4 +64,4 @@ module Merb::Generators
0
   
0
   add :model, ModelGenerator
0
   
0
-end
0
\ No newline at end of file
0
+end
...
3
4
5
6
 
7
8
9
10
 
 
11
12
13
...
29
30
31
32
33
 
...
3
4
5
 
6
7
8
 
 
9
10
11
12
13
...
29
30
31
 
32
33
0
@@ -3,11 +3,11 @@ module Merb::Generators
0
   class ResourceGenerator < ComponentGenerator
0
     
0
     desc <<-DESC
0
- This is a resource generator
0
+ Generates a new resource.
0
     DESC
0
     
0
- first_argument :name, :required => true
0
- second_argument :attributes, :as => :hash
0
+ first_argument :name, :required => true, :desc => "resource name"
0
+ second_argument :attributes, :as => :hash, :default => {}, :desc => "space separated resource model properties in form of name:type. Example: state:string"
0
     
0
     invoke :model do |generator|
0
       generator.new(destination_root, options, model_name, attributes)
0
@@ -29,4 +29,4 @@ module Merb::Generators
0
   
0
   add :resource, ResourceGenerator
0
   
0
-end
0
\ No newline at end of file
0
+end
...
7
8
9
10
 
11
12
13
14
 
 
15
16
17
 
 
 
 
 
18
19
20
...
85
86
87
88
89
 
...
7
8
9
 
10
11
12
 
 
13
14
15
 
 
16
17
18
19
20
21
22
23
...
88
89
90
 
91
92
0
@@ -7,14 +7,17 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This is a resource controller generator
0
+ Generates a new resource controller.
0
     DESC
0
     
0
- option :testing_framework, :desc => 'Specify which testing framework to use (spec, test_unit)'
0
- option :orm, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
+ option :testing_framework, :desc => 'Testing framework to use (one of: spec, test_unit)'
0
+ option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
0
     
0
- first_argument :name, :required => true
0
- second_argument :attributes, :as => :hash, :default => {}
0
+ first_argument :name, :required => true,
0
+ :desc => "model name"
0
+ second_argument :attributes, :as => :hash,
0
+ :default => {},
0
+ :desc => "space separated resource model properties in form of name:type. Example: state:string"
0
     
0
     invoke :helper do |generator|
0
       generator.new(destination_root, options, name)
0
@@ -85,4 +88,4 @@ module Merb::Generators
0
   
0
   add :resource_controller, ResourceControllerGenerator
0
   
0
-end
0
\ No newline at end of file
0
+end
...
7
8
9
10
 
11
12
13
 
14
15
16
...
7
8
9
 
10
11
12
 
13
14
15
16
0
@@ -7,10 +7,10 @@ module Merb::Generators
0
     end
0
     
0
     desc <<-DESC
0
- This is a migration generator
0
+ Generates a new session migration.
0
     DESC
0
     
0
- option :orm, :desc => 'Specify which Object-Relation Mapper to use (none, activerecord, datamapper, sequel)'
0
+ option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
0
     
0
     template :session_migration_activerecord, :orm => :activerecord do
0
       source('activerecord/schema/migrations/%version%_sessions.rb')
...
1
2
 
 
 
 
 
 
3
4
5
...
8
9
10
11
12
13
14
15
16
17
 
18
...
1
2
3
4
5
6
7
8
9
10
11
...
14
15
16
 
 
 
 
 
 
 
17
18
0
@@ -1,5 +1,11 @@
0
 # run very flat apps with merb -I <app file>.
0
 
0
+Merb::Config.use { |c|
0
+ c[:framework] = { :public => [Merb.root / "public", nil] },
0
+ c[:session_store] = 'none',
0
+ c[:exception_details] = true
0
+}
0
+
0
 Merb::Router.prepare do |r|
0
   r.match('/').to(:controller => '<%= app_name %>', :action =>'index')
0
 end
0
@@ -8,10 +14,4 @@ class <%= class_name %> < Merb::Controller
0
   def index
0
     "hi"
0
   end
0
-end
0
-
0
-Merb::Config.use { |c|
0
- c[:framework] = { :public => [Merb.root / "public", nil] },
0
- c[:session_store] = 'none',
0
- c[:exception_details] = true
0
-}
0
+end
0
\ No newline at end of file
...
1
2
3
 
 
 
4
5
6
7
8
9
10
 
...
1
2
 
3
4
5
6
7
8
9
10
 
11
12
0
@@ -1,9 +1,11 @@
0
 <% with_modules(controller_modules) do -%>
0
 class <%= controller_class_name %> < Application
0
-
0
+
0
+ # ...and remember, everything returned from an action
0
+ # goes to the client...
0
   def index
0
     render
0
   end
0
   
0
 end
0
-<% end -%>
0
\ No newline at end of file
0
+<% end -%>
...
1
2
3
 
...
1
 
2
3
0
@@ -1,2 +1,2 @@
0
 class <%= class_name %> < ActiveRecord::Base
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.