astrails-safe 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.document +5 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +3 -0
  4. data/CHANGELOG +25 -0
  5. data/Gemfile +4 -0
  6. data/{LICENSE → LICENSE.txt} +3 -1
  7. data/README.markdown +109 -114
  8. data/Rakefile +5 -55
  9. data/TODO +11 -0
  10. data/astrails-safe.gemspec +35 -0
  11. data/lib/astrails/safe.rb +4 -4
  12. data/lib/astrails/safe/archive.rb +2 -2
  13. data/lib/astrails/safe/cloudfiles.rb +16 -3
  14. data/lib/astrails/safe/config/node.rb +1 -1
  15. data/lib/astrails/safe/local.rb +3 -0
  16. data/lib/astrails/safe/mysqldump.rb +1 -1
  17. data/lib/astrails/safe/pipe.rb +4 -0
  18. data/lib/astrails/safe/s3.rb +10 -2
  19. data/lib/astrails/safe/sink.rb +2 -0
  20. data/lib/astrails/safe/source.rb +1 -0
  21. data/lib/astrails/safe/stream.rb +1 -0
  22. data/lib/astrails/safe/version.rb +5 -0
  23. data/{examples/integration/archive_integration_example.rb → spec/integration/archive_integration_spec.rb} +1 -2
  24. data/{examples/integration/cleanup_example.rb → spec/integration/cleanup_spec.rb} +2 -3
  25. data/spec/spec_helper.rb +7 -0
  26. data/{examples/unit/archive_example.rb → spec/unit/archive_spec.rb} +1 -1
  27. data/spec/unit/cloudfiles_spec.rb +177 -0
  28. data/{examples/unit/config_example.rb → spec/unit/config_spec.rb} +1 -1
  29. data/{examples/unit/gpg_example.rb → spec/unit/gpg_spec.rb} +2 -2
  30. data/{examples/unit/gzip_example.rb → spec/unit/gzip_spec.rb} +6 -6
  31. data/{examples/unit/local_example.rb → spec/unit/local_spec.rb} +2 -2
  32. data/{examples/unit/mysqldump_example.rb → spec/unit/mysqldump_spec.rb} +2 -2
  33. data/{examples/unit/pgdump_example.rb → spec/unit/pgdump_spec.rb} +2 -2
  34. data/{examples/unit/s3_example.rb → spec/unit/s3_spec.rb} +13 -5
  35. data/{examples/unit/svndump_example.rb → spec/unit/svndump_spec.rb} +2 -2
  36. data/templates/script.rb +1 -1
  37. metadata +186 -91
  38. data/VERSION.yml +0 -4
  39. data/examples/example_helper.rb +0 -19
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Astrails::Safe::Config do
4
4
  it "should parse example config" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
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 File.expand_path(File.dirname(__FILE__) + '/../example_helper')
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 File.expand_path(File.dirname(__FILE__) + '/../example_helper')
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].to_a.map { |i| "/mysqldump~blog~NoW/qweqwe.#{i}" }
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 File.expand_path(File.dirname(__FILE__) + '/../example_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Astrails::Safe::Mysqldump do
4
4
 
@@ -80,4 +80,4 @@ port = 7777
80
80
  PWD
81
81
  end
82
82
  end
83
- end
83
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Astrails::Safe::Pgdump do
4
4
 
@@ -42,4 +42,4 @@ describe Astrails::Safe::Pgdump do
42
42
 
43
43
  end
44
44
 
45
- end
45
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
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].to_a.map { |i| stub(o = {}).key {"aaaaa#{i}"}; o }
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).find("_bucket").stub![anything].stub!.delete
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).find("_bucket").mock!["aaaaa1"].mock!.delete
54
- mock(AWS::S3::Bucket).find("_bucket").mock!["aaaaa2"].mock!.delete
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
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Astrails::Safe::Svndump do
4
4
  def def_config
@@ -36,4 +36,4 @@ describe Astrails::Safe::Svndump do
36
36
  end
37
37
 
38
38
  end
39
- end
39
+ end
@@ -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 ocnfiguration 'nodes'
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
- version: 0.2.7
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.3.0
5
6
  platform: ruby
6
- authors:
7
- - Astrails Ltd.
7
+ authors:
8
+ - Vitaly Kushner
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2010-01-21 00:00:00 +02:00
13
- default_executable: astrails-safe
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
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
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
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- - !ruby/object:Gem::Dependency
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
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
45
- description: |
46
- Astrails-Safe is a simple tool to backup databases (MySQL and PostgreSQL), Subversion repositories (with svndump) and just files.
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
- email: we@astrails.com
51
- executables:
133
+ '
134
+ email:
135
+ - we@astrails.com
136
+ executables:
52
137
  - astrails-safe
53
138
  extensions: []
54
-
55
- extra_rdoc_files:
56
- - LICENSE
57
- - README.markdown
58
- files:
59
- - LICENSE
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
- - VERSION.yml
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
- has_rdoc: true
98
- homepage: http://blog.astrails.com/astrails-safe
99
- licenses: []
100
-
187
+ homepage: http://astrails.com/astrails-safe
188
+ licenses:
189
+ - MIT
101
190
  post_install_message:
102
- rdoc_options:
103
- - --charset=UTF-8
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
- version: "0"
111
- version:
112
- required_rubygems_version: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: "0"
117
- version:
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.3.5
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 server/service (with encryption)
125
- test_files:
126
- - examples/example_helper.rb
127
- - examples/integration/archive_integration_example.rb
128
- - examples/integration/cleanup_example.rb
129
- - examples/unit/archive_example.rb
130
- - examples/unit/config_example.rb
131
- - examples/unit/gpg_example.rb
132
- - examples/unit/gzip_example.rb
133
- - examples/unit/local_example.rb
134
- - examples/unit/mysqldump_example.rb
135
- - examples/unit/pgdump_example.rb
136
- - examples/unit/s3_example.rb
137
- - examples/unit/svndump_example.rb
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