class Dotfiler::FileSystem
Attributes
utils[R]
Public Class Methods
new(utils: FileUtils)
click to toggle source
# File lib/dotfiler/file_system.rb, line 7 def initialize(utils: FileUtils) @utils = utils end
Public Instance Methods
copy(source_path, destination_path, *options)
click to toggle source
# File lib/dotfiler/file_system.rb, line 15 def copy(source_path, destination_path, *options) utils.cp_r(source_path, destination_path, *options) end
create_dir(path, *options)
click to toggle source
# File lib/dotfiler/file_system.rb, line 33 def create_dir(path, *options) utils.mkdir_p(path, *options) end
create_file(name, content = "")
click to toggle source
# File lib/dotfiler/file_system.rb, line 27 def create_file(name, content = "") file = File.new(name, "w+") file.write(content) file.close end
execute(command, *command_options, **options)
click to toggle source
# File lib/dotfiler/file_system.rb, line 37 def execute(command, *command_options, **options) full_command = ([command] + command_options).join(" ") options[:capture] == true ? `#{full_command}` : system(full_command) end
move(source_path, destination_path, *options)
click to toggle source
# File lib/dotfiler/file_system.rb, line 11 def move(source_path, destination_path, *options) utils.move(source_path, destination_path, *options) end
remove(path)
click to toggle source
# File lib/dotfiler/file_system.rb, line 23 def remove(path) utils.remove_entry_secure(path) end
symlink(source, destination, *options)
click to toggle source
# File lib/dotfiler/file_system.rb, line 19 def symlink(source, destination, *options) utils.symlink(source, destination, *options) end