Class: MultiSync::LocalSource

Inherits:
Source
  • Object
show all
Defined in:
lib/multi_sync/sources/local_source.rb

Instance Method Summary collapse

Methods inherited from Source

#initialize

Constructor Details

This class inherits a constructor from MultiSync::Source

Instance Method Details

#filesObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/multi_sync/sources/local_source.rb', line 6

def files
  files = []
  # create a local_resource from each file
  # making sure to skip any that do not match the include/exclude patterns
  included_files = Dir.glob(source_dir + include)
  excluded_files = exclude.nil? ? [] : Dir.glob(source_dir + exclude)
  (included_files - excluded_files).each { |path|
    next if File.directory?(path)
    files << path_to_local_resource(path)
  }
  files.sort
end