sass 3.2.0.alpha.101 → 3.2.0.alpha.102

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/REVISION +1 -1
  2. data/Rakefile +2 -2
  3. data/VERSION +1 -1
  4. data/lib/sass/plugin/compiler.rb +25 -32
  5. data/lib/sass/plugin/listener.rb +59 -0
  6. data/lib/sass/script/lexer.rb +1 -1
  7. data/lib/sass/script/list.rb +1 -0
  8. data/test/sass/conversion_test.rb +10 -0
  9. data/test/sass/scss/css_test.rb +9 -0
  10. data/vendor/listen/CHANGELOG.md +72 -0
  11. data/vendor/listen/Gemfile +35 -0
  12. data/vendor/listen/Guardfile +8 -0
  13. data/vendor/listen/LICENSE +20 -0
  14. data/vendor/listen/README.md +297 -0
  15. data/vendor/listen/Rakefile +47 -0
  16. data/vendor/listen/Vagrantfile +96 -0
  17. data/vendor/listen/lib/listen.rb +38 -0
  18. data/vendor/listen/lib/listen/adapter.rb +159 -0
  19. data/vendor/listen/lib/listen/adapters/darwin.rb +84 -0
  20. data/vendor/listen/lib/listen/adapters/linux.rb +99 -0
  21. data/vendor/listen/lib/listen/adapters/polling.rb +66 -0
  22. data/vendor/listen/lib/listen/adapters/windows.rb +82 -0
  23. data/vendor/listen/lib/listen/directory_record.rb +257 -0
  24. data/vendor/listen/lib/listen/listener.rb +186 -0
  25. data/vendor/listen/lib/listen/multi_listener.rb +121 -0
  26. data/vendor/listen/lib/listen/turnstile.rb +28 -0
  27. data/vendor/listen/lib/listen/version.rb +3 -0
  28. data/vendor/listen/listen.gemspec +26 -0
  29. data/vendor/listen/spec/listen/adapter_spec.rb +142 -0
  30. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +31 -0
  31. data/vendor/listen/spec/listen/adapters/linux_spec.rb +30 -0
  32. data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
  33. data/vendor/listen/spec/listen/adapters/windows_spec.rb +24 -0
  34. data/vendor/listen/spec/listen/directory_record_spec.rb +807 -0
  35. data/vendor/listen/spec/listen/listener_spec.rb +151 -0
  36. data/vendor/listen/spec/listen/multi_listener_spec.rb +151 -0
  37. data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
  38. data/vendor/listen/spec/listen_spec.rb +73 -0
  39. data/vendor/listen/spec/spec_helper.rb +16 -0
  40. data/vendor/listen/spec/support/adapter_helper.rb +538 -0
  41. data/vendor/listen/spec/support/directory_record_helper.rb +35 -0
  42. data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
  43. data/vendor/listen/spec/support/listeners_helper.rb +133 -0
  44. data/vendor/listen/spec/support/platform_helper.rb +11 -0
  45. metadata +41 -5
@@ -0,0 +1,35 @@
1
+ # Prepares a record for the test and fetches changes
2
+ # afterwards.
3
+ #
4
+ # @param [String] root_path the path to watch
5
+ # @param [Hash] options
6
+ # @option options [Array<string>] :paths optional paths fetch changes for
7
+ # @option options [Boolean] :use_last_record allow the use of an already
8
+ # created record, handy for ordered tests.
9
+ #
10
+ # @return [Array, Array, Array] the changes
11
+ #
12
+ def changes(root_path, options = {})
13
+ unless @record || options[:use_last_record]
14
+ @record = Listen::DirectoryRecord.new(root_path)
15
+ @record.build
16
+ @record.filter(options.delete(:filter)) if options[:filter]
17
+ @record.ignore(options.delete(:ignore)) if options[:ignore]
18
+ end
19
+
20
+ yield
21
+
22
+ paths = options.delete(:paths) || [root_path]
23
+ options[:recursive] = true if options[:recursive].nil?
24
+
25
+ changes = @record.fetch_changes(paths, {:relative_paths => true}.merge(options))
26
+
27
+ [changes[:modified], changes[:added], changes[:removed]]
28
+ end
29
+
30
+ def ensure_same_second
31
+ t = Time.now
32
+ if t.to_f - t.to_i > 0.1
33
+ sleep 1.5 - (t.to_f - t.to_i)
34
+ end
35
+ end
@@ -0,0 +1,29 @@
1
+ require 'tmpdir'
2
+
3
+ include FileUtils
4
+
5
+ # Prepares temporary fixture-directories and
6
+ # cleans them afterwards.
7
+ #
8
+ # @param [Fixnum] number_of_directories the number of fixture-directories to make
9
+ #
10
+ # @yield [path1, path2, ...] the empty fixture-directories
11
+ # @yieldparam [String] path the path to a fixture directory
12
+ #
13
+ def fixtures(number_of_directories = 1)
14
+ current_pwd = pwd
15
+ paths = 1.upto(number_of_directories).map do
16
+ File.expand_path(File.join(pwd, "spec/.fixtures/#{Time.now.to_f.to_s.sub('.', '') + rand(9999).to_s}"))
17
+ end
18
+
19
+ # Create the dirs
20
+ paths.each { |p| mkdir_p(p) }
21
+
22
+ cd(paths.first) if number_of_directories == 1
23
+
24
+ yield(*paths)
25
+
26
+ ensure
27
+ cd current_pwd
28
+ paths.map { |p| rm_rf(p) if File.exists?(p) }
29
+ end
@@ -0,0 +1,133 @@
1
+ shared_examples_for 'a listener to changes on a file-system' do
2
+ describe '#start' do
3
+ before do
4
+ subject.stub(:initialize_adapter) { adapter }
5
+ end
6
+
7
+ it 'starts the adapter' do
8
+ adapter.should_receive(:start)
9
+ subject.start
10
+ end
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)
15
+ subject.start(false)
16
+ end
17
+ end
18
+ end
19
+
20
+ context 'with a started listener' do
21
+ before do
22
+ subject.start
23
+ end
24
+
25
+ describe '#stop' do
26
+ it "stops adapter" do
27
+ adapter.should_receive(:stop)
28
+ subject.stop
29
+ end
30
+ end
31
+
32
+ describe '#pause' do
33
+ it 'sets adapter.paused to true' do
34
+ adapter.should_receive(:paused=).with(true)
35
+ subject.pause
36
+ end
37
+
38
+ it 'returns the same listener to allow chaining' do
39
+ subject.pause.should equal subject
40
+ end
41
+ end
42
+
43
+ describe '#unpause' do
44
+ it 'sets adapter.paused to false' do
45
+ adapter.should_receive(:paused=).with(false)
46
+ subject.unpause
47
+ end
48
+
49
+ it 'returns the same listener to allow chaining' do
50
+ subject.unpause.should equal subject
51
+ end
52
+ end
53
+
54
+ describe '#paused?' do
55
+ it 'returns false when there is no adapter' do
56
+ subject.instance_variable_set(:@adapter, nil)
57
+ subject.should_not be_paused
58
+ end
59
+
60
+ it 'returns true when adapter is paused' do
61
+ adapter.should_receive(:paused) { true }
62
+ subject.should be_paused
63
+ end
64
+
65
+ it 'returns false when adapter is not paused' do
66
+ adapter.should_receive(:paused) { false }
67
+ subject.should_not be_paused
68
+ end
69
+ end
70
+ end
71
+
72
+ describe '#change' do
73
+ it 'sets the callback block' do
74
+ callback = lambda { |modified, added, removed| }
75
+ subject.change(&callback)
76
+ subject.instance_variable_get(:@block).should eq callback
77
+ end
78
+
79
+ it 'returns the same listener to allow chaining' do
80
+ subject.change(&Proc.new{}).should equal subject
81
+ end
82
+ end
83
+
84
+ describe '#ignore'do
85
+ it 'returns the same listener to allow chaining' do
86
+ subject.ignore('some_directory').should equal subject
87
+ end
88
+ end
89
+
90
+ describe '#filter' do
91
+ it 'returns the same listener to allow chaining' do
92
+ subject.filter(/\.txt$/).should equal subject
93
+ end
94
+ end
95
+
96
+ describe '#latency' do
97
+ it 'sets the latency to @adapter_options' do
98
+ subject.latency(0.7)
99
+ subject.instance_variable_get(:@adapter_options).should eq(:latency => 0.7)
100
+ end
101
+
102
+ it 'returns the same listener to allow chaining' do
103
+ subject.latency(0.7).should equal subject
104
+ end
105
+ end
106
+
107
+ describe '#force_polling' do
108
+ it 'sets force_polling to @adapter_options' do
109
+ subject.force_polling(false)
110
+ subject.instance_variable_get(:@adapter_options).should eq(:force_polling => false)
111
+ end
112
+
113
+ it 'returns the same listener to allow chaining' do
114
+ subject.force_polling(true).should equal subject
115
+ end
116
+ end
117
+
118
+ describe '#polling_fallback_message' do
119
+ it 'sets custom polling fallback message to @adapter_options' do
120
+ subject.polling_fallback_message('custom message')
121
+ subject.instance_variable_get(:@adapter_options).should eq(:polling_fallback_message => 'custom message')
122
+ end
123
+
124
+ it 'sets polling fallback message to false in @adapter_options' do
125
+ subject.polling_fallback_message(false)
126
+ subject.instance_variable_get(:@adapter_options).should eq(:polling_fallback_message => false)
127
+ end
128
+
129
+ it 'returns the same listener to allow chaining' do
130
+ subject.polling_fallback_message('custom message').should equal subject
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,11 @@
1
+ def mac?
2
+ RbConfig::CONFIG['target_os'] =~ /darwin/i
3
+ end
4
+
5
+ def linux?
6
+ RbConfig::CONFIG['target_os'] =~ /linux/i
7
+ end
8
+
9
+ def windows?
10
+ RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
11
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592303063
4
+ hash: 592303057
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 101
12
- version: 3.2.0.alpha.101
11
+ - 102
12
+ version: 3.2.0.alpha.102
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2012-03-28 00:00:00 -04:00
22
+ date: 2012-04-20 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -95,6 +95,7 @@ files:
95
95
  - lib/sass/plugin/rack.rb
