class Chef::ChefFS::FileSystem::PairLister

Attributes

a_root[R]
b_root[R]
pattern[R]

Public Class Methods

new(pattern, a_root, b_root) click to toggle source
# File lib/chef/chef_fs/file_system.rb, line 179
def initialize(pattern, a_root, b_root)
  @pattern = pattern
  @a_root = a_root
  @b_root = b_root
end

Public Instance Methods

each() { |a, b| ... } click to toggle source
# File lib/chef/chef_fs/file_system.rb, line 189
def each
  # Make sure everything on the server is also on the filesystem, and diff
  found_paths = Set.new
  Chef::ChefFS::FileSystem.list(a_root, pattern).each do |a|
    found_paths << a.display_path
    b = Chef::ChefFS::FileSystem.resolve_path(b_root, a.display_path)
    yield [ a, b ]
  end

  # Check the outer regex pattern to see if it matches anything on the
  # filesystem that isn't on the server
  Chef::ChefFS::FileSystem.list(b_root, pattern).each do |b|
    unless found_paths.include?(b.display_path)
      a = Chef::ChefFS::FileSystem.resolve_path(a_root, b.display_path)
      yield [ a, b ]
    end
  end
end