sass 3.2.5 → 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/VERSION +1 -1
  2. data/VERSION_DATE +1 -1
  3. data/bin/sass +2 -1
  4. data/bin/sass-convert +2 -1
  5. data/bin/scss +2 -1
  6. data/lib/sass/cache_stores/chain.rb +1 -1
  7. data/lib/sass/cache_stores/filesystem.rb +0 -1
  8. data/lib/sass/engine.rb +7 -1
  9. data/lib/sass/importers/filesystem.rb +1 -1
  10. data/lib/sass/media.rb +1 -4
  11. data/lib/sass/script/funcall.rb +43 -8
  12. data/lib/sass/script/lexer.rb +0 -2
  13. data/lib/sass/script/parser.rb +0 -2
  14. data/lib/sass/scss/parser.rb +13 -1
  15. data/lib/sass/selector/simple_sequence.rb +1 -1
  16. data/lib/sass/tree/comment_node.rb +2 -2
  17. data/lib/sass/tree/visitors/cssize.rb +10 -1
  18. data/lib/sass/tree/visitors/perform.rb +4 -2
  19. data/lib/sass/util.rb +54 -1
  20. data/lib/sass/util/multibyte_string_scanner.rb +29 -8
  21. data/test/sass/engine_test.rb +16 -0
  22. data/test/sass/extend_test.rb +15 -0
  23. data/test/sass/script_test.rb +3 -1
  24. data/vendor/listen/CHANGELOG.md +76 -2
  25. data/vendor/listen/CONTRIBUTING.md +38 -0
  26. data/vendor/listen/Gemfile +8 -1
  27. data/vendor/listen/Guardfile +1 -1
  28. data/vendor/listen/LICENSE +1 -1
  29. data/vendor/listen/README.md +8 -5
  30. data/vendor/listen/lib/listen.rb +7 -5
  31. data/vendor/listen/lib/listen/adapter.rb +76 -29
  32. data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
  33. data/vendor/listen/lib/listen/adapters/darwin.rb +11 -10
  34. data/vendor/listen/lib/listen/adapters/linux.rb +33 -30
  35. data/vendor/listen/lib/listen/adapters/polling.rb +2 -1
  36. data/vendor/listen/lib/listen/adapters/windows.rb +27 -21
  37. data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
  38. data/vendor/listen/lib/listen/directory_record.rb +63 -10
  39. data/vendor/listen/lib/listen/listener.rb +22 -0
  40. data/vendor/listen/lib/listen/multi_listener.rb +22 -0
  41. data/vendor/listen/lib/listen/version.rb +1 -1
  42. data/vendor/listen/listen.gemspec +0 -4
  43. data/vendor/listen/spec/listen/adapter_spec.rb +45 -4
  44. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
  45. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +6 -0
  46. data/vendor/listen/spec/listen/adapters/linux_spec.rb +6 -0
  47. data/vendor/listen/spec/listen/adapters/windows_spec.rb +7 -1
  48. data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
  49. data/vendor/listen/spec/listen/directory_record_spec.rb +91 -4
  50. data/vendor/listen/spec/listen/listener_spec.rb +14 -0
  51. data/vendor/listen/spec/listen/multi_listener_spec.rb +19 -1
  52. data/vendor/listen/spec/spec_helper.rb +6 -3
  53. data/vendor/listen/spec/support/adapter_helper.rb +125 -212
  54. data/vendor/listen/spec/support/listeners_helper.rb +13 -1
  55. data/vendor/listen/spec/support/platform_helper.rb +4 -0
  56. metadata +9 -3
@@ -93,6 +93,17 @@ 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
+
96
107
  # Adds filtering patterns to the listener.
97
108
  #
98
109
  # @param (see Listen::DirectoryRecord#filter)
@@ -104,6 +115,17 @@ module Listen
104
115
  self
105
116
  end
106
117
 
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
+
107
129
  # Sets the latency for the adapter. This is a helper method
108
130
  # to simplify changing the latency directly from the listener.
109
131
  #
@@ -65,6 +65,17 @@ 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
+
68
79
  # Adds file filters to the listener.
69
80
  #
70
81
  # @param (see Listen::DirectoryRecord#filter)
@@ -76,6 +87,17 @@ module Listen
76
87
  self
77
88
  end
78
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
+
79
101
  # Runs the callback passing it the changes if there are any.
80
102
  #
81
103
  # @param (see Listen::DirectoryRecord#fetch_changes)
@@ -1,3 +1,3 @@
1
1
  module Listen
2
- VERSION = '0.4.7'
2
+ VERSION = '0.7.2'
3
3
  end
@@ -15,10 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.required_rubygems_version = '>= 1.3.6'
16
16
  s.rubyforge_project = 'listen'
17
17
 
18
- s.add_dependency 'rb-fsevent', '~> 0.9.1'
19
- s.add_dependency 'rb-inotify', '~> 0.8.8'
20
- s.add_dependency 'rb-fchange', '~> 0.0.5'
21
-
22
18
  s.add_development_dependency 'bundler'
23
19
 
24
20
  s.files = Dir.glob('{lib}/**/*') + %w[CHANGELOG.md LICENSE README.md]
@@ -21,6 +21,7 @@ describe Listen::Adapter do
21
21
  before do
22
22
  Listen::Adapters::Darwin.stub(:usable_and_works?) { false }
23
23
  Listen::Adapters::Linux.stub(:usable_and_works?) { false }
24
+ Listen::Adapters::BSD.stub(:usable_and_works?) { false }
24
25
  Listen::Adapters::Windows.stub(:usable_and_works?) { false }
25
26
  end
26
27
 
@@ -31,14 +32,28 @@ describe Listen::Adapter do
31
32
  described_class.select_and_initialize('dir')
32
33
  end
33
34
 
