class Kinksync::Path2Sync

Class that represents an absolute local or remote path which contains file(s) and/or directories to sync

Public Class Methods

new(path) click to toggle source

Configures a Path2Sync class

@param path [String] local or remote path to sync

# File lib/kinksync/path_2_sync.rb, line 12
def initialize(path)
  @path = File.expand_path(path)
end

Public Instance Methods

sync() click to toggle source

Syncs all files in path and its subdirectories, ignores symlinks

@return lists of synced files, only including those changed

# File lib/kinksync/path_2_sync.rb, line 21
def sync
  synced = []
  files_to_sync = Find.find(@path).select do |f|
    File.file?(f) && !File.symlink?(f)
  end
  files_to_sync.each { |f| synced.push(f) if File2Sync.new(f).sync }
  synced
end