xass 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +11 -0
  3. data/CONTRIBUTING +3 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +201 -0
  6. data/Rakefile +349 -0
  7. data/VERSION +1 -0
  8. data/VERSION_NAME +1 -0
  9. data/bin/push +13 -0
  10. data/bin/sass +13 -0
  11. data/bin/sass-convert +12 -0
  12. data/bin/scss +13 -0
  13. data/extra/update_watch.rb +13 -0
  14. data/init.rb +18 -0
  15. data/lib/sass/cache_stores/base.rb +88 -0
  16. data/lib/sass/cache_stores/chain.rb +33 -0
  17. data/lib/sass/cache_stores/filesystem.rb +64 -0
  18. data/lib/sass/cache_stores/memory.rb +47 -0
  19. data/lib/sass/cache_stores/null.rb +25 -0
  20. data/lib/sass/cache_stores.rb +15 -0
  21. data/lib/sass/callbacks.rb +66 -0
  22. data/lib/sass/css.rb +409 -0
  23. data/lib/sass/engine.rb +930 -0
  24. data/lib/sass/environment.rb +101 -0
  25. data/lib/sass/error.rb +201 -0
  26. data/lib/sass/exec.rb +707 -0
  27. data/lib/sass/importers/base.rb +139 -0
  28. data/lib/sass/importers/filesystem.rb +186 -0
  29. data/lib/sass/importers.rb +22 -0
  30. data/lib/sass/logger/base.rb +32 -0
  31. data/lib/sass/logger/log_level.rb +49 -0
  32. data/lib/sass/logger.rb +15 -0
  33. data/lib/sass/media.rb +213 -0
  34. data/lib/sass/plugin/compiler.rb +406 -0
  35. data/lib/sass/plugin/configuration.rb +123 -0
  36. data/lib/sass/plugin/generic.rb +15 -0
  37. data/lib/sass/plugin/merb.rb +48 -0
  38. data/lib/sass/plugin/rack.rb +60 -0
  39. data/lib/sass/plugin/rails.rb +47 -0
  40. data/lib/sass/plugin/staleness_checker.rb +199 -0
  41. data/lib/sass/plugin.rb +133 -0
  42. data/lib/sass/railtie.rb +10 -0
  43. data/lib/sass/repl.rb +57 -0
  44. data/lib/sass/root.rb +7 -0
  45. data/lib/sass/script/arg_list.rb +52 -0
  46. data/lib/sass/script/bool.rb +18 -0
  47. data/lib/sass/script/color.rb +606 -0
  48. data/lib/sass/script/css_lexer.rb +29 -0
  49. data/lib/sass/script/css_parser.rb +31 -0
  50. data/lib/sass/script/funcall.rb +245 -0
  51. data/lib/sass/script/functions.rb +1543 -0
  52. data/lib/sass/script/interpolation.rb +79 -0
  53. data/lib/sass/script/lexer.rb +345 -0
  54. data/lib/sass/script/list.rb +85 -0
  55. data/lib/sass/script/literal.rb +221 -0
  56. data/lib/sass/script/node.rb +99 -0
  57. data/lib/sass/script/null.rb +37 -0
  58. data/lib/sass/script/number.rb +453 -0
  59. data/lib/sass/script/operation.rb +110 -0
  60. data/lib/sass/script/parser.rb +502 -0
  61. data/lib/sass/script/string.rb +51 -0
  62. data/lib/sass/script/string_interpolation.rb +103 -0
  63. data/lib/sass/script/unary_operation.rb +69 -0
  64. data/lib/sass/script/variable.rb +58 -0
  65. data/lib/sass/script.rb +39 -0
  66. data/lib/sass/scss/css_parser.rb +36 -0
  67. data/lib/sass/scss/parser.rb +1180 -0
  68. data/lib/sass/scss/rx.rb +133 -0
  69. data/lib/sass/scss/script_lexer.rb +15 -0
  70. data/lib/sass/scss/script_parser.rb +25 -0
  71. data/lib/sass/scss/static_parser.rb +54 -0
  72. data/lib/sass/scss.rb +16 -0
  73. data/lib/sass/selector/abstract_sequence.rb +94 -0
  74. data/lib/sass/selector/comma_sequence.rb +92 -0
  75. data/lib/sass/selector/sequence.rb +507 -0
  76. data/lib/sass/selector/simple.rb +119 -0
  77. data/lib/sass/selector/simple_sequence.rb +215 -0
  78. data/lib/sass/selector.rb +452 -0
  79. data/lib/sass/shared.rb +76 -0
  80. data/lib/sass/supports.rb +229 -0
  81. data/lib/sass/tree/charset_node.rb +22 -0
  82. data/lib/sass/tree/comment_node.rb +82 -0
  83. data/lib/sass/tree/content_node.rb +9 -0
  84. data/lib/sass/tree/css_import_node.rb +60 -0
  85. data/lib/sass/tree/debug_node.rb +18 -0
  86. data/lib/sass/tree/directive_node.rb +42 -0
  87. data/lib/sass/tree/each_node.rb +24 -0
  88. data/lib/sass/tree/extend_node.rb +36 -0
  89. data/lib/sass/tree/for_node.rb +36 -0
  90. data/lib/sass/tree/function_node.rb +34 -0
  91. data/lib/sass/tree/if_node.rb +52 -0
  92. data/lib/sass/tree/import_node.rb +75 -0
  93. data/lib/sass/tree/media_node.rb +58 -0
  94. data/lib/sass/tree/mixin_def_node.rb +38 -0
  95. data/lib/sass/tree/mixin_node.rb +39 -0
  96. data/lib/sass/tree/node.rb +196 -0
  97. data/lib/sass/tree/prop_node.rb +152 -0
  98. data/lib/sass/tree/return_node.rb +18 -0
  99. data/lib/sass/tree/root_node.rb +78 -0
  100. data/lib/sass/tree/rule_node.rb +132 -0
  101. data/lib/sass/tree/supports_node.rb +51 -0
  102. data/lib/sass/tree/trace_node.rb +32 -0
  103. data/lib/sass/tree/variable_node.rb +30 -0
  104. data/lib/sass/tree/visitors/base.rb +75 -0
  105. data/lib/sass/tree/visitors/check_nesting.rb +147 -0
  106. data/lib/sass/tree/visitors/convert.rb +316 -0
  107. data/lib/sass/tree/visitors/cssize.rb +241 -0
  108. data/lib/sass/tree/visitors/deep_copy.rb +102 -0
  109. data/lib/sass/tree/visitors/extend.rb +68 -0
  110. data/lib/sass/tree/visitors/perform.rb +446 -0
  111. data/lib/sass/tree/visitors/set_options.rb +125 -0
  112. data/lib/sass/tree/visitors/to_css.rb +228 -0
  113. data/lib/sass/tree/warn_node.rb +18 -0
  114. data/lib/sass/tree/while_node.rb +18 -0
  115. data/lib/sass/util/multibyte_string_scanner.rb +155 -0
  116. data/lib/sass/util/subset_map.rb +109 -0
  117. data/lib/sass/util/test.rb +10 -0
  118. data/lib/sass/util.rb +948 -0
  119. data/lib/sass/version.rb +126 -0
  120. data/lib/sass.rb +95 -0
  121. data/rails/init.rb +1 -0
  122. data/test/Gemfile +3 -0
  123. data/test/Gemfile.lock +10 -0
  124. data/test/sass/cache_test.rb +89 -0
  125. data/test/sass/callbacks_test.rb +61 -0
  126. data/test/sass/conversion_test.rb +1760 -0
  127. data/test/sass/css2sass_test.rb +458 -0
  128. data/test/sass/data/hsl-rgb.txt +319 -0
  129. data/test/sass/engine_test.rb +3244 -0
  130. data/test/sass/exec_test.rb +86 -0
  131. data/test/sass/extend_test.rb +1482 -0
  132. data/test/sass/fixtures/test_staleness_check_across_importers.css +1 -0
  133. data/test/sass/fixtures/test_staleness_check_across_importers.scss +1 -0
  134. data/test/sass/functions_test.rb +1139 -0
  135. data/test/sass/importer_test.rb +192 -0
  136. data/test/sass/logger_test.rb +58 -0
  137. data/test/sass/mock_importer.rb +49 -0
  138. data/test/sass/more_results/more1.css +9 -0
  139. data/test/sass/more_results/more1_with_line_comments.css +26 -0
  140. data/test/sass/more_results/more_import.css +29 -0
  141. data/test/sass/more_templates/_more_partial.sass +2 -0
  142. data/test/sass/more_templates/more1.sass +23 -0
  143. data/test/sass/more_templates/more_import.sass +11 -0
  144. data/test/sass/plugin_test.rb +564 -0
  145. data/test/sass/results/alt.css +4 -0
  146. data/test/sass/results/basic.css +9 -0
  147. data/test/sass/results/cached_import_option.css +3 -0
  148. data/test/sass/results/compact.css +5 -0
  149. data/test/sass/results/complex.css +86 -0
  150. data/test/sass/results/compressed.css +1 -0
  151. data/test/sass/results/expanded.css +19 -0
  152. data/test/sass/results/filename_fn.css +3 -0
  153. data/test/sass/results/if.css +3 -0
  154. data/test/sass/results/import.css +31 -0
  155. data/test/sass/results/import_charset.css +5 -0
  156. data/test/sass/results/import_charset_1_8.css +5 -0
  157. data/test/sass/results/import_charset_ibm866.css +5 -0
  158. data/test/sass/results/import_content.css +1 -0
  159. data/test/sass/results/line_numbers.css +49 -0
  160. data/test/sass/results/mixins.css +95 -0
  161. data/test/sass/results/multiline.css +24 -0
  162. data/test/sass/results/nested.css +22 -0
  163. data/test/sass/results/options.css +1 -0
  164. data/test/sass/results/parent_ref.css +13 -0
  165. data/test/sass/results/script.css +16 -0
  166. data/test/sass/results/scss_import.css +31 -0
  167. data/test/sass/results/scss_importee.css +2 -0
  168. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  169. data/test/sass/results/subdir/subdir.css +3 -0
  170. data/test/sass/results/units.css +11 -0
  171. data/test/sass/results/warn.css +0 -0
  172. data/test/sass/results/warn_imported.css +0 -0
  173. data/test/sass/script_conversion_test.rb +299 -0
  174. data/test/sass/script_test.rb +622 -0
  175. data/test/sass/scss/css_test.rb +1100 -0
  176. data/test/sass/scss/rx_test.rb +156 -0
  177. data/test/sass/scss/scss_test.rb +2106 -0
  178. data/test/sass/scss/test_helper.rb +37 -0
  179. data/test/sass/templates/_cached_import_option_partial.scss +1 -0
  180. data/test/sass/templates/_double_import_loop2.sass +1 -0
  181. data/test/sass/templates/_filename_fn_import.scss +11 -0
  182. data/test/sass/templates/_imported_charset_ibm866.sass +4 -0
  183. data/test/sass/templates/_imported_charset_utf8.sass +4 -0
  184. data/test/sass/templates/_imported_content.sass +3 -0
  185. data/test/sass/templates/_partial.sass +2 -0
  186. data/test/sass/templates/_same_name_different_partiality.scss +1 -0
  187. data/test/sass/templates/alt.sass +16 -0
  188. data/test/sass/templates/basic.sass +23 -0
  189. data/test/sass/templates/bork1.sass +2 -0
  190. data/test/sass/templates/bork2.sass +2 -0
  191. data/test/sass/templates/bork3.sass +2 -0
  192. data/test/sass/templates/bork4.sass +2 -0
  193. data/test/sass/templates/bork5.sass +3 -0
  194. data/test/sass/templates/cached_import_option.scss +3 -0
  195. data/test/sass/templates/compact.sass +17 -0
  196. data/test/sass/templates/complex.sass +305 -0
  197. data/test/sass/templates/compressed.sass +15 -0
  198. data/test/sass/templates/double_import_loop1.sass +1 -0
  199. data/test/sass/templates/expanded.sass +17 -0
  200. data/test/sass/templates/filename_fn.scss +18 -0
  201. data/test/sass/templates/if.sass +11 -0
  202. data/test/sass/templates/import.sass +12 -0
  203. data/test/sass/templates/import_charset.sass +9 -0
  204. data/test/sass/templates/import_charset_1_8.sass +6 -0
  205. data/test/sass/templates/import_charset_ibm866.sass +11 -0
  206. data/test/sass/templates/import_content.sass +4 -0
  207. data/test/sass/templates/importee.less +2 -0
  208. data/test/sass/templates/importee.sass +19 -0
  209. data/test/sass/templates/line_numbers.sass +13 -0
  210. data/test/sass/templates/mixin_bork.sass +5 -0
  211. data/test/sass/templates/mixins.sass +76 -0
  212. data/test/sass/templates/multiline.sass +20 -0
  213. data/test/sass/templates/nested.sass +25 -0
  214. data/test/sass/templates/nested_bork1.sass +2 -0
  215. data/test/sass/templates/nested_bork2.sass +2 -0
  216. data/test/sass/templates/nested_bork3.sass +2 -0
  217. data/test/sass/templates/nested_bork4.sass +2 -0
  218. data/test/sass/templates/nested_import.sass +2 -0
  219. data/test/sass/templates/nested_mixin_bork.sass +6 -0
  220. data/test/sass/templates/options.sass +2 -0
  221. data/test/sass/templates/parent_ref.sass +25 -0
  222. data/test/sass/templates/same_name_different_ext.sass +2 -0
  223. data/test/sass/templates/same_name_different_ext.scss +1 -0
  224. data/test/sass/templates/same_name_different_partiality.scss +1 -0
  225. data/test/sass/templates/script.sass +101 -0
  226. data/test/sass/templates/scss_import.scss +11 -0
  227. data/test/sass/templates/scss_importee.scss +1 -0
  228. data/test/sass/templates/single_import_loop.sass +1 -0
  229. data/test/sass/templates/subdir/import_up1.scss +1 -0
  230. data/test/sass/templates/subdir/import_up2.scss +1 -0
  231. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  232. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  233. data/test/sass/templates/subdir/subdir.sass +6 -0
  234. data/test/sass/templates/units.sass +11 -0
  235. data/test/sass/templates/warn.sass +3 -0
  236. data/test/sass/templates/warn_imported.sass +4 -0
  237. data/test/sass/test_helper.rb +8 -0
  238. data/test/sass/util/multibyte_string_scanner_test.rb +147 -0
  239. data/test/sass/util/subset_map_test.rb +91 -0
  240. data/test/sass/util_test.rb +382 -0
  241. data/test/test_helper.rb +80 -0
  242. metadata +354 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a8f62893deffb14c5336993042570b50eb1c89f9
