Sha256: 1b7d6c218fa01c348d824d3510c4811268348be079b191e6697b9876dc844a37
Contents?: true
Size: 1.44 KB
Versions: 16
Compression:
Stored size: 1.44 KB
Contents
class ComponentGeneratorGenerator < RubiGen::Base default_options attr_reader :name, :class_name, :generator_type, :generator_path def initialize(runtime_args, runtime_options = {}) super usage if args.empty? @name = args.shift @class_name = "#{name}_generator".camelize @generator_type = args.shift # optional @generator_path = @generator_type ? "#{generator_type}_generators" : "generators" extract_options end def manifest path = "#{generator_path}/#{name}" record do |m| # Ensure appropriate generators folder exists m.directory "#{path}/templates" m.directory "test" # Generator stub m.template "generator.rb", "#{path}/#{name}_generator.rb" m.template "test.rb", "test/test_#{name}_generator.rb" m.file "test_generator_helper.rb", "test/test_generator_helper.rb" m.file "usage", "#{path}/USAGE" m.readme 'readme' end end protected def banner <<-EOS Creates a generator stub within your RubyGem. USAGE: #{$0} #{spec.name} name [generator_type] EOS end def add_options!(opts) # opts.separator '' # opts.separator 'Options:' # opts.on("-a", "--author=\"Your Name\"", String, # "Generated app file will include your name.", # "Default: none") { |options[:author]| } end def extract_options end end
Version data entries
16 entries across 16 versions & 2 rubygems