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
kontena-cli-1.4.1.rc1 lib/kontena/machine/common.rb
kontena-cli-1.4.1.pre1 lib/kontena/machine/common.rb
kontena-cli-1.3.5 lib/kontena/machine/common.rb
kontena-cli-1.3.5.rc1 lib/kontena/machine/common.rb
kontena-cli-1.4.0 lib/kontena/machine/common.rb
kontena-cli-1.4.0.rc2 lib/kontena/machine/common.rb
kontena-cli-1.4.0.rc1 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre14 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre13 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre12 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre11 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre10 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre9 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre8 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre7 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre6 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre5 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre4 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre3 lib/kontena/machine/common.rb
kontena-cli-1.4.0.pre2 lib/kontena/machine/common.rb