4
+ data.tar.gz: 6b545559331994315eb64a82c16e1e1ad53246f7
5
+ SHA512:
6
+ metadata.gz: 2513d08eebcf256df6f291175cdeb2f0b4f268c6fe36bf0e9dfadf26c08f59af0891c2892bcdd45a42be8f2076acc278c0c66258d6f384195099b0ced6324eba
7
+ data.tar.gz: cee4bd797b3357aa4720171203f113b3b76966f839797b49e75a24eca482fc96ae2d0fb10922f8f983ab1818c2bfe5e0f1db7aafb0ba614df64a2f7853be9492
data/.yardopts ADDED
@@ -0,0 +1,11 @@
1
+ --readme README.md
2
+ --markup markdown
3
+ --markup-provider maruku
4
+ --default-return ""
5
+ --title "Sass Documentation"
6
+ --query 'object.type != :classvariable'
7
+ --query 'object.type != :constant || @api && @api.text == "public"'
8
+ --hide-void-return
9
+ --protected
10
+ --no-private
11
+ --no-highlight
data/CONTRIBUTING ADDED
@@ -0,0 +1,3 @@
1
+ Contributions are welcomed. Please see the following sites for guidelines:
2
+
3
+ http://sass-lang.com/community#Contribute
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,201 @@
1
+ # Sass [![Gem Version](https://badge.fury.io/rb/sass.png)](http://badge.fury.io/rb/sass)
2
+
3
+ **Sass makes CSS fun again**. Sass is an extension of CSS3,
4
+ adding nested rules, variables, mixins, selector inheritance, and more.
5
+ It's translated to well-formatted, standard CSS
6
+ using the command line tool or a web-framework plugin.
7
+
8
+ Sass has two syntaxes. The new main syntax (as of Sass 3)
9
+ is known as "SCSS" (for "Sassy CSS"),
10
+ and is a superset of CSS3's syntax.
11
+ This means that every valid CSS3 stylesheet is valid SCSS as well.
12
+ SCSS files use the extension `.scss`.
13
+
14
+ The second, older syntax is known as the indented syntax (or just "Sass").
15
+ Inspired by Haml's terseness, it's intended for people
16
+ who prefer conciseness over similarity to CSS.
17
+ Instead of brackets and semicolons,
18
+ it uses the indentation of lines to specify blocks.
19
+ Although no longer the primary syntax,
20
+ the indented syntax will continue to be supported.
21
+ Files in the indented syntax use the extension `.sass`.
22
+
23
+ ## Using
24
+
25
+ Sass can be used from the command line
26
+ or as part of a web framework.
27
+ The first step is to install the gem:
28
+
29
+ gem install sass
30
+
31
+ After you convert some CSS to Sass, you can run
32
+
33
+ sass style.scss
34
+
35
+ to compile it back to CSS.
36
+ For more information on these commands, check out
37
+
38
+ sass --help
39
+
40
+ To install Sass in Rails 2,
41
+ just add `config.gem "sass"` to `config/environment.rb`.
42
+ In Rails 3, add `gem "sass"` to your Gemfile instead.
43
+ `.sass` or `.scss` files should be placed in `public/stylesheets/sass`,
44
+ where they'll be automatically compiled
45
+ to corresponding CSS files in `public/stylesheets` when needed
46
+ (the Sass template directory is customizable...
47
+ see [the Sass reference](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#template_location-option) for details).
48
+
49
+ Sass can also be used with any Rack-enabled web framework.
50
+ To do so, just add
51
+
52
+ require 'sass/plugin/rack'
53
+ use Sass::Plugin::Rack
54
+
55
+ to `config.ru`.
56
+ Then any Sass files in `public/stylesheets/sass`
57
+ will be compiled into CSS files in `public/stylesheets` on every request.
58
+
59
+ To use Sass programmatically,
60
+ check out the [YARD documentation](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#using_sass).
61
+
62
+ ## Formatting
63
+
64
+ Sass is an extension of CSS
65
+ that adds power and elegance to the basic language.
66
+ It allows you to use [variables][vars], [nested rules][nested],
67
+ [mixins][mixins], [inline imports][imports],
68
+ and more, all with a fully CSS-compatible syntax.
69
+ Sass helps keep large stylesheets well-organized,
70
+ and get small stylesheets up and running quickly,
71
+ particularly with the help of
72
+ [the Compass style library](http://compass-style.org).
73
+
74
+ [vars]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#variables_
75
+ [nested]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#nested_rules
76
+ [mixins]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#mixins
77
+ [imports]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#import
78
+
79
+ Sass has two syntaxes.
80
+ The one presented here, known as "SCSS" (for "Sassy CSS"),
81
+ is fully CSS-compatible.
82
+ The other (older) syntax, known as the indented syntax or just "Sass",
83
+ is whitespace-sensitive and indentation-based.
84
+ For more information, see the [reference documentation][syntax].
85
+
86
+ [syntax]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
87
+
88
+ To run the following examples and see the CSS they produce,
89
+ put them in a file called `test.scss` and run `sass test.scss`.
90
+
91
+ ### Nesting
92
+
93
+ Sass avoids repetition by nesting selectors within one another.
94
+ The same thing works for properties.
95
+
96
+ table.hl {
97
+ margin: 2em 0;
98
+ td.ln { text-align: right; }
99
+ }
100
+
101
+ li {
102
+ font: {
103
+ family: serif;
104
+ weight: bold;
105
+ size: 1.2em;
106
+ }
107
+ }
108
+
109
+ ### Variables
110
+
111
+ Use the same color all over the place?
112
+ Need to do some math with height and width and text size?
113
+ Sass supports variables, math operations, and many useful functions.
114
+
115
+ $blue: #3bbfce;
116
+ $margin: 16px;
117
+
118
+ .content_navigation {
119
+ border-color: $blue;
120
+ color: darken($blue, 10%);
121
+ }
122
+
123
+ .border {
124
+ padding: $margin / 2;
125
+ margin: $margin / 2;
126
+ border-color: $blue;
127
+ }
128
+
129
+ ### Mixins
130
+
131
+ Even more powerful than variables,
132
+ mixins allow you to re-use whole chunks of CSS,
133
+ properties or selectors.
134
+ You can even give them arguments.
135
+
136
+ @mixin table-scaffolding {
137
+ th {
138
+ text-align: center;
139
+ font-weight: bold;
140
+ }
141
+ td, th { padding: 2px; }
142
+ }
143
+
144
+ @mixin left($dist) {
145
+ float: left;
146
+ margin-left: $dist;
147
+ }
148
+
149
+ #data {
150
+ @include left(10px);
151
+ @include table-scaffolding;
152
+ }
153
+
154
+ A comprehensive list of features is available
155
+ in the [Sass reference](http://sass-lang.com/documentation/file.SASS_REFERENCE.html).
156
+
157
+ ## Executables
158
+
159
+ The Sass gem includes several executables that are useful
160
+ for dealing with Sass from the command line.
161
+
162
+ ### `sass`
163
+
164
+ The `sass` executable transforms a source Sass file into CSS.
165
+ See `sass --help` for further information and options.
166
+
167
+ ### `sass-convert`
168
+
169
+ The `sass-convert` executable converts between CSS, Sass, and SCSS.
170
+ When converting from CSS to Sass or SCSS,
171
+ nesting is applied where appropriate.
172
+ See `sass-convert --help` for further information and options.
173
+
174
+ ## Authors
175
+
176
+ Sass was envisioned by [Hampton Catlin](http://www.hamptoncatlin.com)
177
+ (@hcatlin). However, Hampton doesn't even know his way around the code anymore
178
+ and now occasionally consults on the language issues. Hampton lives in San
179
+ Francisco, California and works as VP of Technology
180
+ at [Moovweb](http://www.moovweb.com/).
181
+
182
+ [Nathan Weizenbaum](http://nex-3.com) is the primary developer and architect of
183
+ Sass. His hard work has kept the project alive by endlessly answering forum
184
+ posts, fixing bugs, refactoring, finding speed improvements, writing
185
+ documentation, implementing new features, and getting Hampton coffee (a fitting
186
+ task for a boy-genius). Nathan lives in Seattle, Washington and works on
187
+ [Dart](http://dartlang.org) application libraries at Google.
188
+
189
+ [Chris Eppstein](http://acts-as-architect.blogspot.com) is a core contributor to
190
+ Sass and the creator of Compass, the first Sass-based framework. Chris focuses
191
+ on making Sass more powerful, easy to use, and on ways to speed its adoption
192
+ through the web development community. Chris lives in San Jose, California with
193
+ his wife and daughter. He is the Software Architect for
194
+ [Caring.com](http://caring.com), a website devoted to the 34 Million caregivers
195
+ whose parents are sick or elderly, that uses Haml and Sass.
196
+
197
+ If you use this software, you must pay Hampton a compliment. And
198
+ buy Nathan some jelly beans. Maybe pet a kitten. Yeah. Pet that kitty.
199
+
200
+ Beyond that, the implementation is licensed under the MIT License.
201
+ Okay, fine, I guess that means compliments aren't __required__.
data/Rakefile ADDED
@@ -0,0 +1,349 @@
1
+ require 'rubygems/package'
2
+
3
+ # ----- Utility Functions -----
4
+
5
+ def scope(path)
6
+ File.join(File.dirname(__FILE__), path)
7
+ end
8
+
9
+ # ----- Default: Testing ------
10
+
11
+ task :default => :test
12
+
13
+ require 'rake/testtask'
14
+
15
+ Rake::TestTask.new do |t|
16
+ t.libs << 'test'
17
+ test_files = FileList[scope('test/**/*_test.rb')]
18
+ test_files.exclude(scope('test/rails/*'))
19
+ test_files.exclude(scope('test/plugins/*'))
20
+ t.test_files = test_files
21
+ t.verbose = true
22
+ end
23
+
24
+ # ----- Packaging -----
25
+
26
+ # Don't use Rake::GemPackageTast because we want prerequisites to run
27
+ # before we load the gemspec.
28
+ desc "Build all the packages."
29
+ task :package => [:revision_file, :date_file, :submodules, :permissions] do
30
+ version = get_version
31
+ File.open(scope('VERSION'), 'w') {|f| f.puts(version)}
32
+ load scope('sass.gemspec')
33
+ Gem::Package.build(SASS_GEMSPEC)
34
+ sh %{git checkout VERSION}
35
+
36
+ pkg = "#{SASS_GEMSPEC.name}-#{SASS_GEMSPEC.version}"
37
+ mkdir_p "pkg"
38
+ verbose(true) {mv "#{pkg}.gem", "pkg/#{pkg}.gem"}
39
+
40
+ sh %{rm -f pkg/#{pkg}.tar.gz}
41
+ verbose(false) {SASS_GEMSPEC.files.each {|f| sh %{tar rf pkg/#{pkg}.tar #{f}}}}
42
+ sh %{gzip pkg/#{pkg}.tar}
43
+ end
44
+
45
+ task :permissions do
46
+ sh %{chmod -R a+rx bin}
47
+ sh %{chmod -R a+r .}
48
+ require 'shellwords'
49
+ Dir.glob('test/**/*_test.rb') do |file|
50
+ next if file =~ %r{^test/haml/spec/}
51
+ sh %{chmod a+rx #{file}}
52
+ end
53
+ end
54
+
55
+ task :revision_file do
56
+ require scope('lib/sass')
57
+
58
+ release = Rake.application.top_level_tasks.include?('release') || File.exist?(scope('EDGE_GEM_VERSION'))
59
+ if Sass.version[:rev] && !release
60
+ File.open(scope('REVISION'), 'w') { |f| f.puts Sass.version[:rev] }
61
+ elsif release
62
+ File.open(scope('REVISION'), 'w') { |f| f.puts "(release)" }
63
+ else
64
+ File.open(scope('REVISION'), 'w') { |f| f.puts "(unknown)" }
65
+ end
66
+ end
67
+
68
+ task :date_file do
69
+ File.open(scope('VERSION_DATE'), 'w') do |f|
70
+ f.puts Time.now.utc.strftime('%d %B %Y %T %Z')
71
+ end
72
+ end
73
+
74
+ # We also need to get rid of this file after packaging.
75
+ at_exit do
76
+ File.delete(scope('REVISION')) rescue nil
77
+ File.delete(scope('VERSION_DATE')) rescue nil
78
+ end
79
+
80
+ desc "Install Sass as a gem. Use SUDO=1 to install with sudo."
81
+ task :install => [:package] do
82
+ gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
83
+ sh %{#{'sudo ' if ENV["SUDO"]}#{gem} install --no-ri pkg/sass-#{get_version}}
84
+ end
85
+
86
+ desc "Release a new Sass package to Rubyforge."
87
+ task :release => [:check_release, :package] do
88
+ name = File.read(scope("VERSION_NAME")).strip
89
+ version = File.read(scope("VERSION")).strip
90
+ # sh %{rubyforge add_release sass sass "#{name} (v#{version})" pkg/sass-#{version}.gem}
91
+ # sh %{rubyforge add_file sass sass "#{name} (v#{version})" pkg/sass-#{version}.tar.gz}
92
+ sh %{gem push pkg/sass-#{version}.gem}
93
+ end
94
+
95
+ # Ensures that the VERSION file has been updated for a new release.
96
+ task :check_release do
97
+ version = File.read(scope("VERSION")).strip
98
+ raise "There have been changes since current version (#{version})" if changed_since?(version)
99
+ raise "VERSION_NAME must not be 'Bleeding Edge'" if File.read(scope("VERSION_NAME")) == "Bleeding Edge"
100
+ end
101
+
102
+ # Reads a password from the command line.
103
+ #
104
+ # @param name [String] The prompt to use to read the password
105
+ def read_password(prompt)
106
+ require 'readline'
107
+ system "stty -echo"
108
+ Readline.readline("#{prompt}: ").strip
109
+ ensure
110
+ system "stty echo"
111
+ puts
112
+ end
113
+
114
+ # Returns whether or not the repository, or specific files,
115
+ # has/have changed since a given revision.
116
+ #
117
+ # @param rev [String] The revision to check against
118
+ # @param files [Array<String>] The files to check.
119
+ # If this is empty, checks the entire repository
120
+ def changed_since?(rev, *files)
121
+ IO.popen("git diff --exit-code #{rev} #{files.join(' ')}") {}
122
+ return !$?.success?
123
+ end
124
+
125
+ task :submodules do
126
+ if File.exist?(File.dirname(__FILE__) + "/.git")
127
+ sh %{git submodule sync}
128
+ sh %{git submodule update --init}
129
+ elsif !File.exist?(File.dirname(__FILE__) + "/vendor/listen/lib")
130
+ warn <<WARN
131
+ WARNING: vendor/listen doesn't exist, and this isn't a git repository so
132
+ I can't get it automatically!
133
+ WARN
134
+ end
135
+ end
136
+
137
+ task :release_edge do
138
+ ensure_git_cleanup do
139
+ puts "#{'=' * 50} Running rake release_edge"
140
+
141
+ sh %{git checkout master}
142
+ sh %{git reset --hard origin/master}
143
+ sh %{rake package}
144
+ version = get_version
145
+ # sh %{rubyforge add_release sass sass "Bleeding Edge (v#{version})" pkg/sass-#{version}.gem}
146
+ sh %{gem push pkg/sass-#{version}.gem}
147
+ end
148
+ end
149
+
150
+ # Get the version string. If this is being installed from Git,
151
+ # this includes the proper prerelease version.
152
+ def get_version
153
+ written_version = File.read(scope('VERSION').strip)
154
+ return written_version unless File.exist?(scope('.git'))
155
+
156
+ # Get the current master branch version
157
+ version = written_version.split('.')
158
+ version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
159
+ return written_version unless version.size == 5 && version[3] == "alpha" # prerelease
160
+
161
+ return written_version if (commit_count = `git log --pretty=oneline HEAD ^stable | wc -l`).empty?
162
+ version[4] = commit_count.strip
163
+ version.join('.')
164
+ end
165
+
166
+ task :watch_for_update do
167
+ sh %{ruby extra/update_watch.rb}
168
+ end
169
+
170
+ # ----- Documentation -----
171
+
172
+ task :rdoc do
173
+ puts '=' * 100, <<END, '=' * 100
174
+ Sass uses the YARD documentation system (http://github.com/lsegal/yard).
175
+ Install the yard gem and then run "rake doc".
176
+ END
177
+ end
178
+
179
+ begin
180
+ require 'yard'
181
+
182
+ namespace :doc do
183
+ task :sass do
184
+ require scope('lib/sass')
185
+ Dir[scope("yard/default/**/*.sass")].each do |sass|
186
+ File.open(sass.gsub(/sass$/, 'css'), 'w') do |f|
187
+ f.write(Sass::Engine.new(File.read(sass)).render)
188
+ end
189
+ end
190
+ end
191
+
192
+ desc "List all undocumented methods and classes."
193
+ task :undocumented do
194
+ opts = ENV["YARD_OPTS"] || ""
195
+ ENV["YARD_OPTS"] = opts.dup + <<OPTS
196
+ --list --query "
197
+ object.docstring.blank? &&
198
+ !(object.type == :method && object.is_alias?)"
199
+ OPTS
200
+ Rake::Task['yard'].execute
201
+ end
202
+ end
203
+
204
+ YARD::Rake::YardocTask.new do |t|
205
+ t.files = FileList.new(scope('lib/**/*.rb')) do |list|
206
+ list.exclude('lib/sass/plugin/merb.rb')
207
+ list.exclude('lib/sass/plugin/rails.rb')
208
+ end.to_a
209
+ t.options << '--incremental' if Rake.application.top_level_tasks.include?('redoc')
210
+ t.options += FileList.new(scope('yard/*.rb')).to_a.map {|f| ['-e', f]}.flatten
211
+ files = FileList.new(scope('doc-src/*')).to_a.sort_by {|s| s.size} + %w[MIT-LICENSE VERSION]
212
+ t.options << '--files' << files.join(',')
213
+ t.options << '--template-path' << scope('yard')
214
+ t.options << '--title' << ENV["YARD_TITLE"] if ENV["YARD_TITLE"]
215
+
216
+ t.before = lambda do
217
+ if ENV["YARD_OPTS"]
218
+ require 'shellwords'
219
+ t.options.concat(Shellwords.shellwords(ENV["YARD_OPTS"]))
220
+ end
221
+ end
222
+ end
223
+ Rake::Task['yard'].prerequisites.insert(0, 'doc:sass')
224
+ Rake::Task['yard'].instance_variable_set('@comment', nil)
225
+
226
+ desc "Generate Documentation"
227
+ task :doc => :yard
228
+ task :redoc => :yard
229
+ rescue LoadError
230
+ desc "Generate Documentation"
231
+ task :doc => :rdoc
232
+ task :yard => :rdoc
233
+ end
234
+
235
+ task :pages do
236
+ ensure_git_cleanup do
237
+ puts "#{'=' * 50} Running rake pages"
238
+ sh %{git checkout sass-pages}
239
+ sh %{git reset --hard origin/sass-pages}
240
+
241
+ Dir.chdir("/var/www/sass-pages") do
242
+ sh %{git fetch origin}
243
+
244
+ sh %{git checkout stable}
245
+ sh %{git reset --hard origin/stable}
246
+
247
+ sh %{git checkout sass-pages}
248
+ sh %{git reset --hard origin/sass-pages}
249
+ sh %{rake build --trace}
250
+ sh %{mkdir -p tmp}
251
+ sh %{touch tmp/restart.txt}
252
+ end
253
+ end
254
+ end
255
+
256
+ # ----- Coverage -----
257
+
258
+ begin
259
+ require 'rcov/rcovtask'
260
+
261
+ Rcov::RcovTask.new do |t|
262
+ t.test_files = FileList[scope('test/**/*_test.rb')]
263
+ t.rcov_opts << '-x' << '"^\/"'
264
+ if ENV['NON_NATIVE']
265
+ t.rcov_opts << "--no-rcovrt"
266
+ end
267
+ t.verbose = true
268
+ end
269
+ rescue LoadError; end
270
+
271
+ # ----- Profiling -----
272
+
273
+ begin
274
+ require 'ruby-prof'
275
+
276
+ desc <<END
277
+ Run a profile of sass.
278
+ TIMES=n sets the number of runs. Defaults to 1000.
279
+ FILE=str sets the file to profile. Defaults to 'complex'.
280
+ OUTPUT=str sets the ruby-prof output format.
281
+ Can be Flat, CallInfo, or Graph. Defaults to Flat. Defaults to Flat.
282
+ END
283
+ task :profile do
284
+ times = (ENV['TIMES'] || '1000').to_i
285
+ file = ENV['FILE']
286
+
287
+ require 'lib/sass'
288
+
289
+ file = File.read(scope("test/sass/templates/#{file || 'complex'}.sass"))
290
+ result = RubyProf.profile { times.times { Sass::Engine.new(file).render } }
291
+
292
+ RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
293
+ end
294
+ rescue LoadError; end
295
+
296
+ # ----- Handling Updates -----
297
+
298
+ def email_on_error
299
+ yield
300
+ rescue Exception => e
301
+ IO.popen("sendmail nex342@gmail.com", "w") do |sm|
302
+ sm << "From: nex3@nex-3.com\n" <<
303
+ "To: nex342@gmail.com\n" <<
304
+ "Subject: Exception when running rake #{Rake.application.top_level_tasks.join(', ')}\n" <<
305
+ e.message << "\n\n" <<
306
+ e.backtrace.join("\n")
307
+ end
308
+ ensure
309
+ raise e if e
310
+ end
311
+
312
+ def ensure_git_cleanup
313
+ email_on_error {yield}
314
+ ensure
315
+ sh %{git reset --hard HEAD}
316
+ sh %{git clean -xdf}
317
+ sh %{git checkout master}
318
+ end
319
+
320
+ task :handle_update do
321
+ email_on_error do
322
+ unless ENV["REF"] =~ %r{^refs/heads/(master|stable|sass-pages)$}
323
+ puts "#{'=' * 20} Ignoring rake handle_update REF=#{ENV["REF"].inspect}"
324
+ next
325
+ end
326
+ branch = $1
327
+
328
+ puts
329
+ puts
330
+ puts '=' * 150
331
+ puts "Running rake handle_update REF=#{ENV["REF"].inspect}"
332
+
333
+ sh %{git fetch origin}
334
+ sh %{git checkout stable}
335
+ sh %{git reset --hard origin/stable}
336
+ sh %{git checkout master}
337
+ sh %{git reset --hard origin/master}
338
+
339
+ case branch
340
+ when "master"
341
+ sh %{rake release_edge --trace}
342
+ when "stable", "sass-pages"
343
+ sh %{rake pages --trace}
344
+ end
345
+
346
+ puts 'Done running handle_update'
347
+ puts '=' * 150
348
+ end
349
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/VERSION_NAME ADDED
@@ -0,0 +1 @@
1
+ Media Mark
data/bin/push ADDED
@@ -0,0 +1,13 @@
1
+ #! /bin/bash
2
+
3
+ DIR=$(dirname $0)
4
+ cd $DIR/..
5
+ OLDVER=$(cat VERSION)
6
+ NEWVER=3.4.$(expr $(cat VERSION | awk -F. '{ print $3 }') + 1)
7
+ echo $NEWVER > VERSION
8
+ gem build sass.gemspec
9
+ gem push oreorenasass-$NEWVER.gem
10
+ git add --all
11
+ git commit -m "$NEWVER"
12
+ git tag $NEWVER
13
+ git push origin oreoremaster
data/bin/sass ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # The command line Sass parser.
3
+
4
+ THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
5
+ begin
6
+ require File.dirname(THIS_FILE) + '/../lib/sass'
7
+ rescue LoadError
8
+ require 'sass'
9
+ end
10
+ require 'sass/exec'
11
+
12
+ opts = Sass::Exec::Sass.new(ARGV)
13
+ opts.parse!
data/bin/sass-convert ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
4
+ begin
5
+ require File.dirname(THIS_FILE) + '/../lib/sass'
6
+ rescue LoadError
7
+ require 'sass'
8
+ end
9
+ require 'sass/exec'
10
+
11
+ opts = Sass::Exec::SassConvert.new(ARGV)
12
+ opts.parse!
data/bin/scss ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # The command line Sass parser.
3
+
4
+ THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
5
+ begin
6
+ require File.dirname(THIS_FILE) + '/../lib/sass'
7
+ rescue LoadError
8
+ require 'sass'
9
+ end
10
+ require 'sass/exec'
11
+
12
+ opts = Sass::Exec::Scss.new(ARGV)
13
+ opts.parse!
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'sinatra'
3
+ require 'json'
4
+ set :port, 3124
5
+ set :environment, :production
6
+ enable :lock
7
+ Dir.chdir(File.dirname(__FILE__) + "/..")
8
+
9
+ post "/" do
10
+ puts "Recieved payload!"
11
+ puts "Rev: #{`git name-rev HEAD`.strip}"
12
+ system %{rake handle_update --trace REF=#{JSON.parse(params["payload"])["ref"].inspect}}
13
+ end
data/init.rb ADDED
@@ -0,0 +1,18 @@
1
+ begin
2
+ require File.join(File.dirname(__FILE__), 'lib', 'sass') # From here
3
+ rescue LoadError
4
+ begin
5
+ require 'sass' # From gem
6
+ rescue LoadError => e
7
+ # gems:install may be run to install Haml with the skeleton plugin
8
+ # but not the gem itself installed.
9
+ # Don't die if this is the case.
10
+ raise e unless defined?(Rake) &&
11
+ (Rake.application.top_level_tasks.include?('gems') ||
12
+ Rake.application.top_level_tasks.include?('gems:install'))
13
+ end
14
+ end
15
+
16
+ # Load Sass.
17
+ # Sass may be undefined if we're running gems:install.
18
+ require 'sass/plugin' if defined?(Sass)