diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-03 12:19:22 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-03 14:57:46 +0200 |
commit | de68cf7e0624e7d8e7e94034858a061ca0f6f68c (patch) | |
tree | 31116eb49ee5d132a0cc88c102ac08828dce0b73 | |
parent | d1c404ee90ea7470d662517aa7a2d312a61c8c61 (diff) | |
download | rails-de68cf7e0624e7d8e7e94034858a061ca0f6f68c.tar.gz rails-de68cf7e0624e7d8e7e94034858a061ca0f6f68c.tar.bz2 rails-de68cf7e0624e7d8e7e94034858a061ca0f6f68c.zip |
Plugin generators now reflect new generators sutrcture.
-rw-r--r-- | railties/lib/generators/rails/plugin/plugin_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/rails/plugin/templates/generators/%file_name%/%file_name%_generator.rb.tt | 2 | ||||
-rw-r--r-- | railties/lib/generators/rails/plugin/templates/lib/generators/%file_name%_generator.rb.tt | 5 | ||||
-rw-r--r-- | railties/lib/generators/rails/plugin/templates/lib/generators/USAGE.tt (renamed from railties/lib/generators/rails/plugin/templates/generators/%file_name%/USAGE.tt) | 0 | ||||
-rw-r--r-- | railties/lib/generators/rails/plugin/templates/lib/generators/templates/.empty_directory (renamed from railties/lib/generators/rails/plugin/templates/generators/%file_name%/templates/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 7 |
6 files changed, 9 insertions, 7 deletions
diff --git a/railties/lib/generators/rails/plugin/plugin_generator.rb b/railties/lib/generators/rails/plugin/plugin_generator.rb index 9eaf902021..903f720e12 100644 --- a/railties/lib/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/generators/rails/plugin/plugin_generator.rb @@ -26,7 +26,7 @@ module Rails def create_generator_files return unless options[:generator] - directory 'generators', plugin_dir('generators') + directory 'lib/generators', plugin_dir('lib/generators') end protected diff --git a/railties/lib/generators/rails/plugin/templates/generators/%file_name%/%file_name%_generator.rb.tt b/railties/lib/generators/rails/plugin/templates/generators/%file_name%/%file_name%_generator.rb.tt deleted file mode 100644 index 90aa557eeb..0000000000 --- a/railties/lib/generators/rails/plugin/templates/generators/%file_name%/%file_name%_generator.rb.tt +++ /dev/null @@ -1,2 +0,0 @@ -class <%= class_name %>Generator < Rails::Generators::NamedBase -end diff --git a/railties/lib/generators/rails/plugin/templates/lib/generators/%file_name%_generator.rb.tt b/railties/lib/generators/rails/plugin/templates/lib/generators/%file_name%_generator.rb.tt new file mode 100644 index 0000000000..675f00043f --- /dev/null +++ b/railties/lib/generators/rails/plugin/templates/lib/generators/%file_name%_generator.rb.tt @@ -0,0 +1,5 @@ +class <%= class_name %>Generator < Rails::Generators::NamedBase + def self.source_root + @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates')) + end +end diff --git a/railties/lib/generators/rails/plugin/templates/generators/%file_name%/USAGE.tt b/railties/lib/generators/rails/plugin/templates/lib/generators/USAGE.tt index ea9f4f12cc..ea9f4f12cc 100644 --- a/railties/lib/generators/rails/plugin/templates/generators/%file_name%/USAGE.tt +++ b/railties/lib/generators/rails/plugin/templates/lib/generators/USAGE.tt diff --git a/railties/lib/generators/rails/plugin/templates/generators/%file_name%/templates/.empty_directory b/railties/lib/generators/rails/plugin/templates/lib/generators/templates/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/plugin/templates/generators/%file_name%/templates/.empty_directory +++ b/railties/lib/generators/rails/plugin/templates/lib/generators/templates/.empty_directory diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index b9f09d5163..2b41f85a2d 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -37,10 +37,9 @@ class PluginGeneratorTest < GeneratorsTestCase def test_creates_generator_if_required run_generator ["plugin_fu", "--generator"] - assert_file "vendor/plugins/plugin_fu/generators/plugin_fu/templates" - - flag = /class PluginFuGenerator < Rails::Generators::NamedBase/ - assert_file "vendor/plugins/plugin_fu/generators/plugin_fu/plugin_fu_generator.rb", flag + assert_file "vendor/plugins/plugin_fu/lib/generators/templates" + assert_file "vendor/plugins/plugin_fu/lib/generators/plugin_fu_generator.rb", + /class PluginFuGenerator < Rails::Generators::NamedBase/ end def test_plugin_generator_on_revoke |