diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-11-11 20:25:28 +0100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-11-15 10:06:03 +1100 |
commit | 6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb (patch) | |
tree | 8c6d3e64429e70d7ebf7544333cb291a388f7165 | |
parent | 56486664f25f495182dd3e3708e760d4220b1199 (diff) | |
download | puppet-6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb.tar.gz puppet-6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb.tar.xz puppet-6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb.zip |
Fix #2783 - Puppetdoc rdoc should use environment to get modulepath/manifestdir
Puppetdoc wasn't using the current environment to find the correct
modulepath and manifestdir.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
-rw-r--r-- | lib/puppet/application/puppetdoc.rb | 5 | ||||
-rwxr-xr-x | spec/unit/application/puppetdoc.rb | 17 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/puppet/application/puppetdoc.rb b/lib/puppet/application/puppetdoc.rb index a5496ccee..5656112d0 100644 --- a/lib/puppet/application/puppetdoc.rb +++ b/lib/puppet/application/puppetdoc.rb @@ -66,8 +66,9 @@ Puppet::Application.new(:puppetdoc) do exit_code = 0 files = [] unless @manifest - files += Puppet[:modulepath].split(':').collect { |p| File.expand_path(p) } - files += Puppet[:manifestdir].split(':').collect { |p| File.expand_path(p) } + env = Puppet::Node::Environment.new + files += env.modulepath + files += env.manifestdir end files += ARGV Puppet.info "scanning: %s" % files.inspect diff --git a/spec/unit/application/puppetdoc.rb b/spec/unit/application/puppetdoc.rb index b9173752f..cb60581a4 100755 --- a/spec/unit/application/puppetdoc.rb +++ b/spec/unit/application/puppetdoc.rb @@ -290,16 +290,16 @@ describe "puppetdoc" do @puppetdoc.manifest = false Puppet.stubs(:info) Puppet.stubs(:[]).with(:trace).returns(false) - Puppet.stubs(:[]).with(:modulepath).returns('modules') - Puppet.stubs(:[]).with(:manifestdir).returns('manifests') + @env = stub 'env' + Puppet::Node::Environment.stubs(:new).returns(@env) + @env.stubs(:modulepath).returns(['modules']) + @env.stubs(:manifestdir).returns(['manifests']) @puppetdoc.options.stubs(:[]).with(:all).returns(false) @puppetdoc.options.stubs(:[]).with(:outputdir).returns('doc') Puppet.settings.stubs(:[]=).with(:document_all, false) Puppet.settings.stubs(:setdefaults) Puppet::Util::RDoc.stubs(:rdoc) @puppetdoc.stubs(:exit) - File.stubs(:expand_path).with('modules').returns('modules') - File.stubs(:expand_path).with('manifests').returns('manifests') @old = ARGV.dup ARGV.clear end @@ -331,6 +331,15 @@ describe "puppetdoc" do Puppet::Util::RDoc.expects(:manifestdoc) @puppetdoc.rdoc end + + it "should get modulepath and manifestdir values from the environment" do + @env.expects(:modulepath).returns(['envmodules1','envmodules2']) + @env.expects(:manifestdir).returns(['envmanifests1','envmanifests2']) + + Puppet::Util::RDoc.expects(:rdoc).with('doc', ['envmodules1','envmodules2','envmanifests1','envmanifests2']) + + @puppetdoc.rdoc + end end describe "in the other modes" do |