Sha256: 4af5f9c572c08082fd91b738036492ba7d07c6c763e155158f0451736d6b6765

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

require "inflecto"
require "securerandom"
require "dry/web/roda/generate"
require "dry/web/roda/generators/sub_app"

module Dry
  module Web
    module Roda
      module Generators
        class UmbrellaProject
          attr_reader :generate, :sub_app_generator

          def initialize
            @generate = Generate.new("umbrella_project")
            @sub_app_generator = Generators::SubApp.new
          end

          def call(target_dir)
            generate.(target_dir, prepare_scope(target_dir))

            Dir.chdir(target_dir) do
              sub_app_generator.("main", umbrella: target_dir)
            end
          end

          private

          def prepare_scope(target_dir)
            {
              underscored_app_name: Inflecto.underscore(target_dir),
              camel_cased_app_name: Inflecto.camelize(target_dir)
            }
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-web-roda-0.6.1 lib/dry/web/roda/generators/umbrella_project.rb