listen 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/listen.rb +23 -13
- data/lib/listen/listener.rb +1 -1
- data/lib/listen/silencer.rb +1 -1
- data/lib/listen/version.rb +1 -1
- data/spec/lib/listen_spec.rb +14 -1
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55175dd6e3cf35a92523c2cf980a4a7bdb17786e
|
4
|
+
data.tar.gz: 65865b20296fe78c73c68dbd31da592f0665b684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3833e2a9b82f597701fac590420f1531c79c9800ae7dc0c029a2087693fc35c3a34843598e23ca51360ad1555d91554bde92a860eabf125e6ee2c82085eb445
|
7
|
+
data.tar.gz: 09f971472db48ab4f10f65e8e8bf71a94fabdc18aab60c073d9dcb35719bbe1172ad42c9cd6105931fa1f1634ddd33a47262626556d467cc41f462e7cc959871
|
data/lib/listen.rb
CHANGED
@@ -2,19 +2,29 @@ require 'celluloid'
|
|
2
2
|
require 'listen/listener'
|
3
3
|
|
4
4
|
module Listen
|
5
|
+
class << self
|
6
|
+
attr_accessor :stopping
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
# Listens to file system modifications on a either single directory or multiple directories.
|
9
|
+
#
|
10
|
+
# @param (see Listen::Listener#new)
|
11
|
+
#
|
12
|
+
# @yield [modified, added, removed] the changed files
|
13
|
+
# @yieldparam [Array<String>] modified the list of modified files
|
14
|
+
# @yieldparam [Array<String>] added the list of added files
|
15
|
+
# @yieldparam [Array<String>] removed the list of removed files
|
16
|
+
#
|
17
|
+
# @return [Listen::Listener] the listener
|
18
|
+
#
|
19
|
+
def to(*args, &block)
|
20
|
+
@stopping = false
|
21
|
+
Listener.new(*args, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Stop all listeners
|
25
|
+
#
|
26
|
+
def stop
|
27
|
+
@stopping = true
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
data/lib/listen/listener.rb
CHANGED
data/lib/listen/silencer.rb
CHANGED
@@ -3,7 +3,7 @@ module Listen
|
|
3
3
|
include Celluloid
|
4
4
|
|
5
5
|
# The default list of directories that get ignored.
|
6
|
-
DEFAULT_IGNORED_DIRECTORIES = %w[.bundle .git .hg .rbx .svn bundle log tmp vendor/ruby]
|
6
|
+
DEFAULT_IGNORED_DIRECTORIES = %w[.bundle .git .hg .rbx .svn bundle log tmp vendor/ruby vendor/bundle]
|
7
7
|
|
8
8
|
# The default list of files that get ignored.
|
9
9
|
DEFAULT_IGNORED_EXTENSIONS = %w[.DS_Store .tmp]
|
data/lib/listen/version.rb
CHANGED
data/spec/lib/listen_spec.rb
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Listen do
|
4
|
-
describe '
|
4
|
+
describe '.to' do
|
5
5
|
it "initalizes listener" do
|
6
6
|
expect(Listen::Listener).to receive(:new).with('/path')
|
7
7
|
described_class.to('/path')
|
8
8
|
end
|
9
|
+
|
10
|
+
it "sets stopping at false" do
|
11
|
+
allow(Listen::Listener).to receive(:new)
|
12
|
+
Listen.to('/path')
|
13
|
+
expect(Listen.stopping).to be_false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.stop' do
|
18
|
+
it "stops all listeners" do
|
19
|
+
Listen.stop
|
20
|
+
expect(Listen.stopping).to be_true
|
21
|
+
end
|
9
22
|
end
|
10
23
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaud Guillaume-Gentil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.1.11
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Listen to file modifications
|