Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 972 Bytes

README.md

File metadata and controls

41 lines (29 loc) · 972 Bytes

ShadowFacter

ShadowFacter is a Ruby DSL for Facter, extracted out of the work we at Rails Machine are doing on Moonshine.

ShadowFacter provides a DSL for creating facts and processing them using Facter. A binary is provided to parse facts.

Example:

 $ cat examples/lib/facts/kernel.rb
  require 'shadow_facter'

  namespace :kernel do
    fact :name do
      exec "uname -s"
    end

    fact :release do
      exec "uname -r"
    end

    fact :version do
      value(:release).to_s.split('.')[0]
    end
  end

Executing this fact:

 $ bin/shadow_facter examples/lib/facts/kernel.rb
 kernel_name => Darwin
 kernel_version => 9
 kernel_release => 9.6.0

Unless otherwise specified, all content copyright © 2014, Rails Machine, LLC