Sha256: 3315b17536c2085c83cce4ff8303907e075ca77ab6d240803cb23b955c6fd584

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

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

      desc "Installs git, docker, tmux, tmuxinator and overmind"

      CONFIG = nil

      def call(**)
        install "git"
        install "docker"
        install "tmux"
        install "overmind"
        install "tmuxinator"

        return unless system("apt-get -v")

        system("sudo apt-get update")
      end

      def install(package)
        if ::TTY::Which.exist?(package)
          puts "#{package} is already installed"
        else
          puts "Installing #{package}"
          if system("brew -v")
            system("brew install #{package}")
          elsif package == "overmind"
            system("go install github.com/DarthSim/overmind/v2@latest")
          elsif package == "tmuxinator"
            system("gem install tmuxinator")
          else
            system("sudo apt-get install #{package} -y")
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neptuno-1.2.1 lib/neptuno/cli/install.rb
neptuno-1.2.0 lib/neptuno/cli/install.rb