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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4805d6ac74e7cdeaaad6be240d574fbed59d3090
4
- data.tar.gz: 67127b0f482f26bbd498dd94ff0be00a34321d39
3
+ metadata.gz: a7d6e58090c05bb0ca00b7bc5bf825eb7e43519b
4
+ data.tar.gz: a8f8bc9a02d0f9e45fc40b611d0a672c23389ea4
5
5
  SHA512:
6
- metadata.gz: 0ce618630fbc5f7da2f8d604df7c6f238b8fbcd16b06947a0692352699a04a551162a495e7df801270baa4dda216cb4e8a2d2ec973fb719bfffb8c34ab384d93
7
- data.tar.gz: a63560f860be3f75c00e60227e4e391cc3dde36f4700d6cf356757d608808ea857baff991726a4061cab278e41322216ddad239927e8e06b29318b450d8f3553
6
+ metadata.gz: c8719015eefe0a10ddef2c19b4394f91ab52a26c177f4573e0c3d78e8d3f56d7555ba2e0cdedb483430fa6ce6c212618cd7f94861af3695b5194707619d274dd
7
+ data.tar.gz: ecc4324c39f0569a63c41abe2afe0ead9fda999147c1baf889ac43fa5f9c5f40e91942b7f40aca76058c8ec37101ce89fb4d94b0e1984bf2d6245e3fffc3574b
data/coral_backup.gemspec CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.license = "Zlib"
22
22
 
23
23
  spec.add_dependency "thor", "~> 0.19"
24
- spec.add_dependency "toml-rb", "~> 0.3"
25
24
 
26
25
  spec.add_development_dependency "bundler", "~> 1.10"
27
26
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,3 +1,4 @@
1
+ require "pathname"
1
2
  require "thor"
2
3
 
3
4
  module CoralBackup
@@ -11,7 +11,9 @@ module CoralBackup
11
11
 
12
12
  def add_file(filename)
13
13
  if FileTest.exist?(filename)
14
- @files << filename
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 "toml"
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.to_sym]
16
+ @settings[:actions][action_name]
17
17
  end
18
18
 
19
19
  def action_names
20
- @settings[:actions].keys.map(&:to_s)
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.to_sym] = { source: source, destination: destination, exclusions: exclusions }
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.to_sym)
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.to_sym][:last_run_time] = time.to_s
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
- TOML.load_file(@filename, symbolize_keys: true)
49
+ YAML.load_file(@filename)
50
50
  end
51
51
 
52
52
  def file_dump
53
53
  open(@filename, "w") do |f|
54
- f.puts TOML.dump(@settings)
54
+ YAML.dump(@settings, f)
55
55
  end
56
56
  end
57
57
  end
@@ -1,3 +1,3 @@
1
1
  module CoralBackup
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.2
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