feather_watch 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/feather_watch.gemspec +1 -1
- data/lib/feather_watch/core/darwin_watcher.rb +17 -7
- data/lib/feather_watch/core/linux_watcher.rb +30 -19
- data/lib/feather_watch/core/windows_watcher.rb +24 -13
- data/lib/feather_watch/version.rb +1 -1
- data/lib/feather_watch/watcher.rb +8 -4
- data/spec/lib/feather_watch/core/darwin_watcher_spec.rb +101 -0
- data/spec/lib/feather_watch/core/linux_watcher_spec.rb +396 -0
- data/spec/lib/feather_watch/core/watcher_spec.rb +43 -30
- data/spec/lib/feather_watch/core/windows_watcher_spec.rb +340 -0
- data/spec/lib/feather_watch/feather_watch_spec.rb +16 -13
- metadata +9 -3
@@ -7,7 +7,7 @@ describe FeatherWatch do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "passen self.new on to FeatherWatch::Watcher" do
|
10
|
-
args = [
|
10
|
+
args = [Dir.pwd,lambda { |e| }, false]
|
11
11
|
expect(FeatherWatch::Watcher).to receive(:new).with(*args)
|
12
12
|
FeatherWatch.new(*args)
|
13
13
|
end
|
@@ -17,16 +17,17 @@ describe FeatherWatch do
|
|
17
17
|
path = File.join(Dir.pwd, "test_folder")
|
18
18
|
callback_spy = spy("Callback Spy")
|
19
19
|
verbose = false
|
20
|
-
|
20
|
+
silence_exceptions = true
|
21
|
+
|
21
22
|
file_path = File.join(Dir.pwd, "test_folder", "new_file")
|
22
23
|
|
23
24
|
if FeatherWatch::OS.mac?
|
24
|
-
expect(callback_spy).to receive(:call).with({status: :modified ,file: file_path})
|
25
|
+
expect(callback_spy).to receive(:call).with({status: :modified ,file: file_path, event: anything})
|
25
26
|
else
|
26
|
-
expect(callback_spy).to receive(:call).with({status: :added ,file: file_path})
|
27
|
+
expect(callback_spy).to receive(:call).with({status: :added ,file: file_path, event: anything})
|
27
28
|
end
|
28
|
-
|
29
|
-
watcher = FeatherWatch::Watcher.new(path,callback_spy,verbose)
|
29
|
+
sleep 0.1
|
30
|
+
watcher = FeatherWatch::Watcher.new(path,callback_spy,verbose, silence_exceptions)
|
30
31
|
watcher.start
|
31
32
|
sleep 0.1 #need to wait for watcher to properly start
|
32
33
|
FileUtils.touch(file_path)
|
@@ -38,13 +39,14 @@ describe FeatherWatch do
|
|
38
39
|
path = File.join(Dir.pwd, "test_folder")
|
39
40
|
callback_spy = spy("Callback Spy")
|
40
41
|
verbose = false
|
41
|
-
|
42
|
+
silence_exceptions = true
|
43
|
+
|
42
44
|
file_path = File.join(Dir.pwd, "test_folder", "new_file")
|
43
45
|
FileUtils.touch(file_path)
|
44
46
|
sleep 0.1
|
45
|
-
expect(callback_spy).to receive(:call).with({status: :removed ,file: file_path})
|
47
|
+
expect(callback_spy).to receive(:call).with({status: :removed ,file: file_path, event: anything})
|
46
48
|
|
47
|
-
watcher = FeatherWatch::Watcher.new(path,callback_spy,verbose)
|
49
|
+
watcher = FeatherWatch::Watcher.new(path,callback_spy,verbose, silence_exceptions)
|
48
50
|
watcher.start
|
49
51
|
sleep 0.1 #need to wait for watcher to properly start
|
50
52
|
FileUtils.rm(file_path)
|
@@ -56,6 +58,7 @@ describe FeatherWatch do
|
|
56
58
|
path = File.join(Dir.pwd, "test_folder")
|
57
59
|
callback_spy = spy("Callback Spy")
|
58
60
|
verbose = false
|
61
|
+
silence_exceptions = true
|
59
62
|
|
60
63
|
file_path = File.join(Dir.pwd, "test_folder", "new_file")
|
61
64
|
file_path_new = File.join(Dir.pwd, "test_folder", "new_file_new")
|
@@ -63,14 +66,14 @@ describe FeatherWatch do
|
|
63
66
|
FileUtils.touch(file_path)
|
64
67
|
sleep 0.1
|
65
68
|
|
66
|
-
expect(callback_spy).to receive(:call).with({status: :removed ,file: file_path})
|
69
|
+
expect(callback_spy).to receive(:call).with({status: :removed ,file: file_path, event: anything})
|
67
70
|
if FeatherWatch::OS.mac?
|
68
|
-
expect(callback_spy).to receive(:call).with({status: :modified ,file: file_path_new})
|
71
|
+
expect(callback_spy).to receive(:call).with({status: :modified ,file: file_path_new, event: anything})
|
69
72
|
else
|
70
|
-
expect(callback_spy).to receive(:call).with({status: :added ,file: file_path_new})
|
73
|
+
expect(callback_spy).to receive(:call).with({status: :added ,file: file_path_new, event: anything})
|
71
74
|
end
|
72
75
|
|
73
|
-
watcher = FeatherWatch::Watcher.new(path,callback_spy,verbose)
|
76
|
+
watcher = FeatherWatch::Watcher.new(path,callback_spy,verbose, silence_exceptions)
|
74
77
|
watcher.start
|
75
78
|
sleep 0.1 #need to wait for watcher to properly start
|
76
79
|
FileUtils.mv(file_path, file_path_new)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feather_watch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Nordnes Eriksen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-fsevent
|
@@ -132,7 +132,10 @@ files:
|
|
132
132
|
- lib/feather_watch/os.rb
|
133
133
|
- lib/feather_watch/version.rb
|
134
134
|
- lib/feather_watch/watcher.rb
|
135
|
+
- spec/lib/feather_watch/core/darwin_watcher_spec.rb
|
136
|
+
- spec/lib/feather_watch/core/linux_watcher_spec.rb
|
135
137
|
- spec/lib/feather_watch/core/watcher_spec.rb
|
138
|
+
- spec/lib/feather_watch/core/windows_watcher_spec.rb
|
136
139
|
- spec/lib/feather_watch/feather_watch_spec.rb
|
137
140
|
- spec/spec_helper.rb
|
138
141
|
homepage: https://github.com/stephan-nordnes-eriksen/feather_watch
|
@@ -158,9 +161,12 @@ rubyforge_project:
|
|
158
161
|
rubygems_version: 2.2.2
|
159
162
|
signing_key:
|
160
163
|
specification_version: 4
|
161
|
-
summary: Barebones, simple, and fast file system watcher
|
164
|
+
summary: Barebones, simple, and fast Ruby file system watcher
|
162
165
|
test_files:
|
166
|
+
- spec/lib/feather_watch/core/darwin_watcher_spec.rb
|
167
|
+
- spec/lib/feather_watch/core/linux_watcher_spec.rb
|
163
168
|
- spec/lib/feather_watch/core/watcher_spec.rb
|
169
|
+
- spec/lib/feather_watch/core/windows_watcher_spec.rb
|
164
170
|
- spec/lib/feather_watch/feather_watch_spec.rb
|
165
171
|
- spec/spec_helper.rb
|
166
172
|
has_rdoc:
|