Sha256: ee0893d228d0d44c78d6bbce7b72a2152620585ad88a024ad3968a63001128fe
Contents?: true
Size: 1.43 KB
Versions: 1
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 #{path} #{to}", options end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sbfaulkner-astrovan-0.5.0 | lib/astrovan/util.rb |