From b1999be5a7efd67e2602c37ed898aa8433661863 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 15 Feb 2005 01:45:35 +0000 Subject: A hopefully more successful attempt at the Routing branch merge git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@617 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/rails_generator/options.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'railties/lib/rails_generator/options.rb') diff --git a/railties/lib/rails_generator/options.rb b/railties/lib/rails_generator/options.rb index afe2d31625..54785413ef 100644 --- a/railties/lib/rails_generator/options.rb +++ b/railties/lib/rails_generator/options.rb @@ -1,8 +1,12 @@ require 'optparse' -require File.dirname(__FILE__) + '/../support/class_inheritable_attributes' +require File.dirname(__FILE__) + '/support/class_inheritable_attributes' module Rails module Generator + # Implement add_options! to add your options to the parser: + # def add_options!(opt) + # opt.on('-v', '--verbose') { |value| options[:verbose] = value } + # end module Options def self.append_features(base) super @@ -85,13 +89,14 @@ module Rails @option_parser = OptionParser.new do |opt| opt.banner = banner - add_options!(opt) + add_options!(opt) if respond_to?(:add_options!) add_general_options!(opt) opt.parse!(args) end + return args + ensure self.options = full_options(runtime_options) - args end # Raise a usage error. Override usage_message to provide a blurb @@ -109,14 +114,6 @@ module Rails "Usage: #{$0} [options]" end - # Override with a method that adds options to the parser. - # Added options should use the options hash. For example, - # def add_options!(opt) - # opt.on('-v', '--verbose') { |value| options[:verbose] = value } - # end - def add_options!(opt) - end - # Adds general options like -h and --quiet. Usually don't override. def add_general_options!(opt) opt.separator '' -- cgit v1.2.3