sass 3.2.19 → 3.3.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CONTRIBUTING +1 -1
  2. data/MIT-LICENSE +2 -2
  3. data/README.md +13 -14
  4. data/REVISION +1 -1
  5. data/Rakefile +4 -6
  6. data/VERSION +1 -1
  7. data/VERSION_DATE +1 -1
  8. data/VERSION_NAME +1 -1
  9. data/bin/sass +1 -6
  10. data/bin/sass-convert +1 -6
  11. data/bin/scss +1 -6
  12. data/lib/sass/cache_stores/base.rb +0 -2
  13. data/lib/sass/cache_stores/chain.rb +1 -1
  14. data/lib/sass/cache_stores/filesystem.rb +3 -6
  15. data/lib/sass/callbacks.rb +1 -1
  16. data/lib/sass/css.rb +1 -1
  17. data/lib/sass/engine.rb +4 -11
  18. data/lib/sass/error.rb +2 -2
  19. data/lib/sass/exec.rb +10 -40
  20. data/lib/sass/importers/filesystem.rb +15 -52
  21. data/lib/sass/logger/log_level.rb +3 -3
  22. data/lib/sass/media.rb +4 -1
  23. data/lib/sass/plugin.rb +1 -2
  24. data/lib/sass/plugin/compiler.rb +18 -40
  25. data/lib/sass/plugin/staleness_checker.rb +5 -21
  26. data/lib/sass/railtie.rb +0 -1
  27. data/lib/sass/script/funcall.rb +8 -62
  28. data/lib/sass/script/functions.rb +457 -557
  29. data/lib/sass/script/lexer.rb +30 -25
  30. data/lib/sass/script/list.rb +1 -2
  31. data/lib/sass/script/literal.rb +18 -0
  32. data/lib/sass/script/null.rb +1 -4
  33. data/lib/sass/script/operation.rb +1 -0
  34. data/lib/sass/script/parser.rb +35 -42
  35. data/lib/sass/script/string.rb +1 -1
  36. data/lib/sass/script/unary_operation.rb +3 -8
  37. data/lib/sass/scss/parser.rb +14 -33
  38. data/lib/sass/scss/rx.rb +10 -3
  39. data/lib/sass/selector.rb +16 -19
  40. data/lib/sass/selector/sequence.rb +7 -16
  41. data/lib/sass/selector/simple.rb +1 -1
  42. data/lib/sass/selector/simple_sequence.rb +15 -25
  43. data/lib/sass/tree/comment_node.rb +2 -2
  44. data/lib/sass/tree/import_node.rb +2 -9
  45. data/lib/sass/tree/visitors/check_nesting.rb +2 -3
  46. data/lib/sass/tree/visitors/convert.rb +4 -9
  47. data/lib/sass/tree/visitors/cssize.rb +15 -36
  48. data/lib/sass/tree/visitors/perform.rb +20 -23
  49. data/lib/sass/tree/visitors/set_options.rb +0 -8
  50. data/lib/sass/tree/visitors/to_css.rb +1 -0
  51. data/lib/sass/util.rb +2 -120
  52. data/lib/sass/util/multibyte_string_scanner.rb +8 -29
  53. data/test/sass/conversion_test.rb +8 -33
  54. data/test/sass/css2sass_test.rb +0 -19
  55. data/test/sass/engine_test.rb +17 -129
  56. data/test/sass/extend_test.rb +24 -169
  57. data/test/sass/functions_test.rb +73 -93
  58. data/test/sass/plugin_test.rb +11 -72
  59. data/test/sass/script_conversion_test.rb +0 -14
  60. data/test/sass/script_test.rb +1 -40
  61. data/test/sass/scss/css_test.rb +3 -44
  62. data/test/sass/scss/scss_test.rb +3 -134
  63. data/test/sass/util_test.rb +0 -93
  64. data/vendor/listen/CHANGELOG.md +2 -83
  65. data/vendor/listen/Gemfile +1 -8
  66. data/vendor/listen/Guardfile +1 -1
  67. data/vendor/listen/LICENSE +1 -1
  68. data/vendor/listen/README.md +5 -8
  69. data/vendor/listen/lib/listen.rb +5 -7
  70. data/vendor/listen/lib/listen/adapter.rb +29 -76
  71. data/vendor/listen/lib/listen/adapters/darwin.rb +10 -11
  72. data/vendor/listen/lib/listen/adapters/linux.rb +30 -33
  73. data/vendor/listen/lib/listen/adapters/polling.rb +1 -2
  74. data/vendor/listen/lib/listen/adapters/windows.rb +21 -27
  75. data/vendor/listen/lib/listen/directory_record.rb +10 -63
  76. data/vendor/listen/lib/listen/listener.rb +0 -22
  77. data/vendor/listen/lib/listen/multi_listener.rb +0 -22
  78. data/vendor/listen/lib/listen/version.rb +1 -1
  79. data/vendor/listen/listen.gemspec +4 -0
  80. data/vendor/listen/spec/listen/adapter_spec.rb +4 -45
  81. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -6
  82. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -6
  83. data/vendor/listen/spec/listen/adapters/windows_spec.rb +1 -7
  84. data/vendor/listen/spec/listen/directory_record_spec.rb +4 -91
  85. data/vendor/listen/spec/listen/listener_spec.rb +0 -14
  86. data/vendor/listen/spec/listen/multi_listener_spec.rb +1 -19
  87. data/vendor/listen/spec/spec_helper.rb +3 -6
  88. data/vendor/listen/spec/support/adapter_helper.rb +212 -125
  89. data/vendor/listen/spec/support/listeners_helper.rb +1 -13
  90. data/vendor/listen/spec/support/platform_helper.rb +0 -4
  91. metadata +113 -105
  92. checksums.yaml +0 -7
  93. data/lib/sass/util/test.rb +0 -10
  94. data/test/sass/exec_test.rb +0 -86
  95. data/test/sass/results/cached_import_option.css +0 -3
  96. data/test/sass/templates/_cached_import_option_partial.scss +0 -1
  97. data/test/sass/templates/_same_name_different_partiality.scss +0 -1
  98. data/test/sass/templates/bork5.sass +0 -3
  99. data/test/sass/templates/cached_import_option.scss +0 -3
  100. data/test/sass/templates/same_name_different_ext.sass +0 -2
  101. data/test/sass/templates/same_name_different_ext.scss +0 -1
  102. data/test/sass/templates/same_name_different_partiality.scss +0 -1
  103. data/test/sass/templates/subdir/import_up1.scss +0 -1
  104. data/test/sass/templates/subdir/import_up2.scss +0 -1
  105. data/vendor/listen/CONTRIBUTING.md +0 -38
  106. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -112
  107. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  108. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  109. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
