alg-backup 3.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/.gitignore +2 -0
  2. data/.infinity_test +7 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +25 -0
  5. data/Gemfile.lock +101 -0
  6. data/LICENSE.md +24 -0
  7. data/README.md +276 -0
  8. data/backup.gemspec +39 -0
  9. data/bin/backup +260 -0
  10. data/lib/backup.rb +168 -0
  11. data/lib/backup/archive.rb +73 -0
  12. data/lib/backup/cli.rb +50 -0
  13. data/lib/backup/compressor/base.rb +17 -0
  14. data/lib/backup/compressor/gzip.rb +61 -0
  15. data/lib/backup/configuration/base.rb +15 -0
  16. data/lib/backup/configuration/compressor/base.rb +10 -0
  17. data/lib/backup/configuration/compressor/gzip.rb +23 -0
  18. data/lib/backup/configuration/database/base.rb +18 -0
  19. data/lib/backup/configuration/database/mongodb.rb +37 -0
  20. data/lib/backup/configuration/database/mysql.rb +37 -0
  21. data/lib/backup/configuration/database/postgresql.rb +37 -0
  22. data/lib/backup/configuration/database/redis.rb +35 -0
  23. data/lib/backup/configuration/encryptor/base.rb +10 -0
  24. data/lib/backup/configuration/encryptor/gpg.rb +17 -0
  25. data/lib/backup/configuration/encryptor/open_ssl.rb +26 -0
  26. data/lib/backup/configuration/helpers.rb +54 -0
  27. data/lib/backup/configuration/notifier/base.rb +39 -0
  28. data/lib/backup/configuration/notifier/mail.rb +52 -0
  29. data/lib/backup/configuration/notifier/twitter.rb +21 -0
  30. data/lib/backup/configuration/storage/base.rb +18 -0
  31. data/lib/backup/configuration/storage/cloudfiles.rb +21 -0
  32. data/lib/backup/configuration/storage/dropbox.rb +29 -0
  33. data/lib/backup/configuration/storage/ftp.rb +25 -0
  34. data/lib/backup/configuration/storage/rsync.rb +25 -0
  35. data/lib/backup/configuration/storage/s3.rb +25 -0
  36. data/lib/backup/configuration/storage/scp.rb +25 -0
  37. data/lib/backup/configuration/storage/sftp.rb +25 -0
  38. data/lib/backup/configuration/syncer/rsync.rb +45 -0
  39. data/lib/backup/configuration/syncer/s3.rb +33 -0
  40. data/lib/backup/database/base.rb +33 -0
  41. data/lib/backup/database/mongodb.rb +137 -0
  42. data/lib/backup/database/mysql.rb +104 -0
  43. data/lib/backup/database/postgresql.rb +111 -0
  44. data/lib/backup/database/redis.rb +105 -0
  45. data/lib/backup/dependency.rb +84 -0
  46. data/lib/backup/encryptor/base.rb +17 -0
  47. data/lib/backup/encryptor/gpg.rb +78 -0
  48. data/lib/backup/encryptor/open_ssl.rb +67 -0
  49. data/lib/backup/finder.rb +39 -0
  50. data/lib/backup/logger.rb +86 -0
  51. data/lib/backup/model.rb +272 -0
  52. data/lib/backup/notifier/base.rb +29 -0
  53. data/lib/backup/notifier/binder.rb +32 -0
  54. data/lib/backup/notifier/mail.rb +141 -0
  55. data/lib/backup/notifier/templates/notify_failure.erb +31 -0
  56. data/lib/backup/notifier/templates/notify_success.erb +16 -0
  57. data/lib/backup/notifier/twitter.rb +87 -0
  58. data/lib/backup/storage/base.rb +67 -0
  59. data/lib/backup/storage/cloudfiles.rb +95 -0
  60. data/lib/backup/storage/dropbox.rb +87 -0
  61. data/lib/backup/storage/ftp.rb +114 -0
  62. data/lib/backup/storage/object.rb +45 -0
  63. data/lib/backup/storage/rsync.rb +99 -0
  64. data/lib/backup/storage/s3.rb +108 -0
  65. data/lib/backup/storage/scp.rb +106 -0
  66. data/lib/backup/storage/sftp.rb +106 -0
  67. data/lib/backup/syncer/base.rb +10 -0
  68. data/lib/backup/syncer/rsync.rb +117 -0
  69. data/lib/backup/syncer/s3.rb +116 -0
  70. data/lib/backup/version.rb +43 -0
  71. data/lib/templates/archive +4 -0
  72. data/lib/templates/compressor/gzip +4 -0
  73. data/lib/templates/database/mongodb +10 -0
  74. data/lib/templates/database/mysql +11 -0
  75. data/lib/templates/database/postgresql +11 -0
  76. data/lib/templates/database/redis +10 -0
  77. data/lib/templates/encryptor/gpg +9 -0
  78. data/lib/templates/encryptor/openssl +5 -0
  79. data/lib/templates/notifier/mail +14 -0
  80. data/lib/templates/notifier/twitter +9 -0
  81. data/lib/templates/readme +15 -0
  82. data/lib/templates/storage/cloudfiles +7 -0
  83. data/lib/templates/storage/dropbox +9 -0
  84. data/lib/templates/storage/ftp +8 -0
  85. data/lib/templates/storage/rsync +7 -0
  86. data/lib/templates/storage/s3 +8 -0
  87. data/lib/templates/storage/scp +8 -0
  88. data/lib/templates/storage/sftp +8 -0
  89. data/lib/templates/syncer/rsync +14 -0
  90. data/lib/templates/syncer/s3 +12 -0
  91. data/spec/archive_spec.rb +90 -0
  92. data/spec/backup_spec.rb +11 -0
  93. data/spec/compressor/gzip_spec.rb +59 -0
  94. data/spec/configuration/base_spec.rb +35 -0
  95. data/spec/configuration/compressor/gzip_spec.rb +28 -0
  96. data/spec/configuration/database/base_spec.rb +16 -0
  97. data/spec/configuration/database/mongodb_spec.rb +30 -0
  98. data/spec/configuration/database/mysql_spec.rb +32 -0
  99. data/spec/configuration/database/postgresql_spec.rb +32 -0
  100. data/spec/configuration/database/redis_spec.rb +30 -0
  101. data/spec/configuration/encryptor/gpg_spec.rb +25 -0
  102. data/spec/configuration/encryptor/open_ssl_spec.rb +31 -0
  103. data/spec/configuration/notifier/mail_spec.rb +32 -0
  104. data/spec/configuration/storage/cloudfiles_spec.rb +34 -0
  105. data/spec/configuration/storage/dropbox_spec.rb +43 -0
  106. data/spec/configuration/storage/ftp_spec.rb +40 -0
  107. data/spec/configuration/storage/rsync_spec.rb +37 -0
  108. data/spec/configuration/storage/s3_spec.rb +37 -0
  109. data/spec/configuration/storage/scp_spec.rb +40 -0
  110. data/spec/configuration/storage/sftp_spec.rb +40 -0
  111. data/spec/configuration/syncer/rsync_spec.rb +46 -0
  112. data/spec/configuration/syncer/s3_spec.rb +43 -0
  113. data/spec/database/base_spec.rb +30 -0
  114. data/spec/database/mongodb_spec.rb +144 -0
  115. data/spec/database/mysql_spec.rb +150 -0
  116. data/spec/database/postgresql_spec.rb +164 -0
  117. data/spec/database/redis_spec.rb +122 -0
  118. data/spec/encryptor/gpg_spec.rb +57 -0
  119. data/spec/encryptor/open_ssl_spec.rb +102 -0
  120. data/spec/logger_spec.rb +46 -0
  121. data/spec/model_spec.rb +236 -0
  122. data/spec/notifier/mail_spec.rb +97 -0
  123. data/spec/notifier/twitter_spec.rb +86 -0
  124. data/spec/spec_helper.rb +21 -0
  125. data/spec/storage/base_spec.rb +33 -0
  126. data/spec/storage/cloudfiles_spec.rb +102 -0
  127. data/spec/storage/dropbox_spec.rb +105 -0
  128. data/spec/storage/ftp_spec.rb +133 -0
  129. data/spec/storage/object_spec.rb +74 -0
  130. data/spec/storage/rsync_spec.rb +115 -0
  131. data/spec/storage/s3_spec.rb +110 -0
  132. data/spec/storage/scp_spec.rb +129 -0
  133. data/spec/storage/sftp_spec.rb +125 -0
  134. data/spec/syncer/rsync_spec.rb +156 -0
  135. data/spec/syncer/s3_spec.rb +139 -0
  136. data/spec/version_spec.rb +21 -0
  137. metadata +217 -0
