1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

No more hacks to ensure generators are executed inside Rails.root.

This commit is contained in:
José Valim 2010-01-07 21:24:50 +01:00
parent ccc9f0b7de
commit 3022ce4f72
3 changed files with 2 additions and 19 deletions

View file

@ -7,4 +7,4 @@ if ARGV.size == 0
end end
name = ARGV.shift name = ARGV.shift
Rails::Generators.invoke name, ARGV, :behavior => :revoke Rails::Generators.invoke name, ARGV, :behavior => :revoke, :destination_root => Rails.root

View file

@ -7,4 +7,4 @@ if ARGV.size == 0
end end
name = ARGV.shift name = ARGV.shift
Rails::Generators.invoke name, ARGV, :behavior => :invoke Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => Rails.root

View file

@ -12,16 +12,6 @@ module Rails
add_runtime_options! add_runtime_options!
# Always move to rails source root.
#
def initialize(*args) #:nodoc:
if !invoked?(args) && defined?(Rails.root) && Rails.root
self.destination_root = Rails.root
FileUtils.cd(destination_root)
end
super
end
# Automatically sets the source root based on the class name. # Automatically sets the source root based on the class name.
# #
def self.source_root def self.source_root
@ -268,13 +258,6 @@ module Rails
end end
end end
# Check if this generator was invoked from another one by inspecting
# parameters.
#
def invoked?(args)
args.last.is_a?(Hash) && (args.last.key?(:invocations) || args.last.key?(:destination_root))
end
# Use Rails default banner. # Use Rails default banner.
# #
def self.banner def self.banner