@@ -4,10 +4,6 @@ module Listen
4
4
  # Adapter implementation for Mac OS X `FSEvents`.
5
5
  #
6
6
  class Darwin < Adapter
7
- extend DependencyManager
8
-
9
- # Declare the adapter's dependencies
10
- dependency 'rb-fsevent', '~> 0.9'
11
7
 
12
8
  LAST_SEPARATOR_REGEX = /\/$/
13
9
 
@@ -29,14 +25,13 @@ module Listen
29
25
  end
30
26
 
31
27
  @worker_thread = Thread.new { @worker.run }
28
+ @poll_thread = Thread.new { poll_changed_dirs }
32
29
 
33
30
  # The FSEvent worker needs sometime to startup. Turnstiles can't
34
31
  # be used to wait for it as it runs in a loop.
35
32
  # 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
33
+ sleep @latency
34
+ @poll_thread.join if blocking
40
35
  end
41
36
 
42
37
  # Stops the adapter.
@@ -48,8 +43,8 @@ module Listen
48
43
  end
49
44
 
50
45
  @worker.stop
51
- @worker_thread.join if @worker_thread
52
- @poll_thread.join if @poll_thread
46
+ Thread.kill(@worker_thread) if @worker_thread
47
+ @poll_thread.join
53
48
  end
54
49
 
55
50
  # Checks if the adapter is usable on the current OS.
@@ -58,7 +53,11 @@ module Listen
58
53
  #
59
54
  def self.usable?
60
55
  return false unless RbConfig::CONFIG['target_os'] =~ /darwin(1.+)?$/i
61
- super
56
+
57
+ require 'rb-fsevent'
58
+ true
59
+ rescue LoadError
60
+ false
62
61
  end
63
62
 
64
63
  private
@@ -4,10 +4,6 @@ module Listen
4
4
  # Listener implementation for Linux `inotify`.
5
5
  #
6
6
  class Linux < Adapter
7
- extend DependencyManager
8
-
9
- # Declare the adapter's dependencies
10
- dependency 'rb-inotify', '~> 0.9'
11
7
 
12
8
  # Watched inotify events
13
9
  #
@@ -45,9 +41,8 @@ module Listen
45
41
  end
46
42
 
47
43
  @worker_thread = Thread.new { @worker.run }
