Sha256: 59491fa1a0a5a92319110ee1028a004d5e3b00b0dfb347bcfb69ce41ad7e2545

Contents?: true

Size: 1.71 KB

Versions: 66

Compression:

Stored size: 1.71 KB

Contents

module LocalFS
  def fs_init
    self.fsType = "LocalFS"

    if @dobj && @dobj.root
      @root = @dobj.root
      raise "LocalFS: root directory does not exist, #{@root}" unless File.directory?(@root)
    else
      @root = nil
    end

    @cwd = Dir.pwd
  end

  def freeBytes
    (0)
  end

  def fs_dirEntries(p)
    Dir.entries(internalPath(p))
  end

  def fs_dirMkdir(p)
    Dir.mkdir(internalPath(p))
  end

  def dirRmdir(p)
    Dir.rmdir(internalPath(p))
  end

  def fs_fileDelete(p)
    File.delete(internalPath(p))
  end

  def fs_fileExists?(p)
    File.exist?(internalPath(p))
  end

  def fs_fileFile?(p)
    File.file?(internalPath(p))
  end

  def fs_fileDirectory?(p)
    File.directory? internalPath((p))
  end

  def fs_fileSize(p)
    File.size(internalPath(p))
  end

  def fs_fileSize_obj(fobj)
    fobj.stat.size
  end

  def fs_fileAtime(p)
    File.atime(internalPath(p))
  end

  def fs_fileCtime(p)
    File.ctime(internalPath(p))
  end

  def fs_fileMtime(p)
    File.mtime(internalPath(p))
  end

  def fs_fileAtime_obj(fobj)
    fobj.atime
  end

  def fs_fileCtime_obj(fobj)
    fobj.ctime
  end

  def fs_fileMtime_obj(fobj)
    fobj.mtime
  end

  def fs_fileOpen(p, mode = "r")
    File.new(internalPath(p), mode)
  end

  def fs_fileSeek(fobj, offset, whence)
    fobj.seek(offset, whence)
  end

  def fs_fileRead(fobj, len)
    fobj.read(len)
  end

  def fs_fileWrite(fobj, buf, len)
    return(fobj.write(buf))     if buf.length == len
    return(fobj.write(buf[0, len])) if buf.length > len
    raise "LocalFS.fs_fileWrite: attempt to write passed the end of buffer"
  end

  def fs_fileClose(fobj)
    fobj.close
  end

  def internalPath(p)
    return(File.join(@root, p)) if @root
    (p)
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
manageiq-smartstate-0.5.4 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.3.5 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.5.3 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.5.2 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.5.1 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.5.0 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.3.4 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.4.0 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.18.2 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.3.3 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.3.2 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.3.1 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.3.0 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.24 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.18.1 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.23 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.22 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.21 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.20 lib/fs/MiqFS/modules/LocalFS.rb
manageiq-smartstate-0.2.19 lib/fs/MiqFS/modules/LocalFS.rb