Sha256: 875c5eb5090508cb5fe78c5cd6025b182d5d1dac64d4850b0b7a18a2fb00c69c

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

module Roro
  class CLI < Thor
    method_option :environments,
                 type: :array,
                 aliases: :e,
                 banner: 'one, two, three',
                 desc: 'The environments to generate:',
                 default: %w[base ci development production]

    method_option :containers,
                 type: :array,
                 aliases: :c,
                 banner: 'container_one, container_two, container_three',
                 default: %w[backend database frontend],
                 desc: 'The containers to generate:'

    method_option :mise_en_place,
                 type: :string,
                 aliases: :m,
                 default: 'mise',
                 desc: "The name of your mise en place folder. This is where your container folders, environment files, scripts, and keys will live"

    method_option :keys,
                 type: :array,
                 aliases: :k,
                 banner: 'one.key two.key three.key',
                 default: %w[base ci development production],
                 desc: 'The names of your keys to generate. If none supplied, Roro will infer them from your .env files:'

    desc 'generate', 'Generate stuff.'
    map 'generate'  => 'generate'

    def generate
      order = %w[mise_en_place containers environments keys]
      order.each do |item|
        value = options[item]
        case item
        when 'mise_en_place'
          generate_mise(value)
        when 'containers'
          generate_containers(*value)
        when 'environments'
          generate_environments(*value)
        when 'keys'
          generate_keys(*value)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roro-0.3.25 lib/roro/cli/generate/generate.rb
roro-0.3.24 lib/roro/cli/generate/generate.rb
roro-0.3.23 lib/roro/cli/generate/generate.rb