Sha256: 241879148cdb4c3f89afbbbd0232cc65c58d115fdf4343f82f3219dbf21be9cd
Contents?: true
Size: 1.08 KB
Versions: 22
Compression:
Stored size: 1.08 KB
Contents
module Bourdain module Commands class GenerateCommand < Command usage :command, <<-END Generate various things. Take that, Chef DK! generate [<options>] <generator> <generator> END def initialize argv generators = Bourdain::Registry.specs('generator') maybe_generator_position = generators.map { |c| argv.index c[:name].to_s }.compact.shift generator_position = maybe_generator_position.nil? ? argv.length : maybe_generator_position generator_name = argv[generator_position] options = argv.slice(0, generator_position) argv = argv.slice(generator_position, argv.length) super options generator = nil generator = argv.shift unless maybe_generator_position.nil? Trollop::die 'Invalid <generator> provided' if generator.nil? generator = Bourdain::Registry.klass('generator', generator_name) Trollop::die 'Invalid <generator> provided' if generator.nil? @status = generator.new(argv).status end end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
bourdain-1.2.14 | lib/bourdain/resources/commands/generate.rb |
bourdain-1.2.13 | lib/bourdain/resources/commands/generate.rb |