simple_backup 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/backup_example.rb +8 -8
- data/lib/simple_backup.rb +1 -1
- data/lib/simple_backup/source/abstract.rb +1 -1
- data/lib/simple_backup/source/dir.rb +4 -3
- data/lib/simple_backup/source/file.rb +4 -3
- data/lib/simple_backup/source/mysql.rb +3 -2
- data/lib/simple_backup/sources.rb +1 -2
- data/lib/simple_backup/utils/logger.rb +1 -1
- data/lib/simple_backup/utils/mailer.rb +1 -1
- data/lib/simple_backup/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0469f56e22f8ab0f509e8a51eb8ffdfd820ac023
|
4
|
+
data.tar.gz: 17b0d6e3a9c824e2e49567dda5d9eeacc2f76044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89f78bb4979170c15b9c2467e7cadb1d70889b67ec46786e1aff3732a417e59aac3af0b5c03cd311be76ae346d5a69a5e3f41064a61ee805040ce2f097daeb5f
|
7
|
+
data.tar.gz: 6c28e913f0964292ec9013ca023391da1880213026f5bc0bce1583b1443b742aafdd60ee757aa4f99ea24f1b672d7e45033697f70cbce6ffa1d2457f5805332d
|
data/README.md
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
# simple_backup
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/simple_backup.svg)](http://badge.fury.io/rb/simple_backup)
|
4
|
-
![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)
|
4
|
+
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tmaczukin/simple_backup/blob/development/LICENSE)
|
5
5
|
|
6
6
|
Backup tool with simple DSL for configuration. Tool is under heavy
|
7
7
|
development and its API should be treat as unstable.
|
8
8
|
|
9
9
|
## TODO
|
10
10
|
|
11
|
-
- [
|
12
|
-
- [
|
13
|
-
- [
|
14
|
-
- [ ]
|
15
|
-
- [ ]
|
11
|
+
- [x] Change architecture and refactorize
|
12
|
+
- [x] Add sources mechanism
|
13
|
+
- [x] Add backends mechanism (with 'local' backend implementation)
|
14
|
+
- [ ] Add more backends (e.g. s3, ftp)
|
15
|
+
- [ ] Add filters mechanism (e.g. PGP encryption)
|
16
|
+
- [ ] Add tests
|
17
|
+
- [ ] Add docummentation and examples
|
16
18
|
|
17
19
|
## License
|
18
20
|
|
data/backup_example.rb
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
require 'simple_backup'
|
7
7
|
|
8
|
-
SimpleBackup.
|
8
|
+
SimpleBackup.define do
|
9
9
|
log_level :debug
|
10
10
|
|
11
11
|
high_usage_treshold 0.9
|
@@ -16,15 +16,15 @@ SimpleBackup.run do
|
|
16
16
|
default_keep_last 9
|
17
17
|
|
18
18
|
sources do
|
19
|
-
dir 'app-1', '/home/app/app-1', type: :capistrano, backends: 'backup'
|
20
|
-
dir 'app-2', '/home/app/app-2', backends: :none
|
21
|
-
dir 'none', '/none'
|
19
|
+
dir 'app-1', path: '/home/app/app-1', type: :capistrano, backends: 'backup'
|
20
|
+
dir 'app-2', path: '/home/app/app-2', backends: :none
|
21
|
+
dir 'none', path: '/none'
|
22
22
|
|
23
|
-
file 'hosts', '/etc/hosts'
|
23
|
+
file 'hosts', path: '/etc/hosts'
|
24
24
|
|
25
|
-
mysql 'test1'
|
26
|
-
mysql 'test2'
|
27
|
-
mysql 'test3',
|
25
|
+
mysql 'test1'
|
26
|
+
mysql 'test2'
|
27
|
+
mysql 'test3', exclude_tables: ['t_test1']
|
28
28
|
end
|
29
29
|
|
30
30
|
backends do
|
data/lib/simple_backup.rb
CHANGED
@@ -5,10 +5,11 @@ module SimpleBackup
|
|
5
5
|
@strategy = :bare
|
6
6
|
end
|
7
7
|
|
8
|
-
def configure(
|
9
|
-
|
8
|
+
def configure(options = {})
|
9
|
+
raise "Must provide :path parameter" unless options[:path]
|
10
|
+
@path = options[:path]
|
10
11
|
|
11
|
-
raise "#{path} is a file - use File source instead of Dir" unless !::File.exist?(path) or ::File.directory?(path)
|
12
|
+
raise "#{@path} is a file - use File source instead of Dir" unless !::File.exist?(@path) or ::File.directory?(@path)
|
12
13
|
@strategy = options[:strategy] if options[:strategy]
|
13
14
|
end
|
14
15
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module SimpleBackup
|
2
2
|
module Source
|
3
3
|
class File < Abstract
|
4
|
-
def configure(
|
5
|
-
|
4
|
+
def configure(options = {})
|
5
|
+
raise "Must provide :path parameter" unless options[:path]
|
6
|
+
@path = options[:path]
|
6
7
|
|
7
|
-
raise "#{path} is a directory - use Dir source instead of File" unless !::File.exist?(path) or ::File.file?(path)
|
8
|
+
raise "#{@path} is a directory - use Dir source instead of File" unless !::File.exist?(@path) or ::File.file?(@path)
|
8
9
|
end
|
9
10
|
|
10
11
|
private
|
@@ -3,8 +3,9 @@ module SimpleBackup
|
|
3
3
|
class Mysql < Abstract
|
4
4
|
@@mysql = Utils::MySQL.instance
|
5
5
|
|
6
|
-
def configure(
|
7
|
-
@db = db
|
6
|
+
def configure(options = {})
|
7
|
+
@db = @name unless options[:db]
|
8
|
+
@db = options[:db] if options[:db]
|
8
9
|
|
9
10
|
@exclude_tables = options[:exclude_tables] if options[:exclude_tables]
|
10
11
|
end
|
@@ -42,7 +42,6 @@ module SimpleBackup
|
|
42
42
|
return nil if source.nil?
|
43
43
|
|
44
44
|
name = args.shift
|
45
|
-
identifier = args.shift
|
46
45
|
options = args.shift
|
47
46
|
options ||= {}
|
48
47
|
|
@@ -55,7 +54,7 @@ module SimpleBackup
|
|
55
54
|
source.backends = options[:backends] if options[:backends]
|
56
55
|
source.name = name
|
57
56
|
|
58
|
-
source.configure(
|
57
|
+
source.configure(options)
|
59
58
|
|
60
59
|
@@logger.info "Created source for: #{source.desc.strip}"
|
61
60
|
|
@@ -75,8 +75,8 @@ module SimpleBackup
|
|
75
75
|
|
76
76
|
scope_prefix = '..' * @scope
|
77
77
|
message = "%s %7s: %s%s" % [Time.new.strftime(TIME_FORMAT), level.to_s.upcase, scope_prefix, message]
|
78
|
-
@buffer << message
|
79
78
|
|
79
|
+
@buffer << message if should_write
|
80
80
|
puts message.colorize(color: color) if should_write
|
81
81
|
end
|
82
82
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Maczukin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.4.5
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Backup tool with simple DSL for configuration
|