listen 2.8.4 → 2.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -11
  3. data/lib/listen/adapter/base.rb +8 -4
  4. data/lib/listen/adapter/bsd.rb +8 -25
  5. data/lib/listen/adapter/tcp.rb +2 -1
  6. data/lib/listen/internals/logging.rb +12 -8
  7. data/lib/listen/listener.rb +1 -1
  8. data/lib/listen/version.rb +1 -1
  9. metadata +4 -121
  10. data/.gitignore +0 -28
  11. data/.hound.yml +0 -3
  12. data/.rspec +0 -2
  13. data/.rubocop.yml +0 -20
  14. data/.rubocop_todo.yml +0 -33
  15. data/.travis.yml +0 -15
  16. data/.yardopts +0 -11
  17. data/Gemfile +0 -48
  18. data/Guardfile +0 -16
  19. data/Rakefile +0 -151
  20. data/TROUBLESHOOTING.md +0 -139
  21. data/listen.gemspec +0 -33
  22. data/spec/acceptance/listen_spec.rb +0 -230
  23. data/spec/acceptance/tcp_spec.rb +0 -139
  24. data/spec/lib/listen/adapter/base_spec.rb +0 -31
  25. data/spec/lib/listen/adapter/bsd_spec.rb +0 -14
  26. data/spec/lib/listen/adapter/darwin_spec.rb +0 -145
  27. data/spec/lib/listen/adapter/linux_spec.rb +0 -93
  28. data/spec/lib/listen/adapter/polling_spec.rb +0 -48
  29. data/spec/lib/listen/adapter/tcp_spec.rb +0 -129
  30. data/spec/lib/listen/adapter/windows_spec.rb +0 -14
  31. data/spec/lib/listen/adapter_spec.rb +0 -75
  32. data/spec/lib/listen/change_spec.rb +0 -104
  33. data/spec/lib/listen/directory_spec.rb +0 -180
  34. data/spec/lib/listen/file_spec.rb +0 -252
  35. data/spec/lib/listen/listener_spec.rb +0 -482
  36. data/spec/lib/listen/record_spec.rb +0 -377
  37. data/spec/lib/listen/silencer_spec.rb +0 -100
  38. data/spec/lib/listen/tcp/broadcaster_spec.rb +0 -124
  39. data/spec/lib/listen/tcp/listener_spec.rb +0 -104
  40. data/spec/lib/listen/tcp/message_spec.rb +0 -138
  41. data/spec/lib/listen_spec.rb +0 -52
  42. data/spec/spec_helper.rb +0 -52
  43. data/spec/support/acceptance_helper.rb +0 -275
  44. data/spec/support/fixtures_helper.rb +0 -30
  45. data/spec/support/platform_helper.rb +0 -15
  46. data/vendor/hound/config/style_guides/ruby.yml +0 -259
@@ -1,33 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-11-11 16:35:31 +0100 using RuboCop version 0.25.0.
3
- # The point is for the user to remove these configuration records
4
- # one by one as the offenses are removed from the code base.
5
- # Note that changes in the inspected code, or installation of new
6
- # versions of RuboCop, may require this file to be generated again.
7
-
8
- # Offense count: 2
9
- # Configuration parameters: CountComments.
10
- Metrics/ClassLength:
11
- Max: 223
12
-
13
- # Offense count: 7
14
- Metrics/CyclomaticComplexity:
15
- Max: 14
16
-
17
- # Offense count: 27
18
- # Configuration parameters: CountComments.
19
- Metrics/MethodLength:
20
- Max: 34
21
-
22
- # Offense count: 5
23
- Metrics/PerceivedComplexity:
24
- Max: 16
25
-
26
- # Offense count: 19
27
- Style/Documentation:
28
- Enabled: false
29
-
30
- # Offense count: 44
31
- # Configuration parameters: EnforcedStyle, SupportedStyles.
32
- Style/DotPosition:
33
- Enabled: false
@@ -1,15 +0,0 @@
1
- language: ruby
2
- bundler_args: --without tool
3
- rvm:
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.2
7
- - jruby
8
- - rbx-2
9
- matrix:
10
- allow_failures:
11
- - rvm: jruby
12
- - rvm: rbx-2
13
- os:
14
- - linux
15
- - osx
data/.yardopts DELETED
@@ -1,11 +0,0 @@
1
- --title 'Listen Documentation'
2
- --readme README.md
3
- --markup markdown
4
- --markup-provider redcarpet
5
- --private
6
- --protected
7
- --output-dir ./doc
8
- lib/**/*.rb
9
- -
10
- CHANGELOG.md
11
- LICENSE
data/Gemfile DELETED
@@ -1,48 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- require 'rbconfig'
6
-
7
- case RbConfig::CONFIG['target_os']
8
-
9
- when /mswin|mingw|cygwin/i
10
- gem 'wdm', '>= 0.1.0'
11
- Kernel.warn 'NOTE: Known issues for your platform:'
12
- Kernel.warn ' * celluloid-io dns resovler bug causes TCP adapter to fail'
13
- Kernel.warn ' (fixed celluloid-io requires unreleased celluloid version)'
14
- Kernel.warn " * celluloid master branch doesn't work properly on Windows"
15
-
16
- # has fix, but causes above other problems:
17
- # gem 'celluloid-io', github: 'celluloid/celluloid-io', ref: 'a72cae2e'
18
-
19
- when /bsd|dragonfly/i
20
-
21
- gem 'rb-kqueue', '>= 0.2'
22
-
23
- Kernel.warn 'NOTE: BSD is unsupported because:'
24
- Kernel.warn "* Ruby threads don't work correctly (Ruby/MRI unit tests)"
25
- Kernel.warn "* and because of them, Celluloid doesn't work correctly"
26
-
27
- Kernel.warn '* FFI blows up when libc is a LD script (ac63e07f7)'
28
- gem 'ffi', github: 'carpetsmoker/ffi', ref: 'ac63e07f7'
29
-
30
- Kernel.warn '* Celluloid core detection blows up (7fdef04)'
31
- gem 'celluloid', github: 'celluloid/celluloid', ref: '7fdef04'
32
-
33
- else
34
- # handled by gemspec
35
- end
36
-
37
- group :tool do
38
- gem 'yard', require: false
39
- gem 'guard-rspec', require: false
40
- gem 'rubocop', '0.25.0' # TODO: should match Gemfile HoundCi
41
- gem 'guard-rubocop'
42
- gem 'pry-rescue'
43
- gem 'pry-stack_explorer'
44
- end
45
-
46
- group :test do
47
- gem 'coveralls', require: false
48
- end
data/Guardfile DELETED
@@ -1,16 +0,0 @@
1
- ignore(%r{spec/\.fixtures/})
2
-
3
- group :specs, halt_on_fail: true do
4
- guard :rspec, cmd: 'bundle exec rspec', failed_mode: :keep do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch(%r{^spec/support/*}) { 'spec' }
8
- watch('spec/spec_helper.rb') { 'spec' }
9
- end
10
-
11
- guard :rubocop, all_on_start: false, cli: '--rails' do
12
- watch(%r{.+\.rb$}) { |m| m[0] }
13
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
14
- watch(%r{(?:.+/)?\.rubocop_todo\.yml$}) { |m| File.dirname(m[0]) }
15
- end
16
- end
data/Rakefile DELETED
@@ -1,151 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- if ENV["CI"] != "true"
7
- require "rubocop/rake_task"
8
- RuboCop::RakeTask.new(:rubocop)
9
- task default: [:spec, :rubocop]
10
- else
11
- task default: [:spec]
12
- end
13
-
14
- class Releaser
15
- def initialize(options = {})
16
- @project_name = options.delete(:project_name) do
17
- fail "project_name is needed!"
18
- end
19
-
20
- @gem_name = options.delete(:gem_name) do
21
- fail "gem_name is needed!"
22
- end
23
-
24
- @github_repo = options.delete(:github_repo) do
25
- fail "github_repo is needed!"
26
- end
27
-
28
- @version = options.delete(:version) do
29
- fail "version is needed!"
30
- end
31
- end
32
-
33
- def full
34
- rubygems
35
- github
36
- end
37
-
38
- def rubygems
39
- begin
40
- STDOUT.puts "Release #{@project_name} #{@version} to RubyGems? (y/n)"
41
- input = STDIN.gets.chomp.downcase
42
- end while !%w(y n).include?(input)
43
-
44
- exit if input == "n"
45
-
46
- Rake::Task["release"].invoke
47
- end
48
-
49
- def github
50
- tag_name = "v#{@version}"
51
-
52
- require "gems"
53
-
54
- _verify_released
55
- _verify_tag_pushed
56
-
57
- require "octokit"
58
- gh_client = Octokit::Client.new(netrc: true)
59
-
60
- gh_release = _detect_gh_release(gh_client, tag_name, true)
61
- return unless gh_release
62
-
63
- STDOUT.puts "Draft release for #{tag_name}:\n"
64
- STDOUT.puts gh_release.body
65
- STDOUT.puts "\n-------------------------\n\n"
66
-
67
- _confirm_publish
68
-
69
- return unless _update_release(gh_client, gh_release, tag_name)
70
-
71
- gh_release = _detect_gh_release(gh_client, tag_name, false)
72
-
73
- _success_summary(gh_release, tag_name)
74
- end
75
-
76
- private
77
-
78
- def _verify_released
79
- if @version != Gems.info(@gem_name)["version"]
80
- STDOUT.puts "#{@project_name} #{@version} is not yet released."
81
- STDOUT.puts "Please release it first with: rake release:gem"
82
- exit
83
- end
84
- end
85
-
86
- def _verify_tag_pushed
87
- tags = `git ls-remote --tags origin`.split("\n")
88
- return if tags.detect { |tag| tag =~ /v#{@version}$/ }
89
-
90
- STDOUT.puts "The tag v#{@version} has not yet been pushed."
91
- STDOUT.puts "Please push it first with: rake release:gem"
92
- exit
93
- end
94
-
95
- def _success_summary(gh_release, tag_name)
96
- href = gh_release.rels[:html].href
97
- STDOUT.puts "GitHub release #{tag_name} has been published!"
98
- STDOUT.puts "\nPlease enjoy and spread the word!"
99
- STDOUT.puts "Lack of inspiration? Here's a tweet you could improve:\n\n"
100
- STDOUT.puts "Just released #{@project_name} #{@version}! #{href}"
101
- end
102
-
103
- def _detect_gh_release(gh_client, tag_name, draft)
104
- gh_releases = gh_client.releases(@github_repo)
105
- gh_releases.detect { |r| r.tag_name == tag_name && r.draft == draft }
106
- end
107
-
108
- def _confirm_publish
109
- begin
110
- STDOUT.puts "Would you like to publish this GitHub release now? (y/n)"
111
- input = STDIN.gets.chomp.downcase
112
- end while !%w(y n).include?(input)
113
-
114
- exit if input == "n"
115
- end
116
-
117
- def _update_release(gh_client, gh_release, tag_name)
118
- result = gh_client.update_release(gh_release.rels[:self].href, draft: false)
119
- return true if result
120
- STDOUT.puts "GitHub release #{tag_name} couldn't be published!"
121
- false
122
- end
123
- end
124
-
125
- PROJECT_NAME = "Listen"
126
- CURRENT_VERSION = Listen::VERSION
127
-
128
- def releaser
129
- $releaser ||= Releaser.new(
130
- project_name: PROJECT_NAME,
131
- gem_name: "guard",
132
- github_repo: "guard/guard",
133
- version: CURRENT_VERSION)
134
- end
135
-
136
- namespace :release do
137
- desc "Push #{PROJECT_NAME} #{CURRENT_VERSION} to RubyGems and publish"\
138
- " its GitHub release"
139
-
140
- task full: ["release:gem", "release:github"]
141
-
142
- desc "Push #{PROJECT_NAME} #{CURRENT_VERSION} to RubyGems"
143
- task :gem do
144
- releaser.rubygems
145
- end
146
-
147
- desc "Publish #{PROJECT_NAME} #{CURRENT_VERSION} GitHub release"
148
- task :github do
149
- releaser.github
150
- end
151
- end
@@ -1,139 +0,0 @@
1
- # Issues and troubleshooting
2
-
3
- ## 3 steps before you start diagnosing problems
4
-
5
- These 3 steps will:
6
- * help quickly troubleshoot issues caused by obscure problems
7
- * help quickly identify the area of the problem (a full list is [below](#known-issues))
8
- * help you get familiar with listen's diagnostic mode
9
- * help you create relevant output before you submit an issue
10
-
11
- 1) For effective troubleshooting set the `LISTEN_GEM_DEBUGGING=1` variable
12
- before starting listen.
13
-
14
- 2) Verify polling works (see `force_polling` option).
15
-
16
- After starting listen, you should see something like:
17
- ```
18
- INFO -- : Celluloid loglevel set to: 1
19
- INFO -- : Record.build(): 0.06773114204406738 seconds
20
- ```
21
-
22
- (Listen uses [Celluloid](https://github.com/celluloid/celluloid) for logging, so if you don't see anything, `Celluloid.logger` might have been disabled by a different gem, e.g. sidekiq)
23
-
24
- If you don't see the line `Record.build()`:
25
- * and there's a lot of disk activity, you may have to wait a few seconds
26
- * you may be using an outdated version of Listen
27
- * listen may have got stuck on a recursive symlink, see #259
28
-
29
- 3) Make changes e.g. `touch foo` or `echo "a" >> foo` (for troubleshooting, avoid using an editor which could generate too many misleading events)
30
-
31
- You should see something like:
32
-
33
- ```
34
- INFO -- : listen: raw changes: [[:added, "/home/me/foo"]]
35
- INFO -- : listen: final changes: {:modified=>[], :added=>["/home/me/foo"], :removed=>[]}
36
- ```
37
-
38
- "raw changes" contains changes collected during the `:wait_for_delay` and `:latency` intervals, while "final changes" is what listen decided are relevant changes (for better editor support).
39
-
40
- ## Adapter-specific diagnostics
41
-
42
- Use the `LISTEN_GEM_DEBUGGING` set to `2` for additional info.
43
-
44
- E.g. you'll get:
45
-
46
- ```
47
- INFO -- : Celluloid loglevel set to: 0
48
- DEBUG -- : Broadcaster: starting tcp server: 127.0.0.1:4000
49
- DEBUG -- : Adapter: considering TCP ...
50
- DEBUG -- : Adapter: considering polling ...
51
- DEBUG -- : Adapter: considering optimized backend...
52
- INFO -- : Record.build(): 0.0007264614105224609 seconds
53
- DEBUG -- : inotify: foo ([:create])
54
- DEBUG -- : raw queue: [:file, #<Pathname:/tmp/x>, "foo", {:change=>:added}]
55
- DEBUG -- : added: file:/tmp/x/foo ({:change=>:added})
56
- DEBUG -- : inotify: foo ([:attrib])
57
- DEBUG -- : raw queue: [:file, #<Pathname:/tmp/x>, "foo", {:change=>:modified}]
58
- DEBUG -- : inotify: foo ([:close_write, :close])
59
- DEBUG -- : raw queue: [:file, #<Pathname:/tmp/x>, "foo", {:change=>:modified}]
60
- DEBUG -- : modified: file:/tmp/x/foo ({:change=>:modified})
61
- DEBUG -- : modified: file:/tmp/x/foo ({:change=>:modified})
62
- INFO -- : listen: raw changes: [[:added, "/tmp/x/foo"]]
63
- INFO -- : listen: final changes: {:modified=>[], :added=>["/tmp/x/foo"], :removed=>[]}
64
- DEBUG -- : Callback took 4.410743713378906e-05 seconds
65
- ```
66
-
67
- This shows:
68
- * host port listened to (for forwarding events)
69
- * the actual adapter used (here, it's "optimized backend")
70
- * the event received (here it's `:create` from rb-inotify)
71
- * "raw queue" - events queued for processing (collected during `:latency`)
72
- * "Callback took" - how long it took your app to process changes
73
-
74
- #### Known issues
75
-
76
- Here are common issues grouped by area in which they occur:
77
-
78
- 1. System/OS
79
- * [Update your Dropbox client](http://www.dropbox.com/downloading), if you have Dropbox installed.
80
- * old MacOS (< 10.6)
81
- * certain old versions of Ruby (try a newer Ruby on Windows for `wdm` and TCP mode to work)
82
- * system limits
83
- * threads for Celluloid (e.g. Virtual Machine CPU/RAM limitations)
84
- * [inotify limits (Linux)](https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers)
85
- * system in an inconsistent state or stuck (try rebooting/updating on Windows/Mac - seriously!)
86
- * FSEvent bug: (http://feedback.livereload.com/knowledgebase/articles/86239)
87
-
88
- 2. Installation/gems/config
89
- * not running listen or your app (e.g. guard) with `bundle exec` first
90
- * old version of listen
91
- * problems with adapter gems (`wdm`, `rb-fsevent`, `rb-inotify`) not installed, not detected properly (Windows) or not in Gemfile (Windows)
92
- * Celluloid actors are silently crashing (when no LISTEN_GEM_DEBUGGING variable is present)
93
- * see the [Performance](https://github.com/guard/listen/blob/master/README.md#Performance) section in the README
94
-
95
- 3. Filesystem
96
- * VM shared folders and network folders (NFS, Samba, SSHFS) don't work with optimized backends (workaround: polling, [TCP mode](https://github.com/guard/listen/blob/master/README.md#forwarding-file-events-over-tcp), Vagrant's rsync-auto mode, rsync/unison)
97
- * FAT/HFS timestamps have 1-second precision, which can cause polling and rb-fsevent to be very slow on large files (try `LISTEN_GEM_DISABLE_HASHING` variable)
98
- * virtual filesystems may not implement event monitoring
99
- * restrictive file/folder permissions
100
- * watched folders moved/removed while listen was running (try restarting listen and moving/copying watched folder to a new location)
101
-
102
- 4. Insufficient latency (for polling and rb-fsevent)
103
- * too many files being watched (polling) and not enough threads or CPU power
104
- * slow editor save (see below)
105
- * slow hard drive
106
- * encryption
107
- * a combination of factors
108
-
109
- 5. Too few or too many callbacks (`:wait_for_delay` option)
110
- * complex editor file-save causes events to happen during callback (result: multiple callbacks if wait_for_delay is too small)
111
- * too large when using TCP mode (see timestamps in output to debug)
112
- * too many changes happening too frequently (use ignore rules to filter them out)
113
-
114
- 6. Paths
115
- * default ignore rules
116
- * encoding-related issues (bad filenames, mounted FS encoding mismatch)
117
- * symlinks may cause listen to hang (#259)
118
- * symlinks may not work as you expect or work differently for polling vs non-polling
119
- * TCP paths don't match with client's current working directory
120
-
121
- 7. Editors
122
- * "atomic save" in editors may confuse listen (disable it and try again)
123
- * listen's default ignore rules may need tweaking
124
- * your editor may not be supported yet (see default ignore rules for editors)
125
- * use `touch foo` or `echo "a" >> foo` to confirm it's an editor issue
126
- * slow terminal/GFX card, slow font, transparency effects in terminal
127
- * complex/lengthy editor save (due to e.g. many plugins running during save)
128
- * listen has complex rules for detecting atomic file saves (Linux)
129
-
130
- 8. TCP (tcp mode) issues
131
- * not a recent listen gem (before 2.7.11)
132
- * additional network delay and collecting may need a higher `:wait_for_delay` value
133
- * changes (added, removed, deleted) not matching actual changes
134
-
135
- If your application keeps using the polling-adapter and you can't figure out why, feel free to [open an issue](https://github.com/guard/listen/issues/new) (and be sure to [give all the details](https://github.com/guard/listen/blob/master/CONTRIBUTING.md)).
136
-
137
- Listen traps SIGINT signal to properly finalize listeners. If you plan
138
- on trapping this signal yourself - make sure to call `Listen.stop` in
139
- signal handler.
@@ -1,33 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'listen/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'listen'
8
- s.version = Listen::VERSION
9
- s.license = 'MIT'
10
- s.author = 'Thibaud Guillaume-Gentil'
11
- s.email = 'thibaud@thibaud.gg'
12
- s.homepage = 'https://github.com/guard/listen'
13
- s.summary = 'Listen to file modifications'
14
- s.description = 'The Listen gem listens to file modifications and '\
15
- 'notifies you about the changes. Works everywhere!'
16
-
17
- s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
- s.test_files = s.files.grep(/^spec\//)
19
- s.executable = 'listen'
20
- s.require_path = 'lib'
21
-
22
- s.required_ruby_version = '>= 1.9.3'
23
-
24
- s.add_dependency 'celluloid', '>= 0.15.2'
25
- s.add_dependency 'rb-fsevent', '>= 0.9.3'
26
- s.add_dependency 'rb-inotify', '>= 0.9'
27
-
28
- s.add_development_dependency 'bundler', '>= 1.3.5'
29
- s.add_development_dependency 'celluloid-io', '>= 0.15.0'
30
- s.add_development_dependency 'rake'
31
- s.add_development_dependency 'rspec', '~> 3.0.0rc1'
32
- s.add_development_dependency 'rspec-retry'
33
- end