sass 3.3.0 → 3.3.1

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/VERSION_DATE +1 -1
  4. data/lib/sass/importers/filesystem.rb +3 -3
  5. data/lib/sass/plugin/compiler.rb +95 -52
  6. data/lib/sass/script/functions.rb +1 -1
  7. data/lib/sass/source/map.rb +3 -3
  8. data/lib/sass/util.rb +16 -1
  9. data/vendor/listen/CHANGELOG.md +175 -35
  10. data/vendor/listen/Gemfile +5 -15
  11. data/vendor/listen/README.md +111 -77
  12. data/vendor/listen/Rakefile +0 -42
  13. data/vendor/listen/lib/listen.rb +33 -19
  14. data/vendor/listen/lib/listen/adapter.rb +193 -82
  15. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  16. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  17. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  18. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  19. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  20. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  21. data/vendor/listen/lib/listen/listener.rb +135 -37
  22. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  23. data/vendor/listen/lib/listen/version.rb +1 -1
  24. data/vendor/listen/listen.gemspec +6 -0
  25. data/vendor/listen/spec/listen/adapter_spec.rb +37 -82
  26. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  27. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  28. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  29. data/vendor/listen/spec/listen_spec.rb +15 -21
  30. data/vendor/listen/spec/spec_helper.rb +4 -0
  31. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  32. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  33. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  34. metadata +3 -23
  35. data/ext/mkrf_conf.rb +0 -27
  36. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  37. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  38. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  39. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
@@ -24,7 +24,7 @@ def changes(root_path, options = {})
24
24
  paths = options.delete(:paths) || [root_path]
25
25
  options[:recursive] = true if options[:recursive].nil?
26
26
 
27
- changes = @record.fetch_changes(paths, {:relative_paths => true}.merge(options))
27
+ changes = @record.fetch_changes(paths, { :relative_paths => true }.merge(options))
28
28
 
29
29
  [changes[:modified], changes[:added], changes[:removed]]
30
30
  end
@@ -32,14 +32,15 @@ end
32
32
  # Generates a small time difference before performing a time sensitive
33
33
  # task (like comparing mtimes of files).
34
34
  #
35
- # @note Modification time for files only includes the milliseconds on Linux with MRI > 1.9.2,
35
+ # @note Modification time for files only includes the milliseconds on Linux with MRI > 1.9.2
36
+ # and platform that support it (OS X 10.8 not included),
36
37
  # that's why we generate a difference that's greater than 1 second.
37
38
  #
38
39
  def small_time_difference
39
40
  t = Time.now
40
41
  diff = t.to_f - t.to_i
41
42
 
42
- sleep( 1.5 - (diff < 0.5 ? diff : 0.4) )
43
+ sleep(1.05 - diff)
43
44
  end
44
45
 
45
46
  # Ensures that the test runs at almost the same second at which
@@ -49,7 +50,8 @@ def ensure_same_second
49
50
  t = Time.now
50
51
  diff = t.to_f - t.to_i
51
52
 
52
- if diff > 0.1 # We are not at the beginning of a second
53
- sleep 1.1 - diff # 1.1 is used instead of 1 to account for the processing time (estimated at 0.1 sec)
53
+ # We are not at the end of a second
54
+ if diff >= (1 - Listen::Adapter::DEFAULT_LATENCY)
55
+ sleep(1.05 - diff)
54
56
  end
55
57
  end
@@ -9,14 +9,37 @@ shared_examples_for 'a listener to changes on a file-system' do
9
9
  subject.start
10
10
  end
11
11
 
12
- context 'with the blocking param set to false' do
13
- it 'passes the blocking param to the adapter' do
14
- adapter.should_receive(:start).with(false)
12
+ context 'with the blocking deprecated param set to true' do
13
+ it 'displays a deprecation notice' do
14
+ Kernel.should_receive(:warn).with(/#{Listen::Listener::BLOCKING_PARAMETER_DEPRECATION_MESSAGE}/)
15
+ subject.start(true)
16
+ end
17
+ end
18
+
19
+ context 'with the blocking deprecated param set to false' do
20
+ it 'displays a deprecation notice' do
21
+ Kernel.should_receive(:warn).with(/#{Listen::Listener::BLOCKING_PARAMETER_DEPRECATION_MESSAGE}/)
15
22
  subject.start(false)
16
23
  end
17
24
  end
18
25
  end
19
26
 
27
+ describe '#start!' do
28
+ before do
29
+ subject.stub(:initialize_adapter) { adapter }
30
+ end
31
+
32
+ it 'starts the adapter' do
33
+ adapter.should_receive(:start!)
34
+ subject.start!
35
+ end
36
+
37
+ it 'passes the blocking param to the adapter' do
38
+ adapter.should_receive(:start!)
39
+ subject.start!
40
+ end
41
+ end
42
+
20
43
  context 'with a started listener' do
21
44
  before do
22
45
  subject.start
@@ -31,7 +54,7 @@ shared_examples_for 'a listener to changes on a file-system' do
31
54
 
32
55
  describe '#pause' do
33
56
  it 'sets adapter.paused to true' do
34
- adapter.should_receive(:paused=).with(true)
57
+ adapter.should_receive(:pause)
35
58
  subject.pause
36
59
  end
37
60
 
@@ -42,7 +65,7 @@ shared_examples_for 'a listener to changes on a file-system' do
42
65
 
43
66
  describe '#unpause' do
44
67
  it 'sets adapter.paused to false' do
45
- adapter.should_receive(:paused=).with(false)
68
+ adapter.should_receive(:unpause)
46
69
  subject.unpause
47
70
  end
48
71
 
@@ -58,12 +81,12 @@ shared_examples_for 'a listener to changes on a file-system' do
58
81
  end
59
82
 
60
83
  it 'returns true when adapter is paused' do
61
- adapter.should_receive(:paused) { true }
84
+ adapter.should_receive(:paused?) { true }
62
85
  subject.should be_paused
63
86
  end
64
87
 
65
88
  it 'returns false when adapter is not paused' do
66
- adapter.should_receive(:paused) { false }
89
+ adapter.should_receive(:paused?) { false }
67
90
  subject.should_not be_paused
68
91
  end
69
92
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,22 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-08 00:00:00.000000000 Z
13
+ date: 2014-03-10 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rake
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - '>='
27
- - !ruby/object:Gem::Version
28
- version: '0'
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: yard
31
17
  requirement: !ruby/object:Gem::Requirement
@@ -64,8 +50,7 @@ executables:
64
50
  - sass
65
51
  - sass-convert
66
52
  - scss
67
- extensions:
68
- - ext/mkrf_conf.rb
53
+ extensions: []
69
54
  extra_rdoc_files: []
70
55
  files:
71
56
  - rails/init.rb
@@ -200,8 +185,6 @@ files:
200
185
  - vendor/listen/lib/listen/turnstile.rb
201
186
  - vendor/listen/lib/listen/directory_record.rb
202
187
  - vendor/listen/lib/listen/version.rb
203
- - vendor/listen/lib/listen/dependency_manager.rb
204
- - vendor/listen/lib/listen/multi_listener.rb
205
188
  - vendor/listen/lib/listen/listener.rb
206
189
  - vendor/listen/lib/listen/adapters/polling.rb
207
190
  - vendor/listen/lib/listen/adapters/darwin.rb
@@ -215,7 +198,6 @@ files:
215
198
  - vendor/listen/LICENSE
216
199
  - vendor/listen/listen.gemspec
217
200
  - vendor/listen/Vagrantfile
218
- - vendor/listen/spec/listen/dependency_manager_spec.rb
219
201
  - vendor/listen/spec/listen/directory_record_spec.rb
220
202
  - vendor/listen/spec/listen/adapters/linux_spec.rb
221
203
  - vendor/listen/spec/listen/adapters/darwin_spec.rb
@@ -225,7 +207,6 @@ files:
225
207
  - vendor/listen/spec/listen/turnstile_spec.rb
226
208
  - vendor/listen/spec/listen/adapter_spec.rb
227
209
  - vendor/listen/spec/listen/listener_spec.rb
228
- - vendor/listen/spec/listen/multi_listener_spec.rb
229
210
  - vendor/listen/spec/listen_spec.rb
230
211
  - vendor/listen/spec/spec_helper.rb
231
212
  - vendor/listen/spec/support/directory_record_helper.rb
@@ -369,7 +350,6 @@ files:
369
350
  - MIT-LICENSE
370
351
  - VERSION
371
352
  - CONTRIBUTING
372
- - ext/mkrf_conf.rb
373
353
  homepage: http://sass-lang.com/
374
354
  licenses:
375
355
  - MIT
@@ -1,27 +0,0 @@
1
- require 'rubygems'
2
- require 'rubygems/command.rb'
3
- require 'rubygems/dependency_installer.rb'
4
-
5
- require '../lib/sass'
6
-
7
- # This script installs the correct version of listen. Listen versions
8
- # beyond 1.1 don't support Ruby 1.8, any RubyGems isn't clever enough
9
- # to install the most recent version that works, so we have to do it
10
- # manually.
11
-
12
- puts "Ensuring you have the right version of listen installed."
13
-
14
- Gem::Command.build_args = ARGV
15
- inst = Gem::DependencyInstaller.new
16
- if Sass::Util.version_geq(RUBY_VERSION, "1.9.3")
17
- puts "Installing listen >= 1.1.0, < 3.0.0"
18
- inst.install "listen", Gem::Requirement.new(">= 1.1.0", "< 3.0.0")
19
- else
20
- puts "Installing listen ~> 1.1.0"
21
- inst.install "listen", "~> 1.1.0"
22
- end
23
-
24
- # Create a dummy rakefile to indicate success.
25
- f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
26
- f.write("task :default\n")
27
- f.close
@@ -1,126 +0,0 @@
1
- require 'set'
2
-
3
- module Listen
4
-
5
- # The dependency-manager offers a simple DSL which allows
6
- # classes to declare their gem dependencies and load them when
7
- # needed.
8
- # It raises a user-friendly exception when the dependencies
9
- # can't be loaded which has the install command in the message.
10
- #
11
- module DependencyManager
12
-
13
- GEM_LOAD_MESSAGE = <<-EOS.gsub(/^ {6}/, '')
14
- Missing dependency '%s' (version '%s')!
15
- EOS
16
-
17
- GEM_INSTALL_COMMAND = <<-EOS.gsub(/^ {6}/, '')
18
- Please run the following to satisfy the dependency:
19
- gem install --version '%s' %s
20
- EOS
21
-
22
- BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
23
- Please add the following to your Gemfile to satisfy the dependency:
24
- gem '%s', '%s'
25
- EOS
26
-
27
- Dependency = Struct.new(:name, :version)
28
-
29
- # The error raised when a dependency can't be loaded.
30
- class Error < StandardError; end
31
-
32
- # A list of all loaded dependencies in the dependency manager.
33
- @_loaded_dependencies = Set.new
34
-
35
- # class methods
36
- class << self
37
-
38
- # Initializes the extended class.
39
- #
40
- # @param [Class] the class for which some dependencies must be managed
41
- #
42
- def extended(base)
43
- base.class_eval do
44
- @_dependencies = Set.new
45
- end
46
- end
47
-
48
- # Adds a loaded dependency to a list so that it doesn't have
49
- # to be loaded again by another classes.
50
- #
51
- # @param [Dependency] dependency
52
- #
53
- def add_loaded(dependency)
54
- @_loaded_dependencies << dependency
55
- end
56
-
57
- # Returns whether the dependency is alread loaded or not.
58
- #
59
- # @param [Dependency] dependency
60
- # @return [Boolean]
61
- #
62
- def already_loaded?(dependency)
63
- @_loaded_dependencies.include?(dependency)
64
- end
65
-
66
- # Clears the list of loaded dependencies.
67
- #
68
- def clear_loaded
69
- @_loaded_dependencies.clear
70
- end
71
- end
72
-
73
- # Registers a new dependency.
74
- #
75
- # @param [String] name the name of the gem
76
- # @param [String] version the version of the gem
77
- #
78
- def dependency(name, version)
79
- @_dependencies << Dependency.new(name, version)
80
- end
81
-
82
- # Loads the registered dependencies.
83
- #
84
- # @raise DependencyManager::Error if the dependency can't be loaded.
85
- #
86
- def load_depenencies
87
- @_dependencies.each do |dependency|
88
- begin
89
- next if DependencyManager.already_loaded?(dependency)
90
- gem(dependency.name, dependency.version)
91
- require(dependency.name)
92
- DependencyManager.add_loaded(dependency)
93
- @_dependencies.delete(dependency)
94
- rescue Gem::LoadError
95
- args = [dependency.name, dependency.version]
96
- command = if running_under_bundler?
97
- BUNDLER_DECLARE_GEM % args
98
- else
99
- GEM_INSTALL_COMMAND % args.reverse
100
- end
101
- message = GEM_LOAD_MESSAGE % args
102
-
103
- raise Error.new(message + command)
104
- end
105
- end
106
- end
107
-
108
- # Returns whether all the dependencies has been loaded or not.
109
- #
110
- # @return [Boolean]
111
- #
112
- def dependencies_loaded?
113
- @_dependencies.empty?
114
- end
115
-
116
- private
117
-
118
- # Returns whether we are running under bundler or not
119
- #
120
- # @return [Boolean]
121
- #
122
- def running_under_bundler?
123
- !!(File.exists?('Gemfile') && ENV['BUNDLE_GEMFILE'])
124
- end
125
- end
126
- end
@@ -1,143 +0,0 @@
1
- module Listen
2
- class MultiListener < Listener
3
- attr_reader :directories, :directories_records, :adapter
4
-
5
- # Initializes the multiple directories listener.
6
- #
7
- # @param [String] directories the directories to listen to
8
- # @param [Hash] options the listen options
9
- # @option options [Regexp] ignore a pattern for ignoring paths
10
- # @option options [Regexp] filter a pattern for filtering paths
11
- # @option options [Float] latency the delay between checking for changes in seconds
12
- # @option options [Boolean] force_polling whether to force the polling adapter or not
13
- # @option options [String, Boolean] polling_fallback_message to change polling fallback message or remove it
14
- #
15
- # @yield [modified, added, removed] the changed files
16
- # @yieldparam [Array<String>] modified the list of modified files
17
- # @yieldparam [Array<String>] added the list of added files
18
- # @yieldparam [Array<String>] removed the list of removed files
19
- #
20
- def initialize(*args, &block)
21
- options = args.last.is_a?(Hash) ? args.pop : {}
22
- directories = args
23
-
24
- @block = block
25
- @directories = directories.map { |d| Pathname.new(d).realpath.to_s }
26
- @directories_records = @directories.map { |d| DirectoryRecord.new(d) }
27
-
28
- ignore(*options.delete(:ignore)) if options[:ignore]
29
- filter(*options.delete(:filter)) if options[:filter]
30
-
31
- @adapter_options = options
32
- end
33
-
34
- # Starts the listener by initializing the adapter and building
35
- # the directory record concurrently, then it starts the adapter to watch
36
- # for changes.
37
- #
38
- # @param [Boolean] blocking whether or not to block the current thread after starting
39
- #
40
- def start(blocking = true)
41
- t = Thread.new { @directories_records.each { |r| r.build } }
42
- @adapter = initialize_adapter
43
- t.join
44
- @adapter.start(blocking)
45
- end
46
-
47
- # Unpauses the listener.
48
- #
49
- # @return [Listen::Listener] the listener
50
- #
51
- def unpause
52
- @directories_records.each { |r| r.build }
53
- @adapter.paused = false
54
- self
55
- end
56
-
57
- # Adds ignored paths to the listener.
58
- #
59
- # @param (see Listen::DirectoryRecord#ignore)
60
- #
61
- # @return [Listen::Listener] the listener
62
- #
63
- def ignore(*paths)
64
- @directories_records.each { |r| r.ignore(*paths) }
65
- self
66
- end
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
- # Adds file filters to the listener.
80
- #
81
- # @param (see Listen::DirectoryRecord#filter)
82
- #
83
- # @return [Listen::Listener] the listener
84
- #
85
- def filter(*regexps)
86
- @directories_records.each { |r| r.filter(*regexps) }
87
- self
88
- end
89
-
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
- # Runs the callback passing it the changes if there are any.
102
- #
103
- # @param (see Listen::DirectoryRecord#fetch_changes)
104
- #
105
- def on_change(directories_to_search, options = {})
106
- changes = fetch_records_changes(directories_to_search, options)
107
- unless changes.values.all? { |paths| paths.empty? }
108
- @block.call(changes[:modified],changes[:added],changes[:removed])
109
- end
110
- end
111
-
112
- private
113
-
114
- # Initializes an adapter passing it the callback and adapters' options.
115
- #
116
- def initialize_adapter
117
- callback = lambda { |changed_dirs, options| self.on_change(changed_dirs, options) }
118
- Adapter.select_and_initialize(@directories, @adapter_options, &callback)
119
- end
120
-
121
- # Returns the sum of all the changes to the directories records
122
- #
123
- # @param (see Listen::DirectoryRecord#fetch_changes)
124
- #
125
- # @return [Hash] the changes
126
- #
127
- def fetch_records_changes(directories_to_search, options)
128
- @directories_records.inject({}) do |h, r|
129
- # directory records skips paths outside their range, so passing the
130
- # whole `directories` array is not a problem.
131
- record_changes = r.fetch_changes(directories_to_search, options.merge(:relative_paths => DEFAULT_TO_RELATIVE_PATHS))
132
-
133
- if h.empty?
134
- h.merge!(record_changes)
135
- else
136
- h.each { |k, v| h[k] += record_changes[k] }
137
- end
138
-
139
- h
140
- end
141
- end
142
- end
143
- end