summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/node/environment.rb5
-rw-r--r--lib/puppet/util/rdoc/parser.rb4
-rwxr-xr-xspec/integration/application/doc_spec.rb2
-rwxr-xr-xspec/unit/node/environment_spec.rb2
-rwxr-xr-xspec/unit/util/rdoc/parser_spec.rb4
5 files changed, 13 insertions, 4 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index f25bb65a9..4fc314a6a 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -131,9 +131,12 @@ class Puppet::Node::Environment
def validate_dirs(dirs)
dir_regex = Puppet.features.microsoft_windows? ? /^[A-Za-z]:#{File::SEPARATOR}/ : /^#{File::SEPARATOR}/
+ # REMIND: Dir.getwd on windows returns a path containing backslashes, which when joined with
+ # dir containing forward slashes, breaks our regex matching. In general, path validation needs
+ # to be refactored which will be handled in a future commit.
dirs.collect do |dir|
if dir !~ dir_regex
- File.join(Dir.getwd, dir)
+ File.expand_path(File.join(Dir.getwd, dir))
else
dir
end
diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb
index 762ce25f0..a8996ee9a 100644
--- a/lib/puppet/util/rdoc/parser.rb
+++ b/lib/puppet/util/rdoc/parser.rb
@@ -113,7 +113,9 @@ class Parser
Puppet::Module.modulepath.each do |mp|
# check that fullpath is a descendant of mp
dirname = fullpath
- while (dirname = File.dirname(dirname)) != '/'
+ previous = dirname
+ while (dirname = File.dirname(previous)) != previous
+ previous = dirname
return nil if File.identical?(dirname,mp)
end
end
diff --git a/spec/integration/application/doc_spec.rb b/spec/integration/application/doc_spec.rb
index 47fd93a03..2cf5fd1e9 100755
--- a/spec/integration/application/doc_spec.rb
+++ b/spec/integration/application/doc_spec.rb
@@ -5,7 +5,7 @@ require 'puppet_spec/files'
describe Puppet::Application::Doc do
include PuppetSpec::Files
- it "should not generate an error when module dir overlaps parent of site.pp (#4798)", :'fails_on_ruby_1.9.2' => true, :fails_on_windows => true do
+ it "should not generate an error when module dir overlaps parent of site.pp (#4798)", :'fails_on_ruby_1.9.2' => true, :unless => Puppet.features.microsoft_windows? do
begin
# Note: the directory structure below is more complex than it
# needs to be, but it's representative of the directory structure
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb
index eb20aa7ef..78d383440 100755
--- a/spec/unit/node/environment_spec.rb
+++ b/spec/unit/node/environment_spec.rb
@@ -144,7 +144,7 @@ describe Puppet::Node::Environment do
FileTest.stubs(:directory?).returns true
env = Puppet::Node::Environment.new("testing")
- two = File.join(Dir.getwd, "two")
+ two = File.expand_path(File.join(Dir.getwd, "two"))
env.validate_dirs([@path_one, 'two']).should == [@path_one, two]
end
end
diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb
index 4c2c79e88..29e3298f0 100755
--- a/spec/unit/util/rdoc/parser_spec.rb
+++ b/spec/unit/util/rdoc/parser_spec.rb
@@ -149,6 +149,10 @@ describe RDoc::Parser, :'fails_on_ruby_1.9.2' => true do
File.stubs(:identical?).returns(false)
@parser.split_module("/path/to/manifests/init.pp").should == RDoc::Parser::SITE
end
+
+ it "should handle windows paths with drive letters", :if => Puppet.features.microsoft_windows? do
+ @parser.split_module("C:/temp/init.pp").should == RDoc::Parser::SITE
+ end
end
describe "when parsing AST elements" do