sass 3.1.15 → 3.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/README.md +4 -5
  2. data/Rakefile +2 -2
  3. data/VERSION +1 -1
  4. data/lib/sass/css.rb +144 -48
  5. data/lib/sass/engine.rb +3 -1
  6. data/lib/sass/plugin/compiler.rb +25 -32
  7. data/lib/sass/plugin/listener.rb +59 -0
  8. data/lib/sass/script/lexer.rb +1 -1
  9. data/lib/sass/script/list.rb +1 -0
  10. data/lib/sass/scss/parser.rb +90 -4
  11. data/lib/sass/scss/rx.rb +5 -0
  12. data/lib/sass/scss/static_parser.rb +1 -1
  13. data/lib/sass/selector/abstract_sequence.rb +11 -2
  14. data/lib/sass/selector/simple.rb +6 -0
  15. data/lib/sass/tree/comment_node.rb +1 -1
  16. data/lib/sass/tree/node.rb +2 -2
  17. data/lib/sass/tree/visitors/check_nesting.rb +2 -2
  18. data/lib/sass/tree/visitors/cssize.rb +1 -1
  19. data/lib/sass/util.rb +3 -2
  20. data/test/sass/conversion_test.rb +10 -0
  21. data/test/sass/css2sass_test.rb +24 -0
  22. data/test/sass/engine_test.rb +1 -0
  23. data/test/sass/scss/css_test.rb +53 -0
  24. data/vendor/listen/CHANGELOG.md +72 -0
  25. data/vendor/listen/Gemfile +35 -0
  26. data/vendor/listen/Guardfile +8 -0
  27. data/vendor/{fssm → listen}/LICENSE +1 -1
  28. data/vendor/listen/README.md +297 -0
  29. data/vendor/listen/Rakefile +47 -0
  30. data/vendor/listen/Vagrantfile +96 -0
  31. data/vendor/listen/lib/listen.rb +38 -0
  32. data/vendor/listen/lib/listen/adapter.rb +159 -0
  33. data/vendor/listen/lib/listen/adapters/darwin.rb +84 -0
  34. data/vendor/listen/lib/listen/adapters/linux.rb +99 -0
  35. data/vendor/listen/lib/listen/adapters/polling.rb +66 -0
  36. data/vendor/listen/lib/listen/adapters/windows.rb +82 -0
  37. data/vendor/listen/lib/listen/directory_record.rb +257 -0
  38. data/vendor/listen/lib/listen/listener.rb +186 -0
  39. data/vendor/listen/lib/listen/multi_listener.rb +121 -0
  40. data/vendor/listen/lib/listen/turnstile.rb +28 -0
  41. data/vendor/listen/lib/listen/version.rb +3 -0
  42. data/vendor/listen/listen.gemspec +26 -0
  43. data/vendor/listen/spec/listen/adapter_spec.rb +142 -0
  44. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +31 -0
  45. data/vendor/listen/spec/listen/adapters/linux_spec.rb +30 -0
  46. data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
  47. data/vendor/listen/spec/listen/adapters/windows_spec.rb +24 -0
  48. data/vendor/listen/spec/listen/directory_record_spec.rb +807 -0
  49. data/vendor/listen/spec/listen/listener_spec.rb +151 -0
  50. data/vendor/listen/spec/listen/multi_listener_spec.rb +151 -0
  51. data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
  52. data/vendor/listen/spec/listen_spec.rb +73 -0
  53. data/vendor/listen/spec/spec_helper.rb +16 -0
  54. data/vendor/listen/spec/support/adapter_helper.rb +538 -0
  55. data/vendor/listen/spec/support/directory_record_helper.rb +35 -0
  56. data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
  57. data/vendor/listen/spec/support/listeners_helper.rb +133 -0
  58. data/vendor/listen/spec/support/platform_helper.rb +11 -0
  59. metadata +40 -40
  60. data/vendor/fssm/Gemfile +0 -3
  61. data/vendor/fssm/README.markdown +0 -83
  62. data/vendor/fssm/Rakefile +0 -11
  63. data/vendor/fssm/example.rb +0 -12
  64. data/vendor/fssm/ext/rakefile.rb +0 -14
  65. data/vendor/fssm/fssm.gemspec +0 -27
  66. data/vendor/fssm/lib/fssm.rb +0 -74
  67. data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
  68. data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
  69. data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
  70. data/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
  71. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
  72. data/vendor/fssm/lib/fssm/monitor.rb +0 -36
  73. data/vendor/fssm/lib/fssm/path.rb +0 -94
  74. data/vendor/fssm/lib/fssm/pathname.rb +0 -36
  75. data/vendor/fssm/lib/fssm/state/directory.rb +0 -75
  76. data/vendor/fssm/lib/fssm/state/file.rb +0 -24
  77. data/vendor/fssm/lib/fssm/support.rb +0 -87
  78. data/vendor/fssm/lib/fssm/tree.rb +0 -176
  79. data/vendor/fssm/lib/fssm/version.rb +0 -3
  80. data/vendor/fssm/profile/prof-cache.rb +0 -40
  81. data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
  82. data/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
  83. data/vendor/fssm/profile/prof-pathname.rb +0 -68
  84. data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
  85. data/vendor/fssm/profile/prof.html +0 -2379
  86. data/vendor/fssm/spec/count_down_latch.rb +0 -151
  87. data/vendor/fssm/spec/monitor_spec.rb +0 -202
  88. data/vendor/fssm/spec/path_spec.rb +0 -96
  89. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  90. data/vendor/fssm/spec/root/file.css +0 -0
  91. data/vendor/fssm/spec/root/file.rb +0 -0
  92. data/vendor/fssm/spec/root/file.yml +0 -0
  93. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  94. data/vendor/fssm/spec/spec_helper.rb +0 -14
