Sha256: 6d0769637327aca4fd7289bc12b753560919c7e44a75439aab2ea26198dc8825
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
class DevSystem::FileShell < DevSystem::Shell def self._raise_if_blank path raise ArgumentError, "Path is required" if path.nil? || path.to_s.empty? end def self._raise_if_not_exists path raise ArgumentError, "File does not exist at '#{path}'" unless exist? path end # def self.exist? path log :normal, "Checking if file exists at '#{path}'" _raise_if_blank path File.exist? path end def self.size path log :normal, "Getting size of file at '#{path}'" _raise_if_not_exists path File.size path end # def self.directory? path log :normal, "Checking if '#{path}' is a directory" _raise_if_blank path File.directory? path end def self.file? path log :normal, "Checking if '#{path}' is a file" _raise_if_blank path File.file? path end # def self.touch path log :normal, "Touching '#{path}'" _raise_if_blank path dir = File.dirname(path) DevSystem::DirShell.create dir FileUtils.touch path end def self.gitkeep path touch "#{path}/.gitkeep" end end
Version data entries
3 entries across 3 versions & 1 rubygems