Class: CloudSync::Archiver
- Inherits:
-
Object
- Object
- CloudSync::Archiver
- Defined in:
- lib/cloud_sync/archiver.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #archive ⇒ Object
-
#initialize(source, destination) ⇒ Archiver
constructor
A new instance of Archiver.
Constructor Details
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
4 5 6 |
# File 'lib/cloud_sync/archiver.rb', line 4 def destination @destination end |
#source ⇒ Object
Returns the value of attribute source.
4 5 6 |
# File 'lib/cloud_sync/archiver.rb', line 4 def source @source end |
Instance Method Details
#archive ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cloud_sync/archiver.rb', line 11 def archive unless source return Log.error "Invalid syntax for resource #{source}" end unless destination return Log.error "Invalid syntax for resource #{destination}" end tar = Resource.new("filesystem:#{archive_path}") system "tar czvf #{archive_path} #{source.path}" destination.istream("/home/dan/moo.tgz") << tar.ostream system "rm #{archive_path}" end |