savior 0.0.1 → 0.0.2
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/README.markdown +30 -2
- data/lib/savior.rb +1 -1
- data/lib/savior/storage.rb +6 -9
- metadata +4 -4
data/README.markdown
CHANGED
@@ -1,7 +1,35 @@
|
|
1
|
-
[](http://travis-ci.org/mateuszzawisza/savior)
|
2
|
-
|
3
1
|
Savior
|
4
2
|
==
|
3
|
+
[](http://travis-ci.org/mateuszzawisza/savior)
|
5
4
|
|
6
5
|
Savior is a ruby library (gem) that provides easy to setup MySQL database backups to Amazon AWS S3
|
7
6
|
|
7
|
+
Installation
|
8
|
+
==
|
9
|
+
|
10
|
+
gem install savior
|
11
|
+
|
12
|
+
|
13
|
+
Setup and run
|
14
|
+
==
|
15
|
+
|
16
|
+
To run you can use the executable:
|
17
|
+
|
18
|
+
savior -c path/to/config.yml
|
19
|
+
|
20
|
+
|
21
|
+
Config file is a simple YAML file:
|
22
|
+
|
23
|
+
:database:
|
24
|
+
:user: myuser
|
25
|
+
:database_name: production_db
|
26
|
+
:password: super_secret
|
27
|
+
:storage:
|
28
|
+
:access_key_id: 123123123
|
29
|
+
:secret_access_key: abcabcabcabc
|
30
|
+
:bucket_name: aws-s3-bucket-name
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
Gem is in very early stage and needs a lot of improvements but should work.
|
35
|
+
|
data/lib/savior.rb
CHANGED
data/lib/savior/storage.rb
CHANGED
@@ -3,14 +3,8 @@ require "aws"
|
|
3
3
|
class Savior
|
4
4
|
class Storage
|
5
5
|
def initialize(options={})
|
6
|
-
|
7
|
-
|
8
|
-
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY'],
|
9
|
-
:bucket_name => nil
|
10
|
-
}
|
11
|
-
options = default_options.merge(options)
|
12
|
-
@access_key_id = options[:access_key_id]
|
13
|
-
@secret_access_key = options[:secret_access_key]
|
6
|
+
@access_key_id = options[:access_key_id] || ENV['AMAZON_ACCESS_KEY_ID']
|
7
|
+
@secret_access_key = options[:secret_access_key] || ENV['AMAZON_SECRET_ACCESS_KEY']
|
14
8
|
@bucket_name = options[:bucket_name]
|
15
9
|
@s3 = AWS::S3.new(
|
16
10
|
:access_key_id => @access_key_id,
|
@@ -18,10 +12,13 @@ class Savior
|
|
18
12
|
)
|
19
13
|
end
|
20
14
|
|
21
|
-
def upload_file(db_snapshot_file)
|
15
|
+
def upload_file(db_snapshot_file, remove_temp_file = false)
|
22
16
|
s3_snapshot_object = @s3.buckets[@bucket_name].
|
23
17
|
objects[db_snapshot_file]
|
24
18
|
s3_snapshot_object.write(File.read(db_snapshot_file))
|
19
|
+
if remove_temp_file
|
20
|
+
File.delete(db_snapshot_file)
|
21
|
+
end
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2012-02-
|
12
|
+
date: 2012-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
16
|
-
requirement: &
|
16
|
+
requirement: &70262666200740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.3.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70262666200740
|
25
25
|
description: MySQL database backups to AWS S3
|
26
26
|
email: mateusz@applicake.com
|
27
27
|
executables:
|