Top Level Namespace

Defined Under Namespace

Modules: Fb

Instance Method Summary collapse

Instance Method Details

#key_exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
# File 'ext/fb/extconf.rb', line 21

def key_exists?(path)
  begin
    Win32::Registry::HKEY_LOCAL_MACHINE.open(path, ::Win32::Registry::KEY_READ)
    return true
  rescue
    return false
  end
end

#read_firebird_registryObject



30
31
32
33
34
35
36
37
38
39
# File 'ext/fb/extconf.rb', line 30

def read_firebird_registry
  require 'win32/registry'
  if key_exists?('SOFTWARE\Firebird Project\Firebird Server\Instances')
    Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Firebird Project\Firebird Server\Instances', Win32::Registry::Constants::KEY_READ) do |reg|
      return reg.read_s('DefaultInstance') rescue nil
    end
  else
    return false
  end
end

#search_firebird_pathObject



41
42
43
44
45
# File 'ext/fb/extconf.rb', line 41

def search_firebird_path
  program_files = ENV['ProgramFiles'].gsub('\\', '/').gsub(/(\w+\s+[\w\s]+)/) { |s| s.size > 8 ? s[0,6] + '~1' : s }
  program_files_x86 = ENV['ProgramFiles'].gsub('\\', '/').gsub(/(\w+\s+[\w\s]+)/) { |s| s.size > 8 ? s[0,6] + '~2' : s }
  result = Dir["#{program_files}/Firebird/Firebird_*"].sort.last || Dir["#{program_files_x86}/Firebird/Firebird_*"].sort.last
end

#unquote(string) ⇒ Object

Windows

Sample of Makefile creation:

ruby extconf.rb --with-opt-dir=C:/Progra~1/Firebird/Firebird_2_5

Notes

  • Windows is known to build with Ruby from rubyinstaller.org.

  • New in this release is automatically finding your Firebird install under Program Files.

  • If your install is some place non-standard (or on a non-English version of Windows), you’ll need to run extconf.rb manually as above.

  • mkmf doesn’t like directories with spaces, hence the 8.3 notation in the example above.

Linux

Notes

  • Build seems to “just work.”

  • Unit tests take about 10 times as long to complete using Firebird Classic. Default xinetd.conf settings may not allow the tests to complete due to the frequency with which new attachments are made.

Mac OS X (Intel)

  • Works



17
18
19
# File 'ext/fb/extconf.rb', line 17

def unquote(string)
  string.sub(/\A(['"])?(.*?)\1?\z/m, '\2') unless string.nil?
end