backup 3.0.20 → 3.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. data/Gemfile +1 -5
  2. data/Gemfile.lock +46 -50
  3. data/README.md +54 -27
  4. data/lib/backup.rb +16 -39
  5. data/lib/backup/archive.rb +42 -18
  6. data/lib/backup/cleaner.rb +110 -25
  7. data/lib/backup/cli/helpers.rb +17 -32
  8. data/lib/backup/cli/utility.rb +46 -107
  9. data/lib/backup/compressor/base.rb +14 -2
  10. data/lib/backup/compressor/bzip2.rb +10 -24
  11. data/lib/backup/compressor/gzip.rb +10 -24
  12. data/lib/backup/compressor/lzma.rb +10 -23
  13. data/lib/backup/compressor/pbzip2.rb +12 -32
  14. data/lib/backup/config.rb +171 -0
  15. data/lib/backup/configuration/compressor/base.rb +1 -2
  16. data/lib/backup/configuration/compressor/pbzip2.rb +4 -4
  17. data/lib/backup/configuration/database/base.rb +2 -1
  18. data/lib/backup/configuration/database/mongodb.rb +8 -0
  19. data/lib/backup/configuration/database/mysql.rb +4 -0
  20. data/lib/backup/configuration/database/postgresql.rb +4 -0
  21. data/lib/backup/configuration/database/redis.rb +4 -0
  22. data/lib/backup/configuration/database/riak.rb +5 -1
  23. data/lib/backup/configuration/encryptor/base.rb +1 -2
  24. data/lib/backup/configuration/encryptor/open_ssl.rb +1 -1
  25. data/lib/backup/configuration/helpers.rb +7 -2
  26. data/lib/backup/configuration/notifier/base.rb +4 -28
  27. data/lib/backup/configuration/storage/base.rb +1 -1
  28. data/lib/backup/configuration/storage/dropbox.rb +14 -4
  29. data/lib/backup/configuration/syncer/base.rb +10 -0
  30. data/lib/backup/configuration/syncer/rsync/base.rb +28 -0
  31. data/lib/backup/configuration/syncer/rsync/local.rb +11 -0
  32. data/lib/backup/configuration/syncer/rsync/pull.rb +11 -0
  33. data/lib/backup/configuration/syncer/rsync/push.rb +31 -0
  34. data/lib/backup/configuration/syncer/s3.rb +0 -4
  35. data/lib/backup/database/base.rb +25 -7
  36. data/lib/backup/database/mongodb.rb +112 -75
  37. data/lib/backup/database/mysql.rb +54 -29
  38. data/lib/backup/database/postgresql.rb +60 -42
  39. data/lib/backup/database/redis.rb +61 -39
  40. data/lib/backup/database/riak.rb +35 -11
  41. data/lib/backup/dependency.rb +4 -5
  42. data/lib/backup/encryptor/base.rb +13 -1
  43. data/lib/backup/encryptor/gpg.rb +39 -39
  44. data/lib/backup/encryptor/open_ssl.rb +28 -38
  45. data/lib/backup/logger.rb +20 -11
  46. data/lib/backup/model.rb +206 -163
  47. data/lib/backup/notifier/base.rb +27 -25
  48. data/lib/backup/notifier/campfire.rb +7 -13
  49. data/lib/backup/notifier/hipchat.rb +28 -28
  50. data/lib/backup/notifier/mail.rb +24 -26
  51. data/lib/backup/notifier/presently.rb +10 -18
  52. data/lib/backup/notifier/prowl.rb +9 -17
  53. data/lib/backup/notifier/twitter.rb +11 -18
  54. data/lib/backup/package.rb +47 -0
  55. data/lib/backup/packager.rb +81 -16
  56. data/lib/backup/splitter.rb +48 -35
  57. data/lib/backup/storage/base.rb +44 -172
  58. data/lib/backup/storage/cloudfiles.rb +31 -46
  59. data/lib/backup/storage/cycler.rb +117 -0
  60. data/lib/backup/storage/dropbox.rb +92 -76
  61. data/lib/backup/storage/ftp.rb +30 -40
  62. data/lib/backup/storage/local.rb +44 -45
  63. data/lib/backup/storage/ninefold.rb +55 -49
  64. data/lib/backup/storage/rsync.rb +49 -56
  65. data/lib/backup/storage/s3.rb +33 -44
  66. data/lib/backup/storage/scp.rb +21 -48
  67. data/lib/backup/storage/sftp.rb +26 -40
  68. data/lib/backup/syncer/base.rb +7 -0
  69. data/lib/backup/syncer/rsync/base.rb +78 -0
  70. data/lib/backup/syncer/rsync/local.rb +53 -0
  71. data/lib/backup/syncer/rsync/pull.rb +38 -0
  72. data/lib/backup/syncer/rsync/push.rb +113 -0
  73. data/lib/backup/syncer/s3.rb +42 -32
  74. data/lib/backup/version.rb +1 -1
  75. data/spec/archive_spec.rb +235 -69
  76. data/spec/cleaner_spec.rb +304 -0
  77. data/spec/cli/helpers_spec.rb +142 -1
  78. data/spec/cli/utility_spec.rb +338 -13
  79. data/spec/compressor/base_spec.rb +31 -0
  80. data/spec/compressor/bzip2_spec.rb +60 -35
  81. data/spec/compressor/gzip_spec.rb +60 -35
  82. data/spec/compressor/lzma_spec.rb +60 -35
  83. data/spec/compressor/pbzip2_spec.rb +98 -37
  84. data/spec/config_spec.rb +321 -0
  85. data/spec/configuration/base_spec.rb +4 -4
  86. data/spec/configuration/compressor/bzip2_spec.rb +1 -0
  87. data/spec/configuration/compressor/gzip_spec.rb +1 -0
  88. data/spec/configuration/compressor/lzma_spec.rb +1 -0
  89. data/spec/configuration/compressor/pbzip2_spec.rb +32 -0
  90. data/spec/configuration/database/base_spec.rb +2 -1
  91. data/spec/configuration/database/mongodb_spec.rb +26 -16
  92. data/spec/configuration/database/mysql_spec.rb +4 -0
  93. data/spec/configuration/database/postgresql_spec.rb +4 -0
  94. data/spec/configuration/database/redis_spec.rb +4 -0
  95. data/spec/configuration/database/riak_spec.rb +4 -0
  96. data/spec/configuration/encryptor/gpg_spec.rb +1 -0
  97. data/spec/configuration/encryptor/open_ssl_spec.rb +1 -0
  98. data/spec/configuration/notifier/base_spec.rb +32 -0
  99. data/spec/configuration/notifier/campfire_spec.rb +1 -0
  100. data/spec/configuration/notifier/hipchat_spec.rb +1 -0
  101. data/spec/configuration/notifier/mail_spec.rb +1 -0
  102. data/spec/configuration/notifier/presently_spec.rb +1 -0
  103. data/spec/configuration/notifier/prowl_spec.rb +1 -0
  104. data/spec/configuration/notifier/twitter_spec.rb +1 -0
  105. data/spec/configuration/storage/cloudfiles_spec.rb +1 -0
  106. data/spec/configuration/storage/dropbox_spec.rb +4 -3
  107. data/spec/configuration/storage/ftp_spec.rb +1 -0
  108. data/spec/configuration/storage/local_spec.rb +1 -0
  109. data/spec/configuration/storage/ninefold_spec.rb +1 -0
  110. data/spec/configuration/storage/rsync_spec.rb +3 -1
  111. data/spec/configuration/storage/s3_spec.rb +1 -0
  112. data/spec/configuration/storage/scp_spec.rb +1 -0
  113. data/spec/configuration/storage/sftp_spec.rb +1 -0
  114. data/spec/configuration/syncer/rsync/base_spec.rb +33 -0
  115. data/spec/configuration/syncer/rsync/local_spec.rb +10 -0
  116. data/spec/configuration/syncer/rsync/pull_spec.rb +10 -0
  117. data/spec/configuration/syncer/{rsync_spec.rb → rsync/push_spec.rb} +12 -15
  118. data/spec/configuration/syncer/s3_spec.rb +2 -3
  119. data/spec/database/base_spec.rb +35 -20
  120. data/spec/database/mongodb_spec.rb +298 -119
  121. data/spec/database/mysql_spec.rb +147 -72
  122. data/spec/database/postgresql_spec.rb +155 -100
  123. data/spec/database/redis_spec.rb +200 -97
  124. data/spec/database/riak_spec.rb +82 -24
  125. data/spec/dependency_spec.rb +49 -0
  126. data/spec/encryptor/base_spec.rb +30 -0
  127. data/spec/encryptor/gpg_spec.rb +105 -28
  128. data/spec/encryptor/open_ssl_spec.rb +85 -114
  129. data/spec/logger_spec.rb +74 -8
  130. data/spec/model_spec.rb +528 -220
  131. data/spec/notifier/base_spec.rb +89 -0
  132. data/spec/notifier/campfire_spec.rb +147 -119
  133. data/spec/notifier/hipchat_spec.rb +140 -145
  134. data/spec/notifier/mail_spec.rb +190 -248
  135. data/spec/notifier/presently_spec.rb +147 -282
  136. data/spec/notifier/prowl_spec.rb +79 -111
  137. data/spec/notifier/twitter_spec.rb +87 -106
  138. data/spec/package_spec.rb +61 -0
  139. data/spec/packager_spec.rb +154 -0
  140. data/spec/spec_helper.rb +36 -13
  141. data/spec/splitter_spec.rb +90 -41
  142. data/spec/storage/base_spec.rb +95 -239
  143. data/spec/storage/cloudfiles_spec.rb +185 -75
  144. data/spec/storage/cycler_spec.rb +239 -0
  145. data/spec/storage/dropbox_spec.rb +318 -87
  146. data/spec/storage/ftp_spec.rb +165 -152
  147. data/spec/storage/local_spec.rb +206 -54
  148. data/spec/storage/ninefold_spec.rb +264 -128
  149. data/spec/storage/rsync_spec.rb +244 -163
  150. data/spec/storage/s3_spec.rb +175 -64
  151. data/spec/storage/scp_spec.rb +156 -150
  152. data/spec/storage/sftp_spec.rb +153 -135
  153. data/spec/syncer/base_spec.rb +22 -0
  154. data/spec/syncer/rsync/base_spec.rb +118 -0
  155. data/spec/syncer/rsync/local_spec.rb +121 -0
  156. data/spec/syncer/rsync/pull_spec.rb +90 -0
  157. data/spec/syncer/rsync/push_spec.rb +327 -0
  158. data/spec/syncer/s3_spec.rb +180 -91
  159. data/templates/cli/utility/config +1 -1
  160. data/templates/cli/utility/database/mongodb +4 -0
  161. data/templates/cli/utility/database/mysql +3 -0
  162. data/templates/cli/utility/database/postgresql +3 -0
  163. data/templates/cli/utility/database/redis +3 -0
  164. data/templates/cli/utility/database/riak +3 -0
  165. data/templates/cli/utility/storage/dropbox +4 -1
  166. data/templates/cli/utility/syncer/rsync_local +12 -0
  167. data/templates/cli/utility/syncer/{rsync → rsync_pull} +2 -2
  168. data/templates/cli/utility/syncer/rsync_push +17 -0
  169. data/templates/storage/dropbox/authorization_url.erb +1 -1
  170. metadata +42 -17
  171. data/lib/backup/configuration/syncer/rsync.rb +0 -45
  172. data/lib/backup/finder.rb +0 -87
  173. data/lib/backup/storage/object.rb +0 -47
  174. data/lib/backup/syncer/rsync.rb +0 -152
  175. data/spec/backup_spec.rb +0 -11
  176. data/spec/finder_spec.rb +0 -91
  177. data/spec/storage/object_spec.rb +0 -74
  178. data/spec/syncer/rsync_spec.rb +0 -195
