|
@@
-1,33
+1,37
|
|
1
|
class RedminePluginGenerator < Rails::Generators::NamedBase
|
|
1
|
class RedminePluginGenerator < Rails::Generators::NamedBase
|
|
2
|
source_root File.expand_path("../templates", __FILE__)
|
|
2
|
source_root File.expand_path("../templates", __FILE__)
|
|
3
|
|
|
3
|
|
|
4
|
attr_reader :plugin_path, :plugin_name, :plugin_pretty_name
|
|
4
|
attr_reader :plugin_path, :plugin_name, :plugin_pretty_name
|
|
5
|
|
|
5
|
|
|
6
|
def initialize(*args)
|
|
6
|
def initialize(*args)
|
|
7
|
super
|
|
7
|
super
|
|
8
|
@plugin_name = file_name.underscore
|
|
8
|
@plugin_name = file_name.underscore
|
|
9
|
@plugin_pretty_name = plugin_name.titleize
|
|
9
|
@plugin_pretty_name = plugin_name.titleize
|
|
10
|
@plugin_path = "plugins/#{plugin_name}"
|
|
10
|
@plugin_path = "plugins/#{plugin_name}"
|
|
11
|
end
|
|
11
|
end
|
|
12
|
|
|
12
|
|
|
13
|
def copy_templates
|
|
13
|
def copy_templates
|
|
14
|
empty_directory "#{plugin_path}/app"
|
|
14
|
empty_directory "#{plugin_path}/app"
|
|
15
|
empty_directory "#{plugin_path}/app/controllers"
|
|
15
|
empty_directory "#{plugin_path}/app/controllers"
|
|
16
|
empty_directory "#{plugin_path}/app/helpers"
|
|
16
|
empty_directory "#{plugin_path}/app/helpers"
|
|
17
|
empty_directory "#{plugin_path}/app/models"
|
|
17
|
empty_directory "#{plugin_path}/app/models"
|
|
18
|
empty_directory "#{plugin_path}/app/views"
|
|
18
|
empty_directory "#{plugin_path}/app/views"
|
|
19
|
empty_directory "#{plugin_path}/db/migrate"
|
|
19
|
empty_directory "#{plugin_path}/db/migrate"
|
|
20
|
empty_directory "#{plugin_path}/lib/tasks"
|
|
20
|
empty_directory "#{plugin_path}/lib/tasks"
|
|
21
|
empty_directory "#{plugin_path}/assets/images"
|
|
21
|
empty_directory "#{plugin_path}/assets/images"
|
|
22
|
empty_directory "#{plugin_path}/assets/javascripts"
|
|
22
|
empty_directory "#{plugin_path}/assets/javascripts"
|
|
23
|
empty_directory "#{plugin_path}/assets/stylesheets"
|
|
23
|
empty_directory "#{plugin_path}/assets/stylesheets"
|
|
24
|
empty_directory "#{plugin_path}/config/locales"
|
|
24
|
empty_directory "#{plugin_path}/config/locales"
|
|
25
|
empty_directory "#{plugin_path}/test"
|
|
25
|
empty_directory "#{plugin_path}/test"
|
|
|
|
|
26
|
empty_directory "#{plugin_path}/test/fixtures"
|
|
|
|
|
27
|
empty_directory "#{plugin_path}/test/unit"
|
|
|
|
|
28
|
empty_directory "#{plugin_path}/test/functional"
|
|
|
|
|
29
|
empty_directory "#{plugin_path}/test/integration"
|
|
26
|
|
|
30
|
|
|
27
|
template 'README.rdoc', "#{plugin_path}/README.rdoc"
|
|
31
|
template 'README.rdoc', "#{plugin_path}/README.rdoc"
|
|
28
|
template 'init.rb.erb', "#{plugin_path}/init.rb"
|
|
32
|
template 'init.rb.erb', "#{plugin_path}/init.rb"
|
|
29
|
template 'routes.rb', "#{plugin_path}/config/routes.rb"
|
|
33
|
template 'routes.rb', "#{plugin_path}/config/routes.rb"
|
|
30
|
template 'en_rails_i18n.yml', "#{plugin_path}/config/locales/en.yml"
|
|
34
|
template 'en_rails_i18n.yml', "#{plugin_path}/config/locales/en.yml"
|
|
31
|
template 'test_helper.rb.erb', "#{plugin_path}/test/test_helper.rb"
|
|
35
|
template 'test_helper.rb.erb', "#{plugin_path}/test/test_helper.rb"
|
|
32
|
end
|
|
36
|
end
|
|
33
|
end
|
|
37
|
end
|