Sha256: 143e4f4667e0d22438c02c9d757fdf7fe643142805dcbaecc6401ab5e57530e9
Contents?: true
Size: 1.43 KB
Versions: 4
Compression:
Stored size: 1.43 KB
Contents
module Astrovan module Util # Create one or more directories on the remote servers. Intermediate directories will be created # as required. def mkdir(*paths) options = paths.last.is_a?(Hash) ? paths.pop : {} # flatten, so that arrays of paths can be passed as arguments paths = paths.flatten.join(' ') # TODO: consider using sudo? exec "mkdir -p #{paths} && chmod g+w #{paths}", options end # Remove files or directories on the remote servers. # # Options: # * +recursive+ - set to true to attempt to recursively remove a directory def rm(*paths) options = paths.last.is_a?(Hash) ? paths.pop : {} # flatten, so that arrays of paths can be passed as arguments paths = paths.flatten.join(' ') # TODO: consider using sudo? rm = 'rm' rm << ' -r' if options.delete(:recursive) exec "#{rm} #{paths}", options end # Create a sylink on the remote servers. Any existing symlink will be removed first. # # Options: # * +to+ - the path to the new symlink def symlink(*paths) options = paths.last.is_a?(Hash) ? paths.pop : {} raise ArgumentError, "You must provide a target using the :to option" unless to = options.delete(:to) # flatten, so that arrays of paths can be passed as arguments paths = paths.flatten.join(' ') # TODO: consider using sudo? exec "ln -sf #{paths} #{to}", options end end end
Version data entries
4 entries across 4 versions & 1 rubygems