Module: DaemonKit::Generators

Defined in:
lib/daemon_kit/generators.rb,
lib/daemon_kit/generators/base.rb,
lib/generators/daemon_kit/app/app_generator.rb,
lib/generators/daemon_kit/sqs/sqs_generator.rb,
lib/generators/daemon_kit/xmpp/xmpp_generator.rb,
lib/generators/daemon_kit/amqp/amqp_generator.rb,
lib/generators/daemon_kit/cron/cron_generator.rb,
lib/generators/daemon_kit/rspec/rspec_generator.rb,
lib/generators/daemon_kit/ruote/ruote_generator.rb,
lib/generators/daemon_kit/cucumber/cucumber_generator.rb,
lib/generators/daemon_kit/test_unit/test_unit_generator.rb,
lib/generators/daemon_kit/capistrano/capistrano_generator.rb

Defined Under Namespace

Classes: AmqpGenerator, AppGenerator, Base, CapistranoGenerator, CronGenerator, CucumberGenerator, Error, RuoteGenerator, SpecGenerator, SqsGenerator, TestUnitGenerator, XmppGenerator

Class Method Summary (collapse)

Class Method Details

+ (Object) configure!



18
19
# File 'lib/daemon_kit/generators.rb', line 18

def configure!
end

+ (Object) help



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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

+ (Object) invoke(namespace, args = ARGV, config = {})



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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