coral_backup 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/coral_backup.gemspec +0 -1
- data/lib/coral_backup/cli.rb +1 -0
- data/lib/coral_backup/file_selector.rb +3 -4
- data/lib/coral_backup/settings.rb +8 -8
- data/lib/coral_backup/version.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7d6e58090c05bb0ca00b7bc5bf825eb7e43519b
|
4
|
+
data.tar.gz: a8f8bc9a02d0f9e45fc40b611d0a672c23389ea4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8719015eefe0a10ddef2c19b4394f91ab52a26c177f4573e0c3d78e8d3f56d7555ba2e0cdedb483430fa6ce6c212618cd7f94861af3695b5194707619d274dd
|
7
|
+
data.tar.gz: ecc4324c39f0569a63c41abe2afe0ead9fda999147c1baf889ac43fa5f9c5f40e91942b7f40aca76058c8ec37101ce89fb4d94b0e1984bf2d6245e3fffc3574b
|
data/coral_backup.gemspec
CHANGED
data/lib/coral_backup/cli.rb
CHANGED
@@ -11,7 +11,9 @@ module CoralBackup
|
|
11
11
|
|
12
12
|
def add_file(filename)
|
13
13
|
if FileTest.exist?(filename)
|
14
|
-
|
14
|
+
expanded_filename = File.expand_path(filename)
|
15
|
+
@files << File.expand_path(expanded_filename)
|
16
|
+
warn expanded_filename
|
15
17
|
else
|
16
18
|
raise Errno::ENOENT, filename
|
17
19
|
end
|
@@ -29,8 +31,6 @@ module CoralBackup
|
|
29
31
|
file_selector.add_file(ex)
|
30
32
|
rescue Errno::ENOENT => e
|
31
33
|
warn e
|
32
|
-
else
|
33
|
-
warn ex
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -52,7 +52,6 @@ module CoralBackup
|
|
52
52
|
rescue Errno::ENOENT => e
|
53
53
|
warn e
|
54
54
|
else
|
55
|
-
warn ex
|
56
55
|
file_added = true
|
57
56
|
end
|
58
57
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "yaml"
|
2
2
|
|
3
3
|
module CoralBackup
|
4
4
|
class Settings
|
@@ -13,11 +13,11 @@ module CoralBackup
|
|
13
13
|
|
14
14
|
def action_data(action_name)
|
15
15
|
raise ArgumentError, "Backup action `#{action_name}' does not exist." unless exist_action?(action_name)
|
16
|
-
@settings[:actions][action_name
|
16
|
+
@settings[:actions][action_name]
|
17
17
|
end
|
18
18
|
|
19
19
|
def action_names
|
20
|
-
@settings[:actions].keys
|
20
|
+
@settings[:actions].keys
|
21
21
|
end
|
22
22
|
|
23
23
|
def exist_action?(action_name)
|
@@ -26,19 +26,19 @@ module CoralBackup
|
|
26
26
|
|
27
27
|
def add(action_name, source, destination, exclusions)
|
28
28
|
raise ArgumentError, "Backup action `#{action_name}' already exists." if exist_action?(action_name)
|
29
|
-
@settings[:actions][action_name
|
29
|
+
@settings[:actions][action_name] = { source: source, destination: destination, exclusions: exclusions }
|
30
30
|
file_dump
|
31
31
|
end
|
32
32
|
|
33
33
|
def delete(action_name)
|
34
34
|
raise ArgumentError, "Backup action `#{action_name}' does not exist." unless exist_action?(action_name)
|
35
|
-
@settings[:actions].delete(action_name
|
35
|
+
@settings[:actions].delete(action_name)
|
36
36
|
file_dump
|
37
37
|
end
|
38
38
|
|
39
39
|
def update_time(action_name, time)
|
40
40
|
raise ArgumentError, "Backup action `#{action_name}' does not exist." unless exist_action?(action_name)
|
41
|
-
@settings[:actions][action_name
|
41
|
+
@settings[:actions][action_name][:last_run_time] = time.to_s
|
42
42
|
file_dump
|
43
43
|
end
|
44
44
|
|
@@ -46,12 +46,12 @@ module CoralBackup
|
|
46
46
|
def file_load
|
47
47
|
return INITIAL_SETTINGS unless FileTest.exist?(@filename)
|
48
48
|
|
49
|
-
|
49
|
+
YAML.load_file(@filename)
|
50
50
|
end
|
51
51
|
|
52
52
|
def file_dump
|
53
53
|
open(@filename, "w") do |f|
|
54
|
-
|
54
|
+
YAML.dump(@settings, f)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/lib/coral_backup/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coral_backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OTSUKA Tatsuya
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.19'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: toml-rb
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.3'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.3'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|