diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-07 11:49:38 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-07 11:49:38 +0000 |
commit | 2594581e9f5594b32918326be895b4d443ab3e9c (patch) | |
tree | 051f52e4619b70f4757dbabf362d51a7d5f5fde9 /railties/generators/templates | |
parent | 3ee4357b8643c611bbe9eb3a7ce820a5e32cddaa (diff) | |
download | rails-2594581e9f5594b32918326be895b4d443ab3e9c.tar.gz rails-2594581e9f5594b32918326be895b4d443ab3e9c.tar.bz2 rails-2594581e9f5594b32918326be895b4d443ab3e9c.zip |
Added a better generator for scaffolding that actually creates the code, so it can be edited bit by bit. See "script/generate scaffold" [bitsweat]. Added a whole new approach to generators that used the shared "script/generate" command. Run with no-args to see help [bitsweat].
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@63 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/generators/templates')
-rw-r--r-- | railties/generators/templates/controller.erb | 19 | ||||
-rw-r--r-- | railties/generators/templates/controller_test.erb | 17 | ||||
-rw-r--r-- | railties/generators/templates/controller_view.rhtml | 10 | ||||
-rw-r--r-- | railties/generators/templates/helper.erb | 2 | ||||
-rw-r--r-- | railties/generators/templates/mailer.erb | 15 | ||||
-rw-r--r-- | railties/generators/templates/mailer_action.rhtml | 3 | ||||
-rw-r--r-- | railties/generators/templates/mailer_fixture.rhtml | 4 | ||||
-rw-r--r-- | railties/generators/templates/mailer_test.erb | 37 | ||||
-rw-r--r-- | railties/generators/templates/model.erb | 2 | ||||
-rw-r--r-- | railties/generators/templates/model_test.erb | 11 |
10 files changed, 0 insertions, 120 deletions
diff --git a/railties/generators/templates/controller.erb b/railties/generators/templates/controller.erb deleted file mode 100644 index 600f5d2c59..0000000000 --- a/railties/generators/templates/controller.erb +++ /dev/null @@ -1,19 +0,0 @@ -class <%= class_name %>Controller < AbstractApplicationController - helper :<%= file_name %> -<% if options[:scaffold] -%> - model :<%= file_name %> - scaffold :<%= options[:scaffold] %> - - <%- for action in actions -%> - #def <%= action %> - #end - - <%- end -%> -<% else -%> - <%- for action in actions -%> - def <%= action %> - end - - <%- end -%> -<% end -%> -end diff --git a/railties/generators/templates/controller_test.erb b/railties/generators/templates/controller_test.erb deleted file mode 100644 index 5577379c62..0000000000 --- a/railties/generators/templates/controller_test.erb +++ /dev/null @@ -1,17 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require '<%= file_name %>_controller' - -# Re-raise errors caught by the controller. -class <%= class_name %>Controller; def rescue_action(e) raise e end; end - -class <%= class_name %>ControllerTest < Test::Unit::TestCase - def setup - @controller = <%= class_name %>Controller.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/templates/controller_view.rhtml b/railties/generators/templates/controller_view.rhtml deleted file mode 100644 index d8a310df50..0000000000 --- a/railties/generators/templates/controller_view.rhtml +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title><%= class_name %>#<%= action %></title> -</head> -<body> -<h1><%= class_name %>#<%= action %></h1> -<p>Find me in app/views/<%= file_name %>/<%= action %>.rhtml</p> -</body> -</html> diff --git a/railties/generators/templates/helper.erb b/railties/generators/templates/helper.erb deleted file mode 100644 index 3fe2ecdc74..0000000000 --- a/railties/generators/templates/helper.erb +++ /dev/null @@ -1,2 +0,0 @@ -module <%= class_name %>Helper -end diff --git a/railties/generators/templates/mailer.erb b/railties/generators/templates/mailer.erb deleted file mode 100644 index 5afc254923..0000000000 --- a/railties/generators/templates/mailer.erb +++ /dev/null @@ -1,15 +0,0 @@ -require 'action_mailer' - -class <%= class_name %> < ActionMailer::Base - -<% for action in actions -%> - def <%= action %>(sent_on = Time.now) - @recipients = '' - @from = '' - @subject = '' - @body = {} - @sent_on = sent_on - end - -<% end -%> -end diff --git a/railties/generators/templates/mailer_action.rhtml b/railties/generators/templates/mailer_action.rhtml deleted file mode 100644 index b481906829..0000000000 --- a/railties/generators/templates/mailer_action.rhtml +++ /dev/null @@ -1,3 +0,0 @@ -<%= class_name %>#<%= action %> - -Find me in app/views/<%= file_name %>/<%= action %>.rhtml diff --git a/railties/generators/templates/mailer_fixture.rhtml b/railties/generators/templates/mailer_fixture.rhtml deleted file mode 100644 index f315d430ed..0000000000 --- a/railties/generators/templates/mailer_fixture.rhtml +++ /dev/null @@ -1,4 +0,0 @@ -<%= class_name %>#<%= action %> - -Find me in test/fixtures/<%= file_name %>/<%= action %>. -I'm tested against the view in app/views/<%= file_name %>/<%= action %>. diff --git a/railties/generators/templates/mailer_test.erb b/railties/generators/templates/mailer_test.erb deleted file mode 100644 index f17d614195..0000000000 --- a/railties/generators/templates/mailer_test.erb +++ /dev/null @@ -1,37 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require '<%= file_name %>' - -class <%= class_name %>Test < Test::Unit::TestCase - FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures' - - def setup - ActionMailer::Base.delivery_method = :test - ActionMailer::Base.perform_deliveries = true - ActionMailer::Base.deliveries = [] - - @expected = TMail::Mail.new - @expected.to = 'test@localhost' - @expected.from = 'test@localhost' - @expected.subject = '<%= class_name %> test mail' - end - -<% for action in actions -%> - def test_<%= action %> - @expected.body = read_fixture('<%= action %>') - @expected.date = Time.now - - created = nil - assert_nothing_raised { created = <%= class_name %>.create_<%= action %>(@expected.date) } - assert_not_nil created - assert_equal @expected.encoded, created.encoded - - assert_nothing_raised { <%= class_name %>.deliver_<%= action %>(@expected.date) } - assert_equal @expected.encoded, ActionMailer::Base.deliveries.first.encoded - end - -<% end -%> - private - def read_fixture(action) - IO.readlines("#{FIXTURES_PATH}/<%= file_name %>/#{action}") - end -end diff --git a/railties/generators/templates/model.erb b/railties/generators/templates/model.erb deleted file mode 100644 index 8d4c89e912..0000000000 --- a/railties/generators/templates/model.erb +++ /dev/null @@ -1,2 +0,0 @@ -class <%= class_name %> < ActiveRecord::Base -end diff --git a/railties/generators/templates/model_test.erb b/railties/generators/templates/model_test.erb deleted file mode 100644 index a3ad2b72fb..0000000000 --- a/railties/generators/templates/model_test.erb +++ /dev/null @@ -1,11 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require '<%= file_name %>' - -class <%= class_name %>Test < Test::Unit::TestCase - fixtures :<%= table_name %> - - # Replace this with your real tests - def test_truth - assert true - end -end
\ No newline at end of file |