Sha256: 86a7da34a97d5ec126d4b74c646e2c5f09d09c2d3dc4d9676a07d2282fa1aaf1

Contents?: true

Size: 753 Bytes

Versions: 16

Compression:

Stored size: 753 Bytes

Contents

#!/usr/bin/env ruby
# Generates a markdown file containing fact documentation.
# usage: ruby generate.rb > facts.md

require 'yaml'
require 'erb'
require 'ostruct'

PATH_TO_SCHEMA = File.join(File.dirname(__FILE__), '../schema/facter.yaml')
PATH_TO_TEMPLATE = File.join(File.dirname(__FILE__), 'template.erb')

schema = YAML.load_file(PATH_TO_SCHEMA)

def format_facts(fact_hash)
  scope = OpenStruct.new({
    :facts => fact_hash
  })

  ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-').result(scope.instance_eval {binding})
end

print "## Modern Facts\n\n"
print format_facts(schema.reject {|name, info| info['hidden'] == true})
print "## Legacy Facts\n\n"
print format_facts(schema.reject {|name, info| info['hidden'].nil? || info['hidden'] == false})

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/facter/lib/docs/generate.rb
facter-3.12.1.cfacter.20181031 ext/facter/facter/lib/docs/generate.rb
facter-3.11.6.cfacter.20181031 ext/facter/facter/lib/docs/generate.rb
facter-3.12.1.cfacter.20181023 ext/facter/facter/lib/docs/generate.rb
facter-3.11.5.cfacter.20181022 ext/facter/facter/lib/docs/generate.rb
facter-3.12.0.cfacter.20181004 ext/facter/facter/lib/docs/generate.rb
facter-3.12.0.cfacter.20181001 ext/facter/facter/lib/docs/generate.rb
facter-3.12.0.cfacter.20180918 ext/facter/facter/lib/docs/generate.rb
facter-3.11.4.cfacter.20180821 ext/facter/facter/lib/docs/generate.rb
facter-3.11.3.cfacter.20180716 ext/facter/facter/lib/docs/generate.rb
facter-3.11.2.cfacter.20180612 ext/facter/facter/lib/docs/generate.rb
facter-3.9.6.cfacter.20180612 ext/facter/facter/lib/docs/generate.rb
facter-3.11.2.cfacter.20180606 ext/facter/facter/lib/docs/generate.rb
facter-3.9.6.cfacter.20180606 ext/facter/facter/lib/docs/generate.rb
facter-3.11.0.cfacter.20180319 ext/facter/facter/lib/docs/generate.rb
cfacter-3.11.0.rc.20180314 ext/facter/facter/lib/docs/generate.rb