title: Puppet custom facts - uninitialized constant Facter (NameError)
body: <p>I'm really sorry if I've missed something, and this has already been answered, I've searched this site, and Google, but can't find anything anyway, here goes.</p>
  
  <p>I'm running Ruby 1.8 and Puppet 2.7. I'm new to both, but I've done a fair amount of work with Puppet over the last couple of weeks, touch wood without bringing my site down :)</p>
  
  <p>I would now like to write some custom facts. I've been experimenting with the instruction found on the <a href="http://docs.puppetlabs.com/guides/custom_facts.html" rel="nofollow">Puppet documentation site</a>. I've written a hardware_platform.rb as below:</p>
  
  <pre><code># hardware_platform.rb
  
  Facter.add("hardware_platform") do
    setcode do
      Facter::Util::Resolution.exec('/bin/uname -i')
    end
  end
  </code></pre>
  
  <p>I guess I'm supposed to run it like this:</p>
  
  <pre><code># ruby hardware_platform.rb
  </code></pre>
  
  <p>But when I do, I get this error:</p>
  
  <pre><code>hardware_platform.rb:3: uninitialized constant Facter (NameError)
  </code></pre>
  
  <p>Does anyone know what might be going wrong here? I need to get past this before I can move on...</p>
  
  <p>Thanks</p>