module Kinksync

Kynsync parent module for all classes. Provides methods for configuration and synchronization of a group of files and/or directories

Constants

VERSION

Current gem version

Attributes

configuration[W]

Configuration class instance

Public Class Methods

configuration() click to toggle source

Returns current configuration or initializes an empty one and returns it

@return Configuration object

# File lib/kinksync.rb, line 39
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source

Configures a Kynksync module with the values provided through the block it recieves

@param [block]

Values:
  - remote_path: path to mounting cloud storage location

@example

Kinksync.configure do |config|
  config.remote_path = '/home/pablo/MEGA/kinksync/'
  config.log_file = config.remote_path + 'kinksync.log'
end
# File lib/kinksync.rb, line 32
def self.configure
  yield(configuration)
end
reset() click to toggle source

Resets configuration: all attributes are set to nil

@return Empty Configuration object

# File lib/kinksync.rb, line 46
def self.reset
  @configuration = nil
end
sync(paths_to_sync = []) click to toggle source

Syncs lists of files and paths recieved as arguments. If no arg is provided syncs all files in remote path

@param paths_to_sync [Array] List of files and paths to sync

@example

Kinksync.sync([
  'a_file.mp3',
  '/an/absolute/path/',
  'another_file.avi',
  'a/relative/path'
])
# File lib/kinksync.rb, line 63
def self.sync(paths_to_sync = [])
  synced = []
  paths_to_sync = [Kinksync.configuration.remote_path] if paths_to_sync.empty?
  paths_to_sync.each { |p| synced += Path2Sync.new(p).sync }
  synced
end