Sha256: 11a022d18c4a42b763440a417cce1b16b98607d0d42dfcf8b5754d5af7abc7cc

Contents?: true

Size: 584 Bytes

Versions: 9

Compression:

Stored size: 584 Bytes

Contents

require "rbconfig"

module Sunspot
  module Solr
    module Java
      class << self
        def ensure_install!
          if installed?
            true
          else
            raise Sunspot::Solr::Server::JavaMissing, "You need a Java Runtime Environment to run the Solr server"
          end
        end

        def installed?
          system("java", "-version", [:out, :err] => null_device)
          $?.exitstatus.zero?
        end

        def null_device
          RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "NUL" : "/dev/null"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sunspot_solr-2.7.1 lib/sunspot/solr/java.rb
sunspot_solr-2.7.0 lib/sunspot/solr/java.rb
sunspot_solr-2.6.0 lib/sunspot/solr/java.rb
sunspot_solr-2.5.0 lib/sunspot/solr/java.rb
sunspot_solr-2.4.0 lib/sunspot/solr/java.rb
sunspot_solr-2.3.0 lib/sunspot/solr/java.rb
sunspot_solr-2.2.8 lib/sunspot/solr/java.rb
sunspot_solr-2.2.7 lib/sunspot/solr/java.rb
sunspot_solr-2.2.6 lib/sunspot/solr/java.rb