sass 3.2.0.alpha.11 → 3.2.0.alpha.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/REVISION +1 -1
  2. data/VERSION +1 -1
  3. data/lib/sass/cache_stores/base.rb +4 -9
  4. data/lib/sass/cache_stores/filesystem.rb +2 -0
  5. data/lib/sass/css.rb +2 -1
  6. data/lib/sass/engine.rb +28 -8
  7. data/lib/sass/environment.rb +26 -0
  8. data/lib/sass/exec.rb +13 -0
  9. data/lib/sass/importers/base.rb +2 -1
  10. data/lib/sass/script/funcall.rb +8 -0
  11. data/lib/sass/script/interpolation.rb +9 -0
  12. data/lib/sass/script/list.rb +7 -0
  13. data/lib/sass/script/literal.rb +5 -0
  14. data/lib/sass/script/node.rb +8 -0
  15. data/lib/sass/script/number.rb +28 -5
  16. data/lib/sass/script/operation.rb +8 -0
  17. data/lib/sass/script/string_interpolation.rb +9 -0
  18. data/lib/sass/script/unary_operation.rb +7 -0
  19. data/lib/sass/script/variable.rb +5 -0
  20. data/lib/sass/scss/parser.rb +26 -13
  21. data/lib/sass/scss/rx.rb +1 -1
  22. data/lib/sass/scss/static_parser.rb +2 -2
  23. data/lib/sass/tree/content_node.rb +9 -0
  24. data/lib/sass/tree/debug_node.rb +1 -6
  25. data/lib/sass/tree/each_node.rb +1 -7
  26. data/lib/sass/tree/extend_node.rb +1 -1
  27. data/lib/sass/tree/for_node.rb +2 -7
  28. data/lib/sass/tree/function_node.rb +1 -6
  29. data/lib/sass/tree/if_node.rb +1 -19
  30. data/lib/sass/tree/mixin_def_node.rb +5 -6
  31. data/lib/sass/tree/mixin_node.rb +2 -7
  32. data/lib/sass/tree/node.rb +4 -19
  33. data/lib/sass/tree/prop_node.rb +0 -5
  34. data/lib/sass/tree/return_node.rb +1 -6
  35. data/lib/sass/tree/rule_node.rb +9 -7
  36. data/lib/sass/tree/trace_node.rb +32 -0
  37. data/lib/sass/tree/variable_node.rb +1 -7
  38. data/lib/sass/tree/visitors/check_nesting.rb +30 -13
  39. data/lib/sass/tree/visitors/convert.rb +5 -1
  40. data/lib/sass/tree/visitors/cssize.rb +3 -3
  41. data/lib/sass/tree/visitors/deep_copy.rb +87 -0
  42. data/lib/sass/tree/visitors/perform.rb +36 -16
  43. data/lib/sass/tree/visitors/set_options.rb +97 -0
  44. data/lib/sass/tree/visitors/to_css.rb +5 -1
  45. data/lib/sass/tree/warn_node.rb +1 -7
  46. data/lib/sass/tree/while_node.rb +1 -7
  47. data/test/sass/cache_test.rb +15 -0
  48. data/test/sass/conversion_test.rb +38 -0
  49. data/test/sass/css2sass_test.rb +9 -0
  50. data/test/sass/engine_test.rb +248 -17
  51. data/test/sass/scss/css_test.rb +4 -2
  52. data/test/sass/scss/scss_test.rb +53 -12
  53. data/vendor/fssm/Gemfile +3 -0
  54. data/vendor/fssm/LICENSE +1 -1
  55. data/vendor/fssm/README.markdown +55 -27
  56. data/vendor/fssm/Rakefile +6 -54
  57. data/vendor/fssm/example.rb +6 -3
  58. data/vendor/fssm/fssm.gemspec +17 -70
  59. data/vendor/fssm/lib/fssm.rb +7 -3
  60. data/vendor/fssm/lib/fssm/backends/fsevents.rb +1 -1
  61. data/vendor/fssm/lib/fssm/backends/inotify.rb +2 -2
  62. data/vendor/fssm/lib/fssm/backends/polling.rb +2 -2
  63. data/vendor/fssm/lib/fssm/backends/rbfsevent.rb +42 -0
  64. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
  65. data/vendor/fssm/lib/fssm/monitor.rb +19 -9
  66. data/vendor/fssm/lib/fssm/path.rb +24 -21
  67. data/vendor/fssm/lib/fssm/pathname.rb +13 -479
  68. data/vendor/fssm/lib/fssm/state/directory.rb +29 -11
  69. data/vendor/fssm/lib/fssm/state/file.rb +1 -1
  70. data/vendor/fssm/lib/fssm/support.rb +41 -12
  71. data/vendor/fssm/lib/fssm/tree.rb +6 -6
  72. data/vendor/fssm/lib/fssm/version.rb +3 -0
  73. data/vendor/fssm/profile/prof-cache.rb +3 -3
  74. data/vendor/fssm/profile/prof-pathname-rubinius.rb +35 -0
  75. data/vendor/fssm/profile/prof-pathname.rb +7 -7
  76. data/vendor/fssm/spec/count_down_latch.rb +151 -0
  77. data/vendor/fssm/spec/monitor_spec.rb +202 -0
  78. data/vendor/fssm/spec/path_spec.rb +36 -15
  79. data/vendor/fssm/spec/spec_helper.rb +6 -6
  80. metadata +14 -4
  81. data/vendor/fssm/VERSION.yml +0 -5
