winton-rbackup 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. data/gemspec.rb +1 -1
  2. data/lib/rbackup.rb +20 -21
  3. data/rbackup.gemspec +1 -1
  4. metadata +1 -1
data/gemspec.rb CHANGED
@@ -16,5 +16,5 @@ GEM_SPEC = Gem::Specification.new do |s|
16
16
  s.name = GEM_NAME
17
17
  s.platform = Gem::Platform::RUBY
18
18
  s.require_path = "lib"
19
- s.version = "0.1.2"
19
+ s.version = "0.1.3"
20
20
  end
data/lib/rbackup.rb CHANGED
@@ -17,6 +17,23 @@ class RBackup
17
17
  get_profiles(args, @yaml)
18
18
  end
19
19
 
20
+ def get_profiles(input, hash, force=false)
21
+ @profiles ||= []
22
+ hash.each do |key, value|
23
+ next unless value.respond_to?(:keys)
24
+ is_profile = value['source'] && value['destination']
25
+ if input.include?(key) || input.empty? || force
26
+ if is_profile
27
+ @profiles << value
28
+ else
29
+ get_profiles(input, value, true)
30
+ end
31
+ elsif !is_profile
32
+ get_profiles(input, value, force)
33
+ end
34
+ end
35
+ end
36
+
20
37
  def get_yaml
21
38
  if $TESTING
22
39
  config = SPEC + '/fixtures/rbackup.yml'
@@ -42,30 +59,11 @@ class RBackup
42
59
  paths.collect { |path| path.gsub(' ', '\ ') }.join(' ')
43
60
  end
44
61
 
45
- def get_profiles(input, hash, force=false)
46
- @profiles ||= []
47
- hash.each do |key, value|
48
- next unless value.respond_to?(:keys)
49
- is_profile = value['source'] && value['destination']
50
- if input.include?(key) || input.empty? || force
51
- if is_profile
52
- @profiles << value
53
- else
54
- get_profiles(input, value, true)
55
- end
56
- elsif !is_profile
57
- get_profiles(input, value, force)
58
- end
59
- end
60
- end
61
-
62
62
  def rsync(profile)
63
63
  destination = profile['destination']
64
64
  source = profile['source'].to_a
65
65
 
66
- FileUtils.mkdir_p destination
67
-
68
- options = "--numeric-ids -axzSv"
66
+ options = "--numeric-ids --safe-links -axzSvL"
69
67
  # --numeric-ids don't map uid/gid values by user/group name
70
68
  # -a, --archive recursion and preserve almost everything (-rlptgoD)
71
69
  # -x, --one-file-system don't cross filesystem boundaries
@@ -73,12 +71,13 @@ class RBackup
73
71
  # -S, --sparse handle sparse files efficiently
74
72
  # -v, --verbose verbose
75
73
 
76
- if destination.include?('@') || source.include?('@')
74
+ if destination.include?(':') || source.include?(':')
77
75
  options += ' -e ssh'
78
76
  # -e, --rsh=COMMAND specify the remote shell to use
79
77
  else
80
78
  options += 'E'
81
79
  # -E, --extended-attributes copy extended attributes, resource forks
80
+ FileUtils.mkdir_p destination
82
81
  end
83
82
 
84
83
  if profile['exclude']
data/rbackup.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rbackup}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Winton Welsh"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winton-rbackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh