@@ -3,7 +3,7 require 'rails_generator/generators/components/model/model_generator' | |||||
3 |
|
3 | |||
4 | class RedminePluginModelGenerator < ModelGenerator |
|
4 | class RedminePluginModelGenerator < ModelGenerator | |
5 | attr_accessor :plugin_path, :plugin_name, :plugin_pretty_name |
|
5 | attr_accessor :plugin_path, :plugin_name, :plugin_pretty_name | |
6 |
|
6 | |||
7 | def initialize(runtime_args, runtime_options = {}) |
|
7 | def initialize(runtime_args, runtime_options = {}) | |
8 | runtime_args = runtime_args.dup |
|
8 | runtime_args = runtime_args.dup | |
9 | usage if runtime_args.empty? |
|
9 | usage if runtime_args.empty? | |
@@ -12,11 +12,11 class RedminePluginModelGenerator < ModelGenerator | |||||
12 | @plugin_path = "vendor/plugins/#{plugin_name}" |
|
12 | @plugin_path = "vendor/plugins/#{plugin_name}" | |
13 | super(runtime_args, runtime_options) |
|
13 | super(runtime_args, runtime_options) | |
14 | end |
|
14 | end | |
15 |
|
15 | |||
16 | def destination_root |
|
16 | def destination_root | |
17 | File.join(Rails.root, plugin_path) |
|
17 | File.join(Rails.root, plugin_path) | |
18 | end |
|
18 | end | |
19 |
|
19 | |||
20 | def manifest |
|
20 | def manifest | |
21 | record do |m| |
|
21 | record do |m| | |
22 | # Check for class naming collisions. |
|
22 | # Check for class naming collisions. | |
@@ -31,7 +31,7 class RedminePluginModelGenerator < ModelGenerator | |||||
31 | m.template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb") |
|
31 | m.template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb") | |
32 | m.template 'unit_test.rb.erb', File.join('test/unit', class_path, "#{file_name}_test.rb") |
|
32 | m.template 'unit_test.rb.erb', File.join('test/unit', class_path, "#{file_name}_test.rb") | |
33 |
|
33 | |||
34 |
unless options[:skip_fixture] |
|
34 | unless options[:skip_fixture] | |
35 | m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") |
|
35 | m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") | |
36 | end |
|
36 | end | |
37 |
|
37 |
General Comments 0
You need to be logged in to leave comments.
Login now