@@ -0,0 +1,202 @@
1
+ require 'spec_helper'
2
+
3
+ require 'count_down_latch'
4
+ require 'fileutils'
5
+ require 'tempfile'
6
+
7
+ module FSSM::MonitorSpecHelpers
8
+ def create_tmp_dir
9
+ @tmp_dir = FSSM::Pathname.for(Dir.mktmpdir).realpath.to_s
10
+ FileUtils.cp_r File.join(File.dirname(__FILE__), 'root'), @tmp_dir
11
+ # Because git does not track empty directories, create one ourselves.
12
+ FileUtils.mkdir_p @tmp_dir + '/root/yawn'
13
+ @tmp_dir
14
+ end
15
+
16
+ def remove_tmp_dir
17
+ FileUtils.remove_entry @tmp_dir
18
+ end
19
+
20
+ def create_handler(type, latch)
21
+ lambda do |*args|
22
+ @handler_results[type] << args
23
+ latch.count_down
24
+ end
25
+ end
26
+
27
+ def run_monitor(num_events_to_expect=0, options={})
28
+ event_latch = CountDownLatch.new(num_events_to_expect)
29
+ @handler_results = Hash.new { |hash, key| hash[key] = [] }
30
+ thread = Thread.new do
31
+ monitor = FSSM::Monitor.new(options)
32
+ monitor.path(@tmp_dir) do |p|
33
+ p.create(&create_handler(:create, event_latch))
34
+ p.update(&create_handler(:update, event_latch))
35
+ p.delete(&create_handler(:delete, event_latch))
36
+ end
37
+ monitor.run
38
+ end
39
+ sleep 1 # give time for monitor to start up
40
+ yield if block_given?
41
+ event_latch.wait
42
+ thread.kill
43
+ end
44
+ end
45
+
46
+ describe "The File System State Monitor" do
47
+ describe "monitor" do
48
+ include FSSM::MonitorSpecHelpers
49
+
50
+ before do
51
+ create_tmp_dir
52
+ end
53
+
54
+ after do
55
+ remove_tmp_dir
56
+ end
57
+
58
+ describe "with default options" do
59
+ it "should call create callback upon file creation" do
60
+ run_monitor(1) do
61
+ file = @tmp_dir + "/newfile.rb"
62
+ File.exists?(file).should be_false
63
+ FileUtils.touch file
64
+ end
65
+ @handler_results[:create].should == [[@tmp_dir, 'newfile.rb']]
66
+ end
67
+
68
+ it "should call update callback upon file modification" do
69
+ run_monitor(1) do
70
+ FileUtils.touch @tmp_dir + '/root/file.rb'
71
+ end
72
+ @handler_results[:update].should == [[@tmp_dir, 'root/file.rb']]
73
+ end
74
+
75
+ it "should call delete callback upon file deletion" do
76
+ run_monitor(1) do
77
+ FileUtils.rm @tmp_dir + "/root/file.rb"
78
+ end
79
+ @handler_results[:delete].should == [[@tmp_dir, 'root/file.rb']]
80
+ end
81
+
82
+ it "should call create and delete callbacks upon file renaming in the same directory" do
83
+ run_monitor(2) do
84
+ FileUtils.mv @tmp_dir + "/root/file.rb", @tmp_dir + "/root/old_file.rb"
85
+ end
86
+ @handler_results[:create].should == [[@tmp_dir, 'root/old_file.rb']]
87
+ @handler_results[:delete].should == [[@tmp_dir, 'root/file.rb']]
88
+ @handler_results[:update].should == []
89
+ end
90
+
91
+ it "should call create and delete callbacks upon file moving to another directory" do
92
+ run_monitor(2) do
93
+ FileUtils.mv @tmp_dir + "/root/file.rb", @tmp_dir + "/old_file.rb"
94
+ end
95
+ @handler_results[:create].should == [[@tmp_dir, 'old_file.rb']]
96
+ @handler_results[:delete].should == [[@tmp_dir, 'root/file.rb']]
97
+ @handler_results[:update].should == []
98
+ end
99
+
100
+ it "should not call callbacks upon directory operations" do
101
+ run_monitor do
102
+ FileUtils.mkdir @tmp_dir + "/another_yawn"
103
+ FileUtils.rmdir @tmp_dir + "/root/yawn"
104
+ end
105
+ @handler_results[:create].should == []
106
+ @handler_results[:delete].should == []
107
+ end
108
+ end
109
+
110
+ describe "when configured to consider files and directories" do
111
+ it "should call create callback upon directory creation" do
112
+ run_monitor(1, :directories => true) do
113
+ FileUtils.mkdir @tmp_dir + "/another_yawn"
114
+ end
115
+ @handler_results[:create].should include([@tmp_dir, 'another_yawn', :directory])
116
+ end
117
+
118
+ it "should call delete callback upon directory deletion" do
119
+ run_monitor(1, :directories => true) do
120
+ FileUtils.rmdir @tmp_dir + "/root/yawn"
121
+ end
122
+ @handler_results[:delete].should include([@tmp_dir, 'root/yawn', :directory])
123
+ end
124
+
125
+ it "should call create, update, and delete callbacks upon directory renaming in the same directory" do
126
+ run_monitor(3, :directories => true) do
127
+ FileUtils.mv @tmp_dir + "/root/yawn", @tmp_dir + "/root/old_yawn"
128
+ end
129
+ @handler_results[:create].should include([@tmp_dir, 'root/old_yawn', :directory])
130
+ @handler_results[:delete].should include([@tmp_dir, 'root/yawn', :directory])
131
+ @handler_results[:update].should include([@tmp_dir, 'root', :directory])
132
+ end
133
+
134
+ it "should call create, update, and delete callbacks upon directory moving to another directory" do
135
+ run_monitor(3, :directories => true) do
136
+ FileUtils.mv @tmp_dir + "/root/yawn", @tmp_dir + "/old_yawn"
137
+ end
138
+ @handler_results[:create].should include([@tmp_dir, 'old_yawn', :directory])
139
+ @handler_results[:delete].should include([@tmp_dir, 'root/yawn', :directory])
140
+ @handler_results[:update].should include([@tmp_dir, 'root', :directory])
141
+ end
142
+
143
+ it "should call create, update, and delete callbacks upon file renaming in the same directory" do
144
+ run_monitor(3, :directories => true) do
145
+ FileUtils.mv @tmp_dir + "/root/file.rb", @tmp_dir + "/root/old_file.rb"
146
+ end
147
+ @handler_results[:create].should include([@tmp_dir, 'root/old_file.rb', :file])
148
+ @handler_results[:delete].should include([@tmp_dir, 'root/file.rb', :file])
149
+ @handler_results[:update].should include([@tmp_dir, 'root', :directory])
150
+ end
151
+
152
+ it "should call create, update, and delete callbacks upon file moving to another directory" do
153
+ run_monitor(3, :directories => true) do
154
+ FileUtils.mv @tmp_dir + "/root/file.rb", @tmp_dir + "/old_file.rb"
155
+ end
156
+ @handler_results[:create].should include([@tmp_dir, 'old_file.rb', :file])
157
+ @handler_results[:delete].should include([@tmp_dir, 'root/file.rb', :file])
158
+ @handler_results[:update].should include([@tmp_dir, 'root', :directory])
159
+ end
160
+
161
+ it "should call delete callbacks upon directory structure deletion, in reverse order" do
162
+ expected_delete_events = [
163
+ ['root/yawn', :directory],
164
+ ['root/moo/cow.txt', :file],
165
+ ['root/moo', :directory],
166
+ ['root/file.yml', :file],
167
+ ['root/file.rb', :file],
168
+ ['root/file.css', :file],
169
+ ['root/duck/quack.txt', :file],
170
+ ['root/duck', :directory],
171
+ ['root', :directory]
172
+ ]
173
+ run_monitor(expected_delete_events.size, :directories => true) do
174
+ FileUtils.rm_rf @tmp_dir + '/.'
175
+ end
176
+ @handler_results[:create].should == []
177
+ @handler_results[:delete].should == expected_delete_events.map { |(file, type)| [@tmp_dir, file, type] }
178
+ @handler_results[:update].should == []
179
+ end
180
+
181
+ it "should call create callbacks upon directory structure creation, in order" do
182
+ expected_create_events = [
183
+ ['new_root', :directory],
184
+ ['new_root/duck', :directory],
185
+ ['new_root/duck/quack.txt', :file],
186
+ ['new_root/file.css', :file],
187
+ ['new_root/file.rb', :file],
188
+ ['new_root/file.yml', :file],
189
+ ['new_root/moo', :directory],
190
+ ['new_root/moo/cow.txt', :file],
191
+ ['new_root/yawn', :directory]
192
+ ]
193
+ run_monitor(expected_create_events.size, :directories => true) do
194
+ FileUtils.cp_r @tmp_dir + '/root/.', @tmp_dir + '/new_root'
195
+ end
196
+ @handler_results[:create].should == expected_create_events.map { |(file, type)| [@tmp_dir, file, type] }
197
+ @handler_results[:delete].should == []
198
+ @handler_results[:update].should == []
199
+ end
200
+ end
201
+ end
202
+ end
@@ -1,13 +1,13 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require "spec_helper"
2
2
 
