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
Search Repo:
bigfleet (author)
Mon Apr 21 20:31:52 -0700 2008
commit  d170739dfe041124cb112daf3b297ac35bdbf191
tree    a7c2ae8f07cdb44ea8d8d8325b03bd0364cc84ed
parent  ed6764801d79a77744d03d34d4f3e86baa84f93a
blanket / lib / blanket / plugins / sources / confluence.rb
100644 77 lines (59 sloc) 2.061 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
66
67
68
69
70
71
72
73
74
75
76
77
require 'date'
 
# A Source that's aware of the Confluence wiki's particular strategy towards
# backups. Confluence makes its own when you ask it to, so this takes care
# of uploading them to an off-site location.
#
# [user] Username on the remote system.
# [password] Password on the remote system.
# [host] Domain name of the remote system.
# [remote_directory] The backup directory for Confluence on the remote server.
# [local_directory] The location on client running the blanket where the database backup is stored before being sent to a sink.
 
class Confluence < Source
  
  def initialize(reader) #:nodoc:
    @reader = reader
  end
  
  def self.attribute_symbols #:nodoc:
    [:source_type, :host, :user, :password, :remote_directory, :local_directory ]
  end
  
  def self.default_source_type #:nodoc:
    "Confluence"
  end
  
  def self.default_host #:nodoc:
    "yourhost.com"
  end
  
  def self.default_user #:nodoc:
    "username"
  end
  
  def self.default_password #:nodoc:
    "password"
  end
  
  def self.default_remote_directory #:nodoc:
    "/path/to/remote/confluence/backups"
  end
 
  def self.default_local_directory #:nodoc:
    "/path/to/local/confluence/backups"
  end
  
  # Determines the filename of the most recent backup made by Confluence's automated process.
  def self.filename
    #On my system, they're named daily-backup-2008_02_24.zip
    today = Date.today
    "daily-backup-#{today.strftime("%Y_%m_%d")}.zip"
  end
  
  # The full remote path of the most recent Confluence backup, to be
  # downloaded by the blanket client.
  def remote_backup_path
    [remote_directory, Confluence.filename].join('/')
  end
  
  # The full local path of the most recent Confluence backup, to be
  # uploaded by the blanket client
  def local_backup_path
    [local_directory, Confluence.filename].join('/')
  end
  
  
  def prep_command #:nodoc:
    noop
  end
  
  # Not implemented yet.[http://bigfleet.lighthouseapp.com/projects/8764-blanket/tickets/5-confluence-remote-cleanup]
  def cleanup_command
    noop
  end
  
  
end