Sha256: f4409fa9dcd85bc8c8930b8fc636d6df0d5ff0d3504780ab580d5730dc95e44b
Contents?: true
Size: 511 Bytes
Versions: 2
Compression:
Stored size: 511 Bytes
Contents
module ConfCtl module Utils::File # Atomically replace or create symlink # @param path [String] symlink path # @param dst [String] destination def replace_symlink(path, dst) replacement = "#{path}.new-#{SecureRandom.hex(3)}" File.symlink(dst, replacement) File.rename(replacement, path) end # Unlink file if it exists # @param path [String] def unlink_if_exists(path) File.unlink(path) true rescue Errno::ENOENT false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
confctl-2.0.0 | lib/confctl/utils/file.rb |
confctl-1.0.0 | lib/confctl/utils/file.rb |