3
3
  describe "The File System State Monitor" do
4
4
  describe "paths" do
5
5
  it "should accept a valid filesystem directory" do
6
- lambda {FSSM::Path.new("#{@watch_root}")}.should_not raise_error
6
+ lambda { FSSM::Path.new("#{@watch_root}") }.should_not raise_error
7
7
  end
8
8
 
9
9
  it "should not accept an invalid filesystem directory" do
10
- lambda {FSSM::Path.new('/does/not/exist/kthxbye')}.should raise_error
10
+ lambda { FSSM::Path.new('/does/not/exist/kthxbye') }.should raise_error
11
11
  end
12
12
 
13
13
  it "should default the path to the current directory" do
@@ -27,38 +27,42 @@ describe "The File System State Monitor" do
27
27
  path.glob.should == ['**/*.yml']
28
28
  end
29
29
 
30
+ it "should accept an optional option parameter" do
31
+ lambda { FSSM::Path.new('.', '**/*.yml', :foo => :bar) }.should_not raise_error
32
+ end
33
+
30
34
  it "should default the glob to ['**/*']" do
31
35
  path = FSSM::Path.new
32
36
  path.glob.should == ['**/*']
33
37
  end
34
38
 
35
39
  it "should accept a callback for update events" do
36
- path = FSSM::Path.new
37
- callback = lambda {|base, relative| return true}
38
- path.update(callback)
40
+ path = FSSM::Path.new
41
+ callback = lambda { |base, relative| return true }
42
+ path.update(&callback)
39
43
  (path.update).should == callback
