spring-watcher-listen 1.0.0 → 2.0.0
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 +4 -4
- data/.travis.yml +2 -0
- data/lib/spring/watcher/listen.rb +16 -7
- data/spring-watcher-listen.gemspec +2 -2
- data/test/helper.rb +5 -0
- data/test/unit_test.rb +10 -2
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 561c71a39a3fed50f39fa8342ff3433a7fd38850
|
4
|
+
data.tar.gz: 6e7968fb40f74c0aa54f97f2890c925a3f8c7614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bae5dcf527456279dc77d878a1b0d9e63ef93a182158add2acd673ba40999697adcf245af75a6b66da8a96a11a0fb82ccb980c30c164381e2658dc3ddfc1a28
|
7
|
+
data.tar.gz: 3748230009113fcee8f0cdbbcaf9e06f88785c9899fbbf7e2af80b778138532784db7d1703922240316913bfda7e0e209cad219f54633b62b3d7054405a22509
|
data/.travis.yml
CHANGED
@@ -4,6 +4,16 @@ require "spring/watcher/abstract"
|
|
4
4
|
require "listen"
|
5
5
|
require "listen/version"
|
6
6
|
|
7
|
+
if defined?(Celluloid)
|
8
|
+
# fork() doesn't preserve threads, so a clean
|
9
|
+
# Celluloid shutdown isn't possible, but we can
|
10
|
+
# reduce the 10 second timeout
|
11
|
+
|
12
|
+
# There's a patch for Celluloid to avoid this (search for 'fork' in Celluloid
|
13
|
+
# issues)
|
14
|
+
Celluloid.shutdown_timeout = 2
|
15
|
+
end
|
16
|
+
|
7
17
|
module Spring
|
8
18
|
module Watcher
|
9
19
|
class Listen < Abstract
|
@@ -13,9 +23,7 @@ module Spring
|
|
13
23
|
|
14
24
|
def start
|
15
25
|
unless @listener
|
16
|
-
@listener = ::Listen.to(*base_directories,
|
17
|
-
@listener.latency(latency)
|
18
|
-
@listener.change(&method(:changed))
|
26
|
+
@listener = ::Listen.to(*base_directories, latency: latency, &method(:changed))
|
19
27
|
@listener.start
|
20
28
|
end
|
21
29
|
end
|
@@ -28,9 +36,10 @@ module Spring
|
|
28
36
|
end
|
29
37
|
|
30
38
|
def subjects_changed
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
return unless @listener
|
40
|
+
return unless @listener.respond_to?(:directories)
|
41
|
+
return unless @listener.directories.sort != base_directories.sort
|
42
|
+
restart
|
34
43
|
end
|
35
44
|
|
36
45
|
def watching?(file)
|
@@ -49,7 +58,7 @@ module Spring
|
|
49
58
|
([root] +
|
50
59
|
files.reject { |f| f.start_with? "#{root}/" }.map { |f| File.expand_path("#{f}/..") } +
|
51
60
|
directories.reject { |d| d.start_with? "#{root}/" }
|
52
|
-
).uniq
|
61
|
+
).uniq.map { |path| Pathname.new(path) }
|
53
62
|
end
|
54
63
|
end
|
55
64
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "spring-watcher-listen"
|
5
|
-
spec.version = "
|
5
|
+
spec.version = "2.0.0"
|
6
6
|
spec.authors = ["Jon Leighton"]
|
7
7
|
spec.email = ["j@jonathanleighton.com"]
|
8
8
|
spec.summary = %q{Makes spring watch files using the listen gem.}
|
@@ -19,5 +19,5 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_development_dependency "activesupport"
|
20
20
|
|
21
21
|
spec.add_dependency "spring", "~> 1.2"
|
22
|
-
spec.add_dependency "listen", "
|
22
|
+
spec.add_dependency "listen", ">= 2.7", '< 4.0'
|
23
23
|
end
|
data/test/helper.rb
CHANGED
data/test/unit_test.rb
CHANGED
@@ -7,6 +7,12 @@ class ListenWatcherTest < Spring::Test::WatcherTest
|
|
7
7
|
Spring::Watcher::Listen
|
8
8
|
end
|
9
9
|
|
10
|
+
setup do
|
11
|
+
Celluloid.boot if defined?(Celluloid)
|
12
|
+
end
|
13
|
+
|
14
|
+
teardown { Listen.stop }
|
15
|
+
|
10
16
|
test "root directories" do
|
11
17
|
begin
|
12
18
|
other_dir_1 = File.realpath(Dir.mktmpdir)
|
@@ -18,7 +24,8 @@ class ListenWatcherTest < Spring::Test::WatcherTest
|
|
18
24
|
watcher.add other_dir_2
|
19
25
|
watcher.add "#{dir}/foo"
|
20
26
|
|
21
|
-
|
27
|
+
dirs = [dir, other_dir_1, other_dir_2].sort.map { |path| Pathname.new(path) }
|
28
|
+
assert_equal dirs, watcher.base_directories.sort
|
22
29
|
ensure
|
23
30
|
FileUtils.rmdir other_dir_1
|
24
31
|
FileUtils.rmdir other_dir_2
|
@@ -39,7 +46,8 @@ class ListenWatcherTest < Spring::Test::WatcherTest
|
|
39
46
|
watcher.add "#{other_dir_1}/foo"
|
40
47
|
watcher.add other_dir_2
|
41
48
|
|
42
|
-
|
49
|
+
dirs = [dir, other_dir_1, other_dir_2].sort.map { |path| Pathname.new(path) }
|
50
|
+
assert_equal dirs, watcher.base_directories.sort
|
43
51
|
ensure
|
44
52
|
FileUtils.rmdir other_dir_1
|
45
53
|
FileUtils.rmdir other_dir_2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spring-watcher-listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Leighton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,16 +70,22 @@ dependencies:
|
|
70
70
|
name: listen
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.7'
|
76
|
+
- - "<"
|
74
77
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
78
|
+
version: '4.0'
|
76
79
|
type: :runtime
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
80
|
-
- - "
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '2.7'
|
86
|
+
- - "<"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
88
|
+
version: '4.0'
|
83
89
|
description:
|
84
90
|
email:
|
85
91
|
- j@jonathanleighton.com
|
@@ -118,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
124
|
version: '0'
|
119
125
|
requirements: []
|
120
126
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.4.2
|
122
128
|
signing_key:
|
123
129
|
specification_version: 4
|
124
130
|
summary: Makes spring watch files using the listen gem.
|