diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-09-05 10:31:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-09-05 10:31:06 +0000 |
commit | f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2 (patch) | |
tree | ba4070526883885914942b3a0d253eb2a6e63bf8 /lib/generators/redmine_plugin | |
parent | 4b9df2eac774aa045aa5207c8bc613ed6ca67d42 (diff) | |
download | redmine-f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2.tar.gz redmine-f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2.zip |
Merged hooks branch @ r1785 into trunk.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1786 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/generators/redmine_plugin')
-rw-r--r-- | lib/generators/redmine_plugin/USAGE | 18 | ||||
-rw-r--r-- | lib/generators/redmine_plugin/redmine_plugin_generator.rb | 31 | ||||
-rw-r--r-- | lib/generators/redmine_plugin/templates/README | 3 | ||||
-rw-r--r-- | lib/generators/redmine_plugin/templates/en.yml | 2 | ||||
-rw-r--r-- | lib/generators/redmine_plugin/templates/init.rb | 8 | ||||
-rw-r--r-- | lib/generators/redmine_plugin/templates/test_helper.rb | 5 |
6 files changed, 67 insertions, 0 deletions
diff --git a/lib/generators/redmine_plugin/USAGE b/lib/generators/redmine_plugin/USAGE new file mode 100644 index 000000000..65a45d163 --- /dev/null +++ b/lib/generators/redmine_plugin/USAGE @@ -0,0 +1,18 @@ +Description: + The plugin generator creates stubs for a new Redmine plugin. + +Example: + ./script/generate redmine_plugin meetings + create vendor/plugins/redmine_meetings/app/controllers + create vendor/plugins/redmine_meetings/app/helpers + create vendor/plugins/redmine_meetings/app/models + create vendor/plugins/redmine_meetings/app/views + create vendor/plugins/redmine_meetings/db/migrate + create vendor/plugins/redmine_meetings/lib/tasks + create vendor/plugins/redmine_meetings/assets/images + create vendor/plugins/redmine_meetings/assets/javascripts + create vendor/plugins/redmine_meetings/assets/stylesheets + create vendor/plugins/redmine_meetings/lang + create vendor/plugins/redmine_meetings/README + create vendor/plugins/redmine_meetings/init.rb + create vendor/plugins/redmine_meetings/lang/en.yml diff --git a/lib/generators/redmine_plugin/redmine_plugin_generator.rb b/lib/generators/redmine_plugin/redmine_plugin_generator.rb new file mode 100644 index 000000000..666386abd --- /dev/null +++ b/lib/generators/redmine_plugin/redmine_plugin_generator.rb @@ -0,0 +1,31 @@ +class RedminePluginGenerator < Rails::Generator::NamedBase + attr_reader :plugin_path, :plugin_name, :plugin_pretty_name + + def initialize(runtime_args, runtime_options = {}) + super + @plugin_name = "redmine_#{file_name.underscore}" + @plugin_pretty_name = plugin_name.titleize + @plugin_path = "vendor/plugins/#{plugin_name}" + end + + def manifest + record do |m| + m.directory "#{plugin_path}/app/controllers" + m.directory "#{plugin_path}/app/helpers" + m.directory "#{plugin_path}/app/models" + m.directory "#{plugin_path}/app/views" + m.directory "#{plugin_path}/db/migrate" + m.directory "#{plugin_path}/lib/tasks" + m.directory "#{plugin_path}/assets/images" + m.directory "#{plugin_path}/assets/javascripts" + m.directory "#{plugin_path}/assets/stylesheets" + m.directory "#{plugin_path}/lang" + m.directory "#{plugin_path}/test" + + m.template 'README', "#{plugin_path}/README" + m.template 'init.rb', "#{plugin_path}/init.rb" + m.template 'en.yml', "#{plugin_path}/lang/en.yml" + m.template 'test_helper.rb', "#{plugin_path}/test/test_helper.rb" + end + end +end diff --git a/lib/generators/redmine_plugin/templates/README b/lib/generators/redmine_plugin/templates/README new file mode 100644 index 000000000..7a31a890e --- /dev/null +++ b/lib/generators/redmine_plugin/templates/README @@ -0,0 +1,3 @@ += <%= file_name %> + +Description goes here diff --git a/lib/generators/redmine_plugin/templates/en.yml b/lib/generators/redmine_plugin/templates/en.yml new file mode 100644 index 000000000..e338591ef --- /dev/null +++ b/lib/generators/redmine_plugin/templates/en.yml @@ -0,0 +1,2 @@ +# English strings go here +my_label: "My label" diff --git a/lib/generators/redmine_plugin/templates/init.rb b/lib/generators/redmine_plugin/templates/init.rb new file mode 100644 index 000000000..1ffcd7bb8 --- /dev/null +++ b/lib/generators/redmine_plugin/templates/init.rb @@ -0,0 +1,8 @@ +require 'redmine' + +Redmine::Plugin.register :<%= plugin_name %> do + name '<%= plugin_pretty_name %> plugin' + author 'Author name' + description 'This is a plugin for Redmine' + version '0.0.1' +end diff --git a/lib/generators/redmine_plugin/templates/test_helper.rb b/lib/generators/redmine_plugin/templates/test_helper.rb new file mode 100644 index 000000000..bd1ed0c5d --- /dev/null +++ b/lib/generators/redmine_plugin/templates/test_helper.rb @@ -0,0 +1,5 @@ +# Load the normal Rails helper +require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper') + +# Ensure that we are using the temporary fixture path +Engines::Testing.set_fixture_path |