module DaemonKit::Generators
Public Class Methods
configure!()
click to toggle source
# File lib/daemon_kit/generators.rb, line 18 def configure! end
help()
click to toggle source
# File lib/daemon_kit/generators.rb, line 37 def help namespaces = constants.inject([]) do |list, sym| unless sym == :Base || sym == :AppGenerator klass = const_get( sym ) list << klass.namespace if klass.respond_to?( :namespace ) end list end puts "Usage:" puts " script/generate GENERATOR [args] [options]" puts puts "General options:" puts " -h, [--help] # Print generators options and usage" puts " -p, [--pretend] # Run but do not make any changes" puts " -f, [--force] # Overwrite files that already exist" puts " -s, [--skip] # Skip files that already exist" puts " -q, [--quiet] # Supress status output" puts puts "Available generators:" namespaces.each { |ns| puts " " + ns } puts end
invoke( namespace, args = ARGV, config = {} )
click to toggle source
# File lib/daemon_kit/generators.rb, line 21 def invoke( namespace, args = ARGV, config = {} ) klass_name = constants.detect do |sym| klass = const_get( sym ) klass.respond_to?( :namespace ) && klass.namespace == namespace end if klass_name.nil? raise Error, "Could not find generator #{namespace}." end klass = const_get( klass_name ) args << '--help' if args.empty? && klass.arguments.any? { |a| a.required? } klass.start( args, config ) end