astrails-safe 0.2.7 → 0.3.0
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.
- data/.document +5 -0
- data/.gitignore +18 -0
- data/.rspec +3 -0
- data/CHANGELOG +25 -0
- data/Gemfile +4 -0
- data/{LICENSE → LICENSE.txt} +3 -1
- data/README.markdown +109 -114
- data/Rakefile +5 -55
- data/TODO +11 -0
- data/astrails-safe.gemspec +35 -0
- data/lib/astrails/safe.rb +4 -4
- data/lib/astrails/safe/archive.rb +2 -2
- data/lib/astrails/safe/cloudfiles.rb +16 -3
- data/lib/astrails/safe/config/node.rb +1 -1
- data/lib/astrails/safe/local.rb +3 -0
- data/lib/astrails/safe/mysqldump.rb +1 -1
- data/lib/astrails/safe/pipe.rb +4 -0
- data/lib/astrails/safe/s3.rb +10 -2
- data/lib/astrails/safe/sink.rb +2 -0
- data/lib/astrails/safe/source.rb +1 -0
- data/lib/astrails/safe/stream.rb +1 -0
- data/lib/astrails/safe/version.rb +5 -0
- data/{examples/integration/archive_integration_example.rb → spec/integration/archive_integration_spec.rb} +1 -2
- data/{examples/integration/cleanup_example.rb → spec/integration/cleanup_spec.rb} +2 -3
- data/spec/spec_helper.rb +7 -0
- data/{examples/unit/archive_example.rb → spec/unit/archive_spec.rb} +1 -1
- data/spec/unit/cloudfiles_spec.rb +177 -0
- data/{examples/unit/config_example.rb → spec/unit/config_spec.rb} +1 -1
- data/{examples/unit/gpg_example.rb → spec/unit/gpg_spec.rb} +2 -2
- data/{examples/unit/gzip_example.rb → spec/unit/gzip_spec.rb} +6 -6
- data/{examples/unit/local_example.rb → spec/unit/local_spec.rb} +2 -2
- data/{examples/unit/mysqldump_example.rb → spec/unit/mysqldump_spec.rb} +2 -2
- data/{examples/unit/pgdump_example.rb → spec/unit/pgdump_spec.rb} +2 -2
- data/{examples/unit/s3_example.rb → spec/unit/s3_spec.rb} +13 -5
- data/{examples/unit/svndump_example.rb → spec/unit/svndump_spec.rb} +2 -2
- data/templates/script.rb +1 -1
- metadata +186 -91
- data/VERSION.yml +0 -4
- data/examples/example_helper.rb +0 -19
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Astrails::Safe::Gpg do
|
4
4
|
def def_backup
|
@@ -145,4 +145,4 @@ describe Astrails::Safe::Gpg do
|
|
145
145
|
File.read(file).should == "foo"
|
146
146
|
end
|
147
147
|
end
|
148
|
-
end
|
148
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Astrails::Safe::Gzip do
|
4
4
|
|
@@ -43,22 +43,22 @@ describe Astrails::Safe::Gzip do
|
|
43
43
|
|
44
44
|
describe "when already compressed" do
|
45
45
|
|
46
|
-
before(:each) { @gzip = gzip({}, :compressed => true) }
|
46
|
+
before(:each) { @gzip = gzip({}, :extension => ".foo", :command => "foobar", :compressed => true) }
|
47
47
|
|
48
48
|
it "should not touch extension" do
|
49
|
-
dont_allow(@backup.extension).<< anything
|
50
49
|
@gzip.process
|
50
|
+
@backup.extension.should == ".foo"
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should not touch command" do
|
54
|
-
dont_allow(@backup.command).<< anything
|
55
54
|
@gzip.process
|
55
|
+
@backup.command.should == "foobar"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should not touch compressed" do
|
59
|
-
dont_allow(@backup).compressed = anything
|
60
59
|
@gzip.process
|
60
|
+
@backup.compressed.should == true
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Astrails::Safe::Local do
|
4
4
|
def def_config
|
@@ -87,7 +87,7 @@ describe Astrails::Safe::Local do
|
|
87
87
|
|
88
88
|
describe :cleanup do
|
89
89
|
before(:each) do
|
90
|
-
@files = [4,1,3,2].
|
90
|
+
@files = [4,1,3,2].map { |i| "/mysqldump~blog~NoW/qweqwe.#{i}" }
|
91
91
|
stub(File).file?(anything) {true}
|
92
92
|
stub(File).size(anything) {1}
|
93
93
|
stub(File).unlink
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Astrails::Safe::S3 do
|
4
4
|
|
@@ -37,10 +37,10 @@ describe Astrails::Safe::S3 do
|
|
37
37
|
before(:each) do
|
38
38
|
@s3 = s3
|
39
39
|
|
40
|
-
@files = [4,1,3,2].
|
40
|
+
@files = [4,1,3,2].map { |i| stub(o = {}).key {"aaaaa#{i}"}; o }
|
41
41
|
|
42
42
|
stub(AWS::S3::Bucket).objects("_bucket", :prefix => "_kind/_id/_kind-_id.", :max_keys => 4) {@files}
|
43
|
-
stub(AWS::S3::Bucket).
|
43
|
+
stub(AWS::S3::Bucket).objects("_bucket", :prefix => anything).stub![0].stub!.delete
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should check [:keep, :s3]" do
|
@@ -50,8 +50,8 @@ describe Astrails::Safe::S3 do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should delete extra files" do
|
53
|
-
mock(AWS::S3::Bucket).
|
54
|
-
mock(AWS::S3::Bucket).
|
53
|
+
mock(AWS::S3::Bucket).objects("_bucket", :prefix => "aaaaa1").mock![0].mock!.delete
|
54
|
+
mock(AWS::S3::Bucket).objects("_bucket", :prefix => "aaaaa2").mock![0].mock!.delete
|
55
55
|
@s3.send :cleanup
|
56
56
|
end
|
57
57
|
|
@@ -112,6 +112,7 @@ describe Astrails::Safe::S3 do
|
|
112
112
|
when :stat
|
113
113
|
stub(File).stat("foo").stub!.size {123}
|
114
114
|
when :create_bucket
|
115
|
+
stub(AWS::S3::Bucket).find('_bucket') { raise_error AWS::S3::NoSuchBucket }
|
115
116
|
stub(AWS::S3::Bucket).create
|
116
117
|
when :file_open
|
117
118
|
stub(File).open("foo") {|f, block| block.call(:opened_file)}
|
@@ -156,5 +157,12 @@ describe Astrails::Safe::S3 do
|
|
156
157
|
dont_allow(Benchmark).realtime
|
157
158
|
@s3.send(:save)
|
158
159
|
end
|
160
|
+
|
161
|
+
it 'should not create a bucket that already exists' do
|
162
|
+
add_stubs(:connection, :stat, :file_open, :s3_store)
|
163
|
+
stub(AWS::S3::Bucket).find('_bucket') { true }
|
164
|
+
dont_allow(AWS::S3::Bucket).create
|
165
|
+
@s3.send(:save)
|
166
|
+
end
|
159
167
|
end
|
160
168
|
end
|
data/templates/script.rb
CHANGED
@@ -79,7 +79,7 @@ safe do
|
|
79
79
|
|
80
80
|
# database is a 'collection' element. it must have a hash or block parameter
|
81
81
|
# it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
|
82
|
-
# the following code will create mysqldump/databases/blog and mysqldump/databases/mysql
|
82
|
+
# the following code will create mysqldump/databases/blog and mysqldump/databases/mysql configuration 'nodes'
|
83
83
|
|
84
84
|
# backup database with default values
|
85
85
|
# database :blog
|
metadata
CHANGED
@@ -1,78 +1,154 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: astrails-safe
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
-
|
7
|
+
authors:
|
8
|
+
- Vitaly Kushner
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: aws-s3
|
17
16
|
type: :runtime
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
none: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
none: false
|
29
|
+
prerelease: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
26
31
|
name: cloudfiles
|
27
32
|
type: :runtime
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
none: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
none: false
|
45
|
+
prerelease: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
36
47
|
name: net-sftp
|
37
48
|
type: :runtime
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
none: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
none: false
|
61
|
+
prerelease: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bundler
|
64
|
+
type: :development
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.3'
|
70
|
+
none: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
none: false
|
77
|
+
prerelease: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
type: :development
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
none: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
none: false
|
93
|
+
prerelease: false
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
type: :development
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
none: false
|
103
|
+
version_requirements: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
none: false
|
109
|
+
prerelease: false
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rr
|
112
|
+
type: :development
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.0.4
|
118
|
+
none: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ~>
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.0.4
|
124
|
+
none: false
|
125
|
+
prerelease: false
|
126
|
+
description: ! 'Astrails-Safe is a simple tool to backup databases (MySQL and PostgreSQL),
|
127
|
+
Subversion repositories (with svndump) and just files.
|
128
|
+
|
47
129
|
Backups can be stored locally or remotely and can be enctypted.
|
130
|
+
|
48
131
|
Remote storage is supported on Amazon S3, Rackspace Cloud Files, or just plain SFTP.
|
49
132
|
|
50
|
-
|
51
|
-
|
133
|
+
'
|
134
|
+
email:
|
135
|
+
- we@astrails.com
|
136
|
+
executables:
|
52
137
|
- astrails-safe
|
53
138
|
extensions: []
|
54
|
-
|
55
|
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
|
59
|
-
-
|
139
|
+
extra_rdoc_files: []
|
140
|
+
files:
|
141
|
+
- .document
|
142
|
+
- .gitignore
|
143
|
+
- .rspec
|
144
|
+
- CHANGELOG
|
145
|
+
- Gemfile
|
146
|
+
- LICENSE.txt
|
60
147
|
- README.markdown
|
61
148
|
- Rakefile
|
62
|
-
-
|
149
|
+
- TODO
|
150
|
+
- astrails-safe.gemspec
|
63
151
|
- bin/astrails-safe
|
64
|
-
- examples/example_helper.rb
|
65
|
-
- examples/integration/archive_integration_example.rb
|
66
|
-
- examples/integration/cleanup_example.rb
|
67
|
-
- examples/unit/archive_example.rb
|
68
|
-
- examples/unit/config_example.rb
|
69
|
-
- examples/unit/gpg_example.rb
|
70
|
-
- examples/unit/gzip_example.rb
|
71
|
-
- examples/unit/local_example.rb
|
72
|
-
- examples/unit/mysqldump_example.rb
|
73
|
-
- examples/unit/pgdump_example.rb
|
74
|
-
- examples/unit/s3_example.rb
|
75
|
-
- examples/unit/svndump_example.rb
|
76
152
|
- lib/astrails/safe.rb
|
77
153
|
- lib/astrails/safe/archive.rb
|
78
154
|
- lib/astrails/safe/backup.rb
|
@@ -92,46 +168,65 @@ files:
|
|
92
168
|
- lib/astrails/safe/stream.rb
|
93
169
|
- lib/astrails/safe/svndump.rb
|
94
170
|
- lib/astrails/safe/tmp_file.rb
|
171
|
+
- lib/astrails/safe/version.rb
|
95
172
|
- lib/extensions/mktmpdir.rb
|
173
|
+
- spec/integration/archive_integration_spec.rb
|
174
|
+
- spec/integration/cleanup_spec.rb
|
175
|
+
- spec/spec_helper.rb
|
176
|
+
- spec/unit/archive_spec.rb
|
177
|
+
- spec/unit/cloudfiles_spec.rb
|
178
|
+
- spec/unit/config_spec.rb
|
179
|
+
- spec/unit/gpg_spec.rb
|
180
|
+
- spec/unit/gzip_spec.rb
|
181
|
+
- spec/unit/local_spec.rb
|
182
|
+
- spec/unit/mysqldump_spec.rb
|
183
|
+
- spec/unit/pgdump_spec.rb
|
184
|
+
- spec/unit/s3_spec.rb
|
185
|
+
- spec/unit/svndump_spec.rb
|
96
186
|
- templates/script.rb
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
187
|
+
homepage: http://astrails.com/astrails-safe
|
188
|
+
licenses:
|
189
|
+
- MIT
|
101
190
|
post_install_message:
|
102
|
-
rdoc_options:
|
103
|
-
|
104
|
-
require_paths:
|
191
|
+
rdoc_options: []
|
192
|
+
require_paths:
|
105
193
|
- lib
|
106
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - ! '>='
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
segments:
|
199
|
+
- 0
|
200
|
+
hash: 1115506129816519000
|
201
|
+
version: '0'
|
202
|
+
none: false
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ! '>='
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
segments:
|
208
|
+
- 0
|
209
|
+
hash: 1115506129816519000
|
210
|
+
version: '0'
|
211
|
+
none: false
|
118
212
|
requirements: []
|
119
|
-
|
120
213
|
rubyforge_project:
|
121
|
-
rubygems_version: 1.
|
214
|
+
rubygems_version: 1.8.25
|
122
215
|
signing_key:
|
123
216
|
specification_version: 3
|
124
|
-
summary: Backup filesystem and databases (MySQL and PostgreSQL) locally or to a remote
|
125
|
-
|
126
|
-
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
217
|
+
summary: Backup filesystem and databases (MySQL and PostgreSQL) locally or to a remote
|
218
|
+
server/service (with encryption)
|
219
|
+
test_files:
|
220
|
+
- spec/integration/archive_integration_spec.rb
|
221
|
+
- spec/integration/cleanup_spec.rb
|
222
|
+
- spec/spec_helper.rb
|
223
|
+
- spec/unit/archive_spec.rb
|
224
|
+
- spec/unit/cloudfiles_spec.rb
|
225
|
+
- spec/unit/config_spec.rb
|
226
|
+
- spec/unit/gpg_spec.rb
|
227
|
+
- spec/unit/gzip_spec.rb
|
228
|
+
- spec/unit/local_spec.rb
|
229
|
+
- spec/unit/mysqldump_spec.rb
|
230
|
+
- spec/unit/pgdump_spec.rb
|
231
|
+
- spec/unit/s3_spec.rb
|
232
|
+
- spec/unit/svndump_spec.rb
|