Sha256: 2547bc9977e894c3667069fb0259ef77cae985787e4a1730a313e0eb47afea3b

Contents?: true

Size: 949 Bytes

Versions: 8

Compression:

Stored size: 949 Bytes

Contents

module Runbook::Generators
  class Generator < Thor::Group
    include ::Runbook::Generators::Base

    source_root File.dirname(__FILE__)

    def self.usage
      "generator NAME [options]"
    end

    def self.description
      "Generate a runbook generator named NAME, e.x. acme_runbook"
    end

    argument :name, desc: "The name of your generator for populating boilerplate"

    def create_generator_directory
      target = File.join(
        parent_options[:root],
        name.underscore,
      )
      empty_directory(target)
    end

    def create_templates_directory
      target = File.join(
        parent_options[:root],
        name.underscore,
        "templates",
      )
      empty_directory(target)
    end

    def create_generator
      target = File.join(
        parent_options[:root],
        name.underscore,
        "#{name.underscore}.rb",
      )
      template('templates/generator.tt', target)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
careacademy-runbook-1.2.0 lib/runbook/generators/generator/generator.rb
runbook-1.1.0 lib/runbook/generators/generator/generator.rb
runbook-1.0.0 lib/runbook/generators/generator/generator.rb
runbook-0.16.1 lib/runbook/generators/generator/generator.rb
runbook-0.16.0 lib/runbook/generators/generator/generator.rb
runbook-0.15.0 lib/runbook/generators/generator/generator.rb
runbook-0.14.0 lib/runbook/generators/generator/generator.rb
runbook-0.13.0 lib/runbook/generators/generator/generator.rb