Class: Train::File::Remote::Qnx

Inherits:
Unix show all
Defined in:
lib/train/file/remote/qnx.rb

Constant Summary

Constants inherited from Train::File

DATA_FIELDS

Instance Attribute Summary

Attributes inherited from Unix

#path

Instance Method Summary collapse

Methods inherited from Unix

#exist?, #grouped_into?, #link_path, #linked_to?, #mode?, #mounted, #sanitize_filename, #shallow_link_path, #unix_mode_mask

Methods inherited from Train::File::Remote

#basename, #stat

Methods inherited from Train::File

#block_device?, #character_device?, #directory?, #file?, #file_version, #initialize, #md5sum, #mounted?, #owned_by?, #path, #pipe?, #product_version, #sanitize_filename, #sha256sum, #socket?, #source, #source_path, #symlink?, #to_json, #version?

Constructor Details

This class inherits a constructor from Train::File

Instance Method Details

#contentObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/train/file/remote/qnx.rb', line 12

def content
  cat = 'cat'
  cat = '/proc/boot/cat' if @backend.os[:release].to_i >= 7
  @content ||= case
               when !exist?
                 nil
               else
                 @backend.run_command("#{cat} #{@spath}").stdout || ''
               end
end

#typeObject



23
24
25
26
27
28
29
# File 'lib/train/file/remote/qnx.rb', line 23

def type
  if @backend.run_command("file #{@spath}").stdout.include?('directory')
    return :directory
  else
    return :file
  end
end