Sha256: 80777a312ce0ff410fa01c4ae6ab2202e64d67bf28e3ab21d8eefc2909899fda

Contents?: true

Size: 860 Bytes

Versions: 12

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true

module Polyn
  class Cli
    ##
    # Generates a new Stream configuration file for terraform
    class StreamGenerator < Thor::Group
      include Thor::Actions

      desc "Generates a new stream configuration with boilerplate"

      argument :name, required: true
      class_option :dir, default: Dir.getwd

      source_root File.join(File.expand_path(__dir__), "../templates")

      def check_name
        Polyn::Cli::Naming.validate_stream_name!(name)
      end

      def file_name
        @file_name ||= name.downcase
      end

      def stream_name
        @stream_name ||= Polyn::Cli::Naming.format_stream_name(name)
      end

      def create
        say "Creating new stream config #{stream_name}"
        template "generators/stream.tf", File.join(options.dir, "tf/#{file_name}.tf")
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
polyn-cli-0.3.0 lib/polyn/cli/stream_generator.rb
polyn-cli-0.2.0 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.9 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.8 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.7 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.6 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.5 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.4 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.3 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.2 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.1 lib/polyn/cli/stream_generator.rb
polyn-cli-0.1.0 lib/polyn/cli/stream_generator.rb