sass-listen 3.0.7 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/{listen.rb → sass-listen.rb} +9 -9
  3. data/lib/{listen → sass-listen}/adapter.rb +10 -10
  4. data/lib/{listen → sass-listen}/adapter/base.rb +9 -9
  5. data/lib/{listen → sass-listen}/adapter/bsd.rb +1 -1
  6. data/lib/{listen → sass-listen}/adapter/config.rb +1 -1
  7. data/lib/{listen → sass-listen}/adapter/darwin.rb +23 -6
  8. data/lib/{listen → sass-listen}/adapter/linux.rb +5 -3
  9. data/lib/{listen → sass-listen}/adapter/polling.rb +1 -1
  10. data/lib/{listen → sass-listen}/adapter/windows.rb +1 -1
  11. data/lib/{listen → sass-listen}/backend.rb +6 -4
  12. data/lib/{listen → sass-listen}/change.rb +6 -6
  13. data/lib/{listen → sass-listen}/cli.rb +5 -5
  14. data/lib/{listen → sass-listen}/directory.rb +16 -5
  15. data/lib/{listen → sass-listen}/event/config.rb +1 -1
  16. data/lib/{listen → sass-listen}/event/loop.rb +4 -4
  17. data/lib/{listen → sass-listen}/event/processor.rb +3 -3
  18. data/lib/{listen → sass-listen}/event/queue.rb +3 -1
  19. data/lib/{listen → sass-listen}/file.rb +3 -3
  20. data/lib/{listen → sass-listen}/fsm.rb +1 -1
  21. data/lib/{listen → sass-listen}/internals/thread_pool.rb +10 -2
  22. data/lib/{listen → sass-listen}/listener.rb +14 -14
  23. data/lib/{listen → sass-listen}/listener/config.rb +1 -1
  24. data/lib/{listen → sass-listen}/logger.rb +2 -2
  25. data/lib/{listen → sass-listen}/options.rb +2 -2
  26. data/lib/{listen → sass-listen}/queue_optimizer.rb +2 -2
  27. data/lib/{listen → sass-listen}/record.rb +3 -3
  28. data/lib/{listen → sass-listen}/record/entry.rb +13 -2
  29. data/lib/{listen → sass-listen}/record/symlink_detector.rb +1 -1
  30. data/lib/{listen → sass-listen}/silencer.rb +1 -1
  31. data/lib/{listen → sass-listen}/silencer/controller.rb +1 -1
  32. data/lib/sass-listen/version.rb +3 -0
  33. metadata +49 -40
  34. data/bin/listen +0 -12
  35. data/lib/listen/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83c34d5acc3959e91e3bfdba038c863d9a4a018c
4
- data.tar.gz: 2ab5632e30ef7ccf1c7e1ececdd193377fdb75ba
3
+ metadata.gz: f837a533260d79766fbf0cb58216fbb4262d5bba
4
+ data.tar.gz: 237f28137dc5d1e7e82526abac3a8e693b62ce89
5
5
  SHA512:
6
- metadata.gz: a4ad4191d23a3d8b2c8fa0d102626c7085f8fe6cd756c3cdc38569f7ff8f630f2974d15e656e6799f0c7b74f04edc9cfccae41bf55f0edfe537e0a812239d74f
7
- data.tar.gz: 5daa41e72785162c3ebe4fc5fe6ef1d6290e7d48069c8126104a2d0968ddb06a194deb8f71614d436d940c116eb627b464aa80a558881c6219eca698562d5022
6
+ metadata.gz: 1c6fe33035fd7e489e7ccbe9d3ca47a2af3f76a8942f573d418d77cb00ae03d53f68e591735ae69260dd0517f6820ad6af9f7c44eb0a7c3c806c344ea8314f5e
7
+ data.tar.gz: 4cf4f0f9fd9a61a32d079dea7c42e321702215e3a6c93ccd8e8c9eb5dfed8827e162a68862f2905657f8b5c03b54f6a7bea98ffbfc1ee2f709f7126430ba9522
@@ -1,8 +1,8 @@
1
1
  require 'logger'
2
- require 'listen/logger'
3
- require 'listen/listener'
2
+ require 'sass-listen/logger'
3
+ require 'sass-listen/listener'
4
4
 
5
- require 'listen/internals/thread_pool'
5
+ require 'sass-listen/internals/thread_pool'
6
6
 
