Top Level Namespace
Defined Under Namespace
Modules: Swift
Instance Method Summary collapse
- #apt_install_hint(pkg) ⇒ Object
- #assert_dbicpp_version(ver) ⇒ Object
- #library_installed?(name, hint) ⇒ Boolean
Instance Method Details
#apt_install_hint(pkg) ⇒ Object
9 10 11 |
# File 'ext/extconf.rb', line 9 def apt_install_hint pkg "sudo apt-get install #{pkg}" end |
#assert_dbicpp_version(ver) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'ext/extconf.rb', line 35 def assert_dbicpp_version ver passed = false header = '/usr/include/dbic++.h' = "Swift needs dbic++ >= #{ver}. Please update your dbic++ installation." if File.exists?(header) && match = File.read(header).match(/DBI_VERSION\s+(.*?)\n/mi) rmajor, rminor, rbuild = ver.strip.split(/\./).map(&:to_i) imajor, iminor, ibuild = match.captures.first.strip.split(/\./).map(&:to_i) passed = (imajor > rmajor) || (imajor == rmajor && iminor > rminor) || (imajor == rmajor && iminor == rminor && ibuild >= rbuild) else = "Cannot find #{header} or version number. You need to install dbic++ >= #{ver}" passed = false end raise unless passed end |
#library_installed?(name, hint) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'ext/extconf.rb', line 13 def library_installed? name, hint if have_library(name) true else $stderr.puts <<-ERROR Unable to find required library: #{name}. On debian systems, it can be installed as, #{hint} You may have to add the following ppa to your sources, sudo add-apt-repository ppa:deepfryed to install dbic++-dev and associated drivers dbic++-mysql or dbic++-pg ERROR false end end |