summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2013-01-18 21:17:44 -0800
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:22 -0700
commit3b16515eadd22e28ac879bf0582b341c9c4a690c (patch)
treef7f322360e5473e71e699a1131073c0fcee8c3d7
parent54a28ff3336b08e83ae7f2a6903c7a7f97bb4b78 (diff)
downloadchef-3b16515eadd22e28ac879bf0582b341c9c4a690c.tar.gz
Support backslash on Windows
-rw-r--r--lib/chef/chef_fs.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server_root_dir.rb1
-rw-r--r--lib/chef/chef_fs/path_utils.rb2
-rw-r--r--spec/unit/chef_fs/file_pattern_spec.rb4
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/chef/chef_fs.rb b/lib/chef/chef_fs.rb
index 14ab8c0a6e..bc445e53ad 100644
--- a/lib/chef/chef_fs.rb
+++ b/lib/chef/chef_fs.rb
@@ -1,11 +1,9 @@
-require 'chef/chef_fs/file_system/chef_server_root_dir'
-require 'chef/config'
-require 'chef/rest'
+require 'chef/platform'
class Chef
module ChefFS
def self.windows?
- false
+ Chef::Platform.windows?
end
end
end
diff --git a/lib/chef/chef_fs/file_system/chef_server_root_dir.rb b/lib/chef/chef_fs/file_system/chef_server_root_dir.rb
index 41b8a455dc..b359be9623 100644
--- a/lib/chef/chef_fs/file_system/chef_server_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server_root_dir.rb
@@ -22,6 +22,7 @@ require 'chef/chef_fs/file_system/cookbooks_dir'
require 'chef/chef_fs/file_system/data_bags_dir'
require 'chef/chef_fs/file_system/nodes_dir'
require 'chef/chef_fs/file_system/environments_dir'
+require 'chef/rest'
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/path_utils.rb b/lib/chef/chef_fs/path_utils.rb
index e6483c3d0a..805b092b3a 100644
--- a/lib/chef/chef_fs/path_utils.rb
+++ b/lib/chef/chef_fs/path_utils.rb
@@ -57,7 +57,7 @@ class Chef
end
def self.regexp_path_separator
- Chef::ChefFS::windows? ? '[/\\]' : '/'
+ Chef::ChefFS::windows? ? '[\/\\\\]' : '/'
end
# Given a path which may only be partly real (i.e. /x/y/z when only /x exists,
diff --git a/spec/unit/chef_fs/file_pattern_spec.rb b/spec/unit/chef_fs/file_pattern_spec.rb
index 247ec01a77..bac393a054 100644
--- a/spec/unit/chef_fs/file_pattern_spec.rb
+++ b/spec/unit/chef_fs/file_pattern_spec.rb
@@ -157,7 +157,7 @@ describe Chef::ChefFS::FilePattern do
end
end
- context 'with simple pattern "a\*\b"' do
+ context 'with simple pattern "a\*\b"', :pending => (Chef::Platform.windows?) do
let(:pattern) { Chef::ChefFS::FilePattern.new('a\*\b') }
it 'match?' do
pattern.match?('a*b').should be_true
@@ -264,7 +264,7 @@ describe Chef::ChefFS::FilePattern do
end
end
- context 'with star pattern "/abc/d[a-z][0-9]f/ghi"' do
+ context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', :pending => (Chef::Platform.windows?) do
let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/d[a-z][0-9]f/ghi') }
it 'match?' do
pattern.match?('/abc/de1f/ghi').should be_true