7
7
  # Always set up logging by default first time file is required
8
8
  #
@@ -10,26 +10,26 @@ require 'listen/internals/thread_pool'
10
10
  # requiring this file. If you need to set a custom logger,
11
11
  # require the listen/logger file and set the logger before requiring
12
12
  # this file.
13
- Listen.setup_default_logger_if_unset
13
+ SassListen.setup_default_logger_if_unset
14
14
 
15
15
  # Won't print anything by default because of level - unless you've set
16
16
  # LISTEN_GEM_DEBUGGING or provided your own logger with a high enough level
17
- Listen::Logger.info "Listen loglevel set to: #{Listen.logger.level}"
18
- Listen::Logger.info "Listen version: #{Listen::VERSION}"
17
+ SassListen::Logger.info "SassListen loglevel set to: #{SassListen.logger.level}"
18
+ SassListen::Logger.info "SassListen version: #{SassListen::VERSION}"
19
19
 
20
- module Listen
20
+ module SassListen
21
21
  class << self
22
22
  # Listens to file system modifications on a either single directory or
23
23
  # multiple directories.
24
24
  #
25
- # @param (see Listen::Listener#new)
25
+ # @param (see SassListen::Listener#new)
26
26
  #
27
27
  # @yield [modified, added, removed] the changed files
28
28
  # @yieldparam [Array<String>] modified the list of modified files
29
29
  # @yieldparam [Array<String>] added the list of added files
30
30
  # @yieldparam [Array<String>] removed the list of removed files
31
31
  #
32
- # @return [Listen::Listener] the listener
32
+ # @return [SassListen::Listener] the listener
33
33
  #
34
34
  def to(*args, &block)
35
35
  @listeners ||= []
@@ -1,14 +1,14 @@
1
- require 'listen/adapter/base'
2
- require 'listen/adapter/bsd'
3
- require 'listen/adapter/darwin'
4
- require 'listen/adapter/linux'
5
- require 'listen/adapter/polling'
6
- require 'listen/adapter/windows'
1
+ require 'sass-listen/adapter/base'
2
+ require 'sass-listen/adapter/bsd'
3
+ require 'sass-listen/adapter/darwin'
4
+ require 'sass-listen/adapter/linux'
5
+ require 'sass-listen/adapter/polling'
6
+ require 'sass-listen/adapter/windows'
7
7
 
8
- module Listen
8
+ module SassListen
9
9
  module Adapter
10
10
  OPTIMIZED_ADAPTERS = [Darwin, Linux, BSD, Windows]
11
- POLLING_FALLBACK_MESSAGE = 'Listen will be polling for changes.'\
11
+ POLLING_FALLBACK_MESSAGE = 'SassListen will be polling for changes.'\
12
12
  'Learn more at https://github.com/guard/listen#listen-adapters.'
13
13
 
14
14
  def self.select(options = {})
@@ -33,11 +33,11 @@ module Listen
33
33
 
34
34
  def self._warn_polling_fallback(options)
35
35
  msg = options.fetch(:polling_fallback_message, POLLING_FALLBACK_MESSAGE)
36
- Kernel.warn "[Listen warning]:\n #{msg}" if msg
36
+ Kernel.warn "[SassListen warning]:\n #{msg}" if msg
37
37
  end
38
38
 
39
39
  def self._log(type, message)
40
- Listen::Logger.send(type, message)
40
+ SassListen::Logger.send(type, message)
41
41
  end
42
42
  end
43
43
  end
@@ -1,8 +1,8 @@
1
- require 'listen/options'
2
- require 'listen/record'
3
- require 'listen/change'
1
+ require 'sass-listen/options'
2
+ require 'sass-listen/record'
3
+ require 'sass-listen/change'
4
4
 
5
- module Listen
5
+ module SassListen
6
6
  module Adapter
7
7
  class Base
8
8
  attr_reader :options
@@ -21,7 +21,7 @@ module Listen
21
21
  fail 'No directories to watch!' if config.directories.empty?
22
22
 
23
23
  defaults = self.class.const_get('DEFAULTS')
24
- @options = Listen::Options.new(config.adapter_options, defaults)
24
+ @options = SassListen::Options.new(config.adapter_options, defaults)
25
25
  rescue
26
26
  _log_exception 'adapter config failed: %s:%s called from: %s', caller
27
27
  raise
