Sha256: a305ef11ce4f35c4e899786ff2e26f3064d02e5ed3d8fc8608c666973d1e1287

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

module Kontena
  module Util
    
    def self.included(base)
        base.extend(ClassMethods)
    end

    # @param [String] cmd
    def which(cmd)
      exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
      ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
        exts.each { |ext|
          exe = File.join(path, "#{cmd}#{ext}")
          return exe if File.executable?(exe) && !File.directory?(exe)
        }
      end
      return nil
    end
    module_function(:which)

    module ClassMethods
      def experimental?
        ENV.has_key?('KONTENA_EXPERIMENTAL')
      end   
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kontena-cli-0.15.0 lib/kontena/util.rb
kontena-cli-0.15.0.rc3 lib/kontena/util.rb
kontena-cli-0.15.0.rc2 lib/kontena/util.rb