From 835c9cee3ede273030bae5dcf465176d64b287dd Mon Sep 17 00:00:00 2001 From: Stefan Sprenger Date: Thu, 26 May 2011 17:59:00 +0200 Subject: Introducing engine commands --- railties/lib/rails/commands/generate.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index b6f9a003d1..1f742f8853 100644 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -7,4 +7,9 @@ if ARGV.first.in?([nil, "-h", "--help"]) end name = ARGV.shift -Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => Rails.root + +if defined?(ENGINE_ROOT) + Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => ENGINE_ROOT +else + Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => Rails.root +end -- cgit v1.2.3 From 5f00592466bd91107ecdfd055140cb2b36e29f50 Mon Sep 17 00:00:00 2001 From: Stefan Sprenger Date: Fri, 27 May 2011 13:25:35 +0200 Subject: Refactor identifying generator's destination root --- railties/lib/rails/commands/generate.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index 1f742f8853..1fb2d98834 100644 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -8,8 +8,5 @@ end name = ARGV.shift -if defined?(ENGINE_ROOT) - Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => ENGINE_ROOT -else - Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => Rails.root -end +root = defined?(ENGINE_ROOT) ? ENGINE_ROOT : Rails.root +Rails::Generators.invoke name, ARGV, :behavior => :invoke, :destination_root => root -- cgit v1.2.3