@@ -70,7 +70,7 @@ module Listen
70
70
  @started = true
71
71
 
72
72
  calling_stack = caller.dup
73
- Listen::Internals::ThreadPool.add do
73
+ SassListen::Internals::ThreadPool.add do
74
74
  begin
75
75
  @snapshots.values.each do |snapshot|
76
76
  _timed('Record.build()') { snapshot.record.build }
@@ -102,9 +102,9 @@ module Listen
102
102
  start = Time.now.to_f
103
103
  yield
104
104
  diff = Time.now.to_f - start
105
- Listen::Logger.info format('%s: %.05f seconds', title, diff)
105
+ SassListen::Logger.info format('%s: %.05f seconds', title, diff)
106
106
  rescue
107
- Listen::Logger.warn "#{title} crashed: #{$ERROR_INFO.inspect}"
107
+ SassListen::Logger.warn "#{title} crashed: #{$ERROR_INFO.inspect}"
108
108
  raise
109
109
  end
110
110
 
@@ -130,7 +130,7 @@ module Listen
130
130
  end
131
131
 
132
132
  def self._log(*args, &block)
133
- Listen::Logger.send(*args, &block)
133
+ SassListen::Logger.send(*args, &block)
134
134
  end
135
135
  end
136
136
  end
@@ -2,7 +2,7 @@
2
2
  # @see http://www.freebsd.org/cgi/man.cgi?query=kqueue
3
3
  # @see https://github.com/mat813/rb-kqueue/blob/master/lib/rb-kqueue/queue.rb
4
4
  #
5
- module Listen
5
+ module SassListen
6
6
  module Adapter
7
7
  class BSD < Base
8
8
  OS_REGEXP = /bsd|dragonfly/i
@@ -1,6 +1,6 @@
1
1
  require 'pathname'
2
2
 
3
- module Listen
3
+ module SassListen
4
4
  module Adapter
5
5
  class Config
6
6
  attr_reader :directories
@@ -1,22 +1,39 @@
1
1
  require 'thread'
2
- require 'listen/internals/thread_pool'
2
+ require 'sass-listen/internals/thread_pool'
3
3
 
4
- module Listen
4
+ module SassListen
5
5
  module Adapter
6
6
  # Adapter implementation for Mac OS X `FSEvents`.
7
7
  #
8
8
  class Darwin < Base
9
- OS_REGEXP = /darwin(1.+)?$/i
9
+ OS_REGEXP = /darwin(?<major_version>1\d+)/i
10
10
 
11
11
  # The default delay between checking for changes.
12
12
  DEFAULTS = { latency: 0.1 }
13
13
 
14
+ INCOMPATIBLE_GEM_VERSION = <<-EOS.gsub(/^ {8}/, '')
15
+ rb-fsevent > 0.9.4 no longer supports OS X 10.6 through 10.8.
16
+
17
+ Please add the following to your Gemfile to avoid polling for changes:
18
+ require 'rbconfig'
19
+ if RbConfig::CONFIG['target_os'] =~ /darwin(1[0-3])/i
20
+ gem 'rb-fsevent', '<= 0.9.4'
21
+ end
22
+ EOS
23
+
24
+ def self.usable?
25
+ require 'rb-fsevent'
26
+ darwin_version = RbConfig::CONFIG['target_os'][OS_REGEXP, :major_version] or return false
27
+ return true if darwin_version.to_i >= 13 # darwin13 is OS X 10.9
28
+ return true if Gem::Version.new(FSEvent::VERSION) <= Gem::Version.new('0.9.4')
29
+ Kernel.warn INCOMPATIBLE_GEM_VERSION
30
+ false
31
+ end
32
+
14
33
  private
15
34
 
16
35
  # NOTE: each directory gets a DIFFERENT callback!
17
36
  def _configure(dir, &callback)
18
- require 'rb-fsevent'
19
-
20
37
  opts = { latency: options.latency }
21
38
 
22
39
  @workers ||= ::Queue.new
@@ -57,7 +74,7 @@ module Listen
57
74
  workers.each do |worker|
58
75
  # NOTE: while passing local variables to the block below is not
59
76
  # thread safe, using 'worker' from the enumerator above is ok
60
- Listen::Internals::ThreadPool.add { _run_worker(worker) }
77
+ SassListen::Internals::ThreadPool.add { _run_worker(worker) }
61
78
  end
62
79
  end
