diff options
Diffstat (limited to 'railties/generators/controller')
6 files changed, 0 insertions, 85 deletions
diff --git a/railties/generators/controller/USAGE b/railties/generators/controller/USAGE deleted file mode 100644 index e653d7e7ec..0000000000 --- a/railties/generators/controller/USAGE +++ /dev/null @@ -1,28 +0,0 @@ -GENERATOR - controller - create controller and view stub files - -SYNOPSIS - generate controller ControllerName action [action ...] - -DESCRIPTION - The controller generator takes the name of the new controller as the - first argument and a variable number of view names as subsequent arguments. - The controller name should be supplied without a "Controller" suffix. The - generator will add that itself. - - Controller generates a controller file in app/controllers with a render - action for each of the view names passed, a test suite in test/functional - with one passing test case, and HTML stubs for each view in app/views - under a directory with the same name as the controller. - -EXAMPLE - ./script/generate controller Blog list display new edit - - This will generate a BlogController class in - app/controllers/blog_controller.rb, a BlogHelper class in - app/helpers/blog_helper.rb and a BlogControllerTest in - test/functional/blog_controller_test.rb, and list.rhtml, - display.rhtml, new.rhtml, and edit.rhtml in app/views/blog. - - The BlogController class will have list, display, new, and edit actions. - Each action will render the associated view by default. diff --git a/railties/generators/controller/controller_generator.rb b/railties/generators/controller/controller_generator.rb deleted file mode 100644 index 79f9a7e03b..0000000000 --- a/railties/generators/controller/controller_generator.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'rails_generator' - -class ControllerGenerator < Rails::Generator::Base - attr_reader :actions - - def generate - @actions = args - - # Controller class, functional test, and helper class. - template "controller.rb", "app/controllers/#{file_name}_controller.rb" - template "functional_test.rb", "test/functional/#{file_name}_controller_test.rb" - template "helper.rb", "app/helpers/#{file_name}_helper.rb" - - # Create the views directory even if there are no actions. - FileUtils.mkdir_p "app/views/#{file_name}" - - # Create a view for each action. - actions.each do |action| - template "view.rhtml", "app/views/#{file_name}/#{action}.rhtml", binding - end - end - - def full_class_name - class_name + "Controller" - end -end diff --git a/railties/generators/controller/templates/controller.rb b/railties/generators/controller/templates/controller.rb deleted file mode 100644 index 0daf04b348..0000000000 --- a/railties/generators/controller/templates/controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -class <%= full_class_name %> < ApplicationController -<% if options[:scaffold] -%> - scaffold :<%= singular_name %> -<% end -%> -<% for action in actions -%> - - def <%= action %> - end -<% end -%> -end diff --git a/railties/generators/controller/templates/functional_test.rb b/railties/generators/controller/templates/functional_test.rb deleted file mode 100644 index df75ad57e9..0000000000 --- a/railties/generators/controller/templates/functional_test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require '<%= file_name %>_controller' - -# Re-raise errors caught by the controller. -class <%= full_class_name %>; def rescue_action(e) raise e end; end - -class <%= full_class_name %>Test < Test::Unit::TestCase - def setup - @controller = <%= full_class_name %>.new - @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new - end - - # Replace this with your real tests. - def test_truth - assert true - end -end diff --git a/railties/generators/controller/templates/helper.rb b/railties/generators/controller/templates/helper.rb deleted file mode 100644 index 3fe2ecdc74..0000000000 --- a/railties/generators/controller/templates/helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module <%= class_name %>Helper -end diff --git a/railties/generators/controller/templates/view.rhtml b/railties/generators/controller/templates/view.rhtml deleted file mode 100644 index 7e7a7d53ce..0000000000 --- a/railties/generators/controller/templates/view.rhtml +++ /dev/null @@ -1,2 +0,0 @@ -<h1><%= class_name %>#<%= action %></h1> -<p>Find me in app/views/<%= file_name %>/<%= action %>.rhtml</p> |