Sha256: cc4c8a065b05a219567ccb6ed02505916b1d49130512613a07e988eb4d3d5f5b

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

module Facter
  if RUBY_PLATFORM == "java"
    # For JRuby, require 'facter.jar'
    begin
      require 'facter.jar'
    rescue LoadError
      raise LoadError.new('libfacter was not built with JRuby support.')
    end

    # Pass value call through to JNI interface
    def self.value(name)
      Java::ComPuppetlabs::Facter.lookup(name)
    end

    def self.search(*paths)
      # No-op; we don't support custom facts under JRuby
    end

    def self.version
      Java::ComPuppetlabs::Facter.lookup("facterversion")
    end

    def self.add(*params)
      raise 'adding facts under JRuby is not implemented.'
    end

  else
    # Simply require libfacter.so; this will define all of the Facter API
    begin
      facter_dir = ENV['FACTERDIR'] || File.join(File.expand_path("#{File.dirname(__FILE__)}"), '../')
      #
      # This is a cmake pre-processor check. On *nix it will end up '' == '1'
      # On windows, where we want the changes it will be '1' == '1'
      #
      # Facter requires the extra inclusion of puppet/bin as the libfacter.so
      # lib requires libraries and executables from that directory
      if '' == '1'
        ENV['PATH'] = "#{File.join(facter_dir, 'bin')}#{File::PATH_SEPARATOR}#{File.join(facter_dir, '../puppet/bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
      end
      require "#{facter_dir}/lib/libfacter.so"
    rescue LoadError
      raise LoadError, "libfacter was not found. Please make sure it was installed to the expected location.\n" + ($!.message || ''), $!.backtrace
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
facter-3.11.6.cfacter.20181031-x86_64-linux lib/facter.rb
facter-3.11.6.cfacter.20181031-x86_64-darwin-16 lib/facter.rb
facter-3.11.5.cfacter.20181022-x86_64-linux lib/facter.rb
facter-3.11.5.cfacter.20181022-x86_64-darwin-16 lib/facter.rb
facter-3.11.4.cfacter.20180821-x86_64-linux lib/facter.rb
facter-3.11.4.cfacter.20180821-x86_64-darwin-16 lib/facter.rb
facter-3.11.3.cfacter.20180716-x86_64-linux lib/facter.rb
facter-3.11.3.cfacter.20180716-x86_64-darwin-16 lib/facter.rb
facter-3.11.2.cfacter.20180612-x86_64-linux lib/facter.rb
facter-3.11.2.cfacter.20180612-x86_64-darwin-16 lib/facter.rb
facter-3.9.6.cfacter.20180612-x86_64-linux lib/facter.rb
facter-3.9.6.cfacter.20180612-x86_64-darwin-16 lib/facter.rb
facter-3.11.2.cfacter.20180606-x86_64-linux lib/facter.rb
facter-3.11.2.cfacter.20180606-x86_64-darwin-16 lib/facter.rb
facter-3.9.6.cfacter.20180606-x86_64-linux lib/facter.rb
facter-3.9.6.cfacter.20180606-x86_64-darwin-16 lib/facter.rb
facter-3.11.0.cfacter.20180319-x86_64-linux lib/facter.rb
facter-3.11.0.cfacter.20180319-x86_64-darwin-14 lib/facter.rb
cfacter-3.11.0.rc.20180314-x86_64-darwin-14 lib/facter.rb
cfacter-3.11.0.rc.20180314-x86_64-linux lib/facter.rb