63
80
 
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  module Adapter
3
3
  # @see https://github.com/nex3/rb-inotify
4
4
  class Linux < Base
@@ -22,7 +22,7 @@ module Listen
22
22
  '/wiki/Increasing-the-amount-of-inotify-watchers'
23
23
 
24
24
  INOTIFY_LIMIT_MESSAGE = <<-EOS.gsub(/^\s*/, '')
25
- FATAL: Listen error: unable to monitor directories for changes.
25
+ FATAL: SassListen error: unable to monitor directories for changes.
26
26
  Visit #{WIKI_URL} for info on how to fix this.
27
27
  EOS
28
28
 
@@ -35,7 +35,9 @@ module Listen
35
35
  end
36
36
 
37
37
  def _run
38
+ Thread.current[:listen_blocking_read_thread] = true
38
39
  @worker.run
40
+ Thread.current[:listen_blocking_read_thread] = false
39
41
  end
40
42
 
41
43
  def _process_event(dir, event)
@@ -99,7 +101,7 @@ module Listen
99
101
  end
100
102
 
101
103
  def _stop
102
- @worker.close
104
+ @worker && @worker.close
103
105
  end
104
106
  end
105
107
  end
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  module Adapter
3
3
  # Polling Adapter that works cross-platform and
4
4
  # has no dependencies. This is the adapter that
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  module Adapter
3
3
  # Adapter implementation for Windows `wdm`.
4
4
  #
@@ -1,10 +1,12 @@
1
- require 'listen/adapter'
2
- require 'listen/adapter/base'
3
- require 'listen/adapter/config'
1
+ require 'sass-listen/adapter'
2
+ require 'sass-listen/adapter/base'
3
+ require 'sass-listen/adapter/config'
4
+
5
+ require 'forwardable'
4
6
 
5
7
  # This class just aggregates configuration object to avoid Listener specs
6
8
  # from exploding with huge test setup blocks
7
- module Listen
9
+ module SassListen
8
10
  class Backend
9
11
  def initialize(directories, queue, silencer, config)
10
12
  adapter_select_opts = config.adapter_select_options
@@ -1,7 +1,7 @@
1
- require 'listen/file'
2
- require 'listen/directory'
1
+ require 'sass-listen/file'
2
+ require 'sass-listen/directory'
3
3
 
4
- module Listen
4
+ module SassListen
5
5
  # TODO: rename to Snapshot
6
6
  class Change
7
7
  # TODO: test this class for coverage
@@ -35,13 +35,13 @@ module Listen
35
35
  cookie = options[:cookie]
36
36
 
37
37
  if !cookie && config.silenced?(rel_path, type)
38
- Listen::Logger.debug { "(silenced): #{rel_path.inspect}" }
38
+ SassListen::Logger.debug { "(silenced): #{rel_path.inspect}" }
39
39
  return
40
40
  end
41
41
 
42
42
  path = watched_dir + rel_path
43
43
 
44
- Listen::Logger.debug do
44
+ SassListen::Logger.debug do
45
45
  log_details = options[:silence] && 'recording' || change || 'unknown'
46
46
  "#{log_details}: #{type}:#{path} (#{options.inspect})"
47
47
  end
@@ -67,7 +67,7 @@ module Listen
67
67
  __method__,
68
68
  exinspect,
69
69
  ex.backtrace * "\n")
70
- Listen::Logger.error(msg)
70
+ SassListen::Logger.error(msg)
71
71
  raise
72
72
  end
73
73
 
@@ -1,12 +1,12 @@
1
1
  require 'thor'
2
- require 'listen'
2
+ require 'sass-listen'
3
3
  require 'logger'
4
4
 
5
- module Listen
5
+ module SassListen
6
6
  class CLI < Thor
7
7
  default_task :start
8
8
 
9
- desc 'start', 'Starts Listen'
9
+ desc 'start', 'Starts SassListen'
10
10
 
11
11
  class_option :verbose,
12
12
  type: :boolean,
@@ -27,7 +27,7 @@ module Listen
27
27
  banner: 'Convert paths relative to current directory'
28
28
 
29
29
  def start
30
- Listen::Forwarder.new(options).start
30
+ SassListen::Forwarder.new(options).start
31
31
  end
32
32
  end
33
33
 
@@ -52,7 +52,7 @@ module Listen
52
52
  end
53
53
  end
