GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Blanket is a flexible backup framework designed to get the drudgery out of the way and to make automated backups easy.
Homepage: http://jimvanfleet.com/projects/blanket
Clone URL: git://github.com/bigfleet/blanket.git
commit  9ce51ee24cceaaa965e675d7b2deb4dca202fc1f
tree    8ef2835b7d2d4bf141376f48441c7b0100a9fd55
parent  d4e20ec7c0d343066f5d65d2af5965f38e896c56
blanket / lib / blanket / plugins / sources / remote_directory.rb
100644 65 lines (49 sloc) 1.069 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class RemoteDirectory < Source
  
  def initialize(reader)
    @reader = reader
  end
  
  def self.attribute_symbols
    [:source_type, :host, :user, :password, :remote_directory, :local_path ]
  end
  
  def self.default_source_type
    "Confluence"
  end
  
  def self.default_host
    "yourhost.com"
  end
  
  def self.default_user
    "username"
  end
  
  def self.default_password
    "password"
  end
  
  def self.default_remote_directory
    "/path/to/remote/target/directory"
  end
  
  def self.default_local_path
    "/path/to/local/blanket"
  end
    
  def remote_backup_path
    full_tarfile+".gz"
  end
  
  def local_backup_path
    local_path
  end
  
  def tar_directory
    rp = Pathname.new(remote_directory)
    rp.dirname.to_s
  end
  
  def tarfile
    rp = Pathname.new(remote_directory)
    rp.basename.to_s+".tar"
  end
  
  def full_tarfile
    [tar_directory, tarfile].join("/")
  end
  
  def prep_command
    "tar cvf #{full_tarfile} #{remote_directory}; gzip -f #{full_tarfile}"
  end
  
  def cleanup_command
    noop
  end
  
end