Sha256: 5be94ac2484f02567a62fcef1b09eac18cfee3140820ed7474e9a601316653df

Contents?: true

Size: 872 Bytes

Versions: 3

Compression:

Stored size: 872 Bytes

Contents

# frozen_string_literal: true

module Neptuno
  module CLI
    # Init Neptuno files
    class Execute < Neptuno::CLI::Base
      include TTY::File
      include TTY::Config

      desc "Execute service script"

      def call(**options)
        command_service_to("execute", service_as_args: options[:args]&.first) do |service, _project|
          commands = Dir.glob("#{neptuno_path}/scripts/#{service}/*").map { |x| x.split("/") }.map(&:last)
          command = options[:args].last if commands.include?(options[:args]&.last)
          puts "#{neptuno_path}/scripts/#{service}/*"
          puts service
          puts commands.to_s
          puts Dir.glob("#{neptuno_path}/scripts/#{service}/*").to_s
          command ||= prompt.select("execute", commands || [])
          `cd #{neptuno_path}/scripts/#{service} && ./#{command}`
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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