/usr/lib/ruby/vendor_ruby/nokogiri/version.rb is in ruby-nokogiri 1.6.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | module Nokogiri
# The version of Nokogiri you are using
VERSION = '1.6.8.1'
class VersionInfo # :nodoc:
def jruby?
::JRUBY_VERSION if RUBY_PLATFORM == "java"
end
def engine
defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'mri'
end
def loaded_parser_version
LIBXML_PARSER_VERSION.scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first.collect{ |j|
j.to_i
}.join(".")
end
def compiled_parser_version
LIBXML_VERSION
end
def libxml2?
defined?(LIBXML_VERSION)
end
def libxml2_using_system?
! libxml2_using_packaged?
end
def libxml2_using_packaged?
NOKOGIRI_USE_PACKAGED_LIBRARIES
end
def warnings
return [] unless libxml2?
[]
end
def to_hash
hash_info = {}
hash_info['warnings'] = []
hash_info['nokogiri'] = Nokogiri::VERSION
hash_info['ruby'] = {}
hash_info['ruby']['version'] = ::RUBY_VERSION
hash_info['ruby']['platform'] = ::RUBY_PLATFORM
hash_info['ruby']['description'] = ::RUBY_DESCRIPTION
hash_info['ruby']['engine'] = engine
hash_info['ruby']['jruby'] = jruby? if jruby?
if libxml2?
hash_info['libxml'] = {}
hash_info['libxml']['binding'] = 'extension'
if libxml2_using_packaged?
hash_info['libxml']['source'] = "packaged"
hash_info['libxml']['libxml2_path'] = NOKOGIRI_LIBXML2_PATH
hash_info['libxml']['libxslt_path'] = NOKOGIRI_LIBXSLT_PATH
hash_info['libxml']['libxml2_patches'] = NOKOGIRI_LIBXML2_PATCHES
hash_info['libxml']['libxslt_patches'] = NOKOGIRI_LIBXSLT_PATCHES
else
hash_info['libxml']['source'] = "system"
end
hash_info['libxml']['compiled'] = compiled_parser_version
hash_info['libxml']['loaded'] = loaded_parser_version
hash_info['warnings'] = warnings
elsif jruby?
hash_info['xerces'] = Nokogiri::XERCES_VERSION
hash_info['nekohtml'] = Nokogiri::NEKO_VERSION
end
hash_info
end
def to_markdown
begin
require 'psych'
rescue LoadError
end
require 'yaml'
"# Nokogiri (#{Nokogiri::VERSION})\n" +
YAML.dump(to_hash).each_line.map { |line| " #{line}" }.join
end
# FIXME: maybe switch to singleton?
@@instance = new
@@instance.warnings.each do |warning|
warn "WARNING: #{warning}"
end
def self.instance; @@instance; end
end
# More complete version information about libxml
VERSION_INFO = VersionInfo.instance.to_hash
def self.uses_libxml? # :nodoc:
VersionInfo.instance.libxml2?
end
def self.jruby? # :nodoc:
VersionInfo.instance.jruby?
end
end
|