Class: DirSync::ChangeLogFileSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/dir_sync/change_log_file_system.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ ChangeLogFileSystem

Returns a new instance of ChangeLogFileSystem.



5
6
7
# File 'lib/dir_sync/change_log_file_system.rb', line 5

def initialize io
  @io = io
end

Instance Method Details

#cp(from, to) ⇒ Object



9
10
11
12
13
# File 'lib/dir_sync/change_log_file_system.rb', line 9

def cp from, to
  to_dir = File.dirname to
  @io.puts "mkdir -p \"#{to_dir}\"" unless File.exist? to_dir
  @io.puts "cp -p \"#{from}\" \"#{to}\""
end

#rm(path) ⇒ Object



15
16
17
# File 'lib/dir_sync/change_log_file_system.rb', line 15

def rm path
  @io.puts "rm \"#{path}\""
end