40
44
  end
41
45
 
42
46
  it "should accept a callback for delete events" do
43
- path = FSSM::Path.new
44
- callback = lambda {|base, relative| return true}
45
- path.delete(callback)
47
+ path = FSSM::Path.new
48
+ callback = lambda { |base, relative| return true }
49
+ path.delete(&callback)
46
50
  (path.delete).should == callback
47
51
  end
48
52
 
49
53
  it "should accept a callback for create events" do
50
- path = FSSM::Path.new
51
- callback = lambda {|base, relative| return true}
52
- path.create(callback)
54
+ path = FSSM::Path.new
55
+ callback = lambda { |base, relative| return true }
56
+ path.create(&callback)
53
57
  (path.create).should == callback
54
58
  end
55
59
 
56
60
  it "should accept a configuration block" do
57
61
  path = FSSM::Path.new "#{@watch_root}" do
58
62
  glob '**/*.yml'
59
- update {|base, relative| 'success'}
60
- delete {|base, relative| 'success'}
61
- create {|base, relative| 'success'}
63
+ update { |base, relative| 'success' }
64
+ delete { |base, relative| 'success' }
65
+ create { |base, relative| 'success' }
62
66
  end
63
67
 
64
68
  "#{path}".should == "#{@watch_root}"
@@ -71,5 +75,22 @@ describe "The File System State Monitor" do
71
75
  path.create.call('', '').should == 'success'
72
76
  end
73
77
 
78
+ it "should pass file type to callbacks as the third argument if :directories option is used" do
79
+ path = FSSM::Path.new "#{@watch_root}", nil, :directories => true do
80
+ glob '**/*.yml'
81
+ update { |base, relative, type| [base, relative, type] }
82
+ delete { |base, relative, type| [base, relative, type] }
83
+ create { |base, relative, type| [base, relative, type] }
84
+ end
85
+
86
+ "#{path}".should == "#{@watch_root}"
87
+ path.glob.should == ['**/*.yml']
88
+ path.update.should be_a_kind_of(Proc)
89
+ path.delete.should be_a_kind_of(Proc)
90
+ path.create.should be_a_kind_of(Proc)
91
+ path.update.call('b', 'r', 't').should == ['b', 'r', 't']
92
+ path.delete.call('b', 'r', 't').should == ['b', 'r', 't']
93
+ path.create.call('b', 'r', 't').should == ['b', 'r', 't']
94
+ end
74
95
  end
75
96
  end
@@ -1,14 +1,14 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
3
3
 
4
- require 'pathname'
4
+ require 'rubygems'
5
+ require 'bundler/setup'
5
6
  require 'fssm'
6
7
 
7
- require 'spec'
8
- require 'spec/autorun'
8
+ require 'rspec'
9
9
 
10
- Spec::Runner.configure do |config|
10
+ RSpec.configure do |config|
11
11
  config.before :all do
12
- @watch_root = Pathname.new(__FILE__).dirname.join('root').expand_path
12
+ @watch_root = FSSM::Pathname.new(__FILE__).dirname.join('root').expand_path
13
13
  end
14
14
  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.2.0.alpha.11
4
+ version: 3.2.0.alpha.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-07-02 00:00:00 -04:00
14
+ date: 2011-09-14 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -39,6 +39,7 @@ email: sass-lang@googlegroups.com
39
39
  executables:
40
40
  - sass
41
41
  - sass-convert
42
+ - scss
42
43
  extensions: []
43
44
 
44
45
  extra_rdoc_files: []
@@ -133,23 +134,28 @@ files:
133
134
  - lib/sass/tree/visitors/check_nesting.rb
134
135
  - lib/sass/tree/visitors/convert.rb
135
136
  - lib/sass/tree/visitors/cssize.rb
137
+ - lib/sass/tree/visitors/deep_copy.rb
136
138
  - lib/sass/tree/visitors/perform.rb
139
+ - lib/sass/tree/visitors/set_options.rb
137
140
  - lib/sass/tree/visitors/to_css.rb
138
141
  - lib/sass/tree/warn_node.rb
139
142
  - lib/sass/tree/while_node.rb
143
+ - lib/sass/tree/content_node.rb
144
+ - lib/sass/tree/trace_node.rb
140
145
  - lib/sass/util.rb
141
146
  - lib/sass/util/subset_map.rb
142
147
  - lib/sass/version.rb
148
+ - vendor/fssm/Gemfile
143
149
  - vendor/fssm/LICENSE
144
150
  - vendor/fssm/README.markdown
145
151
  - vendor/fssm/Rakefile
146
- - vendor/fssm/VERSION.yml
147
152
  - vendor/fssm/example.rb
148
153
  - vendor/fssm/fssm.gemspec
149
154
  - vendor/fssm/lib/fssm.rb
150
155
  - vendor/fssm/lib/fssm/backends/fsevents.rb
151
156
  - vendor/fssm/lib/fssm/backends/inotify.rb
152
157
  - vendor/fssm/lib/fssm/backends/polling.rb
158
+ - vendor/fssm/lib/fssm/backends/rbfsevent.rb
153
159
  - vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb
154
160
  - vendor/fssm/lib/fssm/monitor.rb
155
161
  - vendor/fssm/lib/fssm/path.rb
@@ -158,11 +164,15 @@ files:
158
164
  - vendor/fssm/lib/fssm/state/file.rb
159
165
  - vendor/fssm/lib/fssm/support.rb
160
166
  - vendor/fssm/lib/fssm/tree.rb
167
+ - vendor/fssm/lib/fssm/version.rb
161
168
  - vendor/fssm/profile/prof-cache.rb
162
169
  - vendor/fssm/profile/prof-fssm-pathname.html
170
+ - vendor/fssm/profile/prof-pathname-rubinius.rb
163
171
  - vendor/fssm/profile/prof-pathname.rb
164
172
  - vendor/fssm/profile/prof-plain-pathname.html
165
173
  - vendor/fssm/profile/prof.html
174
+ - vendor/fssm/spec/count_down_latch.rb
175
+ - vendor/fssm/spec/monitor_spec.rb
166
176
  - vendor/fssm/spec/path_spec.rb
167
177
  - vendor/fssm/spec/root/duck/quack.txt
168
178
  - vendor/fssm/spec/root/file.css
@@ -294,7 +304,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
304
  requirements:
295
305
  - - ">="
296
306
  - !ruby/object:Gem::Version
297
- version: "0"
307
+ version: 1.8.7
298
308
  version:
299
309
  required_rubygems_version: !ruby/object:Gem::Requirement
300
310
  requirements:
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 0
3
- :minor: 1
4
- :patch: 4
5
- :build: