aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/generators/actions.rb11
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb6
-rw-r--r--railties/lib/rails/generators/rails/helper/helper_generator.rb2
-rw-r--r--railties/lib/rails/generators/test_unit/helper/helper_generator.rb9
4 files changed, 28 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index a239874df0..4709914947 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -7,6 +7,7 @@ module Rails
def initialize(*) # :nodoc:
super
@in_group = nil
+ @after_bundle_callbacks = []
end
# Adds an entry into +Gemfile+ for the supplied gem.
@@ -232,6 +233,16 @@ module Rails
log File.read(find_in_source_paths(path))
end
+ # Registers a callback to be executed after bundle and spring binstubs
+ # have run.
+ #
+ # after_bundle do
+ # git add: '.'
+ # end
+ def after_bundle(&block)
+ @after_bundle_callbacks << block
+ end
+
protected
# Define log for backwards compatibility. If just one argument is sent,
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 188e62b6c8..9110c129d1 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -259,6 +259,12 @@ module Rails
public_task :apply_rails_template, :run_bundle
public_task :generate_spring_binstubs
+ def run_after_bundle_callbacks
+ @after_bundle_callbacks.each do |callback|
+ callback.call
+ end
+ end
+
protected
def self.banner
diff --git a/railties/lib/rails/generators/rails/helper/helper_generator.rb b/railties/lib/rails/generators/rails/helper/helper_generator.rb
index 419607839a..5ff38e4111 100644
--- a/railties/lib/rails/generators/rails/helper/helper_generator.rb
+++ b/railties/lib/rails/generators/rails/helper/helper_generator.rb
@@ -6,6 +6,8 @@ module Rails
def create_helper_files
template 'helper.rb', File.join('app/helpers', class_path, "#{file_name}_helper.rb")
end
+
+ hook_for :test_framework
end
end
end
diff --git a/railties/lib/rails/generators/test_unit/helper/helper_generator.rb b/railties/lib/rails/generators/test_unit/helper/helper_generator.rb
new file mode 100644
index 0000000000..bde4e88915
--- /dev/null
+++ b/railties/lib/rails/generators/test_unit/helper/helper_generator.rb
@@ -0,0 +1,9 @@
+require 'rails/generators/test_unit'
+
+module TestUnit # :nodoc:
+ module Generators # :nodoc:
+ class HelperGenerator < Base # :nodoc:
+ # Rails does not generate anything here.
+ end
+ end
+end