Sha256: 014a1bef5236f71156198ba50489040c254da1f328a0960f5752795e40b58243

Contents?: true

Size: 964 Bytes

Versions: 2

Compression:

Stored size: 964 Bytes

Contents

require "securerandom"
require "dry/web/roda/generate"
require "dry/web/roda/generators/inflections"
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: Inflections.underscored_name(target_dir),
              camel_cased_app_name: Inflections.camel_cased_name(target_dir)
            }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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