diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-23 20:42:29 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-23 20:42:29 +0200 |
commit | ea106cf051e4fafcaf775f75bc4af17e89197a28 (patch) | |
tree | b83f5e46884b25a5ad88471f43427cbb275487ca /railties/lib/generators/base.rb | |
parent | d7bab3a43a72b94775c857865817004408549e70 (diff) | |
download | rails-ea106cf051e4fafcaf775f75bc4af17e89197a28.tar.gz rails-ea106cf051e4fafcaf775f75bc4af17e89197a28.tar.bz2 rails-ea106cf051e4fafcaf775f75bc4af17e89197a28.zip |
Added plugin generators (and a couple of TODOs).
Diffstat (limited to 'railties/lib/generators/base.rb')
-rw-r--r-- | railties/lib/generators/base.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/railties/lib/generators/base.rb b/railties/lib/generators/base.rb index c888316df7..b530713805 100644 --- a/railties/lib/generators/base.rb +++ b/railties/lib/generators/base.rb @@ -1,8 +1,10 @@ require 'generators/actions' -require 'generators/error' module Rails module Generators + class Error < Thor::Error + end + class Base < Thor::Group include Rails::Generators::Actions include Thor::Actions @@ -45,7 +47,7 @@ module Rails # def self.generator_name @generator_name ||= begin - klass_name = self.name.gsub(/^Rails::Generators::/, '') + klass_name = self.name.split('::').last klass_name.gsub!(/Generator$/, '') klass_name.underscore end @@ -71,7 +73,8 @@ module Rails # Small macro to add test_framework option and invoke it. # def self.add_test_framework_option! - class_option :test_framework, :type => :string, :aliases => "-t", :default => "testunit", + # TODO Reduce the example name + class_option :test_framework, :type => :string, :aliases => "-t", :default => "test_unit", :desc => "Test framework to be invoked by this generator" define_method :invoke_test_framework do @@ -80,7 +83,7 @@ module Rails begin invoke name - rescue Thor::UndefinedTaskError + rescue Thor::UndefinedTaskError # TODO Ensure this message is called. say "Could not find and/or invoke #{name}." end end |