@@ -3,136 +3,225 @@
3
3
  require File.expand_path('../../spec_helper.rb', __FILE__)
4
4
 
5
5
  describe Backup::Syncer::S3 do
6
-
7
- let(:s3) do
6
+ let(:syncer) do
8
7
  Backup::Syncer::S3.new do |s3|
9
8
  s3.access_key_id = 'my_access_key_id'
10
9
  s3.secret_access_key = 'my_secret_access_key'
11
10
  s3.bucket = 'my-bucket'
12
- s3.path = "/backups"
13
- s3.mirror = true
11
+ s3.path = "/my_backups"
14
12
 
15
13
  s3.directories do |directory|
16
- directory.add "/some/random/directory"
17
- directory.add "/another/random/directory"
14
+ directory.add "/some/directory"
15
+ directory.add "~/home/directory"
18
16
  end
19
- end
20
- end
21
17
 
22
- before do
23
- Backup::Configuration::Syncer::S3.clear_defaults!
18
+ s3.mirror = true
19
+ s3.additional_options = ['--opt-a', '--opt-b']
20
+ end
24
21
  end
25
22
 
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
23
+ describe '#initialize' do
34
24
 
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
25
+ it 'should have defined the configuration properly' do
26
+ syncer.access_key_id.should == 'my_access_key_id'
27
+ syncer.secret_access_key.should == 'my_secret_access_key'
28
+ syncer.bucket.should == 'my-bucket'
29
+ syncer.path.should == '/my_backups'
30
+ syncer.directories.should == ["/some/directory", "~/home/directory"]
31
+ syncer.mirror.should == true
32
+ syncer.additional_options.should == ['--opt-a', '--opt-b']
41
33
  end
