instance method
usage_message
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
usage_message()
No documentation comment.
Source
# File railties/lib/rails_generator/scripts.rb, line 44
def usage_message
usage = "\nInstalled Generators\n"
Rails::Generator::Base.sources.inject([]) do |mem, source|
# Using an association list instead of a hash to preserve order,
# for aesthetic reasons more than anything else.
label = source.label.to_s.capitalize
pair = mem.assoc(label)
mem << (pair = [label, []]) if pair.nil?
pair[1] |= source.names
mem
end.each do |label, names|
usage << " #{label}: #{names.join(', ')}\n" unless names.empty?
end
usage << <<end_blurb
More are available at http://wiki.rubyonrails.org/rails/pages/AvailableGenerators
1. Download, for example, login_generator.zip
2. Unzip to directory #{Dir.user_home}/.rails/generators/login
to use the generator with all your Rails apps
end_blurb
if Object.const_defined?(:RAILS_ROOT)
usage << <<end_blurb
or to #{File.expand_path(RAILS_ROOT)}/lib/generators/login
to use with this app only.
end_blurb
end
usage << <<end_blurb
3. Run generate with no arguments for usage information
#{$0} login
Generator gems are also available:
1. gem search -r generator
2. gem install login_generator
3. #{$0} login
end_blurb
return usage
end
Defined in railties/lib/rails_generator/scripts.rb line 44
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generator::Scripts::Base