mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Rename invoke_for to hook_for.
This commit is contained in:
@@ -62,7 +62,7 @@ module Rails
|
||||
# ==== Examples
|
||||
#
|
||||
# class ControllerGenerator < Rails::Generators::Base
|
||||
# invoke_for :test_framework, :aliases => "-t"
|
||||
# hook_for :test_framework, :aliases => "-t"
|
||||
# end
|
||||
#
|
||||
# The example above will create a test framework option and will invoke
|
||||
@@ -94,7 +94,7 @@ module Rails
|
||||
# Consider this TestUnit model generator:
|
||||
#
|
||||
# class ModelGenerator < TestUnit::Generators::Base
|
||||
# invoke_for :fixture_replacement, :aliases => "-r"
|
||||
# hook_for :fixture_replacement, :aliases => "-r"
|
||||
# end
|
||||
#
|
||||
# When invoked as:
|
||||
@@ -111,7 +111,7 @@ module Rails
|
||||
# it will implement the second or the third depending on the number of
|
||||
# generators it has.
|
||||
#
|
||||
def self.invoke_for(*names)
|
||||
def self.hook_for(*names)
|
||||
default_options = names.extract_options!
|
||||
|
||||
names.each do |name|
|
||||
@@ -140,7 +140,7 @@ module Rails
|
||||
end
|
||||
|
||||
# Invoke a generator with the given name if the user requires it. The
|
||||
# difference to invoke_for is that the class option here is boolean
|
||||
# difference to hook_for is that the class option here is boolean
|
||||
# and the generator invoked is not based on user input.
|
||||
#
|
||||
# A class option is created when this method is invoked and you can set
|
||||
|
||||
@@ -8,7 +8,7 @@ module Rails
|
||||
template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb")
|
||||
end
|
||||
|
||||
invoke_for :template_engine, :test_framework
|
||||
hook_for :template_engine, :test_framework
|
||||
invoke_if :helper, :aliases => "-v"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ module Rails
|
||||
template 'helper.rb', File.join('app/helpers', class_path, "#{file_name}_helper.rb")
|
||||
end
|
||||
|
||||
invoke_for :test_framework
|
||||
hook_for :test_framework
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ module Rails
|
||||
template "mailer.rb", File.join('app/models', class_path, "#{file_name}.rb")
|
||||
end
|
||||
|
||||
invoke_for :template_engine, :test_framework
|
||||
hook_for :template_engine, :test_framework
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ module Rails
|
||||
module Generators
|
||||
class ModelGenerator < NamedBase
|
||||
argument :attributes, :type => :hash, :default => {}, :banner => "field:type, field:type"
|
||||
invoke_for :orm, :test_framework
|
||||
hook_for :orm, :test_framework
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Rails
|
||||
module Generators
|
||||
class ObserverGenerator < NamedBase
|
||||
invoke_for :orm, :test_framework
|
||||
hook_for :orm, :test_framework
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ module Rails
|
||||
directory 'lib'
|
||||
end
|
||||
|
||||
invoke_for :test_framework
|
||||
hook_for :test_framework
|
||||
|
||||
def create_tasks_files
|
||||
return unless options[:with_tasks]
|
||||
|
||||
@@ -10,7 +10,7 @@ module TestUnit
|
||||
template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
|
||||
end
|
||||
|
||||
invoke_for :fixture_replacement
|
||||
hook_for :fixture_replacement
|
||||
|
||||
def create_fixture_file
|
||||
if options[:fixture] && options[:fixture_replacement].nil?
|
||||
|
||||
Reference in New Issue
Block a user