48
- @poll_thread = Thread.new { poll_changed_dirs } if @report_changes
49
-
50
- @worker_thread.join if blocking
44
+ @poll_thread = Thread.new { poll_changed_dirs }
45
+ @poll_thread.join if blocking
51
46
  end
52
47
 
53
48
  # Stops the adapter.
@@ -60,16 +55,20 @@ module Listen
60
55
 
61
56
  @worker.stop
62
57
  Thread.kill(@worker_thread) if @worker_thread
63
- @poll_thread.join if @poll_thread
58
+ @poll_thread.join
64
59
  end
65
60
 
66
- # Checks if the adapter is usable on the current OS.
61
+ # Check if the adapter is usable on the current OS.
67
62
  #
68
63
  # @return [Boolean] whether usable or not
69
64
  #
70
65
  def self.usable?
71
66
  return false unless RbConfig::CONFIG['target_os'] =~ /linux/i
72
- super
67
+
68
+ require 'rb-inotify'
69
+ true
70
+ rescue LoadError
71
+ false
73
72
  end
74
73
 
75
74
  private
@@ -80,31 +79,29 @@ module Listen
80
79
  # @return [INotify::Notifier] initialized worker
81
80
  #
82
81
  def init_worker
83
- callback = lambda do |event|
84
- if @paused || (
85
- # Event on root directory
86
- event.name == ""
87
- ) || (
88
- # INotify reports changes to files inside directories as events
89
- # on the directories themselves too.
90
- #
91
- # @see http://linux.die.net/man/7/inotify
92
- event.flags.include?(:isdir) and event.flags & [:close, :modify] != []
93
- )
94
- # Skip all of these!
95
- next
96
- end
97
-
98
- @mutex.synchronize do
99
- @changed_dirs << File.dirname(event.absolute_name)
100
- end
101
- end
102
-
103
- INotify::Notifier.new.tap do |worker|
104
- @directories.each do |directory|
105
- worker.watch(directory, *EVENTS.map(&:to_sym), &callback)
82
+ worker = INotify::Notifier.new
83
+ @directories.each do |directory|
84
+ worker.watch(directory, *EVENTS.map(&:to_sym)) do |event|
85
+ if @paused || (
86
+ # Event on root directory
87
+ event.name == ""
88
+ ) || (
89
+ # INotify reports changes to files inside directories as events
90
+ # on the directories themselves too.
91
+ #
92
+ # @see http://linux.die.net/man/7/inotify
93
+ event.flags.include?(:isdir) and event.flags & [:close, :modify] != []
94
+ )
95
+ # Skip all of these!
96
+ next
97
+ end
98
+
99
+ @mutex.synchronize do
100
+ @changed_dirs << File.dirname(event.absolute_name)
101
+ end
106
102
  end
107
103
  end
104
+ worker
108
105
  end
109
106
 
110
107
  end
@@ -10,7 +10,6 @@ module Listen
10
10
  # file IO that the other implementations.
11
11
  #
12
12
  class Polling < Adapter
13
- extend DependencyManager
14
13
 
15
14
  # Initialize the Adapter. See {Listen::Adapter#initialize} for more info.
16
15
  #
@@ -50,7 +49,7 @@ module Listen
50
49
  #
51
50
  def poll
52
51
  until @stop
53
- next if @paused
52
+ sleep(0.1) && next if @paused
54
53
 
55
54
  start = Time.now.to_f
56
55
  @callback.call(@directories.dup, :recursive => true)
@@ -3,13 +3,9 @@ require 'set'
3
3
  module Listen
4
4
  module Adapters
5
5
 
6
- # Adapter implementation for Windows `wdm`.
6
+ # Adapter implementation for Windows `fchange`.
7
7
  #
8
8
  class Windows < Adapter
9
- extend DependencyManager
10
-
11
- # Declare the adapter's dependencies
12
- dependency 'wdm', '~> 0.1'
13
9
 
14
10
  # Initializes the Adapter. See {Listen::Adapter#initialize} for more info.
15
11
  #
@@ -28,15 +24,9 @@ module Listen
28
24
  super
29
25
  end
30
26
 
31
- @worker_thread = Thread.new { @worker.run! }
32
-
33
- # Wait for the worker to start. This is needed to avoid a deadlock
34
- # when stopping immediately after starting.
35
- sleep 0.1
36
-
37
- @poll_thread = Thread.new { poll_changed_dirs } if @report_changes
38
-
39
- @worker_thread.join if blocking
27
+ @worker_thread = Thread.new { @worker.run }
28
+ @poll_thread = Thread.new { poll_changed_dirs(true) }
29
+ @poll_thread.join if blocking
40
30
  end
41
31
 
42
32
  # Stops the adapter.
