Sha256: 155d9c06f0ade35c3da204664d4d3076b56b1136e2feb53f00365602dc00cc0b

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8

require 'singleton'

module Nanoc::Extra

  class JRubyNokogiriWarner

    include Singleton

    TEXT = <<EOS
--------------------------------------------------------------------------------
Note:

The behavior of Pure Java Nokogiri differs from the Nokogiri used on the
standard Ruby interpreter (MRI) due to differences in underlying libraries.

These sometimes problematic behavioral differences can cause nanoc filters not
to function properly, if at all. If you need reliable (X)HTML and XML handling
functionality, consider not using Nokogiri on JRuby for the time being.

These issues are being worked on both from the Nokogiri and the nanoc side. Keep
your Nokogiri and nanoc versions up to date!

For details, see https://github.com/nanoc/nanoc/pull/422.
--------------------------------------------------------------------------------
EOS

    def self.check_and_warn
      instance.check_and_warn
    end

    def initialize
      @warned = false
    end

    def check_and_warn
      return if !defined?(RUBY_ENGINE)
      return if RUBY_ENGINE != 'jruby'
      return if @warned

      $stderr.puts TEXT
      @warned = true
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-3.7.3 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-3.7.2 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-3.7.1 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-3.7.0 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-3.6.11 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-3.6.10 lib/nanoc/extra/jruby_nokogiri_warner.rb