rsync 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,6 +26,8 @@ module Rsync
26
26
  return true
27
27
  elsif update_type == :recv
28
28
  return true
29
+ elsif update_type == :change
30
+ return true
29
31
  end
30
32
  false
31
33
  end
@@ -77,7 +77,7 @@ private
77
77
  list = []
78
78
  @raw.split("\n").each do |line|
79
79
  #if line =~ /^([<>ch.*][fdLDS][ .+\?cstTpoguax]{9}) (.*)$/
80
- if line =~ /^([<>ch\.\*].{10}) (.*)$/
80
+ if line =~ /^([<>ch+\.\*].{10}) (.*)$/
81
81
  detail = Change.new(line)
82
82
  list << detail if detail.changed?
83
83
  end
@@ -1,4 +1,4 @@
1
1
  module Rsync
2
2
  # Project version
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+ require 'rsync'
3
+
4
+ describe Rsync do
5
+ around(:each) do |example|
6
+ TempDir.create do |src, dest|
7
+ @src = src
8
+ @dest = dest
9
+ example.run
10
+ end
11
+ end
12
+
13
+ it "should work" do
14
+ @src.mkdir("blah")
15
+ Rsync.run(@src.path + "/", @dest.path, ["-a"])
16
+ @dest.should eql(@src)
17
+ end
18
+
19
+ it "should dry run" do
20
+ @src.mkdir("blah")
21
+ Rsync.run(@src.path + "/", @dest.path, ["-a", "-n"])
22
+ @dest.should_not eql(@src)
23
+ end
24
+
25
+ it "should list changes" do
26
+ @src.mkdir("blah")
27
+ result = Rsync.run(@src.path + "/", @dest.path, ["-a"])
28
+ result.should be_success
29
+ result.changes.length.should eql(1)
30
+ @dest.should eql(@src)
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ require 'tmpdir'
2
+
3
+ class TempDir
4
+ attr_accessor :path
5
+
6
+ def initialize(root, subpath)
7
+ @path = File.join(root, subpath)
8
+ Dir.mkdir(@path)
9
+ end
10
+
11
+ def tree
12
+ #`cd #{@path}; tree -pugAD`
13
+ #`cd #{@path}; find . -printf "%A@ %p\n"`
14
+ `cd #{@path}; find . -printf "%p\n"`
15
+ end
16
+
17
+ def mkdir(path)
18
+ Dir.mkdir(File.join(@path, path))
19
+ end
20
+
21
+ def eql? other
22
+ tree == other.tree
23
+ end
24
+
25
+ def to_s
26
+ tree
27
+ end
28
+
29
+ def self.create(&block)
30
+ Dir.mktmpdir do |dir|
31
+ yield new(dir, "src"), new(dir, "dest")
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-07-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &13436720 !ruby/object:Gem::Requirement
16
+ requirement: &17026400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *13436720
24
+ version_requirements: *17026400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &13435920 !ruby/object:Gem::Requirement
27
+ requirement: &17025500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *13435920
35
+ version_requirements: *17025500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &13434940 !ruby/object:Gem::Requirement
38
+ requirement: &17024260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *13434940
46
+ version_requirements: *17024260
47
47
  description:
48
48
  email:
49
49
  - jbussdieker@gmail.com
@@ -66,6 +66,8 @@ files:
66
66
  - spec/rsync/change_spec.rb
67
67
  - spec/rsync/command_spec.rb
68
68
  - spec/rsync/result_spec.rb
69
+ - spec/rsync_spec.rb
70
+ - spec/spec_helper.rb
69
71
  homepage: http://github.com/jbussdieker/ruby-rsync
70
72
  licenses:
71
73
  - MIT
@@ -96,4 +98,6 @@ test_files:
96
98
  - spec/rsync/change_spec.rb
97
99
  - spec/rsync/command_spec.rb
98
100
  - spec/rsync/result_spec.rb
101
+ - spec/rsync_spec.rb
102
+ - spec/spec_helper.rb
99
103
  has_rdoc: