Sha256: 05da7a60e2b004bfea9bf71a43f6ce77486f3c6fc1376b436f009843b924f559

Contents?: true

Size: 1.55 KB

Versions: 21

Compression:

Stored size: 1.55 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' == '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}/bin/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

21 entries across 21 versions & 2 rubygems

Version Path
facter-3.11.6.cfacter.20181031-x86-mingw32 lib/facter.rb
facter-3.11.6.cfacter.20181031-x64-mingw32 lib/facter.rb
facter-3.11.5.cfacter.20181022-x86-mingw32 lib/facter.rb
facter-3.11.5.cfacter.20181022-x64-mingw32 lib/facter.rb
facter-3.11.4.cfacter.20180821-x86-mingw32 lib/facter.rb
facter-3.11.4.cfacter.20180821-x64-mingw32 lib/facter.rb
facter-3.11.3.cfacter.20180716-x86-mingw32 lib/facter.rb
facter-3.11.3.cfacter.20180716-x64-mingw32 lib/facter.rb
facter-3.11.2.cfacter.20180612-x86-mingw32 lib/facter.rb
facter-3.11.2.cfacter.20180612-x64-mingw32 lib/facter.rb
facter-3.9.6.cfacter.20180612-x86-mingw32 lib/facter.rb
facter-3.9.6.cfacter.20180612-x64-mingw32 lib/facter.rb
facter-3.11.2.cfacter.20180606-x86-mingw32 lib/facter.rb
facter-3.11.2.cfacter.20180606-x64-mingw32 lib/facter.rb
facter-3.9.6.cfacter.20180606-x86-mingw32 lib/facter.rb
facter-3.9.6.cfacter.20180606-x64-mingw32 lib/facter.rb
facter-3.9.6.cfacter.20180412-x64-mingw32 lib/facter.rb
facter-3.11.0.cfacter.20180319-x86-mingw32 lib/facter.rb
facter-3.11.0.cfacter.20180319-x64-mingw32 lib/facter.rb
cfacter-3.11.0.rc.20180314-x86-mingw32 lib/facter.rb