module CKick::PathDelegate

Public Class Methods

create_directory(dirpath) click to toggle source
# File lib/ckick/path_delegate.rb, line 11
def self.create_directory(dirpath)
  FileUtils.mkdir_p(dirpath)
end
touch_file(filepath) click to toggle source
# File lib/ckick/path_delegate.rb, line 23
def self.touch_file(filepath)
  FileUtils.touch(filepath)
end
write_file(dirpath, filename, content) click to toggle source
# File lib/ckick/path_delegate.rb, line 15
def self.write_file(dirpath, filename, content)
  raise BadFileContentError, "content does not respond to to_s" unless content.respond_to?(:to_s)
  filepath = File.join(dirpath, filename)
  file = File.new(filepath, "w")
  file << content.to_s
  file.close
end