42
34
 
43
- s3 = Backup::Syncer::S3.new do |s3|
44
- s3.secret_access_key = 'some_secret_access_key'
45
- s3.mirror = false
35
+ context 'when options are not set' do
36
+ it 'should use default values' do
37
+ syncer = Backup::Syncer::S3.new
38
+ syncer.access_key_id.should == nil
39
+ syncer.secret_access_key.should == nil
40
+ syncer.bucket.should == nil
41
+ syncer.path.should == 'backups'
42
+ syncer.directories.should == []
43
+ syncer.mirror.should == false
44
+ syncer.additional_options.should == []
45
+ end
46
46
  end
47
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
48
+ context 'when setting configuration defaults' do
49
+ after { Backup::Configuration::Syncer::S3.clear_defaults! }
50
+
51
+ it 'should use the configured defaults' do
52
+ Backup::Configuration::Syncer::S3.defaults do |s3|
53
+ s3.access_key_id = 'some_access_key_id'
54
+ s3.secret_access_key = 'some_secret_access_key'
55
+ s3.bucket = 'some_bucket'
56
+ s3.path = 'some_path'
57
+ #s3.directories = 'cannot_have_a_default_value'
58
+ s3.mirror = 'some_mirror'
59
+ s3.additional_options = 'some_additional_options'
60
+ end
61
+ syncer = Backup::Syncer::S3.new
62
+ syncer.access_key_id.should == 'some_access_key_id'
63
+ syncer.secret_access_key.should == 'some_secret_access_key'
64
+ syncer.bucket.should == 'some_bucket'
65
+ syncer.path.should == 'some_path'
66
+ syncer.directories.should == []
67
+ syncer.mirror.should == 'some_mirror'
68
+ syncer.additional_options.should == 'some_additional_options'
69
+ end
62
70
 
63
- describe '#mirror' do
64
- context 'when true' do
65
- it do
66
- s3.mirror = true
67
- s3.mirror.should == '--delete'
71
+ it 'should override the configured defaults' do
72
+ Backup::Configuration::Syncer::S3.defaults do |s3|
73
+ s3.access_key_id = 'old_access_key_id'
74
+ s3.secret_access_key = 'old_secret_access_key'
75
+ s3.bucket = 'old_bucket'
76
+ s3.path = 'old_path'
77
+ #s3.directories = 'cannot_have_a_default_value'
78
+ s3.mirror = 'old_mirror'
79
+ s3.additional_options = 'old_additional_options'
80
+ end
81
+ syncer = Backup::Syncer::S3.new do |s3|
82
+ s3.access_key_id = 'new_access_key_id'
83
+ s3.secret_access_key = 'new_secret_access_key'
84
+ s3.bucket = 'new_bucket'
85
+ s3.path = 'new_path'
86
+ s3.directories = 'new_directories'
87
+ s3.mirror = 'new_mirror'
88
+ s3.additional_options = 'new_additional_options'
89
+ end
90
+
91
+ syncer.access_key_id.should == 'new_access_key_id'
92
+ syncer.secret_access_key.should == 'new_secret_access_key'
93
+ syncer.bucket.should == 'new_bucket'
94
+ syncer.path.should == 'new_path'
95
+ syncer.directories.should == 'new_directories'
96
+ syncer.mirror.should == 'new_mirror'
97
+ syncer.additional_options.should == 'new_additional_options'
68
98
  end
99
+ end # context 'when setting configuration defaults'
100
+ end # describe '#initialize'
101
+
102
+ describe '#perform!' do
103
+ let(:s) { sequence '' }
104
+
105
+ before do
106
+ syncer.expects(:utility).twice.with(:s3sync).returns('s3sync')
107
+ syncer.expects(:options).twice.returns('options_output')
69
108
  end
70
109
 
71
- context 'when nil/false' do
72
- it do
73
- s3.mirror = nil
74
- s3.mirror.should == nil
75
- end
110
+ it 'should sync two directories' do
111
+ syncer.expects(:set_environment_variables!).in_sequence(s)
112
+
113
+ # first directory
114
+ Backup::Logger.expects(:message).in_sequence(s).with(
115
+ "Syncer::S3 started syncing '/some/directory'."
116
+ )
117
+ syncer.expects(:run).in_sequence(s).with(
118
+ "s3sync options_output '/some/directory' 'my-bucket:my_backups'"
119
+ ).returns('messages from stdout')
120
+ Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
121
+
122
+ # second directory
123
+ Backup::Logger.expects(:message).in_sequence(s).with(
124
+ "Syncer::S3 started syncing '~/home/directory'."
125
+ )
126
+ syncer.expects(:run).in_sequence(s).with(
127
+ "s3sync options_output '#{ File.expand_path('~/home/directory') }' " +
128
+ "'my-bucket:my_backups'"
129
+ ).returns('messages from stdout')
130
+ Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
131
+
132
+ syncer.expects(:unset_environment_variables!).in_sequence(s)
133
+
134
+ syncer.perform!
135
+ end
136
+ end # describe '#perform!'
76
137
 
77
- it do
78
- s3.mirror = false
79
- s3.mirror.should == nil
138
+ describe '#directories' do
139
+ context 'when no block is given' do
140
+ it 'should return @directories' do
141
+ syncer.directories.should ==
142
+ ['/some/directory', '~/home/directory']
80
143
  end
81
144
  end
82
- end
83
145
 
84
- describe '#recursive' do
85
- it do
86
- s3.recursive.should == '--recursive'
146
+ context 'when a block is given' do
147
+ it 'should evalute the block, allowing #add to add directories' do
148
+ syncer.directories do
149
+ add '/new/path'
150
+ add '~/new/home/path'
151
+ end
152
+ syncer.directories.should == [
153
+ '/some/directory',
154
+ '~/home/directory',
155
+ '/new/path',
156
+ '~/new/home/path'
157
+ ]
158
+ end
87
159
  end
88
- end
160
+ end # describe '#directories'
89
161
 
90
- describe '#additional_options' do
91
- it do
92
- s3.additional_options = ['--exclude="*.rb"']
93
- s3.options.should == '--verbose --recursive --delete --exclude="*.rb"'
162
+ describe '#add' do
163
+ it 'should add the given path to @directories' do
164
+ syncer.add '/my/path'
165
+ syncer.directories.should ==
166
+ ['/some/directory', '~/home/directory', '/my/path']
94
167
  end
95
168
  end
96
169
 
97
- describe '#verbose' do
98
- it do
99
- s3.verbose.should == '--verbose'
170
+ describe '#dest_path' do
171
+ it 'should remove any preceeding "/" from @path' do
172
+ syncer.send(:dest_path).should == 'my_backups'
100
173
  end
101
- end
102
174
 
103
- describe '#directories' do
104
- context 'when its empty' do
105
- it do
106
- s3.directories = []
107
- s3.directories.should == []
108
- end
175
+ it 'should set @dest_path' do
176
+ syncer.send(:dest_path)
177
+ syncer.instance_variable_get(:@dest_path).should == 'my_backups'
109
178
  end
110
179
 
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
180
+ it 'should return @dest_path if already set' do
181
+ syncer.instance_variable_set(:@dest_path, 'foo')
182
+ syncer.send(:dest_path).should == 'foo'
116
183
  end
117
184
  end
118
185
 
119
186
  describe '#options' do
120
- it do
121
- s3.options.should == "--verbose --recursive --delete"
187
+ context 'when @mirror is true' do
188
+ it 'should return the options with mirroring enabled' do
189
+ syncer.send(:options).should ==
190
+ '--verbose --recursive --delete --opt-a --opt-b'
191
+ end
122
192
  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
193
 
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'")
194
+ context 'when @mirror is false' do
195
+ before { syncer.mirror = false }
196
+ it 'should return the options without mirroring enabled' do
197
+ syncer.send(:options).should ==
198
+ '--verbose --recursive --opt-a --opt-b'
199
+ end
200
+ end
134
201
 
135
- s3.perform!
202
+ context 'with no additional options' do
203
+ before { syncer.additional_options = [] }
204
+ it 'should return the options without additional options' do
205
+ syncer.send(:options).should ==
206
+ '--verbose --recursive --delete'
207
+ end
208
+ end
209
+ end # describe '#options'
210
+
211
+ describe 'changing environment variables' do
212
+ before { @env = ENV }
213
+ after { ENV.replace(@env) }
214
+
215
+ it 'should set and unset environment variables' do
216
+ syncer.send(:set_environment_variables!)
217
+ ENV['AWS_ACCESS_KEY_ID'].should == 'my_access_key_id'
218
+ ENV['AWS_SECRET_ACCESS_KEY'].should == 'my_secret_access_key'
219
+ ENV['AWS_CALLING_FORMAT'].should == 'SUBDOMAIN'
220
+
221
+ syncer.send(:unset_environment_variables!)
222
+ ENV['AWS_ACCESS_KEY_ID'].should == nil
223
+ ENV['AWS_SECRET_ACCESS_KEY'].should == nil
224
+ ENV['AWS_CALLING_FORMAT'].should == nil
136
225
  end
137
226
  end
138
227
 
@@ -26,6 +26,6 @@ end
26
26
 
27
27
  ##
28
28
  # Load all models from the models directory (after the above global configuration blocks)
29
- Dir[File.join(File.dirname(Backup::CONFIG_FILE), "models", "*.rb")].each do |model|
29
+ Dir[File.join(File.dirname(Config.config_file), "models", "*.rb")].each do |model|
30
30
  instance_eval(File.read(model))
31
31
  end
@@ -11,4 +11,8 @@
11
11
  db.only_collections = ['only', 'these' 'collections']
12
12
  db.additional_options = []
13
13
  db.lock = false
14
+ # Optional: Use to set the location of these utilities
15
+ # if they cannot be found by their name in your $PATH
16
+ # db.mongodump_utility = '/opt/local/bin/mongodump'
17
+ # db.mongo_utility = '/opt/local/bin/mongo'
14
18
  end
@@ -11,4 +11,7 @@
11
11
  db.skip_tables = ['skip', 'these', 'tables']
12
12
  db.only_tables = ['only', 'these' 'tables']
13
13
  db.additional_options = ['--quick', '--single-transaction']
14
+ # Optional: Use to set the location of this utility
15
+ # if it cannot be found by name in your $PATH
16
+ # db.mysqldump_utility = '/opt/local/bin/mysqldump'
14
17
  end
@@ -11,4 +11,7 @@
11
11
  db.skip_tables = ['skip', 'these', 'tables']
12
12
  db.only_tables = ['only', 'these' 'tables']
13
13
  db.additional_options = ['-xc', '-E=utf8']
14
+ # Optional: Use to set the location of this utility
15
+ # if it cannot be found by name in your $PATH
16
+ # db.pg_dump_utility = '/opt/local/bin/pg_dump'
14
17
  end
@@ -10,4 +10,7 @@
10
10
  db.socket = "/tmp/redis.sock"
11
11
  db.additional_options = []
12
12
  db.invoke_save = true
13
+ # Optional: Use to set the location of this utility
14
+ # if it cannot be found by name in your $PATH
15
+ # db.redis_cli_utility = '/opt/local/bin/redis-cli'
13
16
  end
@@ -5,4 +5,7 @@
5
5
  db.name = "hostname"
6
6
  db.node = "riak@hostname"
7
7
  db.cookie = "cookie"
8
+ # Optional: Use to set the location of this utility
9
+ # if it cannot be found by name in your $PATH
10
+ # db.riak_admin_utility = '/opt/local/bin/riak-admin'
8
11
  end
@@ -6,7 +6,10 @@
6
6
  store_with Dropbox do |db|
7
7
  db.api_key = 'my_api_key'
8
8
  db.api_secret = 'my_api_secret'
9
- db.timeout = 300
9
+ # Dropbox Access Type
10
+ # The default value is :app_folder
11
+ # Change this to :dropbox if needed
12
+ # db.access_type = :dropbox
10
13
  db.path = '/path/to/my/backups'
11
14
  db.keep = 25
12
15
  end
@@ -0,0 +1,12 @@
1
+ ##
2
+ # RSync::Local [Syncer]
3
+ #
4
+ sync_with RSync::Local do |rsync|
5
+ rsync.path = "~/backups/"
6
+ rsync.mirror = true
7
+
8
+ rsync.directories do |directory|
9
+ directory.add "/var/apps/my_app/public/uploads"
10
+ directory.add "/var/apps/my_app/logs"
11
+ end
12
+ end
@@ -1,7 +1,7 @@
1
1
  ##
2
- # RSync [Syncer]
2
+ # RSync::Pull [Syncer]
3
3
  #
4
- sync_with RSync do |rsync|
4
+ sync_with RSync::Pull do |rsync|
5
5
  rsync.ip = "123.45.678.90"
6
6
  rsync.port = 22
7
7
  rsync.username = "my_username"
@@ -0,0 +1,17 @@
1
+ ##
2
+ # RSync::Push [Syncer]
3
+ #
4
+ sync_with RSync::Push do |rsync|
5
+ rsync.ip = "123.45.678.90"
6
+ rsync.port = 22
7
+ rsync.username = "my_username"
8
+ rsync.password = "my_password"
9
+ rsync.path = "~/backups/"
10
+ rsync.mirror = true
11
+ rsync.compress = true
12
+
13
+ rsync.directories do |directory|
14
+ directory.add "/var/apps/my_app/public/uploads"
15
+ directory.add "/var/apps/my_app/logs"
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
 
2
2
  Visit the following URL to authorize your Dropbox App with Backup:
3
3
 
4
- <%= @session.authorize_url %>
4
+ <%= @session.get_authorize_url %>
5
5
 
6
6
  Hit "Enter/Return" once you're authorized.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.20
