lib/couch/generators.rb in couch-0.0.2 vs lib/couch/generators.rb in couch-0.0.3
- old
+ new
@@ -16,13 +16,14 @@
# Show help message with available generators.
def self.help(command = 'generate')
path = File.expand_path("../generators/*/*_generator.rb", __FILE__)
generators = Dir.glob(path)
+ generators.sort!
generators.map! { |f| File.basename(f) }
generators.map! { |n| n.sub!(/_generator\.rb$/, '') }
- longest_name = generators.map { |g| g.size }.sort.first
- generators.map! { |g| "%s # %s" % [g.ljust(longest_name), lookup(g).info] }
+ longest_name_size = generators.map { |g| g.size }.sort.last
+ generators.map! { |g| "%s # %s" % [g.ljust(longest_name_size), lookup(g).info] }
puts "Usage: couch #{command} GENERATOR [args] [options]"
puts
puts "General options:"
puts " -h, [--help] # Print generators options and usage"