Class: PXCBackup::Repo
- Inherits:
-
Object
- Object
- PXCBackup::Repo
- Defined in:
- lib/pxcbackup/repo.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #backups ⇒ Object
- #delete(backup) ⇒ Object
-
#initialize(path, options = {}) ⇒ Repo
constructor
A new instance of Repo.
- #stream_command(backup) ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Repo
Returns a new instance of Repo.
9 10 11 12 |
# File 'lib/pxcbackup/repo.rb', line 9 def initialize(path, = {}) @path = path @which = PathResolver.new() end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/pxcbackup/repo.rb', line 7 def path @path end |
Instance Method Details
#backups ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pxcbackup/repo.rb', line 14 def backups backups = [] Dir.foreach(@path) do |file| path = File.join(@path, file) next unless File.file?(path) next unless Backup.regexp.match(path) backups << Backup.new(self, path) end backups.sort end |
#delete(backup) ⇒ Object
25 26 27 28 |
# File 'lib/pxcbackup/repo.rb', line 25 def delete(backup) verify(backup) system("#{@which.rm.shellescape} #{backup.path.shellescape}") end |
#stream_command(backup) ⇒ Object
30 31 32 33 |
# File 'lib/pxcbackup/repo.rb', line 30 def stream_command(backup) verify(backup) "#{@which.cat.shellescape} #{backup.path.shellescape}" end |