4
+ version: 3.0.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-22 00:00:00.000000000 Z
12
+ date: 2012-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70199932850880 !ruby/object:Gem::Requirement
16
+ requirement: &70322872021320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70199932850880
24
+ version_requirements: *70322872021320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: POpen4
27
- requirement: &70199932850360 !ruby/object:Gem::Requirement
27
+ requirement: &70322872019160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.1.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70199932850360
35
+ version_requirements: *70322872019160
36
36
  description:
37
37
  email: meskyanichi@gmail.com
38
38
  executables:
@@ -60,6 +60,7 @@ files:
60
60
  - lib/backup/compressor/gzip.rb
61
61
  - lib/backup/compressor/lzma.rb
62
62
  - lib/backup/compressor/pbzip2.rb
63
+ - lib/backup/config.rb
63
64
  - lib/backup/configuration/base.rb
64
65
  - lib/backup/configuration/compressor/base.rb
65
66
  - lib/backup/configuration/compressor/bzip2.rb
@@ -93,7 +94,11 @@ files:
93
94
  - lib/backup/configuration/storage/s3.rb
94
95
  - lib/backup/configuration/storage/scp.rb
95
96
  - lib/backup/configuration/storage/sftp.rb
96
- - lib/backup/configuration/syncer/rsync.rb
97
+ - lib/backup/configuration/syncer/base.rb
98
+ - lib/backup/configuration/syncer/rsync/base.rb
99
+ - lib/backup/configuration/syncer/rsync/local.rb
100
+ - lib/backup/configuration/syncer/rsync/pull.rb
101
+ - lib/backup/configuration/syncer/rsync/push.rb
97
102
  - lib/backup/configuration/syncer/s3.rb
98
103
  - lib/backup/database/base.rb
99
104
  - lib/backup/database/mongodb.rb
@@ -106,7 +111,6 @@ files:
106
111
  - lib/backup/encryptor/gpg.rb
107
112
  - lib/backup/encryptor/open_ssl.rb
108
113
  - lib/backup/errors.rb
109
- - lib/backup/finder.rb
110
114
  - lib/backup/logger.rb
111
115
  - lib/backup/model.rb
112
116
  - lib/backup/notifier/base.rb
@@ -116,36 +120,43 @@ files:
116
120
  - lib/backup/notifier/presently.rb
117
121
  - lib/backup/notifier/prowl.rb
118
122
  - lib/backup/notifier/twitter.rb
123
+ - lib/backup/package.rb
119
124
  - lib/backup/packager.rb
120
125
  - lib/backup/splitter.rb
121
126
  - lib/backup/storage/base.rb
122
127
  - lib/backup/storage/cloudfiles.rb
128
+ - lib/backup/storage/cycler.rb
123
129
  - lib/backup/storage/dropbox.rb
124
130
  - lib/backup/storage/ftp.rb
125
131
  - lib/backup/storage/local.rb
126
132
  - lib/backup/storage/ninefold.rb
127
- - lib/backup/storage/object.rb
128
133
  - lib/backup/storage/rsync.rb
129
134
  - lib/backup/storage/s3.rb
130
135
  - lib/backup/storage/scp.rb
131
136
  - lib/backup/storage/sftp.rb
132
137
  - lib/backup/syncer/base.rb
133
- - lib/backup/syncer/rsync.rb
138
+ - lib/backup/syncer/rsync/base.rb
139
+ - lib/backup/syncer/rsync/local.rb
140
+ - lib/backup/syncer/rsync/pull.rb
141
+ - lib/backup/syncer/rsync/push.rb
134
142
  - lib/backup/syncer/s3.rb
135
143
  - lib/backup/template.rb
136
144
  - lib/backup/version.rb
137
145
  - spec/archive_spec.rb
138
- - spec/backup_spec.rb
146
+ - spec/cleaner_spec.rb
139
147
  - spec/cli/helpers_spec.rb
140
148
  - spec/cli/utility_spec.rb
149
+ - spec/compressor/base_spec.rb
141
150
  - spec/compressor/bzip2_spec.rb
142
151
  - spec/compressor/gzip_spec.rb
143
152
  - spec/compressor/lzma_spec.rb
144
153
  - spec/compressor/pbzip2_spec.rb
154
+ - spec/config_spec.rb
145
155
  - spec/configuration/base_spec.rb
146
156
  - spec/configuration/compressor/bzip2_spec.rb
147
157
  - spec/configuration/compressor/gzip_spec.rb
148
158
  - spec/configuration/compressor/lzma_spec.rb
159
+ - spec/configuration/compressor/pbzip2_spec.rb
149
160
  - spec/configuration/database/base_spec.rb
