diff options
author | luke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a> | 2005-11-16 17:29:21 +0000 |
---|---|---|
committer | luke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a> | 2005-11-16 17:29:21 +0000 |
commit | 8cb9662660927f0ba55c18be91aa764174fdb61b (patch) | |
tree | 2fe901de41e8b38a31885505edf4274f0ae32199 | |
parent | 7cec936bf10ea2f0c2f56c00839043ad9369d99b (diff) | |
download | facter-8cb9662660927f0ba55c18be91aa764174fdb61b.tar.gz facter-8cb9662660927f0ba55c18be91aa764174fdb61b.tar.xz facter-8cb9662660927f0ba55c18be91aa764174fdb61b.zip |
updating INSTALL with patch from ian
git-svn-id: http://reductivelabs.com/svn/facter/trunk@60 1f5c1d6a-bddf-0310-8f58-fc49e503516a
-rw-r--r-- | INSTALL | 9 | ||||
-rw-r--r-- | lib/facter.rb | 5 | ||||
-rw-r--r-- | tests/tc_simple.rb | 21 |
3 files changed, 33 insertions, 2 deletions
@@ -1,2 +1,7 @@ -Unforantely, no install.rb yet. Hopefully soon. Just copy the libs into -your main ruby library directory. Or something. +Run 'ruby install.rb' or use one of the distributed gem files at +http://reductivelabs.com/downloads/gems . + +install.rb should successfully install; let me know if it doesn't. + +Otherwise, you can just set RUBYLIB to contain its lib directory, or copy +the libs into your main ruby library directory. diff --git a/lib/facter.rb b/lib/facter.rb index e537ca4..9e03892 100644 --- a/lib/facter.rb +++ b/lib/facter.rb @@ -753,6 +753,11 @@ class Facter obj.tag("operatingsystem","=","Darwin") obj.code = "echo 'ps -auxwww'" } + + Facter["id"].add { |obj| + obj.tag("operatingsystem","=","Linux") + obj.code = "whoami" + } end Facter.load diff --git a/tests/tc_simple.rb b/tests/tc_simple.rb index cda2557..af2c82d 100644 --- a/tests/tc_simple.rb +++ b/tests/tc_simple.rb @@ -20,6 +20,10 @@ class TestFacter < Test::Unit::TestCase def teardown # clear out the list of facts, so we start fresh for every test Facter.reset + + if ! @oldhandles.empty? + $stdin, $stdout, $stderr = @oldhandles + end end def test_version @@ -265,4 +269,21 @@ class TestFacter < Test::Unit::TestCase assert(value) } end + + def test_withnoouts + @oldhandles = [] + @oldhandles << $stdin.dup + $stdin.reopen "/dev/null" + @oldhandles << $stdout.dup + $stdout.reopen "/dev/null", "a" + @oldhandles << $stderr.dup + $stderr.reopen $stdout + + assert_nothing_raised { + Facter.each { |name,fact| + list[name] = fact + } + } + $stdin, $stdout, $stderr = @oldhandles + end end |