sass 3.1.20 → 3.1.21
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.
- data/Rakefile +11 -2
- data/VERSION +1 -1
- data/VERSION_DATE +1 -0
- data/lib/sass/script/functions.rb +8 -9
- data/lib/sass/script/number.rb +7 -6
- data/lib/sass/selector/sequence.rb +3 -3
- data/lib/sass/tree/visitors/to_css.rb +2 -3
- data/lib/sass/version.rb +14 -0
- data/test/sass/functions_test.rb +2 -1
- data/test/sass/results/units.css +1 -1
- data/test/sass/script_test.rb +1 -0
- data/test/sass/scss/css_test.rb +15 -0
- data/test/sass/scss/scss_test.rb +21 -0
- data/test/test_helper.rb +1 -0
- data/vendor/listen/CHANGELOG.md +70 -13
- data/vendor/listen/Gemfile +4 -16
- data/vendor/listen/README.md +3 -3
- data/vendor/listen/lib/listen/adapter.rb +1 -1
- data/vendor/listen/lib/listen/adapters/linux.rb +1 -1
- data/vendor/listen/lib/listen/directory_record.rb +9 -8
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/spec/listen/directory_record_spec.rb +105 -1
- data/vendor/listen/spec/spec_helper.rb +4 -2
- metadata +50 -67
data/Rakefile
CHANGED
@@ -24,7 +24,7 @@ end
|
|
24
24
|
# Don't use Rake::GemPackageTast because we want prerequisites to run
|
25
25
|
# before we load the gemspec.
|
26
26
|
desc "Build all the packages."
|
27
|
-
task :package => [:revision_file, :submodules, :permissions] do
|
27
|
+
task :package => [:revision_file, :date_file, :submodules, :permissions] do
|
28
28
|
version = get_version
|
29
29
|
File.open(scope('VERSION'), 'w') {|f| f.puts(version)}
|
30
30
|
load scope('sass.gemspec')
|
@@ -63,8 +63,17 @@ task :revision_file do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
task :date_file do
|
67
|
+
File.open(scope('VERSION_DATE'), 'w') do |f|
|
68
|
+
f.puts Time.now.utc.strftime('%d %B %Y %T %Z')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
66
72
|
# We also need to get rid of this file after packaging.
|
67
|
-
at_exit
|
73
|
+
at_exit do
|
74
|
+
File.delete(scope('REVISION')) rescue nil
|
75
|
+
File.delete(scope('VERSION_DATE')) rescue nil
|
76
|
+
end
|
68
77
|
|
69
78
|
desc "Install Sass as a gem. Use SUDO=1 to install with sudo."
|
70
79
|
task :install => [:package] do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.21
|
data/VERSION_DATE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
11 August 2012 00:38:15 UTC
|
@@ -947,23 +947,22 @@ module Sass::Script
|
|
947
947
|
|
948
948
|
Sass::Util.check_range("Weight", 0..100, weight, '%')
|
949
949
|
|
950
|
-
# This algorithm factors in both the user-provided weight
|
951
|
-
#
|
952
|
-
# to
|
950
|
+
# This algorithm factors in both the user-provided weight (w) and the
|
951
|
+
# difference between the alpha values of the two colors (a) to decide how
|
952
|
+
# to perform the weighted average of the two RGB values.
|
953
953
|
#
|
954
954
|
# It works by first normalizing both parameters to be within [-1, 1],
|
955
|
-
# where 1 indicates "only use color1", -1 indicates "only use
|
956
|
-
#
|
955
|
+
# where 1 indicates "only use color1", -1 indicates "only use color2", and
|
956
|
+
# all values in between indicated a proportionately weighted average.
|
957
957
|
#
|
958
|
-
# Once we have the normalized variables w and a,
|
959
|
-
#
|
960
|
-
# to get the combined weight (in [-1, 1]) of color1.
|
958
|
+
# Once we have the normalized variables w and a, we apply the formula
|
959
|
+
# (w + a)/(1 + w*a) to get the combined weight (in [-1, 1]) of color1.
|
961
960
|
# This formula has two especially nice properties:
|
962
961
|
#
|
963
962
|
# * When either w or a are -1 or 1, the combined weight is also that number
|
964
963
|
# (cases where w * a == -1 are undefined, and handled as a special case).
|
965
964
|
#
|
966
|
-
# * When a is 0, the combined weight is w, and vice versa
|
965
|
+
# * When a is 0, the combined weight is w, and vice versa.
|
967
966
|
#
|
968
967
|
# Finally, the weight of color1 is renormalized to be within [0, 1]
|
969
968
|
# and the weight of color2 is given by 1 minus the weight of color1.
|
data/lib/sass/script/number.rb
CHANGED
@@ -422,12 +422,13 @@ module Sass::Script
|
|
422
422
|
end
|
423
423
|
|
424
424
|
# A hash of unit names to their index in the conversion table
|
425
|
-
CONVERTABLE_UNITS = {"in" => 0, "cm" => 1, "pc" => 2, "mm" => 3, "pt" => 4}
|
426
|
-
CONVERSION_TABLE = [[ 1, 2.54, 6, 25.4, 72 ], # in
|
427
|
-
[ nil, 1, 2.36220473, 10, 28.3464567], # cm
|
428
|
-
[ nil, nil, 1, 4.23333333, 12 ], # pc
|
429
|
-
[ nil, nil, nil, 1, 2.83464567], # mm
|
430
|
-
[ nil, nil, nil, nil, 1 ]
|
425
|
+
CONVERTABLE_UNITS = {"in" => 0, "cm" => 1, "pc" => 2, "mm" => 3, "pt" => 4, "px" => 5 }
|
426
|
+
CONVERSION_TABLE = [[ 1, 2.54, 6, 25.4, 72 , 96 ], # in
|
427
|
+
[ nil, 1, 2.36220473, 10, 28.3464567, 37.795275591], # cm
|
428
|
+
[ nil, nil, 1, 4.23333333, 12 , 16 ], # pc
|
429
|
+
[ nil, nil, nil, 1, 2.83464567, 3.7795275591], # mm
|
430
|
+
[ nil, nil, nil, nil, 1 , 1.3333333333], # pt
|
431
|
+
[ nil, nil, nil, nil, nil , 1 ]] # px
|
431
432
|
|
432
433
|
def conversion_factor(from_unit, to_unit)
|
433
434
|
res = CONVERSION_TABLE[CONVERTABLE_UNITS[from_unit]][CONVERTABLE_UNITS[to_unit]]
|
@@ -47,15 +47,15 @@ module Sass
|
|
47
47
|
# @return [Sequence] This selector, with parent references resolved
|
48
48
|
# @raise [Sass::SyntaxError] If a parent selector is invalid
|
49
49
|
def resolve_parent_refs(super_seq)
|
50
|
-
members = @members
|
50
|
+
members = @members.dup
|
51
51
|
nl = (members.first == "\n" && members.shift)
|
52
52
|
unless members.any? do |seq_or_op|
|
53
53
|
seq_or_op.is_a?(SimpleSequence) && seq_or_op.members.first.is_a?(Parent)
|
54
54
|
end
|
55
|
-
members = []
|
55
|
+
old_members, members = members, []
|
56
56
|
members << nl if nl
|
57
57
|
members << SimpleSequence.new([Parent.new])
|
58
|
-
members +=
|
58
|
+
members += old_members
|
59
59
|
end
|
60
60
|
|
61
61
|
Sequence.new(
|
@@ -59,9 +59,8 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
|
|
59
59
|
return if node.invisible?
|
60
60
|
spaces = (' ' * [@tabs - node.resolved_value[/^ */].size, 0].max)
|
61
61
|
|
62
|
-
content = node.resolved_value.gsub(/^/, spaces)
|
63
|
-
|
64
|
-
end
|
62
|
+
content = node.resolved_value.gsub(/^/, spaces)
|
63
|
+
content.gsub!(%r{^(\s*)//(.*)$}) {|md| "#{$1}/*#{$2} */"} if node.silent
|
65
64
|
content.gsub!(/\n +(\* *(?!\/))?/, ' ') if (node.style == :compact || node.style == :compressed) && !node.loud
|
66
65
|
content
|
67
66
|
end
|
data/lib/sass/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
1
3
|
# This is necessary for loading Sass when Haml is required in Rails 3.
|
2
4
|
# Once the split is complete, we can remove it.
|
3
5
|
require File.dirname(__FILE__) + '/../sass'
|
@@ -16,6 +18,7 @@ module Sass
|
|
16
18
|
# The `:name` key has the name of the version.
|
17
19
|
# The `:string` key contains a human-readable string representation of the version.
|
18
20
|
# The `:number` key is the major, minor, and teeny keys separated by periods.
|
21
|
+
# The `:date` key, which is not guaranteed to be defined, is the [DateTime] at which this release was cut.
|
19
22
|
# If Sass is checked out from Git, the `:rev` key will have the revision hash.
|
20
23
|
# For example:
|
21
24
|
#
|
@@ -23,6 +26,7 @@ module Sass
|
|
23
26
|
# :string => "2.1.0.9616393",
|
24
27
|
# :rev => "9616393b8924ef36639c7e82aa88a51a24d16949",
|
25
28
|
# :number => "2.1.0",
|
29
|
+
# :date => DateTime.parse("Apr 30 13:52:01 2009 -0700"),
|
26
30
|
# :major => 2, :minor => 1, :teeny => 0
|
27
31
|
# }
|
28
32
|
#
|
@@ -36,6 +40,7 @@ module Sass
|
|
36
40
|
# {
|
37
41
|
# :string => "3.0.beta.1",
|
38
42
|
# :number => "3.0.beta.1",
|
43
|
+
# :date => DateTime.parse("Mar 31 00:38:04 2010 -0700"),
|
39
44
|
# :major => 3, :minor => 0, :teeny => -1,
|
40
45
|
# :prerelease => "beta",
|
41
46
|
# :prerelease_number => 1
|
@@ -55,6 +60,10 @@ module Sass
|
|
55
60
|
:name => name
|
56
61
|
}
|
57
62
|
|
63
|
+
if date = version_date
|
64
|
+
@@version[:date] = date
|
65
|
+
end
|
66
|
+
|
58
67
|
if numbers[3].is_a?(String)
|
59
68
|
@@version[:teeny] = -1
|
60
69
|
@@version[:prerelease] = numbers[3]
|
@@ -101,6 +110,11 @@ module Sass
|
|
101
110
|
end
|
102
111
|
return nil
|
103
112
|
end
|
113
|
+
|
114
|
+
def version_date
|
115
|
+
return unless File.exists?(scope('VERSION_DATE'))
|
116
|
+
return DateTime.parse(File.read(scope('VERSION_DATE')).strip)
|
117
|
+
end
|
104
118
|
end
|
105
119
|
|
106
120
|
extend Sass::Version
|
data/test/sass/functions_test.rb
CHANGED
@@ -865,7 +865,8 @@ MSG
|
|
865
865
|
assert_equal(%Q{"px"}, evaluate("unit(100px)"))
|
866
866
|
assert_equal(%Q{"em*px"}, evaluate("unit(10px * 5em)"))
|
867
867
|
assert_equal(%Q{"em*px"}, evaluate("unit(5em * 10px)"))
|
868
|
-
assert_equal(%Q{"em
|
868
|
+
assert_equal(%Q{"em/rem"}, evaluate("unit(10px * 5em / 30cm / 1rem)"))
|
869
|
+
assert_equal(%Q{"em*vh/cm*rem"}, evaluate("unit(10vh * 5em / 30cm / 1rem)"))
|
869
870
|
assert_equal(%Q{"px"}, evaluate("unit($number: 100px)"))
|
870
871
|
assert_error_message("#ff0000 is not a number for `unit'", "unit(#f00)")
|
871
872
|
end
|
data/test/sass/results/units.css
CHANGED
data/test/sass/script_test.rb
CHANGED
@@ -359,6 +359,7 @@ SASS
|
|
359
359
|
|
360
360
|
def test_operator_unit_conversion
|
361
361
|
assert_equal "1.1cm", resolve("1cm + 1mm")
|
362
|
+
assert_equal "2in", resolve("1in + 96px")
|
362
363
|
assert_equal "true", resolve("2mm < 1cm")
|
363
364
|
assert_equal "true", resolve("10mm == 1cm")
|
364
365
|
assert_equal "true", resolve("1 == 1cm")
|
data/test/sass/scss/css_test.rb
CHANGED
@@ -962,6 +962,21 @@ bar {baz: bang}
|
|
962
962
|
SCSS
|
963
963
|
end
|
964
964
|
|
965
|
+
def test_single_line_comment_within_multiline_comment
|
966
|
+
assert_equal(<<CSS, render(<<SCSS))
|
967
|
+
body {
|
968
|
+
/*
|
969
|
+
//comment here
|
970
|
+
*/ }
|
971
|
+
CSS
|
972
|
+
body {
|
973
|
+
/*
|
974
|
+
//comment here
|
975
|
+
*/
|
976
|
+
}
|
977
|
+
SCSS
|
978
|
+
end
|
979
|
+
|
965
980
|
private
|
966
981
|
|
967
982
|
def assert_selector_parses(selector)
|
data/test/sass/scss/scss_test.rb
CHANGED
@@ -1105,6 +1105,27 @@ SCSS
|
|
1105
1105
|
|
1106
1106
|
# Regression
|
1107
1107
|
|
1108
|
+
def test_newline_selector_rendered_multiple_times
|
1109
|
+
assert_equal <<CSS, render(<<SCSS)
|
1110
|
+
form input,
|
1111
|
+
form select {
|
1112
|
+
color: white; }
|
1113
|
+
|
1114
|
+
form input,
|
1115
|
+
form select {
|
1116
|
+
color: white; }
|
1117
|
+
CSS
|
1118
|
+
@for $i from 1 through 2 {
|
1119
|
+
form {
|
1120
|
+
input,
|
1121
|
+
select {
|
1122
|
+
color: white;
|
1123
|
+
}
|
1124
|
+
}
|
1125
|
+
}
|
1126
|
+
SCSS
|
1127
|
+
end
|
1128
|
+
|
1108
1129
|
def test_prop_name_interpolation_after_hyphen
|
1109
1130
|
assert_equal <<CSS, render(<<SCSS)
|
1110
1131
|
a {
|
data/test/test_helper.rb
CHANGED
data/vendor/listen/CHANGELOG.md
CHANGED
@@ -1,23 +1,63 @@
|
|
1
|
+
## 0.4.7 - June 27, 2012
|
2
|
+
|
3
|
+
### Bug fixes
|
4
|
+
|
5
|
+
- Increase latency to 0.25, to avoid useless polling fallback. (fixed by [@thibaudgg][])
|
6
|
+
- Change watched inotify events, to avoid duplication callback. (fixed by [@thibaudgg][])
|
7
|
+
- [#41](https://github.com/guard/listen/issues/41) Use lstat instead of stat when calculating mtime. (fixed by [@ebroder][])
|
8
|
+
|
9
|
+
## 0.4.6 - June 20, 2012
|
10
|
+
|
11
|
+
### Bug fix
|
12
|
+
|
13
|
+
- [#39](https://github.com/guard/listen/issues/39) Fix digest race condition. (fixed by [@dkubb][])
|
14
|
+
|
15
|
+
## 0.4.5 - June 13, 2012
|
16
|
+
|
17
|
+
### Bug fix
|
18
|
+
|
19
|
+
- [#39](https://github.com/guard/listen/issues/39) Rescue Errno::ENOENT when path inserted doesn't exist. (reported by [@textgoeshere][], fixed by [@thibaudgg][] and [@rymai][])
|
20
|
+
|
21
|
+
## 0.4.4 - June 8, 2012
|
22
|
+
|
23
|
+
### Bug fixes
|
24
|
+
|
25
|
+
- ~~[#39](https://github.com/guard/listen/issues/39) Non-existing path insertion bug. (reported by [@textgoeshere][], fixed by [@thibaudgg][])~~
|
26
|
+
- Fix relative path for directories containing special characters. (reported by [@napcs][], fixed by [@netzpirat][])
|
27
|
+
|
28
|
+
## 0.4.3 - June 6, 2012
|
29
|
+
|
30
|
+
### Bug fixes
|
31
|
+
|
32
|
+
- [#24](https://github.com/guard/listen/issues/24) Fail gracefully when the inotify limit is not enough for Listen to function. (reported by [@daemonza][], fixed by [@Maher4Ever][])
|
33
|
+
- [#32](https://github.com/guard/listen/issues/32) Fix a crash when trying to calculate the checksum of unreadable files. (reported by [@nex3][], fixed by [@Maher4Ever][])
|
34
|
+
|
35
|
+
### Improvements
|
36
|
+
|
37
|
+
- Add `#relative_paths` method to listeners. ([@Maher4Ever][])
|
38
|
+
- Add `#started?` query-method to adapters. ([@Maher4Ever][])
|
39
|
+
- Dynamically detect the mtime precision used on a system. ([@Maher4Ever][] with help from [@nex3][])
|
40
|
+
|
1
41
|
## 0.4.2 - May 1, 2012
|
2
42
|
|
3
43
|
### Bug fixes
|
4
44
|
|
5
|
-
- [#21](https://github.com/guard/listen/issues/21)
|
6
|
-
- [#27](https://github.com/guard/listen/issues/27)
|
45
|
+
- [#21](https://github.com/guard/listen/issues/21) Issues when listening to changes in relative paths. (reported by [@akerbos][], fixed by [@Maher4Ever][])
|
46
|
+
- [#27](https://github.com/guard/listen/issues/27) Wrong reports for files modifications. (reported by [@cobychapple][], fixed by [@Maher4Ever][])
|
7
47
|
- Fix segmentation fault when profiling on Windows. ([@Maher4Ever][])
|
8
48
|
- Fix redundant watchers on Windows. ([@Maher4Ever][])
|
9
49
|
|
10
50
|
### Improvements
|
11
51
|
|
12
|
-
- [#17](https://github.com/guard/listen/issues/17)
|
52
|
+
- [#17](https://github.com/guard/listen/issues/17) Use regexp-patterns with the `ignore` method instead of supplying paths. (reported by [@fny][], added by [@Maher4Ever][])
|
13
53
|
- Speed improvement when listening to changes in directories with ignored paths. ([@Maher4Ever][])
|
14
54
|
- Added `.rbx` and `.svn` to ignored directories. ([@Maher4Ever][])
|
15
55
|
|
16
56
|
## 0.4.1 - April 15, 2012
|
17
57
|
|
18
|
-
### Bug
|
58
|
+
### Bug fix
|
19
59
|
|
20
|
-
- [#18](
|
60
|
+
- [#18](https://github.com/guard/listen/issues/18) Listener crashes when removing directories with nested paths. (reported by [@daemonza][], fixed by [@Maher4Ever][])
|
21
61
|
|
22
62
|
## 0.4.0 - April 9, 2012
|
23
63
|
|
@@ -37,19 +77,19 @@
|
|
37
77
|
- Encapsulate thread spawning in the windows-adapter. ([@Maher4Ever][])
|
38
78
|
- Fix linux-adapter bug where Listen would report file-modification events on the parent-directory. ([@Maher4Ever][])
|
39
79
|
|
40
|
-
###
|
80
|
+
### Change
|
41
81
|
|
42
82
|
- Remove `wait_until_listening` as adapters doesn't need to run inside threads anymore ([@Maher4Ever][])
|
43
83
|
|
44
84
|
## 0.3.3 - March 6, 2012
|
45
85
|
|
46
|
-
###
|
86
|
+
### Improvement
|
47
87
|
|
48
88
|
- Improve pause/unpause. ([@thibaudgg][])
|
49
89
|
|
50
90
|
## 0.3.2 - March 4, 2012
|
51
91
|
|
52
|
-
### New
|
92
|
+
### New feature
|
53
93
|
|
54
94
|
- Add pause/unpause listener's methods. ([@thibaudgg][])
|
55
95
|
|
@@ -57,7 +97,7 @@
|
|
57
97
|
|
58
98
|
### Bug fix
|
59
99
|
|
60
|
-
- [#9](https://github.com/guard/listen/issues/9)
|
100
|
+
- [#9](https://github.com/guard/listen/issues/9) Ignore doesn't seem to work. (reported by [@markiz][], fixed by [@thibaudgg][])
|
61
101
|
|
62
102
|
## 0.3.0 - February 21, 2012
|
63
103
|
|
@@ -81,10 +121,27 @@
|
|
81
121
|
|
82
122
|
- First version with only a polling adapter and basic features set (ignore & filter). ([@thibaudgg][])
|
83
123
|
|
84
|
-
|
85
|
-
[
|
124
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
125
|
+
[#9]: https://github.com/guard/listen/issues/9
|
126
|
+
[#17]: https://github.com/guard/listen/issues/17
|
127
|
+
[#18]: https://github.com/guard/listen/issues/18
|
128
|
+
[#21]: https://github.com/guard/listen/issues/21
|
129
|
+
[#24]: https://github.com/guard/listen/issues/24
|
130
|
+
[#27]: https://github.com/guard/listen/issues/27
|
131
|
+
[#32]: https://github.com/guard/listen/issues/32
|
132
|
+
[#39]: https://github.com/guard/listen/issues/39
|
86
133
|
[@Maher4Ever]: https://github.com/Maher4Ever
|
87
|
-
[@
|
134
|
+
[@dkubb]: https://github.com/dkubb
|
135
|
+
[@ebroder]: https://github.com/ebroder
|
88
136
|
[@akerbos]: https://github.com/akerbos
|
89
|
-
[@fny]: https://github.com/fny
|
90
137
|
[@cobychapple]: https://github.com/cobychapple
|
138
|
+
[@daemonza]: https://github.com/daemonza
|
139
|
+
[@fny]: https://github.com/fny
|
140
|
+
[@markiz]: https://github.com/markiz
|
141
|
+
[@napcs]: https://github.com/napcs
|
142
|
+
[@netzpirat]: https://github.com/netzpirat
|
143
|
+
[@nex3]: https://github.com/nex3
|
144
|
+
[@rymai]: https://github.com/rymai
|
145
|
+
[@scottdavis]: https://github.com/scottdavis
|
146
|
+
[@textgoeshere]: https://github.com/textgoeshere
|
147
|
+
[@thibaudgg]: https://github.com/thibaudgg
|
data/vendor/listen/Gemfile
CHANGED
@@ -6,23 +6,11 @@ gem 'rake'
|
|
6
6
|
|
7
7
|
group :development do
|
8
8
|
platform :ruby do
|
9
|
-
gem '
|
9
|
+
gem 'coolline'
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
when /darwin/i
|
15
|
-
# gem 'ruby_gntp', '~> 0.3.4', :require => false
|
16
|
-
gem 'growl', :require => false
|
17
|
-
when /linux/i
|
18
|
-
gem 'libnotify', '~> 0.7.1', :require => false
|
19
|
-
when /mswin|mingw/i
|
20
|
-
gem 'win32console', :require => false
|
21
|
-
gem 'rb-notifu', '>= 0.0.4', :require => false
|
22
|
-
end
|
23
|
-
|
24
|
-
gem 'guard', '~> 1.0.0'
|
25
|
-
gem 'guard-rspec', '~> 0.7.0'
|
12
|
+
gem 'guard'
|
13
|
+
gem 'guard-rspec'
|
26
14
|
gem 'yard'
|
27
15
|
gem 'redcarpet'
|
28
16
|
gem 'pry'
|
@@ -31,5 +19,5 @@ group :development do
|
|
31
19
|
end
|
32
20
|
|
33
21
|
group :test do
|
34
|
-
gem 'rspec'
|
22
|
+
gem 'rspec'
|
35
23
|
end
|
data/vendor/listen/README.md
CHANGED
@@ -32,12 +32,12 @@ Feel free to give your feeback via [Listen issues](https://github.com/guard/list
|
|
32
32
|
|
33
33
|
``` ruby
|
34
34
|
# Listen to a single directory.
|
35
|
-
Listen.to('dir/path/to/listen', filter
|
35
|
+
Listen.to('dir/path/to/listen', :filter => /\.rb$/, :ignore => %r{ignored/path/}) do |modified, added, removed|
|
36
36
|
# ...
|
37
37
|
end
|
38
38
|
|
39
39
|
# Listen to multiple directories.
|
40
|
-
Listen.to('dir/to/awesome_app', 'dir/to/other_app', filter
|
40
|
+
Listen.to('dir/to/awesome_app', 'dir/to/other_app', :filter => /\.rb$/, :latency => 0.1) do |modified, added, removed|
|
41
41
|
# ...
|
42
42
|
end
|
43
43
|
```
|
@@ -191,7 +191,7 @@ These options can be set through `Listen.to` params or via methods (see the "Obj
|
|
191
191
|
# default: See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::DirectoryRecord
|
192
192
|
|
193
193
|
:latency => 0.5 # Set the delay (**in seconds**) between checking for changes
|
194
|
-
# default: 0.
|
194
|
+
# default: 0.25 sec (1.0 sec for polling)
|
195
195
|
|
196
196
|
:relative_paths => true # Enable the use of relative paths in the callback.
|
197
197
|
# default: false
|
@@ -8,7 +8,7 @@ module Listen
|
|
8
8
|
attr_accessor :directories, :latency, :paused
|
9
9
|
|
10
10
|
# The default delay between checking for changes.
|
11
|
-
DEFAULT_LATENCY = 0.
|
11
|
+
DEFAULT_LATENCY = 0.25
|
12
12
|
|
13
13
|
# The default warning message when falling back to polling adapter.
|
14
14
|
POLLING_FALLBACK_MESSAGE = "WARNING: Listen has fallen back to polling, learn more at https://github.com/guard/listen#fallback."
|
@@ -10,7 +10,7 @@ module Listen
|
|
10
10
|
# @see http://www.tin.org/bin/man.cgi?section=7&topic=inotify
|
11
11
|
# @see https://github.com/nex3/rb-inotify/blob/master/lib/rb-inotify/notifier.rb#L99-L177
|
12
12
|
#
|
13
|
-
EVENTS = %w[recursive attrib
|
13
|
+
EVENTS = %w[recursive attrib create delete move close_write]
|
14
14
|
|
15
15
|
# The message to show when the limit of inotify watchers is not enough
|
16
16
|
#
|
@@ -163,7 +163,7 @@ module Listen
|
|
163
163
|
#
|
164
164
|
def relative_to_base(path)
|
165
165
|
return nil unless path[@directory]
|
166
|
-
path.sub(%r{^#{@directory}#{File::SEPARATOR}?}, '')
|
166
|
+
path.sub(%r{^#{Regexp.quote(@directory)}#{File::SEPARATOR}?}, '')
|
167
167
|
end
|
168
168
|
|
169
169
|
private
|
@@ -239,8 +239,8 @@ module Listen
|
|
239
239
|
elsif !ignored?(path) && filtered?(path) && !existing_path?(path)
|
240
240
|
if File.file?(path)
|
241
241
|
@changes[:added] << (options[:relative_paths] ? relative_to_base(path) : path)
|
242
|
+
insert_path(path)
|
242
243
|
end
|
243
|
-
insert_path(path)
|
244
244
|
end
|
245
245
|
end
|
246
246
|
end
|
@@ -253,11 +253,11 @@ module Listen
|
|
253
253
|
def content_modified?(path)
|
254
254
|
sha1_checksum = Digest::SHA1.file(path).to_s
|
255
255
|
return false if @sha1_checksums[path] == sha1_checksum
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
256
|
+
@sha1_checksums.key?(path)
|
257
|
+
rescue Errno::EACCES, Errno::ENOENT
|
258
|
+
false
|
259
|
+
ensure
|
260
|
+
@sha1_checksums[path] = sha1_checksum if sha1_checksum
|
261
261
|
end
|
262
262
|
|
263
263
|
# Traverses the base directory looking for paths that should
|
@@ -292,6 +292,7 @@ module Listen
|
|
292
292
|
meta_data.type = File.directory?(path) ? 'Dir' : 'File'
|
293
293
|
meta_data.mtime = mtime_of(path) unless meta_data.type == 'Dir' # mtimes of dirs are not used yet
|
294
294
|
@paths[File.dirname(path)][File.basename(path)] = meta_data
|
295
|
+
rescue Errno::ENOENT
|
295
296
|
end
|
296
297
|
|
297
298
|
# Returns whether or not a path exists in the paths hash.
|
@@ -311,7 +312,7 @@ module Listen
|
|
311
312
|
# @return [Fixnum, Float] the mtime of the file
|
312
313
|
#
|
313
314
|
def mtime_of(file)
|
314
|
-
File.
|
315
|
+
File.lstat(file).mtime.send(HIGH_PRECISION_SUPPORTED ? :to_f : :to_i)
|
315
316
|
end
|
316
317
|
end
|
317
318
|
end
|
@@ -193,6 +193,25 @@ describe Listen::DirectoryRecord do
|
|
193
193
|
it 'returns nil when the passed path is not inside the base-directory' do
|
194
194
|
subject.relative_to_base('/tmp/some_random_path').should be_nil
|
195
195
|
end
|
196
|
+
|
197
|
+
context 'when containing regexp characters in the base directory' do
|
198
|
+
before do
|
199
|
+
fixtures do |path|
|
200
|
+
mkdir 'a_directory$'
|
201
|
+
@dir = described_class.new(path + '/a_directory$')
|
202
|
+
@dir.build
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'removes the path of the base-directory from the passed path' do
|
207
|
+
path = 'dir/to/app/file.rb'
|
208
|
+
@dir.relative_to_base(File.join(@dir.directory, path)).should eq path
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'returns nil when the passed path is not inside the base-directory' do
|
212
|
+
@dir.relative_to_base('/tmp/some_random_path').should be_nil
|
213
|
+
end
|
214
|
+
end
|
196
215
|
end
|
197
216
|
|
198
217
|
describe '#fetch_changes' do
|
@@ -385,7 +404,7 @@ describe Listen::DirectoryRecord do
|
|
385
404
|
end
|
386
405
|
end
|
387
406
|
|
388
|
-
context '
|
407
|
+
context 'when a file is created and then checked for modifications at the same second - #27' do
|
389
408
|
# This issue was the result of checking a file for content changes when
|
390
409
|
# the mtime and the checking time are the same. In this case there
|
391
410
|
# is no checksum saved, so the file was reported as being changed.
|
@@ -1030,5 +1049,90 @@ describe Listen::DirectoryRecord do
|
|
1030
1049
|
end
|
1031
1050
|
end
|
1032
1051
|
end
|
1052
|
+
|
1053
|
+
context 'within a directory containing unreadble paths - #32' do
|
1054
|
+
it 'detects changes more than a second apart' do
|
1055
|
+
fixtures do |path|
|
1056
|
+
touch 'unreadable_file.txt'
|
1057
|
+
chmod 000, 'unreadable_file.txt'
|
1058
|
+
|
1059
|
+
modified, added, removed = changes(path) do
|
1060
|
+
sleep 1.1
|
1061
|
+
touch 'unreadable_file.txt'
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
added.should be_empty
|
1065
|
+
modified.should =~ %w(unreadable_file.txt)
|
1066
|
+
removed.should be_empty
|
1067
|
+
end
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
context 'with multiple changes within the same second' do
|
1071
|
+
before { ensure_same_second }
|
1072
|
+
|
1073
|
+
it 'does not detect changes even if content changes', :unless => described_class::HIGH_PRECISION_SUPPORTED do
|
1074
|
+
fixtures do |path|
|
1075
|
+
touch 'unreadable_file.txt'
|
1076
|
+
|
1077
|
+
modified, added, removed = changes(path) do
|
1078
|
+
open('unreadable_file.txt', 'w') { |f| f.write('foo') }
|
1079
|
+
chmod 000, 'unreadable_file.txt'
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
added.should be_empty
|
1083
|
+
modified.should be_empty
|
1084
|
+
removed.should be_empty
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
end
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
context 'within a directory containing a removed file - #39' do
|
1091
|
+
it 'does not raise an exception when hashing a removed file' do
|
1092
|
+
|
1093
|
+
# simulate a race condition where the file is removed after the
|
1094
|
+
# change event is tracked, but before the hash is calculated
|
1095
|
+
Digest::SHA1.should_receive(:file).and_raise(Errno::ENOENT)
|
1096
|
+
|
1097
|
+
lambda {
|
1098
|
+
fixtures do |path|
|
1099
|
+
file = 'removed_file.txt'
|
1100
|
+
touch file
|
1101
|
+
changes(path) { touch file }
|
1102
|
+
end
|
1103
|
+
}.should_not raise_error(Errno::ENOENT)
|
1104
|
+
end
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
context 'with symlinks' do
|
1108
|
+
it 'looks at symlinks not their targets' do
|
1109
|
+
fixtures do |path|
|
1110
|
+
touch 'target'
|
1111
|
+
symlink 'target', 'symlink'
|
1112
|
+
|
1113
|
+
record = described_class.new(path)
|
1114
|
+
record.build
|
1115
|
+
|
1116
|
+
sleep 1
|
1117
|
+
touch 'target'
|
1118
|
+
|
1119
|
+
record.fetch_changes([path], :relative_paths => true)[:modified].should == ['target']
|
1120
|
+
end
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
it 'handles broken symlinks' do
|
1124
|
+
fixtures do |path|
|
1125
|
+
symlink 'target', 'symlink'
|
1126
|
+
|
1127
|
+
record = described_class.new(path)
|
1128
|
+
record.build
|
1129
|
+
|
1130
|
+
sleep 1
|
1131
|
+
rm 'symlink'
|
1132
|
+
symlink 'new-target', 'symlink'
|
1133
|
+
record.fetch_changes([path], :relative_paths => true)
|
1134
|
+
end
|
1135
|
+
end
|
1136
|
+
end
|
1033
1137
|
end
|
1034
1138
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'listen'
|
2
2
|
|
3
|
-
ENV["TEST_LATENCY"] ||= "0.
|
3
|
+
ENV["TEST_LATENCY"] ||= "0.25"
|
4
4
|
|
5
5
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
6
6
|
|
7
7
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
8
8
|
RSpec.configure do |config|
|
9
|
+
config.color_enabled = true
|
10
|
+
config.order = :random
|
11
|
+
config.filter_run :focus => true
|
9
12
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
10
13
|
config.run_all_when_everything_filtered = true
|
11
|
-
config.filter_run :focus
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_latency
|
metadata
CHANGED
@@ -1,68 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 1
|
9
|
-
- 20
|
10
|
-
version: 3.1.20
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.21
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Nathan Weizenbaum
|
14
9
|
- Chris Eppstein
|
15
10
|
- Hampton Catlin
|
16
11
|
autorequire:
|
17
12
|
bindir: bin
|
18
13
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
dependencies:
|
23
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2012-08-11 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
24
17
|
name: yard
|
25
|
-
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
27
19
|
none: false
|
28
|
-
requirements:
|
29
|
-
- -
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
hash: 13
|
32
|
-
segments:
|
33
|
-
- 0
|
34
|
-
- 5
|
35
|
-
- 3
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
36
23
|
version: 0.5.3
|
37
24
|
type: :development
|
38
|
-
version_requirements: *id001
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: maruku
|
41
25
|
prerelease: false
|
42
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
27
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.5.3
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: maruku
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
52
39
|
version: 0.5.9
|
53
40
|
type: :development
|
54
|
-
|
55
|
-
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.9
|
48
|
+
description: ! " Sass makes CSS fun again. Sass is an extension of CSS3, adding\n
|
49
|
+
\ nested rules, variables, mixins, selector inheritance, and more.\n It's
|
50
|
+
translated to well-formatted, standard CSS using the\n command line tool or
|
51
|
+
a web-framework plugin.\n"
|
56
52
|
email: sass-lang@googlegroups.com
|
57
|
-
executables:
|
53
|
+
executables:
|
58
54
|
- sass
|
59
55
|
- sass-convert
|
60
56
|
- scss
|
61
57
|
extensions: []
|
62
|
-
|
63
58
|
extra_rdoc_files: []
|
64
|
-
|
65
|
-
files:
|
59
|
+
files:
|
66
60
|
- rails/init.rb
|
67
61
|
- lib/sass.rb
|
68
62
|
- lib/sass/cache_stores.rb
|
@@ -313,47 +307,36 @@ files:
|
|
313
307
|
- .yardopts
|
314
308
|
- README.md
|
315
309
|
- VERSION_NAME
|
310
|
+
- VERSION_DATE
|
316
311
|
- REVISION
|
317
312
|
- MIT-LICENSE
|
318
313
|
- VERSION
|
319
314
|
- CONTRIBUTING
|
320
|
-
has_rdoc: false
|
321
315
|
homepage: http://sass-lang.com/
|
322
316
|
licenses: []
|
323
|
-
|
324
317
|
post_install_message:
|
325
318
|
rdoc_options: []
|
326
|
-
|
327
|
-
require_paths:
|
319
|
+
require_paths:
|
328
320
|
- lib
|
329
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
321
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
330
322
|
none: false
|
331
|
-
requirements:
|
332
|
-
- -
|
333
|
-
- !ruby/object:Gem::Version
|
334
|
-
hash: 57
|
335
|
-
segments:
|
336
|
-
- 1
|
337
|
-
- 8
|
338
|
-
- 7
|
323
|
+
requirements:
|
324
|
+
- - ! '>='
|
325
|
+
- !ruby/object:Gem::Version
|
339
326
|
version: 1.8.7
|
340
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
327
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
341
328
|
none: false
|
342
|
-
requirements:
|
343
|
-
- -
|
344
|
-
- !ruby/object:Gem::Version
|
345
|
-
|
346
|
-
segments:
|
347
|
-
- 0
|
348
|
-
version: "0"
|
329
|
+
requirements:
|
330
|
+
- - ! '>='
|
331
|
+
- !ruby/object:Gem::Version
|
332
|
+
version: '0'
|
349
333
|
requirements: []
|
350
|
-
|
351
334
|
rubyforge_project: sass
|
352
|
-
rubygems_version: 1.
|
335
|
+
rubygems_version: 1.8.24
|
353
336
|
signing_key:
|
354
337
|
specification_version: 3
|
355
338
|
summary: A powerful but elegant CSS compiler that makes CSS fun again.
|
356
|
-
test_files:
|
339
|
+
test_files:
|
357
340
|
- test/sass/engine_test.rb
|
358
341
|
- test/sass/functions_test.rb
|
359
342
|
- test/sass/extend_test.rb
|