module TrainSH::Mixin::FileHelpers

Public Instance Methods

read_file(path) click to toggle source
# File lib/trainsh/mixin/file_helpers.rb, line 6
def read_file(path)
  remotefile = session.file(path)
  say format('Remote file %<filename>s does not exist', filename: path) unless remotefile.exist?

  localfile = Tempfile.open
  localfile.write(remotefile.content || '')
  localfile.close

  localfile
end
write_file(path, content) click to toggle source
# File lib/trainsh/mixin/file_helpers.rb, line 17
def write_file(path, content)
  remotefile = session.file(path)
  remotefile.content = content
end