Sha256: d47f4945ff3c0b35e420b59a5b6520a109bf3d076a6df2ebaabab91677ed051c

Contents?: true

Size: 422 Bytes

Versions: 212

Compression:

Stored size: 422 Bytes

Contents

module Kontena
  module Machine
    module Common

      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
    end
  end
end

Version data entries

212 entries across 212 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/machine/common.rb
krates-1.7.10 lib/kontena/machine/common.rb
krates-1.7.9 lib/kontena/machine/common.rb
krates-1.7.8 lib/kontena/machine/common.rb
krates-1.7.7 lib/kontena/machine/common.rb
krates-1.7.6 lib/kontena/machine/common.rb
krates-1.7.5 lib/kontena/machine/common.rb
krates-1.7.4 lib/kontena/machine/common.rb
krates-1.7.3 lib/kontena/machine/common.rb
krates-1.7.2 lib/kontena/machine/common.rb
krates-1.7.1 lib/kontena/machine/common.rb
krates-1.7.0 lib/kontena/machine/common.rb
krates-1.6.9 lib/kontena/machine/common.rb
krates-1.6.8 lib/kontena/machine/common.rb
krates-1.6.7 lib/kontena/machine/common.rb
krates-1.6.6 lib/kontena/machine/common.rb
krates-1.6.5 lib/kontena/machine/common.rb
krates-1.6.4 lib/kontena/machine/common.rb
krates-1.6.3 lib/kontena/machine/common.rb
krates-1.6.2 lib/kontena/machine/common.rb