Sha256: 5b4758dc08b0cdc9a3d6fca981e40a62b980b936b8964c72f37bb3827c358cd8

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

#List the files in a MogileFS backup with their metadata
class List
  attr_accessor :backup_path
  include Validations


  #initialize the list object
  #@param[Hash] o :backup_path is required
  def initialize(o={})

    #If settings file does not exist then this is not a valid mogilefs backup
    check_settings_file('settings.yml not found in path.  This must not be a backup profile. Cannot list')

    connect_sqlite
    migrate_sqlite

    #Now that database is all setup load the model class
    require('bakfile')
  end

  #Outputs a list of files in CSV format
  #fid,key,length,class
  def list
    files = BakFile.find_each(:conditions => ['saved = ?', true]) do |file|
      puts "#{file.fid},#{file.dkey},#{file.length},#{file.classname}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mogbak-0.1.2 lib/list.rb