From ccd26575d12301816b11bdb22847e10173bd3ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 23 Jun 2009 21:07:12 +0200 Subject: Clean up plugin generator. --- railties/lib/generators/rails/plugin/plugin_generator.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties') diff --git a/railties/lib/generators/rails/plugin/plugin_generator.rb b/railties/lib/generators/rails/plugin/plugin_generator.rb index 38afb3984e..12e67bd188 100644 --- a/railties/lib/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/generators/rails/plugin/plugin_generator.rb @@ -1,14 +1,20 @@ module Rails module Generators class PluginGenerator < NamedBase + class_option :with_tasks, :type => :boolean, :aliases => "-r", :default => false, + :desc => "When supplied creates tasks base files." + + class_option :with_generator, :type => :boolean, :aliases => "-g", :default => false, + :desc => "When supplied creates generator base files." + + # TODO Check class collision + def create_root self.root = File.expand_path("vendor/plugins/#{file_name}", root) empty_directory '.' FileUtils.cd(root) end - # TODO Check class collision - def create_root_files %w(README MIT-LICENSE Rakefile init.rb install.rb uninstall.rb).each do |file| template file @@ -21,12 +27,6 @@ module Rails add_test_framework_option! - class_option :with_tasks, :type => :boolean, :aliases => "-r", :default => false, - :desc => "When supplied creates tasks base files." - - class_option :with_generator, :type => :boolean, :aliases => "-g", :default => false, - :desc => "When supplied creates generator base files." - def create_tasks_files return unless options[:with_tasks] directory 'tasks' -- cgit v1.2.3