summaryrefslogtreecommitdiffstats
path: root/lib/facter
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-05-15 14:30:29 -0500
committerLuke Kanies <luke@madstop.com>2008-05-15 14:30:29 -0500
commit1ba2bed578debd251d2b9514039082eaa3f136df (patch)
tree907098a846dd7215d59ccfec2d470318bb619fa8 /lib/facter
parentbe0a8031fbf8e4a2d608ab600c37c1b01dec16a1 (diff)
downloadfacter-1ba2bed578debd251d2b9514039082eaa3f136df.tar.gz
facter-1ba2bed578debd251d2b9514039082eaa3f136df.tar.xz
facter-1ba2bed578debd251d2b9514039082eaa3f136df.zip
Moving all of the support classes to util/.
This makes it easier for our loader to distinguish between code that Facter uses and new facts.
Diffstat (limited to 'lib/facter')
-rw-r--r--lib/facter/util/collection.rb (renamed from lib/facter/collection.rb)6
-rw-r--r--lib/facter/util/confine.rb (renamed from lib/facter/confine.rb)2
-rw-r--r--lib/facter/util/fact.rb (renamed from lib/facter/fact.rb)6
-rw-r--r--lib/facter/util/loader.rb (renamed from lib/facter/loader.rb)2
-rw-r--r--lib/facter/util/resolution.rb (renamed from lib/facter/resolution.rb)8
5 files changed, 12 insertions, 12 deletions
diff --git a/lib/facter/collection.rb b/lib/facter/util/collection.rb
index 5e6845a..f76b578 100644
--- a/lib/facter/collection.rb
+++ b/lib/facter/util/collection.rb
@@ -1,9 +1,9 @@
require 'facter'
-require 'facter/resolution'
+require 'facter/util/fact'
# Manage which facts exist and how we access them. Largely just a wrapper
# around a hash of facts.
-class Facter::Collection
+class Facter::Util::Collection
# Return a fact object by name. If you use this, you still have to call
# 'value' on it to retrieve the actual value.
def [](name)
@@ -16,7 +16,7 @@ class Facter::Collection
name = canonize(name)
unless fact = @facts[name]
- fact = Facter::Fact.new(name, options)
+ fact = Facter::Util::Fact.new(name, options)
@facts[name] = fact
end
diff --git a/lib/facter/confine.rb b/lib/facter/util/confine.rb
index 529c968..a430bbe 100644
--- a/lib/facter/confine.rb
+++ b/lib/facter/util/confine.rb
@@ -1,6 +1,6 @@
# A restricting tag for fact resolution mechanisms. The tag must be true
# for the resolution mechanism to be suitable.
-class Facter::Confine
+class Facter::Util::Confine
attr_accessor :fact, :values
# Add the restriction. Requires the fact name, an operator, and the value
diff --git a/lib/facter/fact.rb b/lib/facter/util/fact.rb
index 9514cd0..c73dfbf 100644
--- a/lib/facter/fact.rb
+++ b/lib/facter/util/fact.rb
@@ -1,7 +1,7 @@
require 'facter'
-require 'facter/resolution'
+require 'facter/util/resolution'
-class Facter::Fact
+class Facter::Util::Fact
attr_accessor :name, :searching, :ldapname
# Create a new fact, with no resolution mechanisms.
@@ -31,7 +31,7 @@ class Facter::Fact
def add(&block)
raise ArgumentError, "You must pass a block to Fact<instance>.add" unless block_given?
- resolve = Facter::Resolution.new(@name)
+ resolve = Facter::Util::Resolution.new(@name)
resolve.instance_eval(&block)
diff --git a/lib/facter/loader.rb b/lib/facter/util/loader.rb
index 3284cc4..7031172 100644
--- a/lib/facter/loader.rb
+++ b/lib/facter/util/loader.rb
@@ -1,7 +1,7 @@
require 'facter'
# Load facts on demand.
-class Facter::Loader
+class Facter::Util::Loader
# Load all resolutions for a single fact.
def load(fact)
# Now load from the search path
diff --git a/lib/facter/resolution.rb b/lib/facter/util/resolution.rb
index 4df55b7..b6aae77 100644
--- a/lib/facter/resolution.rb
+++ b/lib/facter/util/resolution.rb
@@ -3,9 +3,9 @@
# specific systems. Note that the confinements are always ANDed, so any
# confinements specified must all be true for the resolution to be
# suitable.
-require 'facter/confine'
+require 'facter/util/confine'
-class Facter::Resolution
+class Facter::Util::Resolution
attr_accessor :interpreter, :code, :name
def self.have_which
@@ -51,7 +51,7 @@ class Facter::Resolution
# Add a new confine to the resolution mechanism.
def confine(confines)
confines.each do |fact, values|
- @confines.push Facter::Confine.new(fact, *values)
+ @confines.push Facter::Util::Confine.new(fact, *values)
end
end
@@ -98,7 +98,7 @@ class Facter::Resolution
if @code.is_a?(Proc)
result = @code.call()
else
- result = Facter::Resolution.exec(@code,@interpreter)
+ result = Facter::Util::Resolution.exec(@code,@interpreter)
end
return nil if result == ""