spring-watcher-listen 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fa26b896b479001b9aae68a5d14ecc0812791f0
4
- data.tar.gz: 5b63d1853eb63117b8cac9deedfc9359138f367a
3
+ metadata.gz: 561c71a39a3fed50f39fa8342ff3433a7fd38850
4
+ data.tar.gz: 6e7968fb40f74c0aa54f97f2890c925a3f8c7614
5
5
  SHA512:
6
- metadata.gz: ced8ae4e65b28c9c9a19fc414402dfda9d0a5c20e9216f40a008fa1146269f55d3fc86c4676b9065f92f9b7f2c4d8617159dc43ebaeaea66526f6b9c6043907c
7
- data.tar.gz: e3f21954701269628b287880700ceb4e5ebb9b426f6cbe0ce84dd9f46572f728a9596d6a65e1c5ee28ebc3c4d41ceb06a9f2aa209b82cf28c676d1f1f5e699af
6
+ metadata.gz: 2bae5dcf527456279dc77d878a1b0d9e63ef93a182158add2acd673ba40999697adcf245af75a6b66da8a96a11a0fb82ccb980c30c164381e2658dc3ddfc1a28
7
+ data.tar.gz: 3748230009113fcee8f0cdbbcaf9e06f88785c9899fbbf7e2af80b778138532784db7d1703922240316913bfda7e0e209cad219f54633b62b3d7054405a22509
@@ -1 +1,3 @@
1
1
  language: ruby
2
+ rvm:
3
+ - 2.2.2
@@ -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, relative_paths: false)
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
- if @listener && @listener.directories.sort != base_directories.sort
32
- restart
33
- end
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 = "1.0.0"
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", "~> 1.0"
22
+ spec.add_dependency "listen", ">= 2.7", '< 4.0'
23
23
  end
@@ -4,4 +4,9 @@ require "bundler/setup"
4
4
  require "spring/test"
5
5
  require "minitest/autorun"
6
6
 
7
+ if defined?(Celluloid)
8
+ require "celluloid/test"
9
+ Celluloid.logger.level = Logger::WARN
10
+ end
11
+
7
12
  Spring::Test.root = File.expand_path('..', __FILE__)
@@ -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
- assert_equal [dir, other_dir_1, other_dir_2].sort, watcher.base_directories.sort
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
- assert_equal [dir, other_dir_1, other_dir_2].sort, watcher.base_directories.sort
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: 1.0.0
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: 2014-11-22 00:00:00.000000000 Z
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: '1.0'
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: '1.0'
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.2.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.