listen 2.8.6 → 2.9.0
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 -0
- data/lib/listen/cli.rb +13 -1
- data/lib/listen/listener.rb +9 -0
- data/lib/listen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 605396a439fbf1b2b5df82537a68379c6179fec2
|
4
|
+
data.tar.gz: c1500d284d1f2014b355b24a1b93e06a6928e7f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02a60070b24579a8aa612605bdac0a119b3c47bac007f3145f2e6c6b66a033f1a4b7cf8d46f63fe06fbefe4d79aa32651fe16b809b23e774eefcd86cd04450ba
|
7
|
+
data.tar.gz: 48910b3a4df30ef041339d6176da6b897d207b92a26e3c2ed5e9f142dabe70c6cd3a873b6a56cc0b81bbd1e61eaf79a2487d270122e5392497ccf056bc2e2e2b
|
data/README.md
CHANGED
@@ -163,6 +163,9 @@ wait_for_delay: 4 # Set the delay (**in seconds**)
|
|
163
163
|
force_polling: true # Force the use of the polling adapter
|
164
164
|
# default: none
|
165
165
|
|
166
|
+
relative: false # Whether changes should be relative to current dir or not
|
167
|
+
# default: false
|
168
|
+
|
166
169
|
debug: true # Enable Celluloid logger
|
167
170
|
# default: false
|
168
171
|
|
data/lib/listen/cli.rb
CHANGED
@@ -26,6 +26,12 @@ module Listen
|
|
26
26
|
aliases: '-d',
|
27
27
|
banner: 'The directory to listen to'
|
28
28
|
|
29
|
+
class_option :relative,
|
30
|
+
type: :boolean,
|
31
|
+
default: false,
|
32
|
+
aliases: '-r',
|
33
|
+
banner: 'Convert paths relative to current directory'
|
34
|
+
|
29
35
|
def start
|
30
36
|
Listen::Forwarder.new(options).start
|
31
37
|
end
|
@@ -44,6 +50,7 @@ module Listen
|
|
44
50
|
logger.info 'Starting listen...'
|
45
51
|
address = @options[:forward]
|
46
52
|
directory = @options[:directory]
|
53
|
+
relative = @options[:relative]
|
47
54
|
callback = proc do |modified, added, removed|
|
48
55
|
if @options[:verbose]
|
49
56
|
logger.info "+ #{added}" unless added.empty?
|
@@ -52,7 +59,12 @@ module Listen
|
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
55
|
-
listener = Listen.to
|
62
|
+
listener = Listen.to(
|
63
|
+
directory,
|
64
|
+
forward_to: address,
|
65
|
+
relative: relative,
|
66
|
+
&callback)
|
67
|
+
|
56
68
|
listener.start
|
57
69
|
|
58
70
|
sleep 0.5 while listener.listen?
|
data/lib/listen/listener.rb
CHANGED
@@ -164,6 +164,14 @@ module Listen
|
|
164
164
|
fail "Invalid type: #{type.inspect}" unless [:dir, :file].include? type
|
165
165
|
fail "Invalid change: #{change.inspect}" unless change.is_a?(Symbol)
|
166
166
|
fail "Invalid path: #{path.inspect}" unless path.is_a?(String)
|
167
|
+
if @options[:relative]
|
168
|
+
dir = begin
|
169
|
+
cwd = Pathname.pwd
|
170
|
+
dir.relative_path_from(cwd)
|
171
|
+
rescue ArgumentError
|
172
|
+
dir
|
173
|
+
end
|
174
|
+
end
|
167
175
|
@queue << [type, change, dir, path, options]
|
168
176
|
|
169
177
|
@last_queue_event_time = Time.now.to_f
|
@@ -184,6 +192,7 @@ module Listen
|
|
184
192
|
latency: nil,
|
185
193
|
wait_for_delay: 0.1,
|
186
194
|
force_polling: false,
|
195
|
+
relative: false,
|
187
196
|
polling_fallback_message: nil }.merge(options)
|
188
197
|
end
|
189
198
|
|
data/lib/listen/version.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.9.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: 2015-03-
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|