dir_sync 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ = 0.1.2 Mon 30 Jan 2012 11:32:36 EST
2
+
3
+ * fixed problem where only one instance of a file was being removed
4
+ * fixed problem where files already in sync were not written to history
5
+
1
6
  = 0.1.1 Sun 29 Jan 2012 14:40:03 EST
2
7
 
3
8
  * moved everything into a DirSync module to prevent any namespace collisions.
@@ -22,11 +22,9 @@ Scenario: Syncing two non existant directories
22
22
  And a directory named "b" should exist
23
23
 
24
24
  Scenario: Syncing a single file from left to right
25
- Given a directory named "a"
26
- And I write to "a/readme.txt" with:
27
- """
28
- The content
29
- """
25
+ Given the file system:
26
+ | path | time |
27
+ | a/readme.txt | 1000 |
30
28
  When I successfully run `dir_sync test a b`
31
29
  Then the stdout should contain exactly:
32
30
  """
@@ -35,11 +33,9 @@ Scenario: Syncing a single file from left to right
35
33
  """
36
34
 
37
35
  Scenario: Syncing a single file from right to left
38
- Given a directory named "b"
39
- And I write to "b/readme.txt" with:
40
- """
41
- The content
42
- """
36
+ Given the file system:
37
+ | path | time |
38
+ | b/readme.txt | 1000 |
43
39
  When I successfully run `dir_sync test a b`
44
40
  Then the stdout should contain exactly:
45
41
  """
@@ -60,6 +56,9 @@ Scenario: Do nothing when files are already in sync with history
60
56
  """
61
57
 
62
58
  """
59
+ And the synchronisation history should be:
60
+ | path | time |
61
+ | readme.txt | 1000 |
63
62
 
64
63
  Scenario: Detecting a deletion from past history
65
64
  Given the file system:
@@ -73,4 +72,21 @@ Scenario: Detecting a deletion from past history
73
72
  """
74
73
  rm "b/readme.txt"
75
74
 
76
- """
75
+ """
76
+
77
+ Scenario: Delete all copies of a file that has been removed
78
+ Given the file system:
79
+ | path | time |
80
+ | a/readme.txt | 1000 |
81
+ | b/readme.txt | 1000 |
82
+ And past synchronisation history:
83
+ | path | time |
84
+ | readme.txt | 1000 |
85
+ When I successfully run `dir_sync test a b c`
86
+ Then the stdout should contain exactly:
87
+ """
88
+ rm "a/readme.txt"
89
+ rm "b/readme.txt"
90
+
91
+ """
92
+
@@ -19,4 +19,13 @@ Given /^past synchronisation history:$/ do |table|
19
19
  f.puts "#{path}:#{time}"
20
20
  end
21
21
  end
22
+ end
23
+
24
+ Then /^the synchronisation history should be:$/ do |table|
25
+ home = File.expand_path '~'
26
+ history = table.hashes.inject '' do |acc,row|
27
+ path, time = row['path'], row['time'].to_i
28
+ "#{acc}#{path}:#{time}\n"
29
+ end
30
+ File.read("#{home}/.dir_sync/test").should == history
22
31
  end
@@ -32,7 +32,7 @@ private
32
32
  end
33
33
 
34
34
  def rm traverser
35
- traverser.rm
35
+ @traversers.select{|t| t.name == traverser.name}.each &:rm
36
36
  end
37
37
 
38
38
  def cp traverser
@@ -41,6 +41,7 @@ private
41
41
  end
42
42
 
43
43
  def ignore traverser
44
+ @history.report traverser
44
45
  end
45
46
 
46
47
  def report_traversers
@@ -100,6 +100,7 @@ describe DirSync::ChangeResolver do
100
100
  traversers[0].should_receive(:equivalent?).with(traversers[0]).and_return true
101
101
  traversers[0].should_receive(:equivalent?).with(traversers[1]).and_return false
102
102
  traversers[0].should_receive :rm
103
+ traversers[2].should_receive :rm
103
104
  resolver.iterate
104
105
  end
105
106
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dir_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-29 00:00:00.000000000Z
13
+ date: 2012-01-30 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70170387871540 !ruby/object:Gem::Requirement
17
+ requirement: &70113425411300 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70170387871540
25
+ version_requirements: *70113425411300
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &70170387870300 !ruby/object:Gem::Requirement
28
+ requirement: &70113425410160 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '2'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70170387870300
36
+ version_requirements: *70113425410160
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: guard
39
- requirement: &70170387869340 !ruby/object:Gem::Requirement
39
+ requirement: &70113425409460 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70170387869340
47
+ version_requirements: *70113425409460
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: guard-rspec
50
- requirement: &70170387868340 !ruby/object:Gem::Requirement
50
+ requirement: &70113425408680 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70170387868340
58
+ version_requirements: *70113425408680
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: growl
61
- requirement: &70170387867260 !ruby/object:Gem::Requirement
61
+ requirement: &70113425408040 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70170387867260
69
+ version_requirements: *70113425408040
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: aruba
72
- requirement: &70170387866340 !ruby/object:Gem::Requirement
72
+ requirement: &70113425407220 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70170387866340
80
+ version_requirements: *70113425407220
81
81
  description: ! 'Multidirectional directory synchronisation for any number of directories
82
82
 
83
83
  '
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: -3613376495215102755
131
+ hash: -3650956989958222228
132
132
  requirements: []
133
133
  rubyforge_project:
134
134
  rubygems_version: 1.8.10