@@ -0,0 +1,151 @@
1
+ require 'spec_helper'
2
+
3
+ describe Listen::Listener do
4
+ let(:adapter) { mock(Listen::Adapter, :start => true).as_null_object }
5
+ let(:watched_directory) { Dir.tmpdir }
6
+
7
+ subject { described_class.new(watched_directory) }
8
+
9
+ before do
10
+ Listen::Adapter.stub(:select_and_initialize) { adapter }
11
+ # Don't build a record of the files inside the base directory.
12
+ subject.directory_record.stub(:build)
13
+ end
14
+
15
+ it_should_behave_like 'a listener to changes on a file-system'
16
+
17
+ describe '#initialize' do
18
+ context 'with no options' do
19
+ it 'sets the directory' do
20
+ subject.directory.should eq watched_directory
21
+ end
22
+
23
+ it 'sets the option for using relative paths in the callback to the default one' do
24
+ subject.instance_variable_get(:@use_relative_paths).should eq described_class::DEFAULT_TO_RELATIVE_PATHS
25
+ end
26
+ end
27
+
28
+ context 'with custom options' do
29
+ subject { described_class.new(watched_directory, :ignore => '.ssh', :filter => [/.*\.rb/,/.*\.md/],
30
+ :latency => 0.5, :force_polling => true, :relative_paths => true) }
31
+
32
+ it 'passes the custom ignored paths to the directory record' do
33
+ subject.directory_record.ignored_paths.should =~ %w[.bundle .git .DS_Store log tmp vendor .ssh]
34
+ end
35
+
36
+ it 'passes the custom filters to the directory record' do
37
+ subject.directory_record.filters.should =~ [/.*\.rb/,/.*\.md/]
38
+ end
39
+
40
+ it 'sets the cutom option for using relative paths in the callback' do
41
+ subject.instance_variable_get(:@use_relative_paths).should be_true
42
+ end
43
+
44
+ it 'sets adapter_options' do
45
+ subject.instance_variable_get(:@adapter_options).should eq(:latency => 0.5, :force_polling => true)
46
+ end
47
+ end
48
+ end
49
+
50
+ describe '#start' do
51
+ it 'selects and initializes an adapter' do
52
+ Listen::Adapter.should_receive(:select_and_initialize).with(watched_directory, {}) { adapter }
53
+ subject.start
54
+ end
55
+
56
+ it 'builds the directory record' do
57
+ subject.directory_record.should_receive(:build)
58
+ subject.start
59
+ end
60
+ end
61
+
62
+ context 'with a started listener' do
63
+ before do
64
+ subject.stub(:initialize_adapter) { adapter }
65
+ subject.start
66
+ end
67
+
68
+ describe '#unpause' do
69
+ it 'rebuilds the directory record' do
70
+ subject.directory_record.should_receive(:build)
71
+ subject.unpause
72
+ end
73
+ end
74
+ end
75
+
76
+ describe '#ignore'do
77
+ it 'delegates the work to the directory record' do
78
+ subject.directory_record.should_receive(:ignore).with 'some_directory'
79
+ subject.ignore 'some_directory'
80
+ end
81
+ end
82
+
83
+ describe '#filter' do
84
+ it 'delegates the work to the directory record' do
85
+ subject.directory_record.should_receive(:filter).with /\.txt$/
86
+ subject.filter /\.txt$/
87
+ end
88
+ end
89
+
90
+
91
+ describe '#on_change' do
92
+ let(:directories) { %w{dir1 dir2 dir3} }
93
+ let(:changes) { {:modified => [], :added => [], :removed => []} }
94
+ let(:callback) { Proc.new { @called = true } }
95
+
96
+ before do
97
+ @called = false
98
+ subject.directory_record.stub(:fetch_changes => changes)
99
+ end
100
+
101
+ it 'fetches the changes of the directory record' do
102
+ subject.directory_record.should_receive(:fetch_changes).with(
103
+ directories, hash_including(:relative_paths => described_class::DEFAULT_TO_RELATIVE_PATHS)
104
+ )
105
+ subject.on_change(directories)
106
+ end
107
+
108
+ context 'with relative paths option set to true' do
109
+ subject { described_class.new(watched_directory, :relative_paths => true) }
110
+
111
+ it 'fetches the changes of the directory record' do
112
+ subject.directory_record.should_receive(:fetch_changes).with(directories, hash_including(:relative_paths => true))
113
+ subject.on_change(directories)
114
+ end
115
+ end
116
+
117
+ context 'with no changes to report' do
118
+ if RUBY_VERSION[/^1.8/]
119
+ it 'does not run the callback' do
120
+ subject.change(&callback)
121
+ subject.on_change(directories)
122
+ @called.should be_false
123
+ end
124
+ else
125
+ it 'does not run the callback' do
126
+ callback.should_not_receive(:call)
127
+ subject.change(&callback)
128
+ subject.on_change(directories)
129
+ end
130
+ end
131
+ end
132
+
133
+ context 'with changes to report' do
134
+ let(:changes) { {:modified => %w{path1}, :added => [], :removed => %w{path2}} }
135
+
136
+ if RUBY_VERSION[/^1.8/]
137
+ it 'runs the callback passing it the changes' do
138
+ subject.change(&callback)
139
+ subject.on_change(directories)
140
+ @called.should be_true
141
+ end
142
+ else
143
+ it 'runs the callback passing it the changes' do
144
+ callback.should_receive(:call).with(changes[:modified], changes[:added], changes[:removed])
145
+ subject.change(&callback)
146
+ subject.on_change(directories)
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,151 @@
1
+ require 'spec_helper'
2
+
3
+ describe Listen::MultiListener do
4
+ let(:adapter) { mock(Listen::Adapter, :start => true).as_null_object }
5
+ let(:watched_directories) { [File.dirname(__FILE__), Dir.tmpdir] }
6
+
7
+ subject { described_class.new(*watched_directories) }
8
+
9
+ before do
10
+ Listen::Adapter.stub(:select_and_initialize) { adapter }
11
+ # Don't build a record of the files inside the base directory.
12
+ Listen::DirectoryRecord.any_instance.stub(:build)
13
+ end
14
+
15
+ it_should_behave_like 'a listener to changes on a file-system'
16
+
17
+ describe '#initialize' do
18
+ context 'with no options' do
19
+ it 'sets the directories' do
20
+ subject.directories.should =~ watched_directories
21
+ end
22
+ end
23
+
24
+ context 'with custom options' do
25
+ subject do
26
+ args = watched_directories << {:ignore => '.ssh', :filter => [/.*\.rb/,/.*\.md/], :latency => 0.5, :force_polling => true}
27
+ described_class.new(*args)
28
+ end
29
+
30
+ it 'passes the custom ignored paths to each directory record' do
31
+ subject.directories_records.each do |r|
32
+ r.ignored_paths.should =~ %w[.bundle .git .DS_Store log tmp vendor .ssh]
33
+ end
34
+ end
35
+
36
+ it 'passes the custom filters to each directory record' do
37
+ subject.directories_records.each do |r|
38
+ r.filters.should =~ [/.*\.rb/,/.*\.md/]
39
+ end
40
+ end
41
+
42
+ it 'sets adapter_options' do
43
+ subject.instance_variable_get(:@adapter_options).should eq(:latency => 0.5, :force_polling => true)
44
+ end
45
+ end
46
+ end
47
+
48
+ describe '#start' do
49
+ it 'selects and initializes an adapter' do
50
+ Listen::Adapter.should_receive(:select_and_initialize).with(watched_directories, {}) { adapter }
51
+ subject.start
52
+ end
53
+
54
+ it 'builds all directories records' do
55
+ subject.directories_records.each do |r|
56
+ r.should_receive(:build)
57
+ end
58
+ subject.start
59
+ end
60
+ end
61
+
62
+ context 'with a started listener' do
63
+ before do
64
+ subject.stub(:initialize_adapter) { adapter }
65
+ subject.start
66
+ end
67
+
68
+ describe '#unpause' do
69
+ it 'rebuilds all directories records' do
70
+ subject.directories_records.each do |r|
71
+ r.should_receive(:build)
72
+ end
73
+ subject.unpause
74
+ end
75
+ end
76
+ end
77
+
78
+ describe '#ignore'do
79
+ it 'delegates the work to each directory record' do
80
+ subject.directories_records.each do |r|
81
+ r.should_receive(:ignore).with 'some_directory'
82
+ end
83
+ subject.ignore 'some_directory'
84
+ end
85
+ end
86
+
87
+ describe '#filter' do
88
+ it 'delegates the work to each directory record' do
89
+ subject.directories_records.each do |r|
90
+ r.should_receive(:filter).with /\.txt$/
91
+ end
92
+ subject.filter /\.txt$/
93
+ end
94
+ end
95
+
96
+ describe '#on_change' do
97
+ let(:directories) { %w{dir1 dir2 dir3} }
98
+ let(:changes) { {:modified => [], :added => [], :removed => []} }
99
+ let(:callback) { Proc.new { @called = true } }
100
+
101
+ before do
102
+ @called = false
103
+ subject.stub(:fetch_records_changes => changes)
104
+ end
105
+
106
+ it 'fetches the changes of all directories records' do
107
+ subject.unstub(:fetch_records_changes)
108
+
109
+ subject.directories_records.each do |record|
110
+ record.should_receive(:fetch_changes).with(
111
+ directories, hash_including(:relative_paths => described_class::DEFAULT_TO_RELATIVE_PATHS)
112
+ ).and_return(changes)
113
+ end
114
+ subject.on_change(directories)
115
+ end
116
+
117
+ context 'with no changes to report' do
118
+ if RUBY_VERSION[/^1.8/]
119
+ it 'does not run the callback' do
120
+ subject.change(&callback)
121
+ subject.on_change(directories)
122
+ @called.should be_false
123
+ end
124
+ else
125
+ it 'does not run the callback' do
126
+ callback.should_not_receive(:call)
127
+ subject.change(&callback)
128
+ subject.on_change(directories)
129
+ end
130
+ end
131
+ end
132
+
133
+ context 'with changes to report' do
134
+ let(:changes) { {:modified => %w{path1}, :added => [], :removed => %w{path2}} }
135
+
136
+ if RUBY_VERSION[/^1.8/]
137
+ it 'runs the callback passing it the changes' do
138
+ subject.change(&callback)
139
+ subject.on_change(directories)
140
+ @called.should be_true
141
+ end
142
+ else
143
+ it 'runs the callback passing it the changes' do
144
+ callback.should_receive(:call).with(changes[:modified], changes[:added], changes[:removed])
145
+ subject.change(&callback)
146
+ subject.on_change(directories)
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ def run_in_two_threads(proc1, proc2)
4
+ t1 = Thread.new &proc1
5
+ sleep test_latency # t1 must run before t2
6
+ t2 = Thread.new { proc2.call; Thread.kill t1 }
7
+ t2.join(test_latency * 2)
8
+ ensure
9
+ Thread.kill t1 if t1
10
+ Thread.kill t2 if t2
11
+ end
12
+
13
+ describe Listen::Turnstile do
14
+ before { @called = false }
15
+
16
+ describe '#wait' do
17
+ context 'without a signal' do
18
+ it 'blocks one thread indefinitely' do
19
+ run_in_two_threads lambda {
20
+ subject.wait
21
+ @called = true
22
+ }, lambda {
23
+ sleep test_latency
24
+ }
25
+ @called.should be_false
26
+ end
27
+ end
28
+
29
+ context 'with a signal' do
30
+ it 'blocks one thread until it recieves a signal from another thread' do
31
+ run_in_two_threads lambda {
32
+ subject.wait
33
+ @called = true
34
+ }, lambda {
35
+ subject.signal
36
+ sleep test_latency
37
+ }
38
+ @called.should be_true
39
+ end
40
+ end
41
+ end
42
+
43
+ describe '#signal' do
44
+ context 'without a wait-call before' do
45
+ it 'does nothing' do
46
+ run_in_two_threads lambda {
47
+ subject.signal
48
+ @called = true
49
+ }, lambda {
50
+ sleep test_latency
51
+ }
52
+ @called.should be_true
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+
3
+ describe Listen do
4
+ describe '#to' do
5
+ context 'with one path to listen to' do
6
+ let(:listener) { mock(Listen::Listener) }
7
+ let(:listener_class) { Listen::Listener }
8
+
9
+ before { listener_class.stub(:new => listener) }
10
+
11
+ context 'without options' do
12
+ it 'creates an instance of Listner' do
13
+ listener_class.should_receive(:new).with('/path')
14
+ described_class.to('/path')
15
+ end
16
+ end
17
+
18
+ context 'with options' do
19
+ it 'creates an instance of Listner with the passed params' do
20
+ listener_class.should_receive(:new).with('/path', :filter => '**/*')
21
+ described_class.to('/path', :filter => '**/*')
22
+ end
23
+ end
24
+
25
+ context 'without a block' do
26
+ it 'returns the listener' do
27
+ described_class.to('/path', :filter => '**/*').should eq listener
28
+ end
29
+ end
30
+
31
+ context 'with a block' do
32
+ it 'starts the listner after creating it' do
33
+ listener.should_receive(:start)
34
+ described_class.to('/path', :filter => '**/*') { |modified, added, removed| }
35
+ end
36
+ end
37
+ end
38
+
39
+ context 'with multiple paths to listen to' do
40
+ let(:multi_listener) { mock(Listen::MultiListener) }
41
+ let(:multi_listener_class) { Listen::MultiListener }
42
+
43
+ before { multi_listener_class.stub(:new => multi_listener) }
44
+
45
+ context 'without options' do
46
+ it 'creates an instance of MultiListner' do
47
+ multi_listener_class.should_receive(:new).with('path1', 'path2')
48
+ described_class.to('path1', 'path2')
49
+ end
50
+ end
51
+
52
+ context 'with options' do
53
+ it 'creates an instance of MultiListner with the passed params' do
54
+ multi_listener_class.should_receive(:new).with('path1', 'path2', :filter => '**/*')
55
+ described_class.to('path1', 'path2', :filter => '**/*')
56
+ end
57
+ end
58
+
59
+ context 'without a block' do
60
+ it 'returns a MultiListener instance created with the passed params' do
61
+ described_class.to('path1', 'path2', :filter => '**/*').should eq multi_listener
62
+ end
63
+ end
64
+
65
+ context 'with a block' do
66
+ it 'starts a MultiListener instance after creating it with the passed params' do
67
+ multi_listener.should_receive(:start)
68
+ described_class.to('path1', 'path2', :filter => '**/*') { |modified, added, removed| }
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,16 @@
1
+ require 'listen'
2
+
3
+ ENV["TEST_LATENCY"] ||= "0.1"
4
+
5
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
6
+
7
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
8
+ RSpec.configure do |config|
9
+ config.treat_symbols_as_metadata_keys_with_true_values = true
10
+ config.run_all_when_everything_filtered = true
11
+ config.filter_run :focus
12
+ end
13
+
14
+ def test_latency
15
+ ENV["TEST_LATENCY"].to_f
16
+ end