sass 3.3.0.alpha.136 → 3.3.0.alpha.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/REVISION +1 -1
  2. data/VERSION +1 -1
  3. data/VERSION_DATE +1 -1
  4. data/lib/sass/plugin/compiler.rb +1 -17
  5. metadata +22 -47
  6. data/vendor/listen/CHANGELOG.md +0 -221
  7. data/vendor/listen/CONTRIBUTING.md +0 -38
  8. data/vendor/listen/Gemfile +0 -30
  9. data/vendor/listen/Guardfile +0 -8
  10. data/vendor/listen/LICENSE +0 -20
  11. data/vendor/listen/README.md +0 -315
  12. data/vendor/listen/Rakefile +0 -47
  13. data/vendor/listen/Vagrantfile +0 -96
  14. data/vendor/listen/lib/listen.rb +0 -40
  15. data/vendor/listen/lib/listen/adapter.rb +0 -214
  16. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -112
  17. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -85
  18. data/vendor/listen/lib/listen/adapters/linux.rb +0 -113
  19. data/vendor/listen/lib/listen/adapters/polling.rb +0 -67
  20. data/vendor/listen/lib/listen/adapters/windows.rb +0 -87
  21. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  22. data/vendor/listen/lib/listen/directory_record.rb +0 -371
  23. data/vendor/listen/lib/listen/listener.rb +0 -225
  24. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  25. data/vendor/listen/lib/listen/turnstile.rb +0 -28
  26. data/vendor/listen/lib/listen/version.rb +0 -3
  27. data/vendor/listen/listen.gemspec +0 -22
  28. data/vendor/listen/spec/listen/adapter_spec.rb +0 -183
  29. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  30. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  31. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  32. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  33. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  34. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  35. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1225
  36. data/vendor/listen/spec/listen/listener_spec.rb +0 -169
  37. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
  38. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  39. data/vendor/listen/spec/listen_spec.rb +0 -73
  40. data/vendor/listen/spec/spec_helper.rb +0 -21
  41. data/vendor/listen/spec/support/adapter_helper.rb +0 -629
  42. data/vendor/listen/spec/support/directory_record_helper.rb +0 -55
  43. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  44. data/vendor/listen/spec/support/listeners_helper.rb +0 -156
  45. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -1,40 +0,0 @@
1
- module Listen
2
-
3
- autoload :Turnstile, 'listen/turnstile'
4
- autoload :Listener, 'listen/listener'
5
- autoload :MultiListener, 'listen/multi_listener'
6
- autoload :DirectoryRecord, 'listen/directory_record'
7
- autoload :DependencyManager, 'listen/dependency_manager'
8
- autoload :Adapter, 'listen/adapter'
9
-
10
- module Adapters
11
- autoload :Darwin, 'listen/adapters/darwin'
12
- autoload :Linux, 'listen/adapters/linux'
13
- autoload :BSD, 'listen/adapters/bsd'
14
- autoload :Windows, 'listen/adapters/windows'
15
- autoload :Polling, 'listen/adapters/polling'
16
- end
17
-
18
- # Listens to filesystem modifications on a either single directory or multiple directories.
19
- #
20
- # @param (see Listen::Listener#new)
21
- # @param (see Listen::MultiListener#new)
22
- #
23
- # @yield [modified, added, removed] the changed files
24
- # @yieldparam [Array<String>] modified the list of modified files
25
- # @yieldparam [Array<String>] added the list of added files
26
- # @yieldparam [Array<String>] removed the list of removed files
27
- #
28
- # @return [Listen::Listener] the file listener if no block given
29
- #
30
- def self.to(*args, &block)
31
- listener = if args.length == 1 || ! args[1].is_a?(String)
32
- Listener.new(*args, &block)
33
- else
34
- MultiListener.new(*args, &block)
35
- end
36
-
37
- block ? listener.start : listener
38
- end
39
-
40
- end
@@ -1,214 +0,0 @@
1
- require 'rbconfig'
2
- require 'thread'
3
- require 'set'
4
- require 'fileutils'
5
-
6
- module Listen
7
- class Adapter
8
- attr_accessor :directories, :latency, :paused
9
-
10
- # The default delay between checking for changes.
11
- DEFAULT_LATENCY = 0.25
12
-
13
- # The default warning message when there is a missing dependency.
14
- MISSING_DEPENDENCY_MESSAGE = <<-EOS.gsub(/^\s*/, '')
15
- For a better performance, it's recommended that you satisfy the missing dependency.
16
- EOS
17
-
18
- # The default warning message when falling back to polling adapter.
19
- POLLING_FALLBACK_MESSAGE = <<-EOS.gsub(/^\s*/, '')
20
- Listen will be polling changes. Learn more at https://github.com/guard/listen#polling-fallback.
21
- EOS
22
-
23
- # Selects the appropriate adapter implementation for the
24
- # current OS and initializes it.
25
- #
26
- # @param [String, Array<String>] directories the directories to watch
27
- # @param [Hash] options the adapter options
28
- # @option options [Boolean] force_polling to force polling or not
29
- # @option options [String, Boolean] polling_fallback_message to change polling fallback message or remove it
30
- # @option options [Float] latency the delay between checking for changes in seconds
31
- #
32
- # @yield [changed_dirs, options] callback Callback called when a change happens
33
- # @yieldparam [Array<String>] changed_dirs the changed directories
34
- # @yieldparam [Hash] options callback options (like :recursive => true)
35
- #
36
- # @return [Listen::Adapter] the chosen adapter
37
- #
38
- def self.select_and_initialize(directories, options = {}, &callback)
39
- return Adapters::Polling.new(directories, options, &callback) if options.delete(:force_polling)
40
-
41
- warning = ''
42
-
43
- begin
44
- if Adapters::Darwin.usable_and_works?(directories, options)
45
- return Adapters::Darwin.new(directories, options, &callback)
46
- elsif Adapters::Linux.usable_and_works?(directories, options)
47
- return Adapters::Linux.new(directories, options, &callback)
48
- elsif Adapters::BSD.usable_and_works?(directories, options)
49
- return Adapters::BSD.new(directories, options, &callback)
50
- elsif Adapters::Windows.usable_and_works?(directories, options)
51
- return Adapters::Windows.new(directories, options, &callback)
52
- end
53
- rescue DependencyManager::Error => e
54
- warning += e.message + "\n" + MISSING_DEPENDENCY_MESSAGE
55
- end
56
-
57
- unless options[:polling_fallback_message] == false
58
- warning += options[:polling_fallback_message] || POLLING_FALLBACK_MESSAGE
59
- Kernel.warn "[Listen warning]:\n" + warning.gsub(/^(.*)/, ' \1')
60
- end
61
-
62
- Adapters::Polling.new(directories, options, &callback)
63
- end
64
-
65
- # Initializes the adapter.
66
- #
67
- # @param [String, Array<String>] directories the directories to watch
68
- # @param [Hash] options the adapter options
69
- # @option options [Float] latency the delay between checking for changes in seconds
70
- # @option options [Boolean] report_changes whether or not to automatically report changes (run the callback)
71
- #
72
- # @yield [changed_dirs, options] callback Callback called when a change happens
73
- # @yieldparam [Array<String>] changed_dirs the changed directories
74
- # @yieldparam [Hash] options callback options (like :recursive => true)
75
- #
76
- # @return [Listen::Adapter] the adapter
77
- #
78
- def initialize(directories, options = {}, &callback)
79
- @directories = Array(directories)
80
- @callback = callback
81
- @paused = false
82
- @mutex = Mutex.new
83
- @changed_dirs = Set.new
84
- @turnstile = Turnstile.new
85
- @latency ||= DEFAULT_LATENCY
86
- @latency = options[:latency] if options[:latency]
87
- @report_changes = options[:report_changes].nil? ? true : options[:report_changes]
88
- end
89
-
90
- # Starts the adapter.
91
- #
92
- # @param [Boolean] blocking whether or not to block the current thread after starting
93
- #
94
- def start(blocking = true)
95
- @stop = false
96
- end
97
-
98
- # Stops the adapter.
99
- #
100
- def stop
101
- @stop = true
102
- @turnstile.signal # ensure no thread is blocked
103
- end
104
-
105
- # Returns whether the adapter is statred or not
106
- #
107
- # @return [Boolean] whether the adapter is started or not
108
- #
109
- def started?
110
- @stop.nil? ? false : !@stop
111
- end
112
-
113
- # Blocks the main thread until the poll thread
114
- # runs the callback.
115
- #
116
- def wait_for_callback
117
- @turnstile.wait unless @paused
118
- end
119
-
120
- # Blocks the main thread until N changes are
121
- # detected.
122
- #
123
- def wait_for_changes(goal = 0)
124
- changes = 0
125
-
126
- loop do
127
- @mutex.synchronize { changes = @changed_dirs.size }
128
-
129
- return if @paused || @stop
130
- return if changes >= goal
131
-
132
- sleep(@latency)
133
- end
134
- end
135
-
136
- # Checks if the adapter is usable on the current OS.
137
- #
138
- # @return [Boolean] whether usable or not
139
- #
140
- def self.usable?
141
- load_depenencies
142
- dependencies_loaded?
143
- end
144
-
145
- # Checks if the adapter is usable and works on the current OS.
146
- #
147
- # @param [String, Array<String>] directories the directories to watch
148
- # @param [Hash] options the adapter options
149
- # @option options [Float] latency the delay between checking for changes in seconds
150
- #
151
- # @return [Boolean] whether usable and work or not
152
- #
153
- def self.usable_and_works?(directories, options = {})
154
- usable? && Array(directories).all? { |d| works?(d, options) }
155
- end
156
-
157
- # Runs a tests to determine if the adapter can actually pick up
158
- # changes in a given directory and returns the result.
159
- #
160
- # @note This test takes some time depending the adapter latency.
161
- #
162
- # @param [String, Pathname] directory the directory to watch
163
- # @param [Hash] options the adapter options
164
- # @option options [Float] latency the delay between checking for changes in seconds
165
- #
166
- # @return [Boolean] whether the adapter works or not
167
- #
168
- def self.works?(directory, options = {})
169
- work = false
170
- test_file = "#{directory}/.listen_test"
171
- callback = lambda { |*| work = true }
172
- adapter = self.new(directory, options, &callback)
173
- adapter.start(false)
174
-
175
- FileUtils.touch(test_file)
176
-
177
- t = Thread.new { sleep(adapter.latency * 5); adapter.stop }
178
-
179
- adapter.wait_for_callback
180
- work
181
- ensure
182
- Thread.kill(t) if t
183
- FileUtils.rm(test_file) if File.exists?(test_file)
184
- adapter.stop if adapter && adapter.started?
185
- end
186
-
187
- # Runs the callback and passes it the changes if there are any.
188
- #
189
- def report_changes
190
- changed_dirs = nil
191
-
192
- @mutex.synchronize do
193
- return if @changed_dirs.empty?
194
- changed_dirs = @changed_dirs.to_a
195
- @changed_dirs.clear
196
- end
197
-
198
- @callback.call(changed_dirs, {})
199
- @turnstile.signal
200
- end
201
-
202
- private
203
-
204
- # Polls changed directories and reports them back
205
- # when there are changes.
206
- #
207
- def poll_changed_dirs
208
- until @stop
209
- sleep(@latency)
210
- report_changes
211
- end
212
- end
213
- end
214
- end
@@ -1,112 +0,0 @@
1
- module Listen
2
- module Adapters
3
-
4
- # Listener implementation for BSD's `kqueue`.
5
- #
6
- class BSD < Adapter
7
- extend DependencyManager
8
-
9
- # Declare the adapter's dependencies
10
- dependency 'rb-kqueue', '~> 0.2'
11
-
12
- # Watched kqueue events
13
- #
14
- # @see http://www.freebsd.org/cgi/man.cgi?query=kqueue
15
- # @see https://github.com/nex3/rb-kqueue/blob/master/lib/rb-kqueue/queue.rb
16
- #
17
- EVENTS = [ :delete, :write, :extend, :attrib, :link, :rename, :revoke ]
18
-
19
- # Initializes the Adapter. See {Listen::Adapter#initialize} for
20
- # more info.
21
- #
22
- def initialize(directories, options = {}, &callback)
23
- super
24
- @kqueue = init_kqueue
25
- end
26
-
27
- # Starts the adapter.
28
- #
29
- # @param [Boolean] blocking whether or not to block the current thread after starting
30
- #
31
- def start(blocking = true)
32
- @mutex.synchronize do
33
- return if @stop == false
34
- super
35
- end
36
-
37
- @kqueue_thread = Thread.new do
38
- until @stop
39
- @kqueue.poll
40
- sleep(@latency)
41
- end
42
- end
43
- @poll_thread = Thread.new { poll_changed_dirs } if @report_changes
44
-
45
- @kqueue_thread.join if blocking
46
- end
47
-
48
- # Stops the adapter.
49
- #
50
- def stop
51
- @mutex.synchronize do
52
- return if @stop == true
53
- super
54
- end
55
-
56
- @kqueue.stop
57
- Thread.kill(@kqueue_thread) if @kqueue_thread
58
- @poll_thread.join if @poll_thread
59
- end
60
-
61
- # Checks if the adapter is usable on the current OS.
62
- #
63
- # @return [Boolean] whether usable or not
64
- #
65
- def self.usable?
66
- return false unless RbConfig::CONFIG['target_os'] =~ /freebsd/i
67
- super
68
- end
69
-
70
- private
71
-
72
- # Initializes a kqueue Queue and adds a watcher for each files in
73
- # the directories passed to the adapter.
74
- #
75
- # @return [INotify::Notifier] initialized kqueue
76
- #
77
- def init_kqueue
78
- require 'find'
79
-
80
- callback = lambda do |event|
81
- path = event.watcher.path
82
- @mutex.synchronize do
83
- # kqueue watches everything, but Listen only needs the
84
- # directory where stuffs happens.
85
- @changed_dirs << (File.directory?(path) ? path : File.dirname(path))
86
-
87
- # If it is a directory, and it has a write flag, it means a
88
- # file has been added so find out which and deal with it.
89
- # No need to check for removed file, kqueue will forget them
90
- # when the vfs does..
91
- if File.directory?(path) && !(event.flags & [:write]).empty?
92
- queue = event.watcher.queue
93
- Find.find(path) do |file|
94
- unless queue.watchers.detect {|k,v| v.path == file.to_s}
95
- queue.watch_file(file, *EVENTS, &callback)
96
- end
97
- end
98
- end
99
- end
100
- end
101
-
102
- KQueue::Queue.new.tap do |queue|
103
- @directories.each do |directory|
104
- Find.find(directory) do |path|
105
- queue.watch_file(path, *EVENTS, &callback)
106
- end
107
- end
108
- end
109
- end
110
- end
111
- end
112
- end
@@ -1,85 +0,0 @@
1
- module Listen
2
- module Adapters
3
-
4
- # Adapter implementation for Mac OS X `FSEvents`.
5
- #
6
- class Darwin < Adapter
7
- extend DependencyManager
8
-
9
- # Declare the adapter's dependencies
10
- dependency 'rb-fsevent', '~> 0.9.1'
11
-
12
- LAST_SEPARATOR_REGEX = /\/$/
13
-
14
- # Initializes the Adapter. See {Listen::Adapter#initialize} for more info.
15
- #
16
- def initialize(directories, options = {}, &callback)
17
- super
18
- @worker = init_worker
19
- end
20
-
21
- # Starts the adapter.
22
- #
23
- # @param [Boolean] blocking whether or not to block the current thread after starting
24
- #
25
- def start(blocking = true)
26
- @mutex.synchronize do
27
- return if @stop == false
28
- super
29
- end
30
-
31
- @worker_thread = Thread.new { @worker.run }
32
-
33
- # The FSEvent worker needs sometime to startup. Turnstiles can't
34
- # be used to wait for it as it runs in a loop.
35
- # TODO: Find a better way to block until the worker starts.
36
- sleep 0.1
37
-
38
- @poll_thread = Thread.new { poll_changed_dirs } if @report_changes
39
- @worker_thread.join if blocking
40
- end
41
-
42
- # Stops the adapter.
43
- #
44
- def stop
45
- @mutex.synchronize do
46
- return if @stop == true
47
- super
48
- end
49
-
50
- @worker.stop
51
- @worker_thread.join if @worker_thread
52
- @poll_thread.join if @poll_thread
53
- end
54
-
55
- # Checks if the adapter is usable on the current OS.
56
- #
57
- # @return [Boolean] whether usable or not
58
- #
59
- def self.usable?
60
- return false unless RbConfig::CONFIG['target_os'] =~ /darwin(1.+)?$/i
61
- super
62
- end
63
-
64
- private
65
-
66
- # Initializes a FSEvent worker and adds a watcher for
67
- # each directory passed to the adapter.
68
- #
69
- # @return [FSEvent] initialized worker
70
- #
71
- def init_worker
72
- FSEvent.new.tap do |worker|
73
- worker.watch(@directories.dup, :latency => @latency) do |changes|
74
- next if @paused
75
- @mutex.synchronize do
76
- changes.each { |path| @changed_dirs << path.sub(LAST_SEPARATOR_REGEX, '') }
77
- end
78
- end
79
- end
80
- end
81
-
82
- end
83
-
84
- end
85
- end