@@ -0,0 +1,139 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../spec_helper'
4
+
5
+ describe Backup::Syncer::S3 do
6
+
7
+ let(:s3) do
8
+ Backup::Syncer::S3.new do |s3|
9
+ s3.access_key_id = 'my_access_key_id'
10
+ s3.secret_access_key = 'my_secret_access_key'
11
+ s3.bucket = 'my-bucket'
12
+ s3.path = "/backups"
13
+ s3.mirror = true
14
+
15
+ s3.directories do |directory|
16
+ directory.add "/some/random/directory"
17
+ directory.add "/another/random/directory"
18
+ end
19
+ end
20
+ end
21
+
22
+ before do
23
+ Backup::Configuration::Syncer::S3.clear_defaults!
24
+ end
25
+
26
+ it 'should have defined the configuration properly' do
27
+ s3.access_key_id.should == 'my_access_key_id'
28
+ s3.secret_access_key.should == 'my_secret_access_key'
29
+ s3.bucket.should == 'my-bucket'
30
+ s3.path.should == 'backups'
31
+ s3.mirror.should == '--delete'
32
+ s3.directories.should == ["/some/random/directory", "/another/random/directory"]
33
+ end
34
+
35
+ it 'should use the defaults if a particular attribute has not been defined' do
36
+ Backup::Configuration::Syncer::S3.defaults do |s3|
37
+ s3.access_key_id = 'my_access_key_id'
38
+ s3.bucket = 'my-bucket'
39
+ s3.path = "/backups"
40
+ s3.mirror = true
41
+ end
42
+
43
+ s3 = Backup::Syncer::S3.new do |s3|
44
+ s3.secret_access_key = 'some_secret_access_key'
45
+ s3.mirror = false
46
+ end
47
+
48
+ s3.access_key_id = 'my_access_key_id'
49
+ s3.secret_access_key = 'some_secret_access_key'
50
+ s3.bucket = 'my-bucket'
51
+ s3.path = "/backups"
52
+ s3.mirror = false
53
+ end
54
+
55
+ it 'should have its own defaults' do
56
+ s3 = Backup::Syncer::S3.new
57
+ s3.path.should == 'backups'
58
+ s3.directories.should == Array.new
59
+ s3.mirror.should == nil
60
+ s3.additional_options.should == []
61
+ end
62
+
63
+ describe '#mirror' do
64
+ context 'when true' do
65
+ it do
66
+ s3.mirror = true
67
+ s3.mirror.should == '--delete'
68
+ end
69
+ end
70
+
71
+ context 'when nil/false' do
72
+ it do
73
+ s3.mirror = nil
74
+ s3.mirror.should == nil
75
+ end
76
+
77
+ it do
78
+ s3.mirror = false
79
+ s3.mirror.should == nil
80
+ end
81
+ end
82
+ end
83
+
84
+ describe '#recursive' do
85
+ it do
86
+ s3.recursive.should == '--recursive'
87
+ end
88
+ end
89
+
90
+ describe '#additional_options' do
91
+ it do
92
+ s3.additional_options = ['--exclude="*.rb"']
93
+ s3.options.should == '--verbose --recursive --delete --exclude="*.rb"'
94
+ end
95
+ end
96
+
97
+ describe '#verbose' do
98
+ it do
99
+ s3.verbose.should == '--verbose'
100
+ end
101
+ end
102
+
103
+ describe '#directories' do
104
+ context 'when its empty' do
105
+ it do
106
+ s3.directories = []
107
+ s3.directories.should == []
108
+ end
109
+ end
110
+
111
+ context 'when it has items' do
112
+ it do
113
+ s3.directories = ['directory1', 'directory1/directory2', 'directory1/directory2/directory3']
114
+ s3.directories.should == ['directory1', 'directory1/directory2', 'directory1/directory2/directory3']
115
+ end
116
+ end
117
+ end
118
+
119
+ describe '#options' do
120
+ it do
121
+ s3.options.should == "--verbose --recursive --delete"
122
+ end
123
+ end
124
+
125
+ describe '#perform' do
126
+ it 'should sync two directories' do
127
+ s3.expects(:utility).with(:s3sync).returns(:s3sync).twice
128
+
129
+ Backup::Logger.expects(:message).with("Backup::Syncer::S3 started syncing '/some/random/directory'.")
130
+ s3.expects(:run).with("s3sync --verbose --recursive --delete '/some/random/directory' 'my-bucket:backups'")
131
+
132
+ Backup::Logger.expects(:message).with("Backup::Syncer::S3 started syncing '/another/random/directory'.")
133
+ s3.expects(:run).with("s3sync --verbose --recursive --delete '/another/random/directory' 'my-bucket:backups'")
134
+
135
+ s3.perform!
136
+ end
137
+ end
138
+
139
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/spec_helper'
4
+
5
+ def set_version(major, minor, patch)
6
+ Backup::Version.stubs(:major).returns(major)
7
+ Backup::Version.stubs(:minor).returns(minor)
8
+ Backup::Version.stubs(:patch).returns(patch)
9
+ end
10
+
11
+ describe Backup::Version do
12
+ it 'should return a nicer gemspec output' do
13
+ set_version(1,2,3)
14
+ Backup::Version.current.should == '1.2.3'
15
+ end
16
+
17
+ it 'should return a nicer gemspec output with build' do
18
+ set_version(4,5,6)
19
+ Backup::Version.current.should == '4.5.6'
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alg-backup
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 3
8
+ - 0
9
+ - 10
10
+ version: 3.0.10
11
+ platform: ruby
12
+ authors:
13
+ - Michael van Rooijen
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-25 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: thor
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 43
30
+ segments:
31
+ - 0
32
+ - 14
33
+ - 6
34
+ version: 0.14.6
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email: meskyanichi@gmail.com
39
+ executables:
40
+ - backup
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - .gitignore
47
+ - .infinity_test
48
+ - .rspec
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE.md
52
+ - README.md
53
+ - backup.gemspec
54
+ - bin/backup
55
+ - lib/backup.rb
56
+ - lib/backup/archive.rb
57
+ - lib/backup/cli.rb
58
+ - lib/backup/compressor/base.rb
59
+ - lib/backup/compressor/gzip.rb
60
+ - lib/backup/configuration/base.rb
61
+ - lib/backup/configuration/compressor/base.rb
62
+ - lib/backup/configuration/compressor/gzip.rb
63
+ - lib/backup/configuration/database/base.rb
64
+ - lib/backup/configuration/database/mongodb.rb
65
+ - lib/backup/configuration/database/mysql.rb
66
+ - lib/backup/configuration/database/postgresql.rb
67
+ - lib/backup/configuration/database/redis.rb
68
+ - lib/backup/configuration/encryptor/base.rb
69
+ - lib/backup/configuration/encryptor/gpg.rb
70
+ - lib/backup/configuration/encryptor/open_ssl.rb
71
+ - lib/backup/configuration/helpers.rb
72
+ - lib/backup/configuration/notifier/base.rb
73
+ - lib/backup/configuration/notifier/mail.rb
74
+ - lib/backup/configuration/notifier/twitter.rb
75
+ - lib/backup/configuration/storage/base.rb
76
+ - lib/backup/configuration/storage/cloudfiles.rb
77
+ - lib/backup/configuration/storage/dropbox.rb
78
+ - lib/backup/configuration/storage/ftp.rb
79
+ - lib/backup/configuration/storage/rsync.rb
80
+ - lib/backup/configuration/storage/s3.rb
81
+ - lib/backup/configuration/storage/scp.rb
82
+ - lib/backup/configuration/storage/sftp.rb
83
+ - lib/backup/configuration/syncer/rsync.rb
84
+ - lib/backup/configuration/syncer/s3.rb
85
+ - lib/backup/database/base.rb
86
+ - lib/backup/database/mongodb.rb
87
+ - lib/backup/database/mysql.rb
88
+ - lib/backup/database/postgresql.rb
89
+ - lib/backup/database/redis.rb
90
+ - lib/backup/dependency.rb
91
+ - lib/backup/encryptor/base.rb
92
+ - lib/backup/encryptor/gpg.rb
93
+ - lib/backup/encryptor/open_ssl.rb
94
+ - lib/backup/finder.rb
95
+ - lib/backup/logger.rb
96
+ - lib/backup/model.rb
97
+ - lib/backup/notifier/base.rb
98
+ - lib/backup/notifier/binder.rb
99
+ - lib/backup/notifier/mail.rb
100
+ - lib/backup/notifier/templates/notify_failure.erb
101
+ - lib/backup/notifier/templates/notify_success.erb
102
+ - lib/backup/notifier/twitter.rb
103
+ - lib/backup/storage/base.rb
104
+ - lib/backup/storage/cloudfiles.rb
105
+ - lib/backup/storage/dropbox.rb
106
+ - lib/backup/storage/ftp.rb
107
+ - lib/backup/storage/object.rb
108
+ - lib/backup/storage/rsync.rb
109
+ - lib/backup/storage/s3.rb
110
+ - lib/backup/storage/scp.rb
111
+ - lib/backup/storage/sftp.rb
112
+ - lib/backup/syncer/base.rb
113
+ - lib/backup/syncer/rsync.rb
114
+ - lib/backup/syncer/s3.rb
115
+ - lib/backup/version.rb
116
+ - lib/templates/archive
117
+ - lib/templates/compressor/gzip
118
+ - lib/templates/database/mongodb
119
+ - lib/templates/database/mysql
120
+ - lib/templates/database/postgresql
121
+ - lib/templates/database/redis
122
+ - lib/templates/encryptor/gpg
123
+ - lib/templates/encryptor/openssl
124
+ - lib/templates/notifier/mail
125
+ - lib/templates/notifier/twitter
126
+ - lib/templates/readme
127
+ - lib/templates/storage/cloudfiles
128
+ - lib/templates/storage/dropbox
129
+ - lib/templates/storage/ftp
130
+ - lib/templates/storage/rsync
131
+ - lib/templates/storage/s3
132
+ - lib/templates/storage/scp
133
+ - lib/templates/storage/sftp
134
+ - lib/templates/syncer/rsync
135
+ - lib/templates/syncer/s3
136
+ - spec/archive_spec.rb
137
+ - spec/backup_spec.rb
138
+ - spec/compressor/gzip_spec.rb
139
+ - spec/configuration/base_spec.rb
140
+ - spec/configuration/compressor/gzip_spec.rb
141
+ - spec/configuration/database/base_spec.rb
142
+ - spec/configuration/database/mongodb_spec.rb
143
+ - spec/configuration/database/mysql_spec.rb
144
+ - spec/configuration/database/postgresql_spec.rb
145
+ - spec/configuration/database/redis_spec.rb
146
+ - spec/configuration/encryptor/gpg_spec.rb
147
+ - spec/configuration/encryptor/open_ssl_spec.rb
148
+ - spec/configuration/notifier/mail_spec.rb
149
+ - spec/configuration/storage/cloudfiles_spec.rb
150
+ - spec/configuration/storage/dropbox_spec.rb
151
+ - spec/configuration/storage/ftp_spec.rb
152
+ - spec/configuration/storage/rsync_spec.rb
153
+ - spec/configuration/storage/s3_spec.rb
154
+ - spec/configuration/storage/scp_spec.rb
155
+ - spec/configuration/storage/sftp_spec.rb
156
+ - spec/configuration/syncer/rsync_spec.rb
157
+ - spec/configuration/syncer/s3_spec.rb
158
+ - spec/database/base_spec.rb
159
+ - spec/database/mongodb_spec.rb
160
+ - spec/database/mysql_spec.rb
161
+ - spec/database/postgresql_spec.rb
162
+ - spec/database/redis_spec.rb
163
+ - spec/encryptor/gpg_spec.rb
164
+ - spec/encryptor/open_ssl_spec.rb
165
+ - spec/logger_spec.rb
166
+ - spec/model_spec.rb
167
+ - spec/notifier/mail_spec.rb
168
+ - spec/notifier/twitter_spec.rb
169
+ - spec/spec_helper.rb
170
+ - spec/storage/base_spec.rb
171
+ - spec/storage/cloudfiles_spec.rb
172
+ - spec/storage/dropbox_spec.rb
173
+ - spec/storage/ftp_spec.rb
174
+ - spec/storage/object_spec.rb
175
+ - spec/storage/rsync_spec.rb
176
+ - spec/storage/s3_spec.rb
177
+ - spec/storage/scp_spec.rb
178
+ - spec/storage/sftp_spec.rb
179
+ - spec/syncer/rsync_spec.rb
180
+ - spec/syncer/s3_spec.rb
181
+ - spec/version_spec.rb
182
+ has_rdoc: true
183
+ homepage: http://rubygems.org/gems/backup
184
+ licenses: []
185
+
186
+ post_install_message:
187
+ rdoc_options: []
188
+
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ requirements: []
210
+
211
+ rubyforge_project:
212
+ rubygems_version: 1.3.7
213
+ signing_key:
214
+ specification_version: 3
215
+ summary: "Backup is a RubyGem (for UNIX-like operating systems: Linux, Mac OSX) that allows you to configure and perform backups in a simple manner using an elegant Ruby DSL. It supports various databases (MySQL, PostgreSQL, MongoDB and Redis), it supports various storage locations (Amazon S3, Rackspace Cloud Files, Dropbox, any remote server through FTP, SFTP, SCP and RSync), it provide Syncers (RSync, S3) for efficient backups, it can archive files and directories, it can cycle backups, it can do incremental backups, it can compress backups, it can encrypt backups (OpenSSL or GPG), it can notify you about successful and/or failed backups (Email or Twitter). It is very extensible and easy to add new functionality to. It's easy to use."
216
+ test_files: []
217
+