class Aruba::Platforms::UnixPlatform
WARNING: All methods found here are not considered part of the public API of aruba.
Those methods can be changed at any time in the feature or removed without any further notice.
This includes all methods for the UNIX platform
@private
Public Class Methods
Source
# File lib/aruba/platforms/unix_platform.rb, line 35 def self.match? !Gem.win_platform? end
Public Instance Methods
Source
# File lib/aruba/platforms/unix_platform.rb, line 181 def absolute_path?(path) Pathname.new(path).absolute? end
Is absolute path
Source
# File lib/aruba/platforms/unix_platform.rb, line 51 def announcer Announcer end
Source
# File lib/aruba/platforms/unix_platform.rb, line 237 def builtin_shell_commands [] end
Source
# File lib/aruba/platforms/unix_platform.rb, line 127 def chdir(dir_name, &block) dir_name = ::File.expand_path(dir_name.to_s) with_replaced_environment 'OLDPWD' => getwd, 'PWD' => dir_name do ::Dir.chdir(dir_name, &block) end end
Change to directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 151 def chmod(mode, args, options) FileUtils.chmod_R(mode, args, **options) end
Change mode of file/directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 213 def command?(path) p = Pathname.new(path) p.relative? && p.basename == p end
Check if command is relative
@return [Boolean]
true * command.sh false * /bin/command.sh * bin/command.sh
Source
# File lib/aruba/platforms/unix_platform.rb, line 55 def command_monitor CommandMonitor end
Source
# File lib/aruba/platforms/unix_platform.rb, line 43 def command_string UnixCommandString end
Source
# File lib/aruba/platforms/unix_platform.rb, line 141 def cp(src, dest) FileUtils.cp_r(src, dest) end
Copy file/directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 71 def create_file(*args) ArubaFileCreator.new.call(*args) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 75 def create_fixed_size_file(*args) ArubaFixedSizeFileCreator.new.call(*args) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 99 def current_ruby ::File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 83 def default_shell 'bash' end
Source
# File lib/aruba/platforms/unix_platform.rb, line 95 def deprecated(msg) warn(format('%s. Called by %s', msg, caller[1])) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 87 def detect_ruby(cmd) if /^ruby\s/.match?(cmd) cmd.gsub(/^ruby\s/, "#{current_ruby} ") else cmd end end
Source
# File lib/aruba/platforms/unix_platform.rb, line 67 def determine_disk_usage(paths) DetermineDiskUsage.new.call(paths) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 63 def determine_file_size(*args) DetermineFileSize.new.call(*args) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 161 def directory?(f) File.directory? f end
Exists and is directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 39 def environment_variables UnixEnvironmentVariables end
Source
# File lib/aruba/platforms/unix_platform.rb, line 171 def executable?(f) File.executable?(f) end
Path is executable
Source
# File lib/aruba/platforms/unix_platform.rb, line 166 def exist?(f) File.exist? f end
Path Exists
Source
# File lib/aruba/platforms/unix_platform.rb, line 176 def expand_path(path, base) File.expand_path(path, base) end
Expand path
Source
# File lib/aruba/platforms/unix_platform.rb, line 156 def file?(f) File.file? f end
Exists and is file
Source
# File lib/aruba/platforms/unix_platform.rb, line 47 def filesystem_status FilesystemStatus end
Source
# File lib/aruba/platforms/unix_platform.rb, line 122 def getwd Dir.getwd end
Get current working directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 108 def mkdir(dir_name) dir_name = ::File.expand_path(dir_name) ::FileUtils.mkdir_p(dir_name) unless ::File.directory?(dir_name) end
Create directory and subdirectories
Source
# File lib/aruba/platforms/unix_platform.rb, line 146 def mv(src, dest) FileUtils.mv(src, dest) end
Move file/directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 199 def relative_command?(path) p = Pathname.new(path) p.relative? && p.basename != p end
Check if command is relative
@return [Boolean]
true * bin/command.sh false * /bin/command.sh * command.sh
Source
# File lib/aruba/platforms/unix_platform.rb, line 186 def relative_path?(path) Pathname.new(path).relative? end
Is relative path
Source
# File lib/aruba/platforms/unix_platform.rb, line 103 def require_matching_files(pattern, base) ::Dir.glob(::File.expand_path(pattern, base)).each { |f| require_relative f } end
Source
# File lib/aruba/platforms/unix_platform.rb, line 115 def rm(paths, options = {}) paths = Array(paths).map { |p| ::File.expand_path(p) } FileUtils.rm_r(paths, **options) end
Remove file, directory + sub-directories
Source
# File lib/aruba/platforms/unix_platform.rb, line 241 def term_signal_supported? true end
Source
# File lib/aruba/platforms/unix_platform.rb, line 136 def touch(args, options) FileUtils.touch(args, **options) end
Touch file, directory
Source
# File lib/aruba/platforms/unix_platform.rb, line 233 def which(program, path = ENV['PATH']) UnixWhich.new.call(program, path) end
Resolve path for command using the PATH-environment variable
Mostly taken from here: github.com/djberg96/ptools
@param [#to_s] program
The name of the program which should be resolved
@param [String] path
The PATH, a string concatenated with ":", e.g. /usr/bin/:/bin on a UNIX-system
Source
# File lib/aruba/platforms/unix_platform.rb, line 79 def with_replaced_environment(env = {}, &block) LocalEnvironment.new(self).call(env, &block) end
Source
# File lib/aruba/platforms/unix_platform.rb, line 219 def write_file(path, content) File.write(path, content) end
Write to file