Sha256: d6e3384b9783a47b004861fd1bee3759a475242a0d14e90bd50970f4fec1b255

Contents?: true

Size: 778 Bytes

Versions: 4

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true

module Neptuno
  module CLI
    # Init Neptuno files
    class Init < Dry::CLI::Command
      include TTY::File
      include TTY::Config
      include TTY::Which

      desc 'Initializes a Neptuno project folder structure'

      WORK_TREE = { '.' => [{ 'services' => [], 'dockerfiles' => [], 'procfiles' => [], 'environments' => [] }] }.freeze

      CONFIG = nil

      def call(**)
        abort 'Neptuno projects can not be nested.' if neptuno_path != ''
        ::TTY::File.create_dir(WORK_TREE, Dir.pwd)
        config.set(:configured_services, value: '')
        config.set(:services, value: [])
        config.write(create: true, force: true)
        `cp #{File.expand_path("../../templates", __FILE__)}/* ./`
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neptuno-1.0.10 lib/neptuno/cli/init.rb
neptuno-1.0.9 lib/neptuno/cli/init.rb
neptuno-1.0.8 lib/neptuno/cli/init.rb
neptuno-1.0.7 lib/neptuno/cli/init.rb