96
96
  - lib/sass/plugin/rails.rb
97
97
  - lib/sass/plugin/staleness_checker.rb
98
+ - lib/sass/plugin/listener.rb
98
99
  - lib/sass/railtie.rb
99
100
  - lib/sass/repl.rb
100
101
  - lib/sass/root.rb
@@ -152,6 +153,7 @@ files:
152
153
  - lib/sass/tree/root_node.rb
153
154
  - lib/sass/tree/content_node.rb
154
155
  - lib/sass/tree/css_import_node.rb
156
+ - lib/sass/tree/supports_node.rb
155
157
  - lib/sass/tree/variable_node.rb
156
158
  - lib/sass/tree/visitors/base.rb
157
159
  - lib/sass/tree/visitors/check_nesting.rb
@@ -163,7 +165,6 @@ files:
163
165
  - lib/sass/tree/visitors/to_css.rb
164
166
  - lib/sass/tree/warn_node.rb
165
167
  - lib/sass/tree/while_node.rb
166
- - lib/sass/tree/supports_node.rb
167
168
  - lib/sass/tree/trace_node.rb
168
169
  - lib/sass/util/multibyte_string_scanner.rb
169
170
  - lib/sass/util/subset_map.rb
@@ -205,6 +206,41 @@ files:
205
206
  - vendor/fssm/spec/root/file.yml
206
207
  - vendor/fssm/spec/root/moo/cow.txt
207
208
  - vendor/fssm/spec/spec_helper.rb
209
+ - vendor/listen/CHANGELOG.md
210
+ - vendor/listen/Gemfile
211
+ - vendor/listen/Guardfile
212
+ - vendor/listen/LICENSE
213
+ - vendor/listen/README.md
214
+ - vendor/listen/Rakefile
215
+ - vendor/listen/Vagrantfile
216
+ - vendor/listen/lib/listen.rb
217
+ - vendor/listen/lib/listen/adapter.rb
218
+ - vendor/listen/lib/listen/adapters/darwin.rb
219
+ - vendor/listen/lib/listen/adapters/linux.rb
220
+ - vendor/listen/lib/listen/adapters/polling.rb
221
+ - vendor/listen/lib/listen/adapters/windows.rb
222
+ - vendor/listen/lib/listen/directory_record.rb
223
+ - vendor/listen/lib/listen/listener.rb
224
+ - vendor/listen/lib/listen/multi_listener.rb
225
+ - vendor/listen/lib/listen/turnstile.rb
226
+ - vendor/listen/lib/listen/version.rb
227
+ - vendor/listen/listen.gemspec
228
+ - vendor/listen/spec/listen/adapter_spec.rb
229
+ - vendor/listen/spec/listen/adapters/darwin_spec.rb
230
+ - vendor/listen/spec/listen/adapters/linux_spec.rb
231
+ - vendor/listen/spec/listen/adapters/polling_spec.rb
232
+ - vendor/listen/spec/listen/adapters/windows_spec.rb
233
+ - vendor/listen/spec/listen/directory_record_spec.rb
234
+ - vendor/listen/spec/listen/listener_spec.rb
235
+ - vendor/listen/spec/listen/multi_listener_spec.rb
236
+ - vendor/listen/spec/listen/turnstile_spec.rb
237
+ - vendor/listen/spec/listen_spec.rb
238
+ - vendor/listen/spec/spec_helper.rb
239
+ - vendor/listen/spec/support/adapter_helper.rb
240
+ - vendor/listen/spec/support/directory_record_helper.rb
241
+ - vendor/listen/spec/support/fixtures_helper.rb
242
+ - vendor/listen/spec/support/listeners_helper.rb
243
+ - vendor/listen/spec/support/platform_helper.rb
208
244
  - bin/sass
209
245
  - bin/sass-convert
210
246
  - bin/scss