54
54
 
55
- listener = Listen.to(
55
+ listener = SassListen.to(
56
56
  directory,
57
57
  relative: relative,
58
58
  &callback)
@@ -1,6 +1,6 @@
1
1
  require 'set'
2
2
 
3
- module Listen
3
+ module SassListen
4
4
  # TODO: refactor (turn it into a normal object, cache the stat, etc)
5
5
  class Directory
6
6
  def self.scan(snapshot, rel_path, options)
@@ -12,9 +12,9 @@ module Listen
12
12
 
13
13
  # TODO: use children(with_directory: false)
14
14
  path = dir + rel_path
15
- current = Set.new(path.children)
15
+ current = Set.new(_children(path))
16
16
 
17
- Listen::Logger.debug do
17
+ SassListen::Logger.debug do
18
18
  format('%s: %s(%s): %s -> %s',
19
19
  (options[:silence] ? 'Recording' : 'Scanning'),
20
20
  rel_path, options.inspect, previous.inspect, current.inspect)
@@ -28,7 +28,7 @@ module Listen
28
28
  end
29
29
  rescue Errno::ENOENT
30
30
  # The directory changed meanwhile, so rescan it
31
- current = Set.new(path.children)
31
+ current = Set.new(_children(path))
32
32
  retry
33
33
  end
34
34
 
@@ -47,7 +47,7 @@ module Listen
47
47
  _async_changes(snapshot, path, previous, options)
48
48
  _change(snapshot, :file, rel_path, options)
49
49
  rescue
50
- Listen::Logger.warn do
50
+ SassListen::Logger.warn do
51
51
  format('scan DIED: %s:%s', $ERROR_INFO, $ERROR_POSITION * "\n")
52
52
  end
53
53
  raise
@@ -72,5 +72,16 @@ module Listen
72
72
  opts.delete(:recursive)
73
73
  snapshot.invalidate(type, path, opts)
74
74
  end
75
+
76
+ def self._children(path)
77
+ return path.children unless RUBY_ENGINE == 'jruby'
78
+
79
+ # JRuby inconsistency workaround, see:
80
+ # https://github.com/jruby/jruby/issues/3840
81
+ exists = path.exist?
82
+ directory = path.directory?
83
+ return path.children unless (exists && !directory)
84
+ raise Errno::ENOTDIR, path.to_s
85
+ end
75
86
  end
76
87
  end
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  module Event
3
3
  class Config
4
4
  def initialize(
@@ -1,9 +1,9 @@
1
1
  require 'thread'
2
2
 
3
3
  require 'timeout'
4
- require 'listen/event/processor'
4
+ require 'sass-listen/event/processor'
5
5
 
6
- module Listen
6
+ module SassListen
7
7
  module Event
8
8
  class Loop
9
9
  class Error < RuntimeError
@@ -42,7 +42,7 @@ module Listen
42
42
  _wait_for_changes(q, config)
43
43
  end
44
44
 
45
- Listen::Logger.debug('Waiting for processing to start...')
45
+ SassListen::Logger.debug('Waiting for processing to start...')
46
46
  Timeout.timeout(5) { q.pop }
47
47
  end
48
48
 
@@ -105,7 +105,7 @@ module Listen
105
105
  indent,
106
106
  ex.backtrace * indent
107
107
  )
108
- Listen::Logger.error(msg)
108
+ SassListen::Logger.error(msg)
109
109
  end
110
110
 
111
111
  def _wakeup(reason)
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  module Event
3
3
  class Processor
4
4
  def initialize(config, reasons)
@@ -19,7 +19,7 @@ module Listen
19
19
  _process_changes
20
20
  end
21
21
  rescue Stopped
22
- Listen::Logger.debug('Processing stopped')
22
+ SassListen::Logger.debug('Processing stopped')
23
23
  end
24
24
 
25
25
  private
@@ -113,7 +113,7 @@ module Listen
113
113
 
114
114
  block_start = _timestamp
115
115
  config.call(*result)
116
- Listen::Logger.debug "Callback took #{_timestamp - block_start} sec"
116
+ SassListen::Logger.debug "Callback took #{_timestamp - block_start} sec"
117
117
  end
118
118
 
119
119
  attr_reader :config
@@ -1,6 +1,8 @@
1
1
  require 'thread'
2
2
 
3
- module Listen
3
+ require 'forwardable'
4
+
5
+ module SassListen
4
6
  module Event
5
7
  class Queue
6
8
  class Config
@@ -1,6 +1,6 @@
1
1
  require 'digest/md5'
2
2
 
3
- module Listen
3
+ module SassListen
4
4
  class File
5
5
  def self.change(record, rel_path)
6
6
  path = Pathname.new(record.root) + rel_path
@@ -35,7 +35,7 @@ module Listen
35
35
  # when file was changed and when the event was triggered.
36
36
  #
37
37
  # If a file is saved at ???14.998, by the time the event is
38
- # actually received by Listen, the time could already be e.g.
38
+ # actually received by SassListen, the time could already be e.g.
39
39
  # ???15.7.
40
40
  #
41
41
  # And since Darwin adapter uses directory scanning, the file
@@ -64,7 +64,7 @@ module Listen
64
64
  record.unset_path(rel_path)
65
65
  :removed
66
66
  rescue
67
- Listen::Logger.debug "lstat failed for: #{rel_path} (#{$ERROR_INFO})"
67
+ SassListen::Logger.debug "lstat failed for: #{rel_path} (#{$ERROR_INFO})"
68
68
  raise
69
69
  end
70
70
 
@@ -1,5 +1,5 @@
1
1
  # Code copied from https://github.com/celluloid/celluloid-fsm
2
- module Listen
2
+ module SassListen
3
3
  module FSM
4
4
  DEFAULT_STATE = :default # Default state name unless one is explicitly set
5
5
 
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  # @private api
3
3
  module Internals
4
4
  module ThreadPool
@@ -13,8 +13,16 @@ module Listen
13
13
  return if @threads.empty? # return to avoid using possibly stubbed Queue
14
14
 
15
15
  killed = Queue.new
16
+ # You can't kill a read on a descriptor in JRuby, so let's just
17
+ # ignore running threads (listen rb-inotify waiting for disk activity
18
+ # before closing) pray threads die faster than they are created...
19
+ limit = RUBY_ENGINE == 'jruby' ? [1] : []
20
+
16
21
  killed << @threads.pop.kill until @threads.empty?
17
- killed.pop.join until killed.empty?
22
+ until killed.empty?
23
+ th = killed.pop
24
+ th.join(*limit) unless th[:listen_blocking_read_thread]
25
+ end
18
26
  end
19
27
  end
20
28
  end
@@ -1,30 +1,30 @@
1
1
  require 'English'
2
2
 
3
- require 'listen/version'
3
+ require 'sass-listen/version'
4
4
 
5
- require 'listen/backend'
5
+ require 'sass-listen/backend'
6
6
 
7
- require 'listen/silencer'
8
- require 'listen/silencer/controller'
7
+ require 'sass-listen/silencer'
8
+ require 'sass-listen/silencer/controller'
9
9
 
10
- require 'listen/queue_optimizer'
10
+ require 'sass-listen/queue_optimizer'
11
11
 
12
- require 'listen/fsm'
12
+ require 'sass-listen/fsm'
13
13
 
14
- require 'listen/event/loop'
15
- require 'listen/event/queue'
16
- require 'listen/event/config'
14
+ require 'sass-listen/event/loop'
15
+ require 'sass-listen/event/queue'
16
+ require 'sass-listen/event/config'
17
17
 
18
- require 'listen/listener/config'
18
+ require 'sass-listen/listener/config'
19
19
 
20
- module Listen
20
+ module SassListen
21
21
  class Listener
22
- include Listen::FSM
22
+ include SassListen::FSM
23
23
 
24
24
  # Initializes the directories listener.
25
25
  #
26
26
  # @param [String] directory the directories to listen to
27
- # @param [Hash] options the listen options (see Listen::Listener::Options)
27
+ # @param [Hash] options the listen options (see SassListen::Listener::Options)
28
28
  #
29
29
  # @yield [modified, added, removed] the changed files
30
30
  # @yieldparam [Array<String>] modified the list of modified files
@@ -61,7 +61,7 @@ module Listen
61
61
 
62
62
  default_state :initializing
63
63
 
64
- state :initializing, to: :backend_started
64
+ state :initializing, to: [:backend_started, :stopped]
65
65
 
66
66
  state :backend_started, to: [:frontend_ready, :stopped] do
67
67
  backend.start
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  class Listener
3
3
  class Config
4
4
  DEFAULTS = {
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  def self.logger
3
3
  @logger ||= nil
4
4
  end
@@ -25,7 +25,7 @@ module Listen
25
25
  class Logger
26
26
  [:fatal, :error, :warn, :info, :debug].each do |meth|
27
27
  define_singleton_method(meth) do |*args, &block|
28
- Listen.logger.public_send(meth, *args, &block) if Listen.logger
28
+ SassListen.logger.public_send(meth, *args, &block) if SassListen.logger
29
29
  end
30
30
  end
31
31
  end
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  class Options
3
3
  def initialize(opts, defaults)
4
4
  @options = {}
@@ -10,7 +10,7 @@ module Listen
10
10
  return if given_options.empty?
11
11
 
12
12
  msg = "Unknown options: #{given_options.inspect}"
13
- Listen::Logger.warn msg
13
+ SassListen::Logger.warn msg
14
14
  fail msg
15
15
  end
16
16
 
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  class QueueOptimizer
3
3
  class Config
4
4
  def initialize(adapter_class, silencer)
@@ -15,7 +15,7 @@ module Listen
15
15
  end
16
16
 
17
17
  def debug(*args, &block)
18
- Listen.logger.debug(*args, &block)
18
+ SassListen.logger.debug(*args, &block)
19
19
  end
20
20
  end
21
21
 
@@ -1,8 +1,8 @@
1
1
  require 'thread'
2
- require 'listen/record/entry'
3
- require 'listen/record/symlink_detector'
2
+ require 'sass-listen/record/entry'
3
+ require 'sass-listen/record/symlink_detector'
4
4
 
5
- module Listen
5
+ module SassListen
6
6
  class Record
7
7
  # TODO: one Record object per watched directory?
8
8
  # TODO: deprecate
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  # @private api
3
3
  class Record
4
4
  # Represents a directory entry (dir or file)
@@ -13,7 +13,7 @@ module Listen
13
13
 
14
14
  def children
15
15
  child_relative = _join
16
- (Dir.entries(sys_path) - %w(. ..)).map do |name|
16
+ (_entries(sys_path) - %w(. ..)).map do |name|
17
17
  Entry.new(@root, child_relative, name)
18
18
  end
19
19
  end
@@ -46,6 +46,17 @@ module Listen
46
46
  args = [@relative, @name].compact
47
47
  args.empty? ? nil : ::File.join(*args)
48
48
  end
49
+
50
+ def _entries(dir)
51
+ return Dir.entries(dir) unless RUBY_ENGINE == 'jruby'
52
+
53
+ # JRuby inconsistency workaround, see:
54
+ # https://github.com/jruby/jruby/issues/3840
55
+ exists = ::File.exist?(dir)
56
+ directory = ::File.directory?(dir)
57
+ return Dir.entries(dir) unless (exists && !directory)
58
+ raise Errno::ENOTDIR, dir
59
+ end
49
60
  end
50
61
  end
51
62
  end
@@ -1,6 +1,6 @@
1
1
  require 'set'
2
2
 
3
- module Listen
3
+ module SassListen
4
4
  # @private api
5
5
  class Record
6
6
  class SymlinkDetector
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  class Silencer
3
3
  # The default list of directories that get ignored.
4
4
  DEFAULT_IGNORED_DIRECTORIES = %r{^(?:
@@ -1,4 +1,4 @@
1
- module Listen
1
+ module SassListen
2
2
  class Silencer
3
3
  class Controller
4
4
  def initialize(silencer, default_options)
@@ -0,0 +1,3 @@
1
+ module SassListen
2
+ VERSION = '4.0.0'
3
+ end
metadata CHANGED
@@ -1,33 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-listen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
4
+ version: 4.0.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: 2016-05-05 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-fsevent
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: 0.9.3
22
+ version: 0.9.4
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.9'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: 0.9.3
32
+ version: 0.9.4
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rb-inotify
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.9'
31
40
  - - ">="
32
41
  - !ruby/object:Gem::Version
33
42
  version: 0.9.7
@@ -35,6 +44,9 @@ dependencies:
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.9'
38
50
  - - ">="
39
51
  - !ruby/object:Gem::Version
40
52
  version: 0.9.7
@@ -55,8 +67,7 @@ dependencies:
55
67
  description: This fork of guard/listen provides a stable API for users of the ruby
56
68
  Sass CLI
57
69
  email: thibaud@thibaud.gg
58
- executables:
59
- - listen
70
+ executables: []
60
71
  extensions: []
61
72
  extra_rdoc_files: []
62
73
  files:
@@ -64,38 +75,37 @@ files:
64
75
  - CONTRIBUTING.md
65
76
  - LICENSE.txt
66
77
  - README.md
67
- - bin/listen
68
- - lib/listen.rb
69
- - lib/listen/adapter.rb
70
- - lib/listen/adapter/base.rb
71
- - lib/listen/adapter/bsd.rb
72
- - lib/listen/adapter/config.rb
73
- - lib/listen/adapter/darwin.rb
74
- - lib/listen/adapter/linux.rb
75
- - lib/listen/adapter/polling.rb
76
- - lib/listen/adapter/windows.rb
77
- - lib/listen/backend.rb
78
- - lib/listen/change.rb
79
- - lib/listen/cli.rb
80
- - lib/listen/directory.rb
81
- - lib/listen/event/config.rb
82
- - lib/listen/event/loop.rb
83
- - lib/listen/event/processor.rb
84
- - lib/listen/event/queue.rb
85
- - lib/listen/file.rb
86
- - lib/listen/fsm.rb
87
- - lib/listen/internals/thread_pool.rb
88
- - lib/listen/listener.rb
89
- - lib/listen/listener/config.rb
90
- - lib/listen/logger.rb
91
- - lib/listen/options.rb
92
- - lib/listen/queue_optimizer.rb
93
- - lib/listen/record.rb
94
- - lib/listen/record/entry.rb
95
- - lib/listen/record/symlink_detector.rb
96
- - lib/listen/silencer.rb
97
- - lib/listen/silencer/controller.rb
98
- - lib/listen/version.rb
78
+ - lib/sass-listen.rb
79
+ - lib/sass-listen/adapter.rb
80
+ - lib/sass-listen/adapter/base.rb
81
+ - lib/sass-listen/adapter/bsd.rb
82
+ - lib/sass-listen/adapter/config.rb
83
+ - lib/sass-listen/adapter/darwin.rb
84
+ - lib/sass-listen/adapter/linux.rb
85
+ - lib/sass-listen/adapter/polling.rb
86
+ - lib/sass-listen/adapter/windows.rb
87
+ - lib/sass-listen/backend.rb
88
+ - lib/sass-listen/change.rb
89
+ - lib/sass-listen/cli.rb
90
+ - lib/sass-listen/directory.rb
91
+ - lib/sass-listen/event/config.rb
92
+ - lib/sass-listen/event/loop.rb
93
+ - lib/sass-listen/event/processor.rb
94
+ - lib/sass-listen/event/queue.rb
95
+ - lib/sass-listen/file.rb
96
+ - lib/sass-listen/fsm.rb
97
+ - lib/sass-listen/internals/thread_pool.rb
98
+ - lib/sass-listen/listener.rb
99
+ - lib/sass-listen/listener/config.rb
100
+ - lib/sass-listen/logger.rb
101
+ - lib/sass-listen/options.rb
102
+ - lib/sass-listen/queue_optimizer.rb
103
+ - lib/sass-listen/record.rb
104
+ - lib/sass-listen/record/entry.rb
105
+ - lib/sass-listen/record/symlink_detector.rb
106
+ - lib/sass-listen/silencer.rb
107
+ - lib/sass-listen/silencer/controller.rb
108
+ - lib/sass-listen/version.rb
99
109
  homepage: https://github.com/sass/listen
100
110
  licenses:
101
111
  - MIT
@@ -116,9 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
126
  version: '0'
117
127
  requirements: []
118
128
  rubyforge_project:
119
- rubygems_version: 2.5.1
129
+ rubygems_version: 2.6.11
120
130
  signing_key:
121
131
  specification_version: 4
122
132
  summary: Fork of guard/listen
123
133
  test_files: []
124
- has_rdoc:
data/bin/listen DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'listen'
4
- require 'listen/cli'
5
-
6
- unless defined?(JRUBY_VERSION)
7
- if Signal.list.keys.include?('INT')
8
- Signal.trap('INT') { Thread.new { Listen.stop } }
9
- end
10
- end
11
-
12
- Listen::CLI.start
@@ -1,3 +0,0 @@
1
- module Listen
2
- VERSION = '3.0.7'
3
- end