module Mclone
Constants
- PATH_LIST_SEPARATOR
TODO handle Windows variants Specify OS-specific path name list separator (such as in the $PATH environment variable)
- UNIX_SYSTEM_MOUNTS
Match OS-specific system mount points (/dev /proc etc.) which normally should be omitted when scanning for
Mclone
voulmes- VERSION
Public Class Methods
environment_mounts()
click to toggle source
Return list of live user-provided mounts (mount points on *NIX and disk drives on Windows) which may contain Mclone
volumes Look for the $MCLONE_PATH environment variable
# File lib/mclone.rb, line 702 def self.environment_mounts ENV['MCLONE_PATH'].split(PATH_LIST_SEPARATOR).collect { |path| File.directory?(path) ? path : nil }.compact rescue [] end
rclone()
click to toggle source
# File lib/mclone.rb, line 684 def self.rclone @@rclone ||= (rclone = ENV['RCLONE']).nil? ? 'rclone' : rclone end
system_mounts()
click to toggle source
Linux OS
# File lib/mclone.rb, line 709 def self.system_mounts # Query /proc for currently mounted file systems IO.readlines('/proc/self/mountstats').collect do |line| mount = line.split[4] UNIX_SYSTEM_MOUNTS.match?(mount) || !File.directory?(mount) ? nil : mount end.compact end
windows?()
click to toggle source
Return true if run in the real Windows environment (e.g. not in real *NIX or various emulation layers such as MSYS, Cygwin etc.)
# File lib/mclone.rb, line 689 def self.windows? @@windows ||= /^(mingw)/.match?(RbConfig::CONFIG['target_os']) # RubyInstaller's MRI, other MinGW-build MRI end