150
161
  - spec/configuration/database/mongodb_spec.rb
151
162
  - spec/configuration/database/mysql_spec.rb
@@ -154,6 +165,7 @@ files:
154
165
  - spec/configuration/database/riak_spec.rb
155
166
  - spec/configuration/encryptor/gpg_spec.rb
156
167
  - spec/configuration/encryptor/open_ssl_spec.rb
168
+ - spec/configuration/notifier/base_spec.rb
157
169
  - spec/configuration/notifier/campfire_spec.rb
158
170
  - spec/configuration/notifier/hipchat_spec.rb
159
171
  - spec/configuration/notifier/mail_spec.rb
@@ -169,7 +181,10 @@ files:
169
181
  - spec/configuration/storage/s3_spec.rb
170
182
  - spec/configuration/storage/scp_spec.rb
171
183
  - spec/configuration/storage/sftp_spec.rb
172
- - spec/configuration/syncer/rsync_spec.rb
184
+ - spec/configuration/syncer/rsync/base_spec.rb
185
+ - spec/configuration/syncer/rsync/local_spec.rb
186
+ - spec/configuration/syncer/rsync/pull_spec.rb
187
+ - spec/configuration/syncer/rsync/push_spec.rb
173
188
  - spec/configuration/syncer/s3_spec.rb
174
189
  - spec/database/base_spec.rb
175
190
  - spec/database/mongodb_spec.rb
@@ -177,32 +192,40 @@ files:
177
192
  - spec/database/postgresql_spec.rb
178
193
  - spec/database/redis_spec.rb
179
194
  - spec/database/riak_spec.rb
195
+ - spec/dependency_spec.rb
196
+ - spec/encryptor/base_spec.rb
180
197
  - spec/encryptor/gpg_spec.rb
181
198
  - spec/encryptor/open_ssl_spec.rb
182
199
  - spec/errors_spec.rb
183
- - spec/finder_spec.rb
184
200
  - spec/logger_spec.rb
185
201
  - spec/model_spec.rb
202
+ - spec/notifier/base_spec.rb
186
203
  - spec/notifier/campfire_spec.rb
187
204
  - spec/notifier/hipchat_spec.rb
188
205
  - spec/notifier/mail_spec.rb
189
206
  - spec/notifier/presently_spec.rb
190
207
  - spec/notifier/prowl_spec.rb
191
208
  - spec/notifier/twitter_spec.rb
209
+ - spec/package_spec.rb
210
+ - spec/packager_spec.rb
192
211
  - spec/spec_helper.rb
193
212
  - spec/splitter_spec.rb
194
213
  - spec/storage/base_spec.rb
195
214
  - spec/storage/cloudfiles_spec.rb
215
+ - spec/storage/cycler_spec.rb
196
216
  - spec/storage/dropbox_spec.rb
197
217
  - spec/storage/ftp_spec.rb
198
218
  - spec/storage/local_spec.rb
199
219
  - spec/storage/ninefold_spec.rb
200
- - spec/storage/object_spec.rb
201
220
  - spec/storage/rsync_spec.rb
202
221
  - spec/storage/s3_spec.rb
203
222
  - spec/storage/scp_spec.rb
204
223
  - spec/storage/sftp_spec.rb
205
- - spec/syncer/rsync_spec.rb
224
+ - spec/syncer/base_spec.rb
225
+ - spec/syncer/rsync/base_spec.rb
226
+ - spec/syncer/rsync/local_spec.rb
227
+ - spec/syncer/rsync/pull_spec.rb
228
+ - spec/syncer/rsync/push_spec.rb
206
229
  - spec/syncer/s3_spec.rb
207
230
  - spec/version_spec.rb
208
231
  - templates/cli/utility/archive
@@ -235,7 +258,9 @@ files:
235
258
  - templates/cli/utility/storage/s3
236
259
  - templates/cli/utility/storage/scp
237
260
  - templates/cli/utility/storage/sftp
238
- - templates/cli/utility/syncer/rsync
261
+ - templates/cli/utility/syncer/rsync_local
262
+ - templates/cli/utility/syncer/rsync_pull
263
+ - templates/cli/utility/syncer/rsync_push
239
264
  - templates/cli/utility/syncer/s3
240
265
  - templates/general/links
241
266
  - templates/general/version.erb
@@ -265,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
290
  version: '0'
266
291
  requirements: []
267
292
  rubyforge_project:
268
- rubygems_version: 1.8.10
293
+ rubygems_version: 1.8.15
269
294
  signing_key:
270
295
  specification_version: 3
271
296
  summary: Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily