rsyncbackup 2.0.1 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f1596ffc77f401908dae8ed0cae815e56720665
4
- data.tar.gz: a362a37ecf71f1427e06d349ecbf8a40ff15a29a
3
+ metadata.gz: 6005b2502d88e96b50eeaf78ca1a44b16faf4bf8
4
+ data.tar.gz: 543789938c94f4650acdb096623a7308169ca082
5
5
  SHA512:
6
- metadata.gz: 1ec7c869069858f94f1a555c8bc8f1c6c0f44f08e08921bb9cf8a958ece1f73412491638c66b56bc5049daa971d00fa059189e3a82b7df4dd29e1b4194e147fd
7
- data.tar.gz: 75dad458110c68f0bf38060e6e7245d18bca48d8cdb552d59c6543ab7109cfc5867f5f6294017c1865d42db25ad1c77faad987b403c1194a9bc0ec83debe74dd
6
+ metadata.gz: 2edb9f263195660fee96ee25ce51738f37a6f4e12cee39fb241ec04c9b0d23a25ddeecc645aecc2ccfb2743108afb36801ee0880e832433b48694b1e97fc1a86
7
+ data.tar.gz: 0c063e820b653a58d64c32bbce898439cb876a3ce01cb9c0cd7d17bd8a1a4abd1e6970a613a9143ea717af5a83f85b88379019909d6faea6f6418b7b002a0713
@@ -89,7 +89,12 @@ class Rsyncbackup
89
89
  # *s*:: string to strip
90
90
  def strip_trailing_separator_if_any(s,keep_if_symlink=false)
91
91
  s = s.to_s
92
- s = s.sub(%r{/+$},'') unless keep_if_symlink && File.symlink?(s)
92
+ s_s = s.sub(%r{#{File::SEPARATOR}+$},'')
93
+ unless keep_if_symlink
94
+ s_s
95
+ else
96
+ File.symlink?(s_s) ? s : s_s
97
+ end
93
98
  end
94
99
 
95
100
  end
@@ -1,5 +1,5 @@
1
1
  class Rsyncbackup
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  DEFAULT_EXCLUSIONS = File.expand_path('.rsyncbackup.exclusions', ENV['HOME'])
4
4
  DEFAULT_INCOMPLETE_DIR_NAME = '.incomplete'
5
5
  DEFAULT_LAST_FULL_DIR_NAME = '.lastfull'
@@ -26,7 +26,7 @@ describe Rsyncbackup do
26
26
  end
27
27
 
28
28
  context "utilities" do
29
- let(:syncer) { Rsyncbackup.new(source, target, :dry_run => true, :debug => true) }
29
+ let(:syncer) { Rsyncbackup.new(source, target, :dry_run => true) }
30
30
 
31
31
  context "#build_command" do
32
32
 
@@ -92,11 +92,34 @@ describe Rsyncbackup do
92
92
  syncer.strip_trailing_separator_if_any('source/',true).should == 'source'
93
93
  end
94
94
 
95
- it "should not remove trailing slash from source if source is a symlink" do
96
- source_link = Tempfile.new("sourcelink").to_s
97
- syncer.strip_trailing_separator_if_any(source_link,true).should == source_link
95
+ context "when a symlink" do
96
+ let(:source_link) do
97
+ tmpfile = Tempfile.new("sourcelink")
98
+ path = tmpfile.path
99
+ tmpfile.close
100
+ tmpfile.unlink
101
+ path
102
+ end
103
+
104
+ let(:source_link_slash) {source_link + File::SEPARATOR}
105
+
106
+
107
+ before do
108
+ File.symlink(source,source_link)
109
+ end
110
+
111
+ after do
112
+ File.unlink(source_link)
113
+ end
114
+
115
+ it "should not remove trailing slash from source if source is a symlink" do
116
+ syncer.strip_trailing_separator_if_any(source_link_slash,true).should == source_link_slash
117
+ end
118
+
119
+
98
120
  end
99
121
 
122
+
100
123
  it "should remove trailing slash from target" do
101
124
  syncer.strip_trailing_separator_if_any('target/').should == 'target'
102
125
  end
@@ -32,7 +32,7 @@ describe Rsyncbackup do
32
32
  end
33
33
 
34
34
  context "Options Validity" do
35
- let(:syncer) { Rsyncbackup.new(source, target, :dry_run => true, :debug => true) }
35
+ let(:syncer) { Rsyncbackup.new(source, target, :dry_run => true) }
36
36
 
37
37
  it "has a command" do
38
38
  syncer.options[:rsync_cmd].should =~ /rsync/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyncbackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tamara Temple
@@ -156,9 +156,9 @@ files:
156
156
  - lib/rsyncbackup/utilities.rb
157
157
  - lib/rsyncbackup/version.rb
158
158
  - rsyncbackup.gemspec
159
+ - spec/rsyncbackup/utilities_spec.rb
159
160
  - spec/rsyncbackup_spec.rb
160
161
  - spec/spec_helper.rb
161
- - spec/utilities_spec.rb
162
162
  homepage: http://github.com/tamouse/rsyncbackup-rb
163
163
  licenses: []
164
164
  metadata: {}
@@ -196,6 +196,6 @@ test_files:
196
196
  - features/test_files/source/three
197
197
  - features/test_files/source/two
198
198
  - features/test_files/target/.gitignore
199
+ - spec/rsyncbackup/utilities_spec.rb
199
200
  - spec/rsyncbackup_spec.rb
200
201
  - spec/spec_helper.rb
201
- - spec/utilities_spec.rb