diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-09-13 22:57:48 -0700 |
---|---|---|
committer | Jesse Wolfe <jes5199@gmail.com> | 2010-09-13 22:57:48 -0700 |
commit | 754ed19a8105a1be01c723a91abf9999ec6a8ab3 (patch) | |
tree | 8a3b59432ff56fbaf64d1cb6448e4e228f5359c0 /test/lib/puppettest/support/utils.rb | |
parent | 21afb51a1b84116b2a906a6959ae588f45135104 (diff) | |
parent | efa834aaec596b0d5e7b314a53e6b258ce44728c (diff) | |
download | puppet-754ed19a8105a1be01c723a91abf9999ec6a8ab3.tar.gz puppet-754ed19a8105a1be01c723a91abf9999ec6a8ab3.tar.xz puppet-754ed19a8105a1be01c723a91abf9999ec6a8ab3.zip |
Merge commit '2.6.1rc4'
Diffstat (limited to 'test/lib/puppettest/support/utils.rb')
-rw-r--r-- | test/lib/puppettest/support/utils.rb | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb index edc81d3d6..e022f123c 100644 --- a/test/lib/puppettest/support/utils.rb +++ b/test/lib/puppettest/support/utils.rb @@ -1,5 +1,3 @@ -require 'puppettest' - module PuppetTest::Support end module PuppetTest::Support::Utils @@ -7,6 +5,30 @@ module PuppetTest::Support::Utils Puppet.warning "#{type}: #{ObjectSpace.each_object(type) { |o| }}" end + def basedir(*list) + unless defined? @@basedir + Dir.chdir(File.dirname(__FILE__)) do + @@basedir = File.dirname(File.dirname(File.dirname(File.dirname(Dir.getwd)))) + end + end + if list.empty? + @@basedir + else + File.join(@@basedir, *list) + end + end + + def fakedata(dir,pat='*') + glob = "#{basedir}/test/#{dir}/#{pat}" + files = Dir.glob(glob,File::FNM_PATHNAME) + raise Puppet::DevError, "No fakedata matching #{glob}" if files.empty? + files + end + + def datadir(*list) + File.join(basedir, "test", "data", *list) + end + # # TODO: I think this method needs to be renamed to something a little more # explanatory. @@ -38,10 +60,6 @@ module PuppetTest::Support::Utils config end - # stop any services that might be hanging around - def stopservices - end - # TODO: rewrite this to use the 'etc' module. # Define a variable that contains the name of my user. @@ -84,7 +102,7 @@ module PuppetTest::Support::Utils end def fakefile(name) - ary = [PuppetTest.basedir, "test"] + ary = [basedir, "test"] ary += name.split("/") file = File.join(ary) raise Puppet::DevError, "No fakedata file #{file}" unless FileTest.exists?(file) @@ -140,16 +158,3 @@ module PuppetTest::Support::Utils config end end - -module PuppetTest - include PuppetTest::Support::Utils - - def fakedata(dir,pat='*') - glob = "#{basedir}/test/#{dir}/#{pat}" - files = Dir.glob(glob,File::FNM_PATHNAME) - raise Puppet::DevError, "No fakedata matching #{glob}" if files.empty? - files - end - module_function :fakedata - -end |