Sha256: 34dc2229c29d7dee6ef1662d1b6a4dd757273ebe810552b2d538abfcf5a2ddbf

Contents?: true

Size: 674 Bytes

Versions: 6

Compression:

Stored size: 674 Bytes

Contents

#!/usr/bin/env ruby

BIN   = 'tsql'
ROOT  = File.expand_path(File.join File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__), '..')
PATHS = ENV['PATH'].split(File::PATH_SEPARATOR)
EXTS  = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
SELF  = File.join ROOT, 'bin', BIN
EXE   = File.join ROOT, 'exe', BIN

def which(cmd)
  PATHS.each do |path|
    EXTS.each do |ext|
      exe = File.expand_path File.join(path, "#{cmd}#{ext}"), ROOT
      next unless File.executable?(exe)
      next if exe == SELF
      return exe
    end
  end
  return nil
end

bin = File.exists?(EXE) ? EXE : which(BIN)
puts "[TinyTds] #{BIN}: #{bin}"

Kernel.system bin, *ARGV

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tiny_tds-0.9.5.beta.2-x64-mingw32 bin/tsql
tiny_tds-0.9.5.beta.2-x86-mingw32 bin/tsql
tiny_tds-0.9.5.beta.2 bin/tsql
tiny_tds-0.9.5.beta.1-x64-mingw32 bin/tsql
tiny_tds-0.9.5.beta.1-x86-mingw32 bin/tsql
tiny_tds-0.9.5.beta.1 bin/tsql