knife-essentials 0.7.6 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/lib/chef/knife/{delete.rb → delete_essentials.rb} +10 -2
- data/lib/chef/knife/dependencies_essentials.rb +117 -0
- data/lib/chef/knife/{diff.rb → diff_essentials.rb} +3 -1
- data/lib/chef/knife/{download.rb → download_essentials.rb} +9 -4
- data/lib/chef/knife/{list.rb → list_essentials.rb} +8 -2
- data/lib/chef/knife/{raw.rb → raw_essentials.rb} +2 -0
- data/lib/chef/knife/{show.rb → show_essentials.rb} +3 -1
- data/lib/chef/knife/{upload.rb → upload_essentials.rb} +9 -4
- data/lib/chef_fs/command_line.rb +18 -0
- data/lib/chef_fs/file_pattern.rb +18 -0
- data/lib/chef_fs/file_system.rb +18 -1
- data/lib/chef_fs/file_system/base_fs_dir.rb +18 -0
- data/lib/chef_fs/file_system/base_fs_object.rb +19 -1
- data/lib/chef_fs/file_system/chef_repository_file_system_entry.rb +49 -8
- data/lib/chef_fs/file_system/chef_repository_file_system_root_dir.rb +62 -3
- data/lib/chef_fs/file_system/chef_server_root_dir.rb +18 -0
- data/lib/chef_fs/file_system/cookbook_dir.rb +26 -0
- data/lib/chef_fs/file_system/cookbook_file.rb +18 -0
- data/lib/chef_fs/file_system/cookbook_subdir.rb +18 -0
- data/lib/chef_fs/file_system/cookbooks_dir.rb +18 -2
- data/lib/chef_fs/file_system/data_bag_dir.rb +18 -0
- data/lib/chef_fs/file_system/data_bag_item.rb +18 -0
- data/lib/chef_fs/file_system/data_bags_dir.rb +18 -0
- data/lib/chef_fs/file_system/file_system_entry.rb +18 -0
- data/lib/chef_fs/file_system/file_system_error.rb +18 -0
- data/lib/chef_fs/file_system/file_system_root_dir.rb +18 -0
- data/lib/chef_fs/file_system/multiplexed_dir.rb +46 -0
- data/lib/chef_fs/file_system/must_delete_recursively_error.rb +18 -0
- data/lib/chef_fs/file_system/nodes_dir.rb +18 -0
- data/lib/chef_fs/file_system/nonexistent_fs_object.rb +18 -0
- data/lib/chef_fs/file_system/not_found_error.rb +18 -0
- data/lib/chef_fs/file_system/rest_list_dir.rb +18 -0
- data/lib/chef_fs/file_system/rest_list_entry.rb +18 -0
- data/lib/chef_fs/knife.rb +128 -18
- data/lib/chef_fs/path_utils.rb +19 -1
- data/lib/chef_fs/version.rb +1 -1
- data/spec/chef_fs/diff_spec.rb +69 -44
- data/spec/chef_fs/file_pattern_spec.rb +497 -479
- data/spec/chef_fs/file_system/chef_server_root_dir_spec.rb +18 -0
- data/spec/chef_fs/file_system/cookbooks_dir_spec.rb +18 -0
- data/spec/chef_fs/file_system/data_bags_dir_spec.rb +18 -0
- data/spec/chef_fs/file_system_spec.rb +124 -106
- data/spec/support/file_system_support.rb +93 -75
- metadata +12 -11
- data/lib/chef/sandbox_uploader.rb +0 -208
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
1
19
|
require 'chef_fs/file_system/file_system_error'
|
2
20
|
|
3
21
|
module ChefFS
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
1
19
|
require 'chef_fs/file_system/base_fs_dir'
|
2
20
|
require 'chef_fs/file_system/rest_list_entry'
|
3
21
|
require 'chef_fs/file_system/not_found_error'
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
1
19
|
require 'chef_fs/file_system/base_fs_object'
|
2
20
|
require 'chef_fs/file_system/not_found_error'
|
3
21
|
require 'chef/role'
|
data/lib/chef_fs/knife.rb
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
1
19
|
require 'chef_fs/file_system/chef_server_root_dir'
|
2
20
|
require 'chef_fs/file_system/chef_repository_file_system_root_dir'
|
3
21
|
require 'chef_fs/file_pattern'
|
@@ -13,36 +31,124 @@ module ChefFS
|
|
13
31
|
:description => "Specifies the local repository layout. Values: default or full"
|
14
32
|
end
|
15
33
|
|
16
|
-
def
|
17
|
-
@
|
18
|
-
|
19
|
-
|
34
|
+
def chef_fs
|
35
|
+
@chef_fs ||= ChefFS::FileSystem::ChefServerRootDir.new("remote", Chef::Config, config[:repo_mode])
|
36
|
+
end
|
37
|
+
|
38
|
+
def chef_repo_path
|
39
|
+
@chef_repo_path ||= begin
|
40
|
+
if Chef::Config.chef_repo_path
|
41
|
+
File.expand_path(Chef::Config.chef_repo_path)
|
42
|
+
elsif Chef::Config.cookbook_path
|
43
|
+
File.expand_path('..', Array(Chef::Config.cookbook_path).flatten.first)
|
44
|
+
else
|
45
|
+
nil
|
46
|
+
end
|
20
47
|
end
|
21
48
|
end
|
22
49
|
|
23
|
-
|
24
|
-
|
50
|
+
# Smooth out some inappropriate (for know) variable defaults in Chef.
|
51
|
+
def config_var(name)
|
52
|
+
case name
|
53
|
+
when :data_bag_path
|
54
|
+
Chef::Config[name] == Chef::Config.platform_specific_path('/var/chef/data_bags') ? nil : Chef::Config[name]
|
55
|
+
when :node_path
|
56
|
+
Chef::Config[name] == '/var/chef/node' ? nil : Chef::Config[name]
|
57
|
+
when :role_path
|
58
|
+
Chef::Config[name] == Chef::Config.platform_specific_path('/var/chef/roles') ? nil : Chef::Config[name]
|
59
|
+
when :chef_repo_path
|
60
|
+
chef_repo_path
|
61
|
+
else
|
62
|
+
Chef::Config[name]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def object_paths
|
67
|
+
@object_paths ||= begin
|
68
|
+
result = {}
|
69
|
+
%w(clients cookbooks data_bags environments nodes roles users).each do |object_name|
|
70
|
+
variable_name = "#{object_name[0..-2]}_path" # cookbooks -> cookbook_path
|
71
|
+
paths = config_var(variable_name.to_sym)
|
72
|
+
if !paths
|
73
|
+
if !chef_repo_path
|
74
|
+
# TODO if chef_repo is not specified and repo_mode does not require
|
75
|
+
# clients/users/nodes, don't require them to be specified.
|
76
|
+
Chef::Log.error("Must specify either chef_repo_path or #{variable_name} in Chef config file")
|
77
|
+
exit(1)
|
78
|
+
end
|
79
|
+
paths = File.join(chef_repo_path, object_name)
|
80
|
+
end
|
81
|
+
paths = Array(paths).flatten.map { |path| File.expand_path(path) }
|
82
|
+
result[object_name] = paths
|
83
|
+
end
|
84
|
+
result
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Returns the given real path's location relative to the server root.
|
89
|
+
#
|
90
|
+
# If chef_repo is /home/jkeiser/chef_repo,
|
91
|
+
# and pwd is /home/jkeiser/chef_repo/cookbooks,
|
92
|
+
# server_path('blah') == '/cookbooks/blah'
|
93
|
+
# server_path('../roles/blah.json') == '/roles/blah'
|
94
|
+
# server_path('../../readme.txt') == nil
|
95
|
+
# server_path('*/*ab*') == '/cookbooks/*/*ab*'
|
96
|
+
# server_path('/home/jkeiser/chef_repo/cookbooks/blah') == '/cookbooks/blah'
|
97
|
+
# server_path('/home/*/chef_repo/cookbooks/blah') == nil
|
98
|
+
#
|
99
|
+
# If there are multiple paths (cookbooks, roles, data bags, etc. can all
|
100
|
+
# have separate paths), and cwd+the path reaches into one of them, we will
|
101
|
+
# return a path relative to that. Otherwise we will return a path to
|
102
|
+
# chef_repo.
|
103
|
+
#
|
104
|
+
# Globs are allowed as well, but globs outside server paths are NOT
|
105
|
+
# (presently) supported. See above examples. TODO support that.
|
106
|
+
#
|
107
|
+
# If the path does not reach into ANY specified directory, nil is returned.
|
108
|
+
def server_path(file_path)
|
109
|
+
pwd = File.expand_path(Dir.pwd)
|
110
|
+
absolute_path = File.expand_path(file_path, pwd)
|
111
|
+
|
112
|
+
# Check all object paths (cookbooks_dir, data_bags_dir, etc.)
|
113
|
+
object_paths.each_pair do |name, paths|
|
114
|
+
paths.each do |path|
|
115
|
+
if absolute_path[0,path.length] == path
|
116
|
+
relative_path = ChefFS::PathUtils::relative_to(path, absolute_path)
|
117
|
+
return relative_path == '.' ? "/#{name}" : "/#{name}/#{relative_path}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Check chef_repo_path
|
123
|
+
if chef_repo_path[0,absolute_path.length] == absolute_path
|
124
|
+
relative_path = ChefFS::PathUtils::relative_to(chef_repo_path, absolute_path)
|
125
|
+
return relative_path == '.' ? '/' : "/#{relative_path}"
|
126
|
+
end
|
127
|
+
|
128
|
+
nil
|
25
129
|
end
|
26
130
|
|
27
|
-
|
28
|
-
|
131
|
+
# The current directory, relative to server root
|
132
|
+
def base_path
|
133
|
+
@base_path ||= server_path(File.expand_path(Dir.pwd))
|
29
134
|
end
|
30
135
|
|
31
|
-
|
32
|
-
|
33
|
-
|
136
|
+
# Print the given server path, relative to the current directory
|
137
|
+
def format_path(server_path)
|
138
|
+
if server_path[0,base_path.length] == base_path
|
139
|
+
if server_path == base_path
|
34
140
|
return "."
|
35
|
-
elsif
|
36
|
-
return
|
37
|
-
elsif base_path == "/" &&
|
38
|
-
return
|
141
|
+
elsif server_path[base_path.length] == "/"
|
142
|
+
return server_path[base_path.length + 1, server_path.length - base_path.length - 1]
|
143
|
+
elsif base_path == "/" && server_path[0] == "/"
|
144
|
+
return server_path[1, server_path.length - 1]
|
39
145
|
end
|
40
146
|
end
|
41
|
-
|
147
|
+
server_path
|
42
148
|
end
|
43
149
|
|
44
150
|
def local_fs
|
45
|
-
@local_fs ||= ChefFS::FileSystem::ChefRepositoryFileSystemRootDir.new(
|
151
|
+
@local_fs ||= ChefFS::FileSystem::ChefRepositoryFileSystemRootDir.new(object_paths)
|
46
152
|
end
|
47
153
|
|
48
154
|
def pattern_args
|
@@ -50,7 +156,11 @@ module ChefFS
|
|
50
156
|
end
|
51
157
|
|
52
158
|
def pattern_args_from(args)
|
53
|
-
|
159
|
+
# TODO support absolute file paths and not just patterns? Too much?
|
160
|
+
# Could be super useful in a world with multiple repo paths
|
161
|
+
args.map do |arg|
|
162
|
+
ChefFS::FilePattern::relative_to(base_path, arg)
|
163
|
+
end
|
54
164
|
end
|
55
165
|
|
56
166
|
end
|
data/lib/chef_fs/path_utils.rb
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
1
19
|
require 'chef_fs'
|
2
20
|
|
3
21
|
module ChefFS
|
@@ -5,7 +23,7 @@ module ChefFS
|
|
5
23
|
|
6
24
|
# If you are in 'source', this is what you would have to type to reach 'dest'
|
7
25
|
# relative_to('/a/b/c/d/e', '/a/b/x/y') == '../../c/d/e'
|
8
|
-
# relative_to('/a/b', '/a/b') == ''
|
26
|
+
# relative_to('/a/b', '/a/b') == '.'
|
9
27
|
def self.relative_to(dest, source)
|
10
28
|
# Skip past the common parts
|
11
29
|
source_parts = ChefFS::PathUtils.split(source)
|
data/lib/chef_fs/version.rb
CHANGED
data/spec/chef_fs/diff_spec.rb
CHANGED
@@ -1,69 +1,94 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
1
19
|
require 'support/spec_helper'
|
2
20
|
require 'chef_fs/file_pattern'
|
3
21
|
require 'chef_fs/command_line'
|
4
22
|
|
5
|
-
|
23
|
+
# Removes the date stamp from the diff and replaces it with ' DATE'
|
24
|
+
# example match: "/dev/null\t2012-10-16 16:15:54.000000000 +0000"
|
25
|
+
# windows match: "--- /dev/null\tTue Oct 16 18:04:34 2012"
|
26
|
+
def remove_date(diff)
|
27
|
+
diff.gsub(/([+-]{3}.*)\t.*/, '\1 DATE')
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'diff', :uses_diff => true do
|
6
31
|
include FileSystemSupport
|
7
32
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
33
|
+
context 'with two filesystems with all types of difference' do
|
34
|
+
let(:a) {
|
35
|
+
memory_fs('a', {
|
36
|
+
:both_dirs => {
|
37
|
+
:sub_both_dirs => { :subsub => nil },
|
13
38
|
:sub_both_files => nil,
|
14
39
|
:sub_both_files_different => "a\n",
|
15
|
-
|
40
|
+
:sub_both_dirs_empty => {},
|
16
41
|
:sub_dirs_empty_in_a_filled_in_b => {},
|
17
42
|
:sub_dirs_empty_in_b_filled_in_a => { :subsub => nil },
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
43
|
+
:sub_a_only_dir => { :subsub => nil },
|
44
|
+
:sub_a_only_file => nil,
|
45
|
+
:sub_dir_in_a_file_in_b => {},
|
46
|
+
:sub_file_in_a_dir_in_b => nil
|
47
|
+
},
|
48
|
+
:both_files => nil,
|
24
49
|
:both_files_different => "a\n",
|
25
50
|
:both_dirs_empty => {},
|
26
51
|
:dirs_empty_in_a_filled_in_b => {},
|
27
52
|
:dirs_empty_in_b_filled_in_a => { :subsub => nil },
|
28
53
|
:dirs_in_a_cannot_be_in_b => {},
|
29
54
|
:file_in_a_cannot_be_in_b => nil,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
55
|
+
:a_only_dir => { :subsub => nil },
|
56
|
+
:a_only_file => nil,
|
57
|
+
:dir_in_a_file_in_b => {},
|
58
|
+
:file_in_a_dir_in_b => nil
|
59
|
+
}, /cannot_be_in_a/)
|
60
|
+
}
|
61
|
+
let(:b) {
|
62
|
+
memory_fs('b', {
|
63
|
+
:both_dirs => {
|
64
|
+
:sub_both_dirs => { :subsub => nil },
|
65
|
+
:sub_both_files => nil,
|
41
66
|
:sub_both_files_different => "b\n",
|
42
|
-
|
67
|
+
:sub_both_dirs_empty => {},
|
43
68
|
:sub_dirs_empty_in_a_filled_in_b => { :subsub => nil },
|
44
69
|
:sub_dirs_empty_in_b_filled_in_a => {},
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
70
|
+
:sub_b_only_dir => { :subsub => nil },
|
71
|
+
:sub_b_only_file => nil,
|
72
|
+
:sub_dir_in_a_file_in_b => nil,
|
73
|
+
:sub_file_in_a_dir_in_b => {}
|
74
|
+
},
|
75
|
+
:both_files => nil,
|
51
76
|
:both_files_different => "b\n",
|
52
|
-
|
77
|
+
:both_dirs_empty => {},
|
53
78
|
:dirs_empty_in_a_filled_in_b => { :subsub => nil },
|
54
79
|
:dirs_empty_in_b_filled_in_a => {},
|
55
80
|
:dirs_in_b_cannot_be_in_a => {},
|
56
81
|
:file_in_b_cannot_be_in_a => nil,
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
82
|
+
:b_only_dir => { :subsub => nil },
|
83
|
+
:b_only_file => nil,
|
84
|
+
:dir_in_a_file_in_b => nil,
|
85
|
+
:file_in_a_dir_in_b => {}
|
86
|
+
}, /cannot_be_in_b/)
|
87
|
+
}
|
63
88
|
it 'ChefFS::CommandLine.diff(/)' do
|
64
89
|
results = []
|
65
90
|
ChefFS::CommandLine.diff(pattern('/'), a, b, nil, nil) do |diff|
|
66
|
-
results << diff
|
91
|
+
results << remove_date(diff)
|
67
92
|
end
|
68
93
|
results.should =~ [
|
69
94
|
'diff --knife a/both_dirs/sub_both_files_different b/both_dirs/sub_both_files_different
|
@@ -139,7 +164,7 @@ new file
|
|
139
164
|
it 'ChefFS::CommandLine.diff(/both_dirs)' do
|
140
165
|
results = []
|
141
166
|
ChefFS::CommandLine.diff(pattern('/both_dirs'), a, b, nil, nil) do |diff|
|
142
|
-
results << diff
|
167
|
+
results << remove_date(diff)
|
143
168
|
end
|
144
169
|
results.should =~ [
|
145
170
|
'diff --knife a/both_dirs/sub_both_files_different b/both_dirs/sub_both_files_different
|
@@ -181,7 +206,7 @@ new file
|
|
181
206
|
it 'ChefFS::CommandLine.diff(/) with depth 1' do
|
182
207
|
results = []
|
183
208
|
ChefFS::CommandLine.diff(pattern('/'), a, b, 1, nil) do |diff|
|
184
|
-
results << diff
|
209
|
+
results << remove_date(diff)
|
185
210
|
end
|
186
211
|
results.should =~ [
|
187
212
|
'Common subdirectories: /both_dirs
|
@@ -215,7 +240,7 @@ new file
|
|
215
240
|
it 'ChefFS::CommandLine.diff(/*_*) with depth 0' do
|
216
241
|
results = []
|
217
242
|
ChefFS::CommandLine.diff(pattern('/*_*'), a, b, 0, nil) do |diff|
|
218
|
-
results << diff
|
243
|
+
results << remove_date(diff)
|
219
244
|
end
|
220
245
|
results.should =~ [
|
221
246
|
'Common subdirectories: /both_dirs
|
@@ -249,7 +274,7 @@ new file
|
|
249
274
|
it 'ChefFS::CommandLine.diff(/) in name-only mode' do
|
250
275
|
results = []
|
251
276
|
ChefFS::CommandLine.diff(pattern('/'), a, b, nil, :name_only) do |diff|
|
252
|
-
results << diff
|
277
|
+
results << remove_date(diff)
|
253
278
|
end
|
254
279
|
results.should =~ [
|
255
280
|
"b/both_dirs/sub_both_files_different\n",
|
@@ -275,7 +300,7 @@ new file
|
|
275
300
|
it 'ChefFS::CommandLine.diff(/) in name-status mode' do
|
276
301
|
results = []
|
277
302
|
ChefFS::CommandLine.diff(pattern('/'), a, b, nil, :name_status) do |diff|
|
278
|
-
results << diff
|
303
|
+
results << remove_date(diff)
|
279
304
|
end
|
280
305
|
results.should =~ [
|
281
306
|
"M\tb/both_dirs/sub_both_files_different\n",
|