34
- it "warns with the default polling fallback message" do
35
- Kernel.should_receive(:warn).with(Listen::Adapter::POLLING_FALLBACK_MESSAGE)
35
+ it 'warns with the default polling fallback message' do
36
+ Kernel.should_receive(:warn).with(/#{Listen::Adapter::POLLING_FALLBACK_MESSAGE}/)
36
37
  described_class.select_and_initialize('dir')
37
38
  end
38
39
 
40
+ context 'when the dependencies of an adapter are not satisfied' do
41
+ before do
42
+ Listen::Adapters::Darwin.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
43
+ Listen::Adapters::Linux.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
44
+ Listen::Adapters::BSD.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
45
+ Listen::Adapters::Windows.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
46
+ end
47
+
48
+ it 'invites the user to satisfy the dependencies of the adapter in the warning' do
49
+ Kernel.should_receive(:warn).with(/#{Listen::Adapter::MISSING_DEPENDENCY_MESSAGE}/)
50
+ described_class.select_and_initialize('dir')
51
+ end
52
+ end
53
+
39
54
  context "with custom polling_fallback_message option" do
40
55
  it "warns with the custom polling fallback message" do
41
- Kernel.should_receive(:warn).with('custom')
56
+ Kernel.should_receive(:warn).with(/custom/)
42
57
  described_class.select_and_initialize('dir', :polling_fallback_message => 'custom')
43
58
  end
44
59
  end
@@ -83,6 +98,22 @@ describe Listen::Adapter do
83
98
  end
84
99
  end
85
100
 
101
+ context "on BSD" do
102
+ before { Listen::Adapters::BSD.stub(:usable_and_works?) { true } }
103
+
104
+ it "uses Listen::Adapters::BSD" do
105
+ Listen::Adapters::BSD.should_receive(:new).with('dir', {})
106
+ described_class.select_and_initialize('dir')
107
+ end
108
+
109
+ context 'when the use of the polling adapter is forced' do
110
+ it 'uses Listen::Adapters::Polling' do
111
+ Listen::Adapters::Polling.should_receive(:new).with('dir', {})
112
+ described_class.select_and_initialize('dir', :force_polling => true)
113
+ end
114
+ end
115
+ end
116
+
86
117
  context "on Windows" do
87
118
  before { Listen::Adapters::Windows.stub(:usable_and_works?) { true } }
88
119
 
@@ -100,8 +131,18 @@ describe Listen::Adapter do
100
131
  end
101
132
  end
102
133
 
103
- [Listen::Adapters::Darwin, Listen::Adapters::Linux, Listen::Adapters::Windows].each do |adapter_class|
134
+ [Listen::Adapters::Darwin, Listen::Adapters::Linux,
135
+ Listen::Adapters::BSD, Listen::Adapters::Windows].each do
136
+ |adapter_class|
104
137
  if adapter_class.usable?
138
+ describe '.usable?' do
139
+ it 'checks the dependencies' do
140
+ adapter_class.should_receive(:load_depenencies)
141
+ adapter_class.should_receive(:dependencies_loaded?)
142
+ adapter_class.usable?
143
+ end
144
+ end
145
+
105
146
  describe '.usable_and_works?' do
106
147
  it 'checks if the adapter is usable' do
107
148
  adapter_class.stub(:works?)
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Listen::Adapters::BSD do
4
+ if bsd?
5
+ if Listen::Adapters::BSD.usable?
6
+ it "is usable on BSD" do
7
+ described_class.should be_usable
8
+ end
9
+
10
+ it_should_behave_like 'a filesystem adapter'
11
+ it_should_behave_like 'an adapter that call properly listener#on_change'
12
+ else
13
+ it "isn't usable on BSD with #{RbConfig::CONFIG['RUBY_INSTALL_NAME']}" do
14
+ described_class.should_not be_usable
15
+ end
16
+ end
17
+ end
18
+
19
+ if linux?
20
+ it "isn't usable on Linux" do
21
+ described_class.should_not be_usable
22
+ end
23
+ end
24
+
25
+ if mac?
26
+ it "isn't usable on Mac OS X" do
27
+ described_class.should_not be_usable
28
+ end
29
+ end
30
+
31
+ if windows?
32
+ it "isn't usable on Windows" do
33
+ described_class.should_not be_usable
34
+ end
35
+ end
36
+ end
@@ -28,4 +28,10 @@ describe Listen::Adapters::Darwin do
28
28
  described_class.should_not be_usable
29
29
  end
30
30
  end
31
+
32
+ if bsd?
33
+ it "isn't usable on BSD" do
34
+ described_class.should_not be_usable
35
+ end
36
+ end
31
37
  end
@@ -27,6 +27,12 @@ describe Listen::Adapters::Linux do
27
27
  end
28
28
  end
29
29
 
30
+ if bsd?
31
+ it "isn't usable on BSD" do
32
+ described_class.should_not be_usable
33
+ end
34
+ end
35
+
30
36
  if mac?
31
37
  it "isn't usable on Mac OS X" do
32
38
  described_class.should_not be_usable
@@ -7,7 +7,7 @@ describe Listen::Adapters::Windows do
7
7
  end
8
8
 
9
9
  it_should_behave_like 'a filesystem adapter'
10
- it_should_behave_like 'an adapter that call properly listener#on_change', :recursive => true, :adapter => :windows
10
+ it_should_behave_like 'an adapter that call properly listener#on_change'
11
11
  end
12
12
 
13
13
  if mac?
@@ -16,6 +16,12 @@ describe Listen::Adapters::Windows do
16
16
  end
17
17
  end
18
18
 
19
+ if bsd?
20
+ it "isn't usable on BSD" do
21
+ described_class.should_not be_usable
22
+ end
23
+ end
24
+
19
25
  if linux?
20
26
  it "isn't usable on Linux" do
21
27
  described_class.should_not be_usable
@@ -0,0 +1,107 @@
1
+ require 'spec_helper'
2
+
3
+ describe Listen::DependencyManager do
4
+ let(:dependency) { Listen::DependencyManager::Dependency.new('listen', '~> 0.0.1') }
5
+
6
+ subject { Class.new { extend Listen::DependencyManager } }
7
+
8
+ before { described_class.clear_loaded }
9
+
10
+ describe '.add_loaded' do
11
+ it 'adds a dependency to the list of loaded dependencies' do
12
+ described_class.add_loaded dependency
13
+ described_class.already_loaded?(dependency).should be_true
14
+ end
15
+ end
16
+
17
+ describe '.already_loaded?' do
18
+ it 'returns false when a dependency is not in the list of loaded dependencies' do
19
+ described_class.already_loaded?(dependency).should be_false
20
+ end
21
+
22
+ it 'returns true when a dependency is in the list of loaded dependencies' do
23
+ described_class.add_loaded dependency
24
+ described_class.already_loaded?(dependency).should be_true
25
+ end
26
+ end
27
+
28
+ describe '.clear_loaded' do
29
+ it 'clears the whole list of loaded dependencies' do
30
+ described_class.add_loaded dependency
31
+ described_class.already_loaded?(dependency).should be_true
32
+ described_class.clear_loaded
33
+ described_class.already_loaded?(dependency).should be_false
34
+ end
35
+ end
36
+
37
+ describe '#dependency' do
38
+ it 'registers a new dependency for the managed class' do
39
+ subject.dependency 'listen', '~> 0.0.1'
40
+ subject.dependencies_loaded?.should be_false
41
+ end
42
+ end
43
+
44
+ describe '#load_depenencies' do
45
+ before { subject.dependency 'listen', '~> 0.0.1' }
46
+
47
+ context 'when dependencies can be loaded' do
48
+ before { subject.stub(:gem, :require) }
49
+
50
+ it 'loads all the registerd dependencies' do
51
+ subject.load_depenencies
52
+ subject.dependencies_loaded?.should be_true
53
+ end
54
+ end
55
+
56
+ context 'when dependencies can not be loaded' do
57
+ it 'raises an error' do
58
+ expect {
59
+ subject.load_depenencies
60
+ }.to raise_error(described_class::Error)
61
+ end
62
+
63
+ context 'when running under bundler' do
64
+ before { subject.should_receive(:running_under_bundler?).and_return(true) }
65
+
66
+ it 'includes the Gemfile declaration to satisfy the dependency' do
67
+ begin
68
+ subject.load_depenencies
69
+ rescue described_class::Error => e
70
+ e.message.should include("gem 'listen', '~> 0.0.1'")
71
+ end
72
+ end
73
+ end
74
+
75
+ context 'when not running under bundler' do
76
+ before { subject.should_receive(:running_under_bundler?).and_return(false) }
77
+
78
+ it 'includes the command to install the dependency' do
79
+ begin
80
+ subject.load_depenencies
81
+ rescue described_class::Error => e
82
+ e.message.should include("gem install --version '~> 0.0.1' listen")
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ describe '#dependencies_loaded?' do
90
+ it 'return false when dependencies are not loaded' do
91
+ subject.dependency 'listen', '~> 0.0.1'
92
+ subject.dependencies_loaded?.should be_false
93
+ end
94
+
95
+ it 'return true when dependencies are loaded' do
96
+ subject.stub(:gem, :require)
97
+
98
+ subject.dependency 'listen', '~> 0.0.1'
99
+ subject.load_depenencies
100
+ subject.dependencies_loaded?.should be_true
101
+ end
102
+
103
+ it 'return true when there are no dependencies to load' do
104
+ subject.dependencies_loaded?.should be_true
105
+ end
106
+ end
107
+ end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Listen::DirectoryRecord do
@@ -41,12 +42,19 @@ describe Listen::DirectoryRecord do
41
42
  end
42
43
 
43
44
  describe '#ignore' do
44
- it 'adds the passed paths to the list of ignoted paths in the record' do
45
+ it 'adds the passed paths to the list of ignored paths in the record' do
45
46
  subject.ignore(%r{^\.old/}, %r{\.pid$})
46
47
  subject.ignoring_patterns.should include(%r{^\.old/}, %r{\.pid$})
47
48
  end
48
49
  end
49
50
 
51
+ describe '#ignore!' do
52
+ it 'replace the ignored paths in the record' do
53
+ subject.ignore!(%r{^\.old/}, %r{\.pid$})
54
+ subject.ignoring_patterns.should =~ [%r{^\.old/}, %r{\.pid$}]
55
+ end
56
+ end
57
+
50
58
  describe '#filter' do
51
59
  it 'adds the passed regexps to the list of filters that determine the stored paths' do
52
60
  subject.filter(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
@@ -54,6 +62,13 @@ describe Listen::DirectoryRecord do
54
62
  end
55
63
  end
56
64
 
65
+ describe '#filter!' do
66
+ it 'replaces the passed regexps in the list of filters that determine the stored paths' do
67
+ subject.filter!(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
68
+ subject.filtering_patterns.should =~ [%r{\.(?:mp3|ogg|a3c)}, %r{\.(?:jpe?g|gif|png)}]
69
+ end
70
+ end
71
+
57
72
  describe '#ignored?' do
58
73
  before { subject.stub(:relative_to_base) { |path| path } }
59
74
 
@@ -193,7 +208,12 @@ describe Listen::DirectoryRecord do
193
208
  it 'returns nil when the passed path is not inside the base-directory' do
194
209
  subject.relative_to_base('/tmp/some_random_path').should be_nil
195
210
  end
196
-
211
+
212
+ it 'works with non UTF-8 paths' do
213
+ path = "tmp/\xE4\xE4"
214
+ subject.relative_to_base(File.join(base_directory, path))
215
+ end
216
+
197
217
  context 'when containing regexp characters in the base directory' do
198
218
  before do
199
219
  fixtures do |path|
@@ -442,6 +462,11 @@ describe Listen::DirectoryRecord do
442
462
  it 'detects the modified file the second time if the content have changed' do
443
463
  fixtures do |path|
444
464
  touch 'existing_file.txt'
465
+ # Set sha1 path checksum
466
+ changes(path) do
467
+ touch 'existing_file.txt'
468
+ end
469
+ small_time_difference
445
470
 
446
471
  changes(path) do
447
472
  touch 'existing_file.txt'
@@ -456,6 +481,58 @@ describe Listen::DirectoryRecord do
456
481
  removed.should be_empty
457
482
  end
458
483
  end
484
+
485
+ it "doesn't detects the modified file the second time if just touched - #62" do
486
+ fixtures do |path|
487
+ touch 'existing_file.txt'
488
+ # Set sha1 path checksum
489
+ changes(path) do
490
+ touch 'existing_file.txt'
491
+ end
492
+ small_time_difference
493
+
494
+ changes(path, :use_last_record => true) do
495
+ open('existing_file.txt', 'w') { |f| f.write('foo') }
496
+ end
497
+
498
+ modified, added, removed = changes(path, :use_last_record => true) do
499
+ touch 'existing_file.txt'
500
+ end
501
+
502
+ added.should be_empty
503
+ modified.should be_empty
504
+ removed.should be_empty
505
+ end
506
+ end
507
+
508
+ it "adds the path in the paths checksums if just touched - #62" do
509
+ fixtures do |path|
510
+ touch 'existing_file.txt'
511
+ small_time_difference
512
+
513
+ changes(path) do
514
+ touch 'existing_file.txt'
515
+ end
516
+
517
+ @record.sha1_checksums["#{path}/existing_file.txt"].should_not be_nil
518
+ end
519
+ end
520
+
521
+ it "deletes the path from the paths checksums" do
522
+ fixtures do |path|
523
+ touch 'unnecessary.txt'
524
+
525
+ changes(path) do
526
+ @record.sha1_checksums["#{path}/unnecessary.txt"] = 'foo'
527
+
528
+ rm 'unnecessary.txt'
529
+ end
530
+
531
+ @record.sha1_checksums["#{path}/unnecessary.txt"].should be_nil
532
+ end
533
+ end
534
+
535
+
459
536
  end
460
537
 
461
538
  context 'given a hidden file' do
@@ -1092,7 +1169,7 @@ describe Listen::DirectoryRecord do
1092
1169
 
1093
1170
  # simulate a race condition where the file is removed after the
1094
1171
  # change event is tracked, but before the hash is calculated
1095
- Digest::SHA1.should_receive(:file).and_raise(Errno::ENOENT)
1172
+ Digest::SHA1.should_receive(:file).twice.and_raise(Errno::ENOENT)
1096
1173
 
1097
1174
  lambda {
1098
1175
  fixtures do |path|
@@ -1104,7 +1181,17 @@ describe Listen::DirectoryRecord do
1104
1181
  end
1105
1182
  end
1106
1183
 
1107
- context 'with symlinks' do
1184
+ context 'within a directory containing a unix domain socket file' do
1185
+ it 'does not raise an exception when hashing a unix domain socket file' do
1186
+ fixtures do |path|
1187
+ require 'socket'
1188
+ UNIXServer.new('unix_domain_socket.sock')
1189
+ lambda { changes(path){} }.should_not raise_error(Errno::ENXIO)
1190
+ end
1191
+ end
1192
+ end
1193
+
1194
+ context 'with symlinks', :unless => windows? do
1108
1195
  it 'looks at symlinks not their targets' do
1109
1196
  fixtures do |path|
1110
1197
  touch 'target'