Top Level Namespace

Defined Under Namespace

Modules: TinyTds

Constant Summary collapse

LIBDIR =

Shamelessly copied from nokogiri

RbConfig::CONFIG['libdir']
INCLUDEDIR =
RbConfig::CONFIG['includedir']
SEARCHABLE_PATHS =
begin
  eop_regexp = /#{File::SEPARATOR}bin$/
  paths = ENV['PATH']
  paths = paths.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
  paths = paths.split(File::PATH_SEPARATOR)
  bin_paths = paths.select{ |p| p =~ eop_regexp }
  bin_paths.map{ |p| p.sub(eop_regexp,'') }.compact.reject{ |p| p.empty? }.uniq
end
HEADER_DIRS =

There's no default include/lib dir on Windows. Let's just add the Ruby ones and resort on the search path specified by INCLUDE and LIB environment variables

[
  # First search /opt/local for macports
  '/opt/local/include',
  # Then search /usr/local for people that installed from source
  '/usr/local/include',
  # Check the ruby install locations
  INCLUDEDIR,
  # Finally fall back to /usr
  '/usr/include'
].reject{ |dir| !File.directory?(dir) }
LIB_DIRS =
[
  # First search /opt/local for macports
  '/opt/local/lib',
  # Then search /usr/local for people that installed from source
  '/usr/local/lib',
  # Check the ruby install locations
  LIBDIR,
  # Finally fall back to /usr
  '/usr/lib',
].reject{ |dir| !File.directory?(dir) }
FREETDS_HEADER_DIRS =
(searchable_paths_with_directories(['include'],['include','freetds']) + HEADER_DIRS).uniq
FREETDS_LIB_DIRS =
(searchable_paths_with_directories(['lib'],['lib','freetds']) + LIB_DIRS).uniq

Instance Method Summary collapse

Instance Method Details

#asplode(lib) ⇒ Object


81
82
83
# File 'ext/tiny_tds/extconf.rb', line 81

def asplode(lib)
  abort "-----\n#{lib} is missing.\n-----"
end

#searchable_paths_with_directories(*directories) ⇒ Object


25
26
27
28
29
30
31
32
# File 'ext/tiny_tds/extconf.rb', line 25

def searchable_paths_with_directories(*directories)
  SEARCHABLE_PATHS.map do |path|
    directories.map do |paths|
      dir = File.join path, *paths
      File.directory?(dir) ? dir : nil
    end.flatten.compact
  end.flatten.compact
end