Module: Bootprint::Collectors::Libraries
- Defined in:
- lib/bootprint/collectors/libraries.rb
Class Method Summary collapse
- .capture ⇒ Object
- .format_pg_version(version) ⇒ Object
- .key ⇒ Object
- .libc_info ⇒ Object
- .mysql_info ⇒ Object
- .postgresql_info ⇒ Object
- .sqlite_info ⇒ Object
Class Method Details
.capture ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bootprint/collectors/libraries.rb', line 14 def capture result = { "openssl" => { "compiled" => OpenSSL::OPENSSL_VERSION, "runtime" => OpenSSL.const_defined?(:OPENSSL_LIBRARY_VERSION) ? OpenSSL::OPENSSL_LIBRARY_VERSION : OpenSSL::OPENSSL_VERSION }, "libyaml" => Psych.libyaml_version.join("."), "psych" => Psych::VERSION } result["sqlite"] = sqlite_info if Gem.loaded_specs.key?("sqlite3") result["postgresql"] = postgresql_info if Gem.loaded_specs.key?("pg") result["mysql"] = mysql_info if Gem.loaded_specs.key?("mysql2") result["libc"] = libc_info result end |
.format_pg_version(version) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/bootprint/collectors/libraries.rb', line 45 def format_pg_version(version) major = version / 10_000 minor = (version / 100) % 100 patch = version % 100 major >= 10 ? "#{major}.#{patch}" : "#{major}.#{minor}.#{patch}" end |
.key ⇒ Object
12 |
# File 'lib/bootprint/collectors/libraries.rb', line 12 def key = "libraries" |
.libc_info ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/bootprint/collectors/libraries.rb', line 60 def libc_info host = RbConfig::CONFIG["host_os"].to_s family = if host.include?("linux") RbConfig::CONFIG["CC"].to_s.include?("musl") ? "musl" : "glibc-or-compatible" elsif host.match?(/mswin|mingw/) "windows-crt" elsif host.include?("darwin") "libSystem" else "unknown" end { "family" => family } end |
.mysql_info ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/bootprint/collectors/libraries.rb', line 52 def mysql_info require "mysql2" info = Mysql2::Client.info { "gem" => Mysql2::VERSION, "client" => info[:version] || info["version"] } rescue LoadError, StandardError => error { "capture_error" => Sanitizer.text("#{error.class}: #{error.}") } end |
.postgresql_info ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/bootprint/collectors/libraries.rb', line 37 def postgresql_info require "pg" version = PG.library_version { "gem" => PG::VERSION, "client" => format_pg_version(version) } rescue LoadError, StandardError => error { "capture_error" => Sanitizer.text("#{error.class}: #{error.}") } end |
.sqlite_info ⇒ Object
30 31 32 33 34 35 |
# File 'lib/bootprint/collectors/libraries.rb', line 30 def sqlite_info require "sqlite3" { "gem" => SQLite3::VERSION, "runtime" => SQLite3::SQLITE_VERSION } rescue LoadError, StandardError => error { "capture_error" => Sanitizer.text("#{error.class}: #{error.}") } end |