lib/jeweler/generator/options.rb in dima-jeweler-0.9.2 vs lib/jeweler/generator/options.rb in dima-jeweler-1.2.0
- old
+ new
@@ -1,14 +1,16 @@
class Jeweler
class Generator
class Options < Hash
- attr_reader :opts
+ attr_reader :opts, :orig_args
def initialize(args)
super()
- self[:testing_framework] = :shoulda
+ @orig_args = args.clone
+ self[:testing_framework] = :shoulda
+ self[:documentation_framework] = :rdoc
@opts = OptionParser.new do |o|
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
o.on('--bacon', 'generate bacon specifications') do
@@ -37,27 +39,59 @@
o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
self[:use_cucumber] = true
end
+ o.on('--reek', 'generate rake task for reek') do
+ self[:use_reek] = true
+ end
+
+ o.on('--roodi', 'generate rake task for roodi') do
+ self[:use_roodi] = true
+ end
+
o.on('--create-repo', 'create the repository on GitHub') do
self[:create_repo] = true
end
+ o.on('--rubyforge', 'setup project for rubyforge') do
+ self[:rubyforge] = true
+ end
+
o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
self[:summary] = summary
end
+ o.on('--description [DESCRIPTION]', 'specify a description of the project') do |description|
+ self[:description] = description
+ end
+
o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|
self[:directory] = directory
end
+ o.on('--yard', 'use yard for documentation') do
+ self[:documentation_framework] = :yard
+ end
+
+ o.on('--rdoc', 'use rdoc for documentation') do
+ self[:documentation_framework] = :rdoc
+ end
+
o.on_tail('-h', '--help', 'display this help and exit') do
self[:show_help] = true
end
end
- @opts.parse!(args)
+ begin
+ @opts.parse!(args)
+ rescue OptionParser::InvalidOption => e
+ self[:invalid_argument] = e.message
+ end
+ end
+
+ def merge(other)
+ self.class.new(@orig_args + other.orig_args)
end
end
end
end