Sha256: 652fd2bfcbe4c4679d4fbb52a0b6e30d8eea407421738e00fdc582288427381e

Contents?: true

Size: 590 Bytes

Versions: 4

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

module Neptuno
  module Docker
    module Services
      include Neptuno::TTY::Config
      require "yaml"

      def running_services
        running_services = `cd ~/.neptuno/projects/#{current_project} && docker compose ps | awk '{ print $3 }' | awk 'NR>1'`
        running_services.split("\n").map(&:strip)
      end

      def registered_services
        dc = YAML.load_file("#{neptuno_path}/docker-compose.yml")
        dc["services"].keys
      end

      def stopped_services
        registered_services - running_services
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neptuno-1.5.0 lib/neptuno/docker/services.rb
neptuno-1.4.10 lib/neptuno/docker/services.rb
neptuno-1.2.1 lib/neptuno/docker/services.rb
neptuno-1.2.0 lib/neptuno/docker/services.rb