Class: Oldtime::Rsync2
- Inherits:
-
Object
- Object
- Oldtime::Rsync2
- Defined in:
- lib/oldtime/rsync.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(file, name) ⇒ Rsync2
constructor
A new instance of Rsync2.
- #run ⇒ Object
Constructor Details
#initialize(file, name) ⇒ Rsync2
Returns a new instance of Rsync2.
28 29 30 31 |
# File 'lib/oldtime/rsync.rb', line 28 def initialize(file, name) @file = file @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/oldtime/rsync.rb', line 26 def name @name end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/oldtime/rsync.rb', line 33 def run begin @dir = Pa.mktmpdir(Rc.profile) end_cmd, file_config = parse(@file) file_config.each { |k, v| File.write("#{@dir}/#{k}", v) } cmd = build_cmd(end_cmd, file_config) File.append(Rc.p.logfile.p, "\n#{'='*30}\n#{'='*10} rsync #{name} #{'='*10}\n#{'='*30}\n\n") system cmd, :verbose => true ensure # cleanup Pa.rm_r @dir end end |