Sha256: 1ebc50b24af5967e100054748d948e0f31623adf16b0841cca8b5976e50961a8

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module Umwelt::CLI::Commands
  class Example < Hanami::CLI::Command
    desc 'Create example Umwelt'

    option :target,
           type: :string,
           default: '.umwelt',
           desc: 'provide target path (relative)'

    def call(**options)
      FileUtils.cp_r(
        examples_dir,
        target_dir(options.fetch(:target)),
        verbose: true
      )
    end

    def examples_dir
      Pathname.new(__dir__) / '../../../../spec/examples/.'
    end

    def target_dir(target)
      Pathname.pwd / target
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
umwelt-0.2 lib/umwelt/cli/commands/example.rb
umwelt-0.1.1 lib/umwelt/cli/commands/example.rb