listen 3.3.0.pre.3 → 3.3.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
  SHA256:
3
- metadata.gz: 1d6639e347ad2eafe447bbb0c00b50ceab5e3f7a6b3bdce169482c910765198d
4
- data.tar.gz: 617efbcc3815ea658bc886e02d9ee24a0dd142cc0273442d4323d55766c5d8ed
3
+ metadata.gz: 5b176ea600fdb505fc248ac0f680ca32e16aacb4c158d70bbf2a3a2f179e81cc
4
+ data.tar.gz: e3d6d42fcb64fd16149ecdfc889ac934977c5ebd3aa0b73f82efd2241a53b73a
5
5
  SHA512:
6
- metadata.gz: 5e55c50925feb8a8909978344e3061cec23ae2ee9cdba2583928da45bb907eb17284e7fb94aad431c9b1ba141f6401f98f131c6b774fe49619ea7bf353c6f352
7
- data.tar.gz: 221ca770caf975a3bd686704e93888a852cba10e725f582c22076a42d0540b085f929faaf474b9d81690beb0c88fb647107e3bf296e738bd913d1c0f5097a442
6
+ metadata.gz: eda24062fbec2af3e05da6ae80bc91ce6753bb4644d1fd2f2890c961bc85f7291d532d43d570def525b09987e19ff422c3746cb461583d0b597767e39d72ac2e
7
+ data.tar.gz: 82104ab7d9b6f3d5a743af79d56b9d44d60c0823c06010542049978a90d6f30ccb4145b0ec63bb3341bb823871fbfe2c32f674f19501433a4df79fc56319a430
data/README.md CHANGED
@@ -16,7 +16,7 @@ The `listen` gem listens to file modifications and notifies you about the change
16
16
  * You can watch multiple directories.
17
17
  * Regexp-patterns for ignoring paths for more accuracy and speed
18
18
  * Increased change detection accuracy on OS X HFS and VFAT volumes.
19
- * Tested on selected Ruby environments via [Travis CI](https://travis-ci.org/guard/listen). (See [.travis.yml](https:///github.com/guard/listen/master/.travis.yml) for supported/tested Ruby Versions),
19
+ * Continuous Integration: tested on selected Ruby environments via [Github Workflows](https:///github.com/guard/listen/master/.github/workflows).
20
20
 
21
21
  ## Issues / limitations
22
22
 
@@ -114,8 +114,12 @@ module Listen
114
114
  return if result.all?(&:empty?)
115
115
 
116
116
  block_start = _timestamp
117
- config.call(*result)
118
- Listen.logger.debug "Callback took #{_timestamp - block_start} sec"
117
+ exception_note = " (exception)"
118
+ ::Listen::Thread.rescue_and_log('_process_changes') do
119
+ config.call(*result)
120
+ exception_note = nil
121
+ end
122
+ Listen.logger.debug "Callback#{exception_note} took #{_timestamp - block_start} sec"
119
123
  end
120
124
 
121
125
  attr_reader :config
@@ -9,26 +9,31 @@ module Listen
9
9
  class << self
10
10
  # Creates a new thread with the given name.
11
11
  # Any exceptions raised by the thread will be logged with the thread name and complete backtrace.
12
- def new(name)
12
+ def new(name, &block)
13
13
  thread_name = "listen-#{name}"
14
-
15
14
  caller_stack = caller
15
+
16
16
  ::Thread.new do
17
- begin
18
- yield
19
- rescue Exception => ex
20
- _log_exception(ex, thread_name, caller_stack)
21
- nil
22
- end
17
+ rescue_and_log(thread_name, caller_stack: caller_stack, &block)
23
18
  end.tap do |thread|
24
19
  thread.name = thread_name
25
20
  end
26
21
  end
27
22
 
23
+ def rescue_and_log(method_name, *args, caller_stack: nil)
24
+ yield(*args)
25
+ rescue Exception => ex
26
+ _log_exception(ex, method_name, caller_stack: caller_stack)
27
+ end
28
+
28
29
  private
29
30
 
30
- def _log_exception(ex, thread_name, caller_stack)
31
- complete_backtrace = [*ex.backtrace, "--- Thread.new ---", *caller_stack]
31
+ def _log_exception(ex, thread_name, caller_stack: nil)
32
+ complete_backtrace = if caller_stack
33
+ [*ex.backtrace, "--- Thread.new ---", *caller_stack]
34
+ else
35
+ ex.backtrace
36
+ end
32
37
  message = "Exception rescued in #{thread_name}:\n#{_exception_with_causes(ex)}\n#{complete_backtrace * "\n"}"
33
38
  Listen.logger.error(message)
34
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Listen
4
- VERSION = '3.3.0.pre.3'
4
+ VERSION = '3.3.0'
5
5
  end
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: 3.3.0.pre.3
4
+ version: 3.3.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: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-fsevent
@@ -110,9 +110,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: 2.2.7
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - ">"
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
- version: 1.3.1
115
+ version: '0'
116
116
  requirements: []
117
117
  rubygems_version: 3.0.1
118
118
  signing_key: