Sha256: 93999a3eb5f9d38b19eee9948f05f1e89859d7eb435e4dcb996f26f2163af895

Contents?: true

Size: 912 Bytes

Versions: 4

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module Neptuno
  module CLI
    # Init Neptuno files

    class Clone < Dry::CLI::Command
      desc "Clone a neptuno compliant project"
      option :provision, type: :boolean, default: false, desc: "Build docker images, start containers and run procs"

      def call(**options)
        git_url = options[:args].first
        args_path = options[:args].second
        path = args_path || git_url.split("/").last.split(".").first
        `git clone --recurse-submodules #{git_url} #{path}`

        sleep(1)

        return unless options.fetch(:provision)

        `cd #{path} && neptuno services update -am`
        puts "Building Docker images"
        `cd #{path} && neptuno build -a`
        puts "Starting Docker containers"
        `cd #{path} && neptuno up -a`
        puts "Starting service processes"
        `cd #{path} && neptuno start -a`
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neptuno-1.5.0 lib/neptuno/cli/clone.rb
neptuno-1.4.10 lib/neptuno/cli/clone.rb
neptuno-1.2.1 lib/neptuno/cli/clone.rb
neptuno-1.2.0 lib/neptuno/cli/clone.rb