@@ -48,8 +38,8 @@ module Listen
48
38
  end
49
39
 
50
40
  @worker.stop
51
- @worker_thread.join if @worker_thread
52
- @poll_thread.join if @poll_thread
41
+ Thread.kill(@worker_thread) if @worker_thread
42
+ @poll_thread.join
53
43
  end
54
44
 
55
45
  # Checks if the adapter is usable on the current OS.
@@ -58,27 +48,31 @@ module Listen
58
48
  #
59
49
  def self.usable?
60
50
  return false unless RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
61
- super
51
+
52
+ require 'rb-fchange'
53
+ true
54
+ rescue LoadError
55
+ false
62
56
  end
63
57
 
64
58
  private
65
59
 
66
- # Initializes a WDM monitor and adds a watcher for
60
+ # Initializes a FChange worker and adds a watcher for
67
61
  # each directory passed to the adapter.
68
62
  #
69
- # @return [WDM::Monitor] initialized worker
63
+ # @return [FChange::Notifier] initialized worker
70
64
  #
71
65
  def init_worker
72
- callback = Proc.new do |change|
73
- next if @paused
74
- @mutex.synchronize do
75
- @changed_dirs << File.dirname(change.path)
66
+ FChange::Notifier.new.tap do |worker|
67
+ @directories.each do |directory|
68
+ worker.watch(directory, :all_events, :recursive) do |event|
69
+ next if @paused
70
+ @mutex.synchronize do
71
+ @changed_dirs << File.expand_path(event.watcher.path)
72
+ end
73
+ end
76
74
  end
77
75
  end
78
-
79
- WDM::Monitor.new.tap do |worker|
80
- @directories.each { |d| worker.watch_recursively(d, &callback) }
81
- end
82
76
  end
83
77
 
84
78
  end
@@ -18,11 +18,7 @@ module Listen
18
18
  # Defines the used precision based on the type of mtime returned by the
19
19
  # system (whether its in milliseconds or just seconds)
20
20
  #
21
- begin
22
- HIGH_PRECISION_SUPPORTED = File.mtime(__FILE__).to_f.to_s[-2..-1] != '.0'
23
- rescue
24
- HIGH_PRECISION_SUPPORTED = false
25
- end
21
+ HIGH_PRECISION_SUPPORTED = File.mtime(__FILE__).to_f.to_s[-2..-1] != '.0'
26
22
 
27
23
  # Data structure used to save meta data about a path
28
24
  #
@@ -92,17 +88,6 @@ module Listen
92
88
  @ignoring_patterns.merge(regexps)
93
89
  end
94
90
 
95
- # Replaces ignoring patterns in the record.
96
- #
97
- # @example Ignore only these paths
98
- # ignore! %r{^ignored/path/}, /man/
99
- #
100
- # @param [Regexp] regexp a pattern for ignoring paths
101
- #
102
- def ignore!(*regexps)
103
- @ignoring_patterns.replace(regexps)
104
- end
105
-
106
91
  # Adds filtering patterns to the listener.
107
92
  #
108
93
  # @example Filter some files
@@ -114,17 +99,6 @@ module Listen
114
99
  @filtering_patterns.merge(regexps)
115
100
  end
116
101
 
117
- # Replaces filtering patterns in the listener.
118
- #
119
- # @example Filter only these files
120
- # ignore /\.txt$/, /.*\.zip/
121
- #
122
- # @param [Regexp] regexp a pattern for filtering paths
123
- #
124
- def filter!(*regexps)
125
- @filtering_patterns.replace(regexps)
126
- end
127
-
128
102
  # Returns whether a path should be ignored or not.
129
103
  #
130
104
  # @param [String] path the path to test.
@@ -189,7 +163,6 @@ module Listen
189
163
  #
190
164
  def relative_to_base(path)
191
165
  return nil unless path[@directory]
