aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-06-09 00:01:00 -0700
committerJosé Valim <jose.valim@gmail.com>2011-06-09 00:01:00 -0700
commiteb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a (patch)
tree714871363eaaba2123ceebc12e94b307aea6148c /railties/lib/rails/generators
parentaf3f0b6204dd81b4df50dbc567276bf5c8264ebe (diff)
parent331d58fb04821546b1e622290432a2dd13e52301 (diff)
downloadrails-eb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a.tar.gz
rails-eb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a.tar.bz2
rails-eb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a.zip
Merge pull request #1356 from flippingbits/fix_engine_generator
Fix engine's generator
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/named_base.rb4
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb2
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt7
3 files changed, 8 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb
index 7e7f8d2d08..c6c0392f43 100644
--- a/railties/lib/rails/generators/named_base.rb
+++ b/railties/lib/rails/generators/named_base.rb
@@ -63,9 +63,7 @@ module Rails
end
def namespace
- @namespace ||= if defined?(Rails) && Rails.application
- Rails.application.class.parents.detect { |n| n.respond_to?(:_railtie) }
- end
+ Rails::Generators.namespace
end
def namespaced?
diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
index 11867a4cd7..807350316c 100644
--- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
+++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -126,6 +126,8 @@ task :default => :test
end
def script(force = false)
+ return unless full?
+
directory "script", :force => force do |content|
"#{shebang}\n" + content
end
diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt b/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt
index 65d82abf6d..aa87d1b50c 100644
--- a/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt
+++ b/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt
@@ -1,4 +1,7 @@
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-ENGINE_PATH = File.expand_path('../..', __FILE__)
-load File.expand_path('../../<%= dummy_path %>/script/rails', __FILE__)
+ENGINE_ROOT = File.expand_path('../..', __FILE__)
+ENGINE_PATH = File.expand_path('../../lib/<%= name -%>/engine', __FILE__)
+
+require 'rails/all'
+require 'rails/engine/commands'