Sha256: 76aad0c5fee6c939af470e2d0cc8b6433d62a8715c635eded63cc06454be3ef7
Contents?: true
Size: 919 Bytes
Versions: 26
Compression:
Stored size: 919 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/simple_cache' module EacRubyUtils module Envs class Executable include ::EacRubyUtils::SimpleCache attr_reader :env, :name, :check_args def initialize(env, name, *check_args) @env = env @name = name @check_args = check_args end def exist? exist end def validate return nil if exist? "Program \"#{name}\" not found in environment #{env}" end def validate! message = validate raise ProgramNotFoundError, message if message end def command validate! env.command(name) end private def exist_uncached env.command(name, *check_args).execute! true rescue Errno::ENOENT false end class ProgramNotFoundError < ::StandardError; end end end end
Version data entries
26 entries across 26 versions & 2 rubygems