Sha256: 0a4636c884d5659e079ec55264aa237edc327284d1df0515e43b586122f22bff

Contents?: true

Size: 981 Bytes

Versions: 9

Compression:

Stored size: 981 Bytes

Contents

require "inflecto"
require "dry/web/roda/generate"

module Dry
  module Web
    module Roda
      module Generators
        class App
          attr_reader :generate

          def initialize
            @generate = Dry::Web::Roda::Generate.new("app")
          end

          def call(target_dir, options = {})
            umbrella_name = options.fetch(:umbrella)
            generate_to = options.fetch(:to) { File.join("apps", target_dir) }

            generate.(generate_to, prepare_scope(target_dir, umbrella_name))
          end

          private

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dry-web-roda-0.6.0 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.5.1 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.5.0 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.4.0 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.3.0 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.2.3 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.2.2 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.2.1 lib/dry/web/roda/generators/app.rb
dry-web-roda-0.2.0 lib/dry/web/roda/generators/app.rb