192
- path = path.force_encoding("BINARY") if path.respond_to?(:force_encoding)
193
166
  path.sub(%r{^#{Regexp.quote(@directory)}#{File::SEPARATOR}?}, '')
194
167
  end
195
168
 
@@ -225,11 +198,8 @@ module Listen
225
198
 
226
199
  # First check if we are in the same second (to update checksums)
227
200
  # before checking the time difference
228
- if (meta_data.mtime.to_i == new_mtime.to_i && content_modified?(path)) || meta_data.mtime < new_mtime
229
- # Update the sha1 checksum of the file
230
- insert_sha1_checksum(path)
231
-
232
- # Update the meta data of the file
201
+ if (meta_data.mtime.to_i == new_mtime.to_i && content_modified?(path)) || meta_data.mtime < new_mtime
202
+ # Update the meta data of the files
233
203
  meta_data.mtime = new_mtime
234
204
  @paths[directory][basename] = meta_data
235
205
 
@@ -277,40 +247,17 @@ module Listen
277
247
 
278
248
  # Returns whether or not a file's content has been modified by
279
249
  # comparing the SHA1-checksum to a stored one.
280
- # Ensure that the SHA1-checksum is inserted to the sha1_checksums
281
- # array for later comparaison if false.
282
250
  #
283
251
  # @param [String] path the file path
284
252
  #
285
253
  def content_modified?(path)
286
- @sha1_checksum = sha1_checksum(path)
287
- if @sha1_checksums[path] == @sha1_checksum || !@sha1_checksums.key?(path)
288
- insert_sha1_checksum(path)
289
- false
290
- else
291
- true
292
- end
293
- end
294
-
295
- # Inserts a SHA1-checksum path in @SHA1-checksums hash.
296
- #
297
- # @param [String] path the SHA1-checksum path to insert in @sha1_checksums.
298
- #
299
- def insert_sha1_checksum(path)
300
- if @sha1_checksum ||= sha1_checksum(path)
301
- @sha1_checksums[path] = @sha1_checksum
302
- @sha1_checksum = nil
303
- end
304
- end
305
-
306
- # Returns the SHA1-checksum for the file path.
307
- #
308
- # @param [String] path the file path
309
- #
310
- def sha1_checksum(path)
311
- Digest::SHA1.file(path).to_s
312
- rescue Errno::EACCES, Errno::ENOENT, Errno::ENXIO, Errno::EOPNOTSUPP
313
- nil
254
+ sha1_checksum = Digest::SHA1.file(path).to_s
255
+ return false if @sha1_checksums[path] == sha1_checksum
256
+ @sha1_checksums.key?(path)
257
+ rescue Errno::EACCES, Errno::ENOENT
258
+ false
259
+ ensure
260
+ @sha1_checksums[path] = sha1_checksum if sha1_checksum
314
261
  end
315
262
 
316
263
  # Traverses the base directory looking for paths that should
@@ -93,17 +93,6 @@ module Listen
93
93
  self
94
94
  end
95
95
 
96
- # Replaces ignoring patterns in the listener.
97
- #
98
- # @param (see Listen::DirectoryRecord#ignore!)
99
- #
100
- # @return [Listen::Listener] the listener
101
- #
102
- def ignore!(*regexps)
103
- @directory_record.ignore!(*regexps)
104
- self
105
- end
106
-
107
96
  # Adds filtering patterns to the listener.
108
97
  #
109
98
  # @param (see Listen::DirectoryRecord#filter)
@@ -115,17 +104,6 @@ module Listen
115
104
  self
116
105
  end
117
106
 
118
- # Replacing filtering patterns in the listener.
119
- #
120
- # @param (see Listen::DirectoryRecord#filter!)
121
- #
122
- # @return [Listen::Listener] the listener
123
- #
124
- def filter!(*regexps)
125
- @directory_record.filter!(*regexps)
126
- self
127
- end
128
-
129
107
  # Sets the latency for the adapter. This is a helper method
130
108
  # to simplify changing the latency directly from the listener.
131
109
  #
@@ -65,17 +65,6 @@ module Listen
65
65
  self
66
66
  end
67
67
 
68
- # Replaces ignored paths in the listener.
69
- #
70
- # @param (see Listen::DirectoryRecord#ignore!)
71
- #
72
- # @return [Listen::Listener] the listener
73
- #
74
- def ignore!(*paths)
75
- @directories_records.each { |r| r.ignore!(*paths) }
76
- self
77
- end
78
-
79
68
  # Adds file filters to the listener.
80
69
  #
81
70
  # @param (see Listen::DirectoryRecord#filter)
@@ -87,17 +76,6 @@ module Listen
87
76
  self
88
77
  end
89
78
 
90
- # Replaces file filters in the listener.
91
- #
92
- # @param (see Listen::DirectoryRecord#filter!)
93
- #
94
- # @return [Listen::Listener] the listener
95
- #
96
- def filter!(*regexps)
97
- @directories_records.each { |r| r.filter!(*regexps) }
98
- self
99
- end
100
-
101
79
  # Runs the callback passing it the changes if there are any.
102
80
  #
103
81
  # @param (see Listen::DirectoryRecord#fetch_changes)
@@ -1,3 +1,3 @@
1
1
  module Listen
2
- VERSION = '0.7.3'
2
+ VERSION = '0.4.7'
3
3
  end