rubigen 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/History.txt +8 -0
  2. data/Manifest.txt +1 -72
  3. data/app_generators/ruby_app/ruby_app_generator.rb +1 -1
  4. data/app_generators/ruby_app/templates/configs/{empty.log → empty_log} +0 -0
  5. data/generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb +7 -0
  6. data/lib/rubigen/lookup.rb +1 -1
  7. data/lib/rubigen/version.rb +1 -1
  8. data/website/index.html +2 -2
  9. metadata +3 -74
  10. data/examples/rails_generators/applications/app/USAGE +0 -16
  11. data/examples/rails_generators/applications/app/app_generator.rb +0 -177
  12. data/examples/rails_generators/components/controller/USAGE +0 -29
  13. data/examples/rails_generators/components/controller/controller_generator.rb +0 -37
  14. data/examples/rails_generators/components/controller/templates/controller.rb +0 -10
  15. data/examples/rails_generators/components/controller/templates/functional_test.rb +0 -18
  16. data/examples/rails_generators/components/controller/templates/helper.rb +0 -2
  17. data/examples/rails_generators/components/controller/templates/view.html.erb +0 -2
  18. data/examples/rails_generators/components/integration_test/USAGE +0 -8
  19. data/examples/rails_generators/components/integration_test/integration_test_generator.rb +0 -16
  20. data/examples/rails_generators/components/integration_test/templates/integration_test.rb +0 -10
  21. data/examples/rails_generators/components/mailer/USAGE +0 -16
  22. data/examples/rails_generators/components/mailer/mailer_generator.rb +0 -34
  23. data/examples/rails_generators/components/mailer/templates/fixture.erb +0 -3
  24. data/examples/rails_generators/components/mailer/templates/fixture.rhtml +0 -0
  25. data/examples/rails_generators/components/mailer/templates/mailer.rb +0 -13
  26. data/examples/rails_generators/components/mailer/templates/unit_test.rb +0 -37
  27. data/examples/rails_generators/components/mailer/templates/view.erb +0 -3
  28. data/examples/rails_generators/components/mailer/templates/view.rhtml +0 -0
  29. data/examples/rails_generators/components/migration/USAGE +0 -24
  30. data/examples/rails_generators/components/migration/migration_generator.rb +0 -20
  31. data/examples/rails_generators/components/migration/templates/migration.rb +0 -7
  32. data/examples/rails_generators/components/model/USAGE +0 -27
  33. data/examples/rails_generators/components/model/model_generator.rb +0 -38
  34. data/examples/rails_generators/components/model/templates/fixtures.yml +0 -15
  35. data/examples/rails_generators/components/model/templates/migration.rb +0 -14
  36. data/examples/rails_generators/components/model/templates/model.rb +0 -2
  37. data/examples/rails_generators/components/model/templates/unit_test.rb +0 -10
  38. data/examples/rails_generators/components/observer/USAGE +0 -13
  39. data/examples/rails_generators/components/observer/observer_generator.rb +0 -16
  40. data/examples/rails_generators/components/observer/templates/observer.rb +0 -2
  41. data/examples/rails_generators/components/observer/templates/unit_test.rb +0 -10
  42. data/examples/rails_generators/components/plugin/USAGE +0 -25
  43. data/examples/rails_generators/components/plugin/plugin_generator.rb +0 -39
  44. data/examples/rails_generators/components/plugin/templates/MIT-LICENSE +0 -20
  45. data/examples/rails_generators/components/plugin/templates/README +0 -13
  46. data/examples/rails_generators/components/plugin/templates/Rakefile +0 -22
  47. data/examples/rails_generators/components/plugin/templates/USAGE +0 -8
  48. data/examples/rails_generators/components/plugin/templates/generator.rb +0 -8
  49. data/examples/rails_generators/components/plugin/templates/init.rb +0 -1
  50. data/examples/rails_generators/components/plugin/templates/install.rb +0 -1
  51. data/examples/rails_generators/components/plugin/templates/plugin.rb +0 -1
  52. data/examples/rails_generators/components/plugin/templates/tasks.rake +0 -4
  53. data/examples/rails_generators/components/plugin/templates/uninstall.rb +0 -1
  54. data/examples/rails_generators/components/plugin/templates/unit_test.rb +0 -8
  55. data/examples/rails_generators/components/resource/USAGE +0 -23
  56. data/examples/rails_generators/components/resource/resource_generator.rb +0 -72
  57. data/examples/rails_generators/components/resource/templates/USAGE +0 -18
  58. data/examples/rails_generators/components/resource/templates/controller.rb +0 -2
  59. data/examples/rails_generators/components/resource/templates/fixtures.yml +0 -0
  60. data/examples/rails_generators/components/resource/templates/functional_test.rb +0 -20
  61. data/examples/rails_generators/components/resource/templates/helper.rb +0 -2
  62. data/examples/rails_generators/components/scaffold/USAGE +0 -25
  63. data/examples/rails_generators/components/scaffold/scaffold_generator.rb +0 -90
  64. data/examples/rails_generators/components/scaffold/templates/controller.rb +0 -85
  65. data/examples/rails_generators/components/scaffold/templates/functional_test.rb +0 -57
  66. data/examples/rails_generators/components/scaffold/templates/helper.rb +0 -2
  67. data/examples/rails_generators/components/scaffold/templates/layout.html.erb +0 -17
  68. data/examples/rails_generators/components/scaffold/templates/style.css +0 -74
  69. data/examples/rails_generators/components/scaffold/templates/view_edit.html.erb +0 -19
  70. data/examples/rails_generators/components/scaffold/templates/view_index.html.erb +0 -24
  71. data/examples/rails_generators/components/scaffold/templates/view_new.html.erb +0 -18
  72. data/examples/rails_generators/components/scaffold/templates/view_show.html.erb +0 -10
  73. data/examples/rails_generators/components/session_migration/USAGE +0 -10
  74. data/examples/rails_generators/components/session_migration/session_migration_generator.rb +0 -18
  75. data/examples/rails_generators/components/session_migration/templates/migration.rb +0 -16
  76. data/examples/rails_generators/components/web_service/USAGE +0 -24
  77. data/examples/rails_generators/components/web_service/templates/api_definition.rb +0 -5
  78. data/examples/rails_generators/components/web_service/templates/controller.rb +0 -8
  79. data/examples/rails_generators/components/web_service/templates/functional_test.rb +0 -19
  80. data/examples/rails_generators/components/web_service/web_service_generator.rb +0 -29
@@ -1,25 +0,0 @@
1
- Description:
2
- Scaffolds an entire resource, from model and migration to controller and
3
- views, along with a full test suite. The resource is ready to use as a
4
- starting point for your restful, resource-oriented application.
5
-
6
- Pass the name of the model, either CamelCased or under_scored, as the first
7
- argument, and an optional list of attribute pairs.
8
-
9
- Attribute pairs are column_name:sql_type arguments specifying the
10
- model's attributes. Timestamps are added by default, so you don't have to
11
- specify them by hand as 'created_at:datetime updated_at:datetime'.
12
-
13
- You don't have to think up every attribute up front, but it helps to
14
- sketch out a few so you can start working with the resource immediately.
15
-
16
- For example, `scaffold post title:string body:text published:boolean`
17
- gives you a model with those three attributes, a controller that handles
18
- the create/show/update/destroy, forms to create and edit your posts, and
19
- an index that lists them all, as well as a map.resources :posts
20
- declaration in config/routes.rb.
21
-
22
- Examples:
23
- `./script/generate scaffold post` # no attributes, view will be anemic
24
- `./script/generate scaffold post title:string body:text published:boolean`
25
- `./script/generate scaffold purchase order_id:integer amount:decimal`
@@ -1,90 +0,0 @@
1
- class ScaffoldGenerator < RubiGen::NamedBase
2
- default_options :skip_migration => false
3
-
4
- attr_reader :controller_name,
5
- :controller_class_path,
6
- :controller_file_path,
7
- :controller_class_nesting,
8
- :controller_class_nesting_depth,
9
- :controller_class_name,
10
- :controller_underscore_name,
11
- :controller_singular_name,
12
- :controller_plural_name
13
- alias_method :controller_file_name, :controller_underscore_name
14
- alias_method :controller_table_name, :controller_plural_name
15
-
16
- def initialize(runtime_args, runtime_options = {})
17
- super
18
-
19
- @controller_name = @name.pluralize
20
-
21
- base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
22
- @controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
23
- @controller_singular_name=base_name.singularize
24
- if @controller_class_nesting.empty?
25
- @controller_class_name = @controller_class_name_without_nesting
26
- else
27
- @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
28
- end
29
- end
30
-
31
- def manifest
32
- record do |m|
33
- # Check for class naming collisions.
34
- m.class_collisions(controller_class_path, "#{controller_class_name}Controller", "#{controller_class_name}Helper")
35
- m.class_collisions(class_path, "#{class_name}")
36
-
37
- # Controller, helper, views, and test directories.
38
- m.directory(File.join('app/models', class_path))
39
- m.directory(File.join('app/controllers', controller_class_path))
40
- m.directory(File.join('app/helpers', controller_class_path))
41
- m.directory(File.join('app/views', controller_class_path, controller_file_name))
42
- m.directory(File.join('test/functional', controller_class_path))
43
- m.directory(File.join('test/unit', class_path))
44
-
45
- for action in scaffold_views
46
- m.template(
47
- "view_#{action}.html.erb",
48
- File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.erb")
49
- )
50
- end
51
-
52
- # Layout and stylesheet.
53
- m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
54
- m.template('style.css', 'public/stylesheets/scaffold.css')
55
-
56
- m.template(
57
- 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
58
- )
59
-
60
- m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
61
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
62
-
63
- m.route_resources controller_file_name
64
-
65
- m.dependency 'model', [singular_name] + @args, :collision => :skip
66
-
67
- end
68
- end
69
-
70
- protected
71
- # Override with your own usage banner.
72
- def banner
73
- "Usage: #{$0} scaffold ModelName [field:type, field:type]"
74
- end
75
-
76
- def add_options!(opt)
77
- opt.separator ''
78
- opt.separator 'Options:'
79
- opt.on("--skip-migration",
80
- "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
81
- end
82
-
83
- def scaffold_views
84
- %w[ index show new edit ]
85
- end
86
-
87
- def model_name
88
- class_name.demodulize
89
- end
90
- end
@@ -1,85 +0,0 @@
1
- class <%= controller_class_name %>Controller < ApplicationController
2
- # GET /<%= table_name %>
3
- # GET /<%= table_name %>.xml
4
- def index
5
- @<%= table_name %> = <%= class_name %>.find(:all)
6
-
7
- respond_to do |format|
8
- format.html # index.html.erb
9
- format.xml { render :xml => @<%= table_name %> }
10
- end
11
- end
12
-
13
- # GET /<%= table_name %>/1
14
- # GET /<%= table_name %>/1.xml
15
- def show
16
- @<%= file_name %> = <%= class_name %>.find(params[:id])
17
-
18
- respond_to do |format|
19
- format.html # show.html.erb
20
- format.xml { render :xml => @<%= file_name %> }
21
- end
22
- end
23
-
24
- # GET /<%= table_name %>/new
25
- # GET /<%= table_name %>/new.xml
26
- def new
27
- @<%= file_name %> = <%= class_name %>.new
28
-
29
- respond_to do |format|
30
- format.html # new.html.erb
31
- format.xml { render :xml => @<%= file_name %> }
32
- end
33
- end
34
-
35
- # GET /<%= table_name %>/1/edit
36
- def edit
37
- @<%= file_name %> = <%= class_name %>.find(params[:id])
38
- end
39
-
40
- # POST /<%= table_name %>
41
- # POST /<%= table_name %>.xml
42
- def create
43
- @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
44
-
45
- respond_to do |format|
46
- if @<%= file_name %>.save
47
- flash[:notice] = '<%= class_name %> was successfully created.'
48
- format.html { redirect_to(@<%= file_name %>) }
49
- format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
50
- else
51
- format.html { render :action => "new" }
52
- format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
53
- end
54
- end
55
- end
56
-
57
- # PUT /<%= table_name %>/1
58
- # PUT /<%= table_name %>/1.xml
59
- def update
60
- @<%= file_name %> = <%= class_name %>.find(params[:id])
61
-
62
- respond_to do |format|
63
- if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
64
- flash[:notice] = '<%= class_name %> was successfully updated.'
65
- format.html { redirect_to(@<%= file_name %>) }
66
- format.xml { head :ok }
67
- else
68
- format.html { render :action => "edit" }
69
- format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
70
- end
71
- end
72
- end
73
-
74
- # DELETE /<%= table_name %>/1
75
- # DELETE /<%= table_name %>/1.xml
76
- def destroy
77
- @<%= file_name %> = <%= class_name %>.find(params[:id])
78
- @<%= file_name %>.destroy
79
-
80
- respond_to do |format|
81
- format.html { redirect_to(<%= table_name %>_url) }
82
- format.xml { head :ok }
83
- end
84
- end
85
- end
@@ -1,57 +0,0 @@
1
- require File.dirname(__FILE__) + '<%= '/..' * controller_class_nesting_depth %>/../test_helper'
2
- require '<%= controller_file_path %>_controller'
3
-
4
- # Re-raise errors caught by the controller.
5
- class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end
6
-
7
- class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
8
- fixtures :<%= table_name %>
9
-
10
- def setup
11
- @controller = <%= controller_class_name %>Controller.new
12
- @request = ActionController::TestRequest.new
13
- @response = ActionController::TestResponse.new
14
- end
15
-
16
- def test_should_get_index
17
- get :index
18
- assert_response :success
19
- assert assigns(:<%= table_name %>)
20
- end
21
-
22
- def test_should_get_new
23
- get :new
24
- assert_response :success
25
- end
26
-
27
- def test_should_create_<%= file_name %>
28
- assert_difference('<%= class_name %>.count') do
29
- post :create, :<%= file_name %> => { }
30
- end
31
-
32
- assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
33
- end
34
-
35
- def test_should_show_<%= file_name %>
36
- get :show, :id => 1
37
- assert_response :success
38
- end
39
-
40
- def test_should_get_edit
41
- get :edit, :id => 1
42
- assert_response :success
43
- end
44
-
45
- def test_should_update_<%= file_name %>
46
- put :update, :id => 1, :<%= file_name %> => { }
47
- assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
48
- end
49
-
50
- def test_should_destroy_<%= file_name %>
51
- assert_difference('<%= class_name %>.count', -1) do
52
- delete :destroy, :id => 1
53
- end
54
-
55
- assert_redirected_to <%= table_name %>_path
56
- end
57
- end
@@ -1,2 +0,0 @@
1
- module <%= controller_class_name %>Helper
2
- end
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
- <title><%= controller_class_name %>: <%%= controller.action_name %></title>
8
- <%%= stylesheet_link_tag 'scaffold' %>
9
- </head>
10
- <body>
11
-
12
- <p style="color: green"><%%= flash[:notice] %></p>
13
-
14
- <%%= yield %>
15
-
16
- </body>
17
- </html>
@@ -1,74 +0,0 @@
1
- body { background-color: #fff; color: #333; }
2
-
3
- body, p, ol, ul, td {
4
- font-family: verdana, arial, helvetica, sans-serif;
5
- font-size: 13px;
6
- line-height: 18px;
7
- }
8
-
9
- pre {
10
- background-color: #eee;
11
- padding: 10px;
12
- font-size: 11px;
13
- }
14
-
15
- a { color: #000; }
16
- a:visited { color: #666; }
17
- a:hover { color: #fff; background-color:#000; }
18
-
19
- .fieldWithErrors {
20
- padding: 2px;
21
- background-color: red;
22
- display: table;
23
- }
24
-
25
- #errorExplanation {
26
- width: 400px;
27
- border: 2px solid red;
28
- padding: 7px;
29
- padding-bottom: 12px;
30
- margin-bottom: 20px;
31
- background-color: #f0f0f0;
32
- }
33
-
34
- #errorExplanation h2 {
35
- text-align: left;
36
- font-weight: bold;
37
- padding: 5px 5px 5px 15px;
38
- font-size: 12px;
39
- margin: -7px;
40
- background-color: #c00;
41
- color: #fff;
42
- }
43
-
44
- #errorExplanation p {
45
- color: #333;
46
- margin-bottom: 0;
47
- padding: 5px;
48
- }
49
-
50
- #errorExplanation ul li {
51
- font-size: 12px;
52
- list-style: square;
53
- }
54
-
55
- div.uploadStatus {
56
- margin: 5px;
57
- }
58
-
59
- div.progressBar {
60
- margin: 5px;
61
- }
62
-
63
- div.progressBar div.border {
64
- background-color: #fff;
65
- border: 1px solid grey;
66
- width: 100%;
67
- }
68
-
69
- div.progressBar div.background {
70
- background-color: #333;
71
- height: 18px;
72
- width: 0%;
73
- }
74
-
@@ -1,19 +0,0 @@
1
- <h1>Editing <%= singular_name %></h1>
2
-
3
- <%%= error_messages_for :<%= singular_name %> %>
4
-
5
- <%% form_for(@<%= singular_name %>) do |f| %>
6
- <% for attribute in attributes -%>
7
- <p>
8
- <b><%= attribute.column.human_name %></b><br />
9
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
10
- </p>
11
-
12
- <% end -%>
13
- <p>
14
- <%%= f.submit "Update" %>
15
- </p>
16
- <%% end %>
17
-
18
- <%%= link_to 'Show', @<%= singular_name %> %> |
19
- <%%= link_to 'Back', <%= plural_name %>_path %>
@@ -1,24 +0,0 @@
1
- <h1>Listing <%= plural_name %></h1>
2
-
3
- <table>
4
- <tr>
5
- <% for attribute in attributes -%>
6
- <th><%= attribute.column.human_name %></th>
7
- <% end -%>
8
- </tr>
9
-
10
- <%% for <%= singular_name %> in @<%= plural_name %> %>
11
- <tr>
12
- <% for attribute in attributes -%>
13
- <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
14
- <% end -%>
15
- <td><%%= link_to 'Show', <%= singular_name %> %></td>
16
- <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
17
- <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
18
- </tr>
19
- <%% end %>
20
- </table>
21
-
22
- <br />
23
-
24
- <%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %>
@@ -1,18 +0,0 @@
1
- <h1>New <%= singular_name %></h1>
2
-
3
- <%%= error_messages_for :<%= singular_name %> %>
4
-
5
- <%% form_for(@<%= singular_name %>) do |f| %>
6
- <% for attribute in attributes -%>
7
- <p>
8
- <b><%= attribute.column.human_name %></b><br />
9
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
10
- </p>
11
-
12
- <% end -%>
13
- <p>
14
- <%%= f.submit "Create" %>
15
- </p>
16
- <%% end %>
17
-
18
- <%%= link_to 'Back', <%= plural_name %>_path %>
@@ -1,10 +0,0 @@
1
- <% for attribute in attributes -%>
2
- <p>
3
- <b><%= attribute.column.human_name %>:</b>
4
- <%%=h @<%= singular_name %>.<%= attribute.name %> %>
5
- </p>
6
-
7
- <% end -%>
8
-
9
- <%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
10
- <%%= link_to 'Back', <%= plural_name %>_path %>
@@ -1,10 +0,0 @@
1
- Description:
2
- Creates a migration to add the sessions table used by the Active Record
3
- session store. Pass the migration name, either CamelCased or under_scored,
4
- as an argument.
5
-
6
- Example:
7
- `./script/generate session_migration CreateSessionTable`
8
-
9
- With 4 existing migrations, this creates the AddSessionTable migration
10
- in db/migrate/005_add_session_table.rb
@@ -1,18 +0,0 @@
1
- class SessionMigrationGenerator < RubiGen::NamedBase
2
- def initialize(runtime_args, runtime_options = {})
3
- runtime_args << 'add_session_table' if runtime_args.empty?
4
- super
5
- end
6
-
7
- def manifest
8
- record do |m|
9
- m.migration_template 'migration.rb', 'db/migrate',
10
- :assigns => { :session_table_name => default_session_table_name }
11
- end
12
- end
13
-
14
- protected
15
- def default_session_table_name
16
- ActiveRecord::Base.pluralize_table_names ? 'session'.pluralize : 'session'
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- class <%= class_name %> < ActiveRecord::Migration
2
- def self.up
3
- create_table :<%= session_table_name %> do |t|
4
- t.string :session_id, :null => false
5
- t.text :data
6
- t.timestamps
7
- end
8
-
9
- add_index :<%= session_table_name %>, :session_id
10
- add_index :<%= session_table_name %>, :updated_at
11
- end
12
-
13
- def self.down
14
- drop_table :<%= session_table_name %>
15
- end
16
- end
@@ -1,24 +0,0 @@
1
- Description:
2
- Stubs out the controller and API for a new web service using the deprecated
3
- Action Web Service framework. Pass the web service name, either CamelCased
4
- or under_scored, and a list of API methods as arguments. To create a web
5
- service within a module, use a path like 'module_name/web_service_name'.
6
-
7
- This generates a controller in app/controllers, an API definition
8
- in app/apis, and functional tests in test/functional.
9
-
10
- Example:
11
- `./script/generate web_service User add edit list remove`
12
-
13
- creates the User controller, API, and functional test:
14
- Controller: app/controllers/user_controller.rb
15
- API: app/apis/user_api.rb
16
- Test: test/functional/user_api_test.rb
17
-
18
- Modules Example:
19
- `./script/generate web_service 'api/registration' register renew`
20
-
21
- creates the Registration controller, API, and functional test:
22
- Controller: app/controllers/api/registration_controller.rb
23
- API: app/apis/api/registration_api.rb
24
- Test: test/functional/api/registration_api_test.rb
@@ -1,5 +0,0 @@
1
- class <%= class_name %>Api < ActionWebService::API::Base
2
- <% for method_name in args -%>
3
- api_method :<%= method_name %>
4
- <% end -%>
5
- end
@@ -1,8 +0,0 @@
1
- class <%= class_name %>Controller < ApplicationController
2
- wsdl_service_name '<%= class_name %>'
3
- <% for method_name in args -%>
4
-
5
- def <%= method_name %>
6
- end
7
- <% end -%>
8
- end
@@ -1,19 +0,0 @@
1
- require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
- require '<%= file_path %>_controller'
3
-
4
- class <%= class_name %>Controller; def rescue_action(e) raise e end; end
5
-
6
- class <%= class_name %>ControllerApiTest < Test::Unit::TestCase
7
- def setup
8
- @controller = <%= class_name %>Controller.new
9
- @request = ActionController::TestRequest.new
10
- @response = ActionController::TestResponse.new
11
- end
12
- <% for method_name in args -%>
13
-
14
- def test_<%= method_name %>
15
- result = invoke :<%= method_name %>
16
- assert_equal nil, result
17
- end
18
- <% end -%>
19
- end
@@ -1,29 +0,0 @@
1
- class WebServiceGenerator < RubiGen::NamedBase
2
- def manifest
3
- record do |m|
4
- # Check for class naming collisions.
5
- m.class_collisions class_path, "#{class_name}Api", "#{class_name}Controller", "#{class_name}ApiTest"
6
-
7
- # API and test directories.
8
- m.directory File.join('app/apis', class_path)
9
- m.directory File.join('app/controllers', class_path)
10
- m.directory File.join('test/functional', class_path)
11
-
12
- # API definition, controller, and functional test.
13
- m.template 'api_definition.rb',
14
- File.join('app/apis',
15
- class_path,
16
- "#{file_name}_api.rb")
17
-
18
- m.template 'controller.rb',
19
- File.join('app/controllers',
20
- class_path,
21
- "#{file_name}_controller.rb")
22
-
23
- m.template 'functional_test.rb',
24
- File.join('test/functional',
25
- class_path,
26
- "#{file_name}_api_test.rb")
27
- end
28
- end
29
- end