cloud-backup 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.rdoc +41 -2
- data/VERSION +1 -1
- data/cloud-backup.gemspec +2 -2
- data/lib/driver.rb +0 -24
- data/lib/drivers/log_backup_driver.rb +0 -8
- data/lib/drivers/rack_cloud_backup_driver.rb +4 -11
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,9 +1,48 @@
|
|
1
1
|
= cloud-backup
|
2
2
|
|
3
|
-
|
3
|
+
Backup to multiple cloud storage engines easily!
|
4
|
+
|
5
|
+
Backup to cloud services with ease and easily plug or unplug the storage
|
6
|
+
service that you might prefer.
|
7
|
+
|
8
|
+
If it doesn't exist you can contribute, or you can create
|
9
|
+
a driver class and use it locally!
|
10
|
+
|
11
|
+
== Example usage:
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'cloud-backup'
|
15
|
+
|
16
|
+
# The idea is that you can plug and unplug drivers with ease, each one
|
17
|
+
# supporting different storage services like s3, cloudfiles, google
|
18
|
+
# storage, etc.
|
19
|
+
|
20
|
+
# NOTE: Files must exist!
|
21
|
+
# ==============================================================================
|
22
|
+
files = ['/tmp/kz0', '/tmp/kz1', '/tmp/kz2']
|
23
|
+
|
24
|
+
|
25
|
+
# Use the RackCloud-driver to store data in rackspace!
|
26
|
+
# ==============================================================================
|
27
|
+
mysql = RackCloudBackupDriver.new { :id => 'xx', :key => 'xx', :bucket => 'xx' }
|
28
|
+
|
29
|
+
# Use the Log-driver to log or display what is being executed.
|
30
|
+
# ==============================================================================
|
31
|
+
log = LogBackupDriver.new STDOUT
|
32
|
+
|
33
|
+
|
34
|
+
# Stack Drivers and execute!
|
35
|
+
# ==============================================================================
|
36
|
+
stack = CloudBackup::DriverStack.new
|
37
|
+
stack.add_driver mysql
|
38
|
+
stack.add_driver log
|
39
|
+
stack.add_files files
|
40
|
+
|
41
|
+
stack.perform_backup!
|
42
|
+
|
4
43
|
|
5
44
|
== Note on Patches/Pull Requests
|
6
|
-
|
45
|
+
|
7
46
|
* Fork the project.
|
8
47
|
* Make your feature addition or bug fix.
|
9
48
|
* Add tests for it. This is important so I don't break it in a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/cloud-backup.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cloud-backup}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kazuyoshi tlacaelel"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-15}
|
13
13
|
s.description = %q{Backup to different clouds or create a driver and extend functionality!}
|
14
14
|
s.email = %q{kazu.dev@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/driver.rb
CHANGED
@@ -29,30 +29,6 @@ module CloudBackup
|
|
29
29
|
raise Error.must_define :initiate
|
30
30
|
end
|
31
31
|
|
32
|
-
# Driver Identificator
|
33
|
-
#
|
34
|
-
# Specifies the *identificator* where the resources will be
|
35
|
-
# installed.
|
36
|
-
#
|
37
|
-
# For example: If you are storing data into Google-Storage, or
|
38
|
-
# S3 this could be a bucket-name.
|
39
|
-
#
|
40
|
-
# Note: each driver may specify different types of identificators
|
41
|
-
# or implement it's own methods depending on the storage-engine
|
42
|
-
# that is being used.
|
43
|
-
#
|
44
|
-
def identificator
|
45
|
-
raise Error.must_define :identificator
|
46
|
-
end
|
47
|
-
|
48
|
-
# Identificator changer
|
49
|
-
#
|
50
|
-
# Allows the client to change the identificator
|
51
|
-
#
|
52
|
-
def identificator name
|
53
|
-
raise Error.must_define :identificator=
|
54
|
-
end
|
55
|
-
|
56
32
|
# File aggregator
|
57
33
|
#
|
58
34
|
# Adds a file to be backed up by the driver, path might be an
|
@@ -8,14 +8,6 @@ class LogBackupDriver < CloudBackup::Driver
|
|
8
8
|
output 'Initiating execution'
|
9
9
|
end
|
10
10
|
|
11
|
-
def identificator
|
12
|
-
@identificator
|
13
|
-
end
|
14
|
-
|
15
|
-
def identificator= name
|
16
|
-
@identificator = name
|
17
|
-
end
|
18
|
-
|
19
11
|
def list_by_date
|
20
12
|
output 'Listing driver items by date'
|
21
13
|
list.each do |file|
|
@@ -5,6 +5,7 @@ class RackCloudBackupDriver < CloudBackup::Driver
|
|
5
5
|
def initialize credentials
|
6
6
|
@id = credentials[:id]
|
7
7
|
@key = credentials[:key]
|
8
|
+
@identificator = credentials[:bucket]
|
8
9
|
@cf = CloudFiles::Connection.new(@id, @key)
|
9
10
|
end
|
10
11
|
|
@@ -12,14 +13,6 @@ class RackCloudBackupDriver < CloudBackup::Driver
|
|
12
13
|
@bucket = get_or_create_bucket
|
13
14
|
end
|
14
15
|
|
15
|
-
def identificator
|
16
|
-
@identificator
|
17
|
-
end
|
18
|
-
|
19
|
-
def identificator= name
|
20
|
-
@identificator = name
|
21
|
-
end
|
22
|
-
|
23
16
|
# TODO: parse metadata
|
24
17
|
def list_by_date
|
25
18
|
@bucket.objects
|
@@ -44,10 +37,10 @@ class RackCloudBackupDriver < CloudBackup::Driver
|
|
44
37
|
private
|
45
38
|
|
46
39
|
def get_or_create_bucket
|
47
|
-
unless @cf.containers.include? identificator
|
48
|
-
@cf.create_container identificator
|
40
|
+
unless @cf.containers.include? @identificator
|
41
|
+
@cf.create_container @identificator
|
49
42
|
end
|
50
|
-
@cf.container identificator
|
43
|
+
@cf.container @identificator
|
51
44
|
end
|
52
45
|
|
53
46
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kazuyoshi tlacaelel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-15 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|