diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-25 09:35:51 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-25 09:35:51 +0000 |
commit | 738fc579f0dc95aad9ab0dedc65fbce7af0bb980 (patch) | |
tree | b3b5d7a8cdd3825323a6301ba3885ad8cc236fab /lib/generators/redmine_plugin_model | |
parent | 0316fde06bb8892589ac83c387789db22ee29614 (diff) | |
download | redmine-738fc579f0dc95aad9ab0dedc65fbce7af0bb980.tar.gz redmine-738fc579f0dc95aad9ab0dedc65fbce7af0bb980.zip |
Renames template ruby files to erb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1951 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/generators/redmine_plugin_model')
-rw-r--r-- | lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb | 26 | ||||
-rw-r--r-- | lib/generators/redmine_plugin_model/templates/migration.rb.erb (renamed from lib/generators/redmine_plugin_model/templates/migration.rb) | 0 | ||||
-rw-r--r-- | lib/generators/redmine_plugin_model/templates/model.rb.erb (renamed from lib/generators/redmine_plugin_model/templates/model.rb) | 0 | ||||
-rw-r--r-- | lib/generators/redmine_plugin_model/templates/unit_test.rb.erb (renamed from lib/generators/redmine_plugin_model/templates/unit_test.rb) | 0 |
4 files changed, 26 insertions, 0 deletions
diff --git a/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb b/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb index b712d9b07..059a028d6 100644 --- a/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb +++ b/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb @@ -15,4 +15,30 @@ class RedminePluginModelGenerator < ModelGenerator def destination_root File.join(RAILS_ROOT, plugin_path) end + + def manifest + record do |m| + # Check for class naming collisions. + m.class_collisions class_path, class_name, "#{class_name}Test" + + # Model, test, and fixture directories. + m.directory File.join('app/models', class_path) + m.directory File.join('test/unit', class_path) + m.directory File.join('test/fixtures', class_path) + + # Model class, unit test, and fixtures. + m.template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb") + m.template 'unit_test.rb.erb', File.join('test/unit', class_path, "#{file_name}_test.rb") + + unless options[:skip_fixture] + m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") + end + + unless options[:skip_migration] + m.migration_template 'migration.rb.erb', 'db/migrate', :assigns => { + :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}" + }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}" + end + end + end end diff --git a/lib/generators/redmine_plugin_model/templates/migration.rb b/lib/generators/redmine_plugin_model/templates/migration.rb.erb index 2a305a6a9..2a305a6a9 100644 --- a/lib/generators/redmine_plugin_model/templates/migration.rb +++ b/lib/generators/redmine_plugin_model/templates/migration.rb.erb diff --git a/lib/generators/redmine_plugin_model/templates/model.rb b/lib/generators/redmine_plugin_model/templates/model.rb.erb index 8d4c89e91..8d4c89e91 100644 --- a/lib/generators/redmine_plugin_model/templates/model.rb +++ b/lib/generators/redmine_plugin_model/templates/model.rb.erb diff --git a/lib/generators/redmine_plugin_model/templates/unit_test.rb b/lib/generators/redmine_plugin_model/templates/unit_test.rb.erb index cc8b2e591..cc8b2e591 100644 --- a/lib/generators/redmine_plugin_model/templates/unit_test.rb +++ b/lib/generators/redmine_plugin_model/templates/unit_test.rb.erb |