haml 3.0.25 → 3.1.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

Files changed (212) hide show
  1. data/.yardopts +1 -1
  2. data/CONTRIBUTING +0 -1
  3. data/EDGE_GEM_VERSION +1 -0
  4. data/MIT-LICENSE +1 -1
  5. data/README.md +10 -175
  6. data/Rakefile +56 -84
  7. data/VERSION +1 -1
  8. data/VERSION_NAME +1 -1
  9. data/init.rb +1 -1
  10. data/lib/haml.rb +14 -12
  11. data/lib/haml/engine.rb +1 -1
  12. data/lib/haml/exec.rb +19 -316
  13. data/lib/haml/helpers/action_view_extensions.rb +1 -1
  14. data/lib/haml/html.rb +69 -76
  15. data/lib/haml/precompiler.rb +34 -41
  16. data/lib/haml/railtie.rb +4 -6
  17. data/lib/haml/template/plugin.rb +6 -16
  18. data/lib/haml/util.rb +91 -107
  19. data/lib/haml/version.rb +7 -0
  20. data/test/benchmark.rb +2 -9
  21. data/test/haml/engine_test.rb +195 -92
  22. data/test/haml/html2haml/erb_tests.rb +0 -14
  23. data/test/haml/util_test.rb +32 -0
  24. data/test/test_helper.rb +0 -39
  25. metadata +96 -324
  26. data/bin/css2sass +0 -13
  27. data/bin/sass +0 -8
  28. data/bin/sass-convert +0 -7
  29. data/extra/haml-mode.el +0 -753
  30. data/extra/sass-mode.el +0 -207
  31. data/lib/haml/util/subset_map.rb +0 -101
  32. data/lib/sass.rb +0 -29
  33. data/lib/sass/callbacks.rb +0 -52
  34. data/lib/sass/css.rb +0 -294
  35. data/lib/sass/engine.rb +0 -720
  36. data/lib/sass/environment.rb +0 -143
  37. data/lib/sass/error.rb +0 -198
  38. data/lib/sass/files.rb +0 -160
  39. data/lib/sass/less.rb +0 -382
  40. data/lib/sass/plugin.rb +0 -279
  41. data/lib/sass/plugin/configuration.rb +0 -221
  42. data/lib/sass/plugin/generic.rb +0 -15
  43. data/lib/sass/plugin/merb.rb +0 -37
  44. data/lib/sass/plugin/rack.rb +0 -47
  45. data/lib/sass/plugin/rails.rb +0 -32
  46. data/lib/sass/plugin/staleness_checker.rb +0 -123
  47. data/lib/sass/repl.rb +0 -58
  48. data/lib/sass/script.rb +0 -63
  49. data/lib/sass/script/bool.rb +0 -18
  50. data/lib/sass/script/color.rb +0 -491
  51. data/lib/sass/script/css_lexer.rb +0 -29
  52. data/lib/sass/script/css_parser.rb +0 -31
  53. data/lib/sass/script/funcall.rb +0 -77
  54. data/lib/sass/script/functions.rb +0 -861
  55. data/lib/sass/script/interpolation.rb +0 -70
  56. data/lib/sass/script/lexer.rb +0 -337
  57. data/lib/sass/script/literal.rb +0 -236
  58. data/lib/sass/script/node.rb +0 -112
  59. data/lib/sass/script/number.rb +0 -423
  60. data/lib/sass/script/operation.rb +0 -95
  61. data/lib/sass/script/parser.rb +0 -401
  62. data/lib/sass/script/string.rb +0 -67
  63. data/lib/sass/script/string_interpolation.rb +0 -93
  64. data/lib/sass/script/unary_operation.rb +0 -57
  65. data/lib/sass/script/variable.rb +0 -48
  66. data/lib/sass/scss.rb +0 -17
  67. data/lib/sass/scss/css_parser.rb +0 -46
  68. data/lib/sass/scss/parser.rb +0 -855
  69. data/lib/sass/scss/rx.rb +0 -126
  70. data/lib/sass/scss/sass_parser.rb +0 -11
  71. data/lib/sass/scss/script_lexer.rb +0 -15
  72. data/lib/sass/scss/script_parser.rb +0 -25
  73. data/lib/sass/scss/static_parser.rb +0 -40
  74. data/lib/sass/selector.rb +0 -361
  75. data/lib/sass/selector/abstract_sequence.rb +0 -62
  76. data/lib/sass/selector/comma_sequence.rb +0 -82
  77. data/lib/sass/selector/sequence.rb +0 -237
  78. data/lib/sass/selector/simple.rb +0 -113
  79. data/lib/sass/selector/simple_sequence.rb +0 -136
  80. data/lib/sass/tree/charset_node.rb +0 -37
  81. data/lib/sass/tree/comment_node.rb +0 -128
  82. data/lib/sass/tree/debug_node.rb +0 -36
  83. data/lib/sass/tree/directive_node.rb +0 -75
  84. data/lib/sass/tree/extend_node.rb +0 -65
  85. data/lib/sass/tree/for_node.rb +0 -55
  86. data/lib/sass/tree/if_node.rb +0 -69
  87. data/lib/sass/tree/import_node.rb +0 -102
  88. data/lib/sass/tree/mixin_def_node.rb +0 -48
  89. data/lib/sass/tree/mixin_node.rb +0 -111
  90. data/lib/sass/tree/node.rb +0 -464
  91. data/lib/sass/tree/prop_node.rb +0 -220
  92. data/lib/sass/tree/root_node.rb +0 -163
  93. data/lib/sass/tree/rule_node.rb +0 -261
  94. data/lib/sass/tree/variable_node.rb +0 -39
  95. data/lib/sass/tree/warn_node.rb +0 -42
  96. data/lib/sass/tree/while_node.rb +0 -36
  97. data/test/haml/util/subset_map_test.rb +0 -91
  98. data/test/sass/callbacks_test.rb +0 -61
  99. data/test/sass/conversion_test.rb +0 -1218
  100. data/test/sass/css2sass_test.rb +0 -364
  101. data/test/sass/data/hsl-rgb.txt +0 -319
  102. data/test/sass/engine_test.rb +0 -2267
  103. data/test/sass/extend_test.rb +0 -1348
  104. data/test/sass/functions_test.rb +0 -556
  105. data/test/sass/less_conversion_test.rb +0 -653
  106. data/test/sass/more_results/more1.css +0 -9
  107. data/test/sass/more_results/more1_with_line_comments.css +0 -26
  108. data/test/sass/more_results/more_import.css +0 -29
  109. data/test/sass/more_templates/_more_partial.sass +0 -2
  110. data/test/sass/more_templates/more1.sass +0 -23
  111. data/test/sass/more_templates/more_import.sass +0 -11
  112. data/test/sass/plugin_test.rb +0 -433
  113. data/test/sass/results/alt.css +0 -4
  114. data/test/sass/results/basic.css +0 -9
  115. data/test/sass/results/compact.css +0 -5
  116. data/test/sass/results/complex.css +0 -86
  117. data/test/sass/results/compressed.css +0 -1
  118. data/test/sass/results/expanded.css +0 -19
  119. data/test/sass/results/import.css +0 -31
  120. data/test/sass/results/import_charset.css +0 -4
  121. data/test/sass/results/import_charset_1_8.css +0 -4
  122. data/test/sass/results/import_charset_ibm866.css +0 -4
  123. data/test/sass/results/line_numbers.css +0 -49
  124. data/test/sass/results/mixins.css +0 -95
  125. data/test/sass/results/multiline.css +0 -24
  126. data/test/sass/results/nested.css +0 -22
  127. data/test/sass/results/options.css +0 -1
  128. data/test/sass/results/parent_ref.css +0 -13
  129. data/test/sass/results/script.css +0 -16
  130. data/test/sass/results/scss_import.css +0 -31
  131. data/test/sass/results/scss_importee.css +0 -2
  132. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
  133. data/test/sass/results/subdir/subdir.css +0 -3
  134. data/test/sass/results/units.css +0 -11
  135. data/test/sass/results/warn.css +0 -0
  136. data/test/sass/results/warn_imported.css +0 -0
  137. data/test/sass/script_conversion_test.rb +0 -314
  138. data/test/sass/script_test.rb +0 -470
  139. data/test/sass/scss/css_test.rb +0 -916
  140. data/test/sass/scss/rx_test.rb +0 -156
  141. data/test/sass/scss/scss_test.rb +0 -1122
  142. data/test/sass/scss/test_helper.rb +0 -37
  143. data/test/sass/templates/_imported_charset_ibm866.sass +0 -4
  144. data/test/sass/templates/_imported_charset_utf8.sass +0 -4
  145. data/test/sass/templates/_partial.sass +0 -2
  146. data/test/sass/templates/alt.sass +0 -16
  147. data/test/sass/templates/basic.sass +0 -23
  148. data/test/sass/templates/bork1.sass +0 -2
  149. data/test/sass/templates/bork2.sass +0 -2
  150. data/test/sass/templates/bork3.sass +0 -2
  151. data/test/sass/templates/bork4.sass +0 -2
  152. data/test/sass/templates/compact.sass +0 -17
  153. data/test/sass/templates/complex.sass +0 -305
  154. data/test/sass/templates/compressed.sass +0 -15
  155. data/test/sass/templates/expanded.sass +0 -17
  156. data/test/sass/templates/import.sass +0 -12
  157. data/test/sass/templates/import_charset.sass +0 -7
  158. data/test/sass/templates/import_charset_1_8.sass +0 -4
  159. data/test/sass/templates/import_charset_ibm866.sass +0 -9
  160. data/test/sass/templates/importee.less +0 -2
  161. data/test/sass/templates/importee.sass +0 -19
  162. data/test/sass/templates/line_numbers.sass +0 -13
  163. data/test/sass/templates/mixin_bork.sass +0 -5
  164. data/test/sass/templates/mixins.sass +0 -76
  165. data/test/sass/templates/multiline.sass +0 -20
  166. data/test/sass/templates/nested.sass +0 -25
  167. data/test/sass/templates/nested_bork1.sass +0 -2
  168. data/test/sass/templates/nested_bork2.sass +0 -2
  169. data/test/sass/templates/nested_bork3.sass +0 -2
  170. data/test/sass/templates/nested_bork4.sass +0 -2
  171. data/test/sass/templates/nested_mixin_bork.sass +0 -6
  172. data/test/sass/templates/options.sass +0 -2
  173. data/test/sass/templates/parent_ref.sass +0 -25
  174. data/test/sass/templates/script.sass +0 -101
  175. data/test/sass/templates/scss_import.scss +0 -11
  176. data/test/sass/templates/scss_importee.scss +0 -1
  177. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
  178. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
  179. data/test/sass/templates/subdir/subdir.sass +0 -6
  180. data/test/sass/templates/units.sass +0 -11
  181. data/test/sass/templates/warn.sass +0 -3
  182. data/test/sass/templates/warn_imported.sass +0 -4
  183. data/vendor/fssm/LICENSE +0 -20
  184. data/vendor/fssm/README.markdown +0 -55
  185. data/vendor/fssm/Rakefile +0 -59
  186. data/vendor/fssm/VERSION.yml +0 -5
  187. data/vendor/fssm/example.rb +0 -9
  188. data/vendor/fssm/fssm.gemspec +0 -77
  189. data/vendor/fssm/lib/fssm.rb +0 -33
  190. data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
  191. data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
  192. data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
  193. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
  194. data/vendor/fssm/lib/fssm/monitor.rb +0 -26
  195. data/vendor/fssm/lib/fssm/path.rb +0 -91
  196. data/vendor/fssm/lib/fssm/pathname.rb +0 -502
  197. data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
  198. data/vendor/fssm/lib/fssm/state/file.rb +0 -24
  199. data/vendor/fssm/lib/fssm/support.rb +0 -63
  200. data/vendor/fssm/lib/fssm/tree.rb +0 -176
  201. data/vendor/fssm/profile/prof-cache.rb +0 -40
  202. data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
  203. data/vendor/fssm/profile/prof-pathname.rb +0 -68
  204. data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
  205. data/vendor/fssm/profile/prof.html +0 -2379
  206. data/vendor/fssm/spec/path_spec.rb +0 -75
  207. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  208. data/vendor/fssm/spec/root/file.css +0 -0
  209. data/vendor/fssm/spec/root/file.rb +0 -0
  210. data/vendor/fssm/spec/root/file.yml +0 -0
  211. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  212. data/vendor/fssm/spec/spec_helper.rb +0 -14
data/.yardopts CHANGED
@@ -2,7 +2,7 @@
2
2
  --markup markdown
3
3
  --markup-provider maruku
4
4
  --default-return ""
5
- --title "Haml/Sass Documentation"
5
+ --title "Haml Documentation"
6
6
  --query 'object.type != :classvariable'
7
7
  --query 'object.type != :constant || @api && @api.text == "public"'
8
8
  --hide-void-return
@@ -1,4 +1,3 @@
1
1
  Contributions are welcomed. Please see the following sites for guidelines:
2
2
 
3
3
  http://haml-lang.com/development.html#contributing
4
- http://sass-lang.com/development.html#contributing
@@ -0,0 +1 @@
1
+ 3.1.0.alpha.2
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
1
+ Copyright (c) 2006-2009 Hampton Catlin and Nathan Weizenbaum
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,72 +1,40 @@
1
- # Haml and Sass
1
+ # Haml
2
2
 
3
- Haml and Sass are templating engines
4
- for the two most common types of documents on the web:
5
- HTML and CSS, respectively.
6
- They are designed to make it both easier and more pleasant
7
- to code HTML and CSS documents,
3
+ Haml is a templating engine for HTML.
4
+ It's are designed to make it both easier and more pleasant
5
+ to write HTML documents,
8
6
  by eliminating redundancy,
9
7
  reflecting the underlying structure that the document represents,
10
8
  and providing elegant, easily understandable, and powerful syntax.
11
9
 
12
10
  ## Using
13
11
 
14
- Haml and Sass can be used from the command line
12
+ Haml can be used from the command line
15
13
  or as part of a Ruby web framework.
16
14
  The first step is to install the gem:
17
15
 
18
16
  gem install haml
19
17
 
20
- After you convert some HTML to Haml or some CSS to Sass,
21
- you can run
18
+ After you convert some HTML to Haml, you can run
22
19
 
23
20
  haml document.haml
24
- sass style.scss
25
21
 
26
22
  to compile them.
27
23
  For more information on these commands, check out
28
24
 
29
25
  haml --help
30
- sass --help
31
26
 
32
- To install Haml and Sass in Rails 2,
27
+ To install Haml in Rails 2,
33
28
  just add `config.gem "haml"` to `config/environment.rb`.
34
29
  In Rails 3, add `gem "haml"` to your Gemfile instead.
35
30
  and both Haml and Sass will be installed.
36
31
  Views with the `.html.haml` extension will automatically use Haml.
37
- Sass is a little more complicated;
38
- `.sass` files should be placed in `public/stylesheets/sass`,
39
- where they'll be automatically compiled
40
- to corresponding CSS files in `public/stylesheets` when needed
41
- (the Sass template directory is customizable...
42
- see [the Sass reference](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#template_location-option) for details).
43
32
 
44
- For Merb, `.html.haml` views will work without any further modification.
45
- To enable Sass, you also need to add a dependency.
46
- To do so, just add
47
-
48
- dependency "merb-haml"
49
-
50
- to `config/dependencies.rb` (or `config/init.rb` in a flat/very flat Merb application).
51
- Then it'll work just like it does in Rails.
52
-
53
- Sass can also be used with any Rack-enabled web framework.
54
- To do so, just add
55
-
56
- require 'sass/plugin/rack'
57
- use Sass::Plugin::Rack
58
-
59
- to `config.ru`.
60
- Then any Sass files in `public/stylesheets/sass`
61
- will be compiled CSS files in `public/stylesheets` on every request.
62
-
63
- To use Haml and Sass programatically,
33
+ To use Haml programatically,
64
34
  check out the [YARD documentation](http://haml-lang.com/docs/yardoc/).
65
35
 
66
36
  ## Formatting
67
37
 
68
- ### Haml
69
-
70
38
  The most basic element of Haml
71
39
  is a shorthand for creating HTML:
72
40
 
@@ -133,141 +101,16 @@ Haml provides far more tools than those presented here.
133
101
  Check out the [reference documentation](http://beta.haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html)
134
102
  for full details.
135
103
 
136
- #### Indentation
104
+ ### Indentation
137
105
 
138
106
  Haml's indentation can be made up of one or more tabs or spaces.
139
107
  However, indentation must be consistent within a given document.
140
108
  Hard tabs and spaces can't be mixed,
141
109
  and the same number of tabs or spaces must be used throughout.
142
110
 
143
- ### Sass
144
-
145
- Sass is an extension of CSS
146
- that adds power and elegance to the basic language.
147
- It allows you to use [variables][vars], [nested rules][nested],
148
- [mixins][mixins], [inline imports][imports],
149
- and more, all with a fully CSS-compatible syntax.
150
- Sass helps keep large stylesheets well-organized,
151
- and get small stylesheets up and running quickly,
152
- particularly with the help of
153
- [the Compass style library](http://compass-style.org).
154
-
155
- [vars]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#variables_
156
- [nested]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#nested_rules_
157
- [mixins]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
158
- [imports]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import
159
-
160
- Sass has two syntaxes.
161
- The one presented here, known as "SCSS" (for "Sassy CSS"),
162
- is fully CSS-compatible.
163
- The other (older) syntax, known as the indented syntax or just "Sass",
164
- is whitespace-sensitive and indentation-based.
165
- For more information, see the [reference documentation][syntax].
166
-
167
- [syntax]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#syntax
168
-
169
- To run the following examples and see the CSS they produce,
170
- put them in a file called `test.scss` and run `sass test.scss`.
171
-
172
- #### Nesting
173
-
174
- Sass avoids repetition by nesting selectors within one another.
175
- The same thing works for properties.
176
-
177
- table.hl {
178
- margin: 2em 0;
179
- td.ln { text-align: right; }
180
- }
181
-
182
- li {
183
- font: {
184
- family: serif;
185
- weight: bold;
186
- size: 1.2em;
187
- }
188
- }
189
-
190
- #### Variables
191
-
192
- Use the same color all over the place?
193
- Need to do some math with height and width and text size?
194
- Sass supports variables, math operations, and many useful functions.
195
-
196
- $blue: #3bbfce;
197
- $margin: 16px;
198
-
199
- .content_navigation {
200
- border-color: $blue;
201
- color: darken($blue, 10%);
202
- }
203
-
204
- .border {
205
- padding: $margin / 2;
206
- margin: $margin / 2;
207
- border-color: $blue;
208
- }
209
-
210
- #### Mixins
211
-
212
- Even more powerful than variables,
213
- mixins allow you to re-use whole chunks of CSS,
214
- properties or selectors.
215
- You can even give them arguments.
216
-
217
- @mixin table-scaffolding {
218
- th {
219
- text-align: center;
220
- font-weight: bold;
221
- }
222
- td, th { padding: 2px; }
223
- }
224
-
225
- @mixin left($dist) {
226
- float: left;
227
- margin-left: $dist;
228
- }
229
-
230
- #data {
231
- @include left(10px);
232
- @include table-scaffolding;
233
- }
234
-
235
- A comprehensive list of features is available
236
- in the [Sass reference](http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html).
237
-
238
- ## Executables
239
-
240
- The Haml gem includes several executables that are useful
241
- for dealing with Haml and Sass from the command line.
242
-
243
- ### `haml`
244
-
245
- The `haml` executable transforms a source Haml file into HTML.
246
- See `haml --help` for further information and options.
247
-
248
- ### `sass`
249
-
250
- The `sass` executable transforms a source Sass file into CSS.
251
- See `sass --help` for further information and options.
252
-
253
- ### `html2haml`
254
-
255
- The `html2haml` executable attempts to transform HTML,
256
- optionally with ERB markup, into Haml code.
257
- Since HTML is so variable, this transformation is not always perfect;
258
- it's a good idea to have a human check the output of this tool.
259
- See `html2haml --help` for further information and options.
260
-
261
- ### `sass-convert`
262
-
263
- The `sass-convert` executable converts between CSS, Sass, and SCSS.
264
- When converting from CSS to Sass or SCSS,
265
- nesting is applied where appropriate.
266
- See `sass-convert --help` for further information and options.
267
-
268
111
  ## Authors
269
112
 
270
- Haml and Sass were created by [Hampton Catlin](http://hamptoncatlin.com)
113
+ Haml was created by [Hampton Catlin](http://hamptoncatlin.com)
271
114
  (hcatlin) and he is the author of the original implementation. However, Hampton
272
115
  doesn't even know his way around the code anymore and now occasionally consults
273
116
  on the language issues. Hampton lives in Jacksonville, Florida and is the lead
@@ -281,14 +124,6 @@ getting Hampton coffee (a fitting task for a boy-genius). Nathan lives in
281
124
  Seattle, Washington and while not being a student at the University of
282
125
  Washington or working at an internship, he consults for Unspace Interactive.
283
126
 
284
- [Chris Eppstein](http://acts-as-architect.blogspot.com) is a core contributor to
285
- Sass and the creator of Compass, the first Sass-based framework. Chris focuses
286
- on making Sass more powerful, easy to use, and on ways to speed its adoption
287
- through the web development community. Chris lives in San Jose, California with
288
- his wife and daughter. He is the Software Architect for
289
- [Caring.com](http://caring.com), a website devoted to the 34 Million caregivers
290
- whose parents are sick or elderly, that uses Haml and Sass.
291
-
292
127
  If you use this software, you must pay Hampton a compliment. And
293
128
  buy Nathan some jelly beans. Maybe pet a kitten. Yeah. Pet that kitty.
294
129
 
data/Rakefile CHANGED
@@ -42,7 +42,7 @@ END
42
42
  # Don't use Rake::GemPackageTast because we want prerequisites to run
43
43
  # before we load the gemspec.
44
44
  desc "Build all the packages."
45
- task :package => [:revision_file, :submodules, :permissions] do
45
+ task :package => [:revision_file, :submodules] do
46
46
  load scope('haml.gemspec')
47
47
  Gem::Builder.new(HAML_GEMSPEC).build
48
48
  pkg = "#{HAML_GEMSPEC.name}-#{HAML_GEMSPEC.version}"
@@ -54,16 +54,6 @@ task :package => [:revision_file, :submodules, :permissions] do
54
54
  sh %{gzip pkg/#{pkg}.tar}
55
55
  end
56
56
 
57
- task :permissions do
58
- sh %{chmod -R a+rx bin}
59
- sh %{chmod -R a+r .}
60
- require 'shellwords'
61
- Dir.glob('test/**/*_test.rb') do |file|
62
- next if file =~ %r{^test/haml/spec/}
63
- sh %{chmod a+rx #{file}}
64
- end
65
- end
66
-
67
57
  task :revision_file do
68
58
  require 'lib/haml'
69
59
 
@@ -95,7 +85,8 @@ task :release => [:check_release, :package] do
95
85
  sh %{gem push pkg/haml-#{version}.gem}
96
86
  end
97
87
 
98
- # Ensures that the version have been updated for a new release.
88
+
89
+ # Ensures that the VERSION file has been updated for a new release.
99
90
  task :check_release do
100
91
  version = File.read(scope("VERSION")).strip
101
92
  raise "There have been changes since current version (#{version})" if changed_since?(version)
@@ -125,29 +116,10 @@ def changed_since?(rev, *files)
125
116
  return !$?.success?
126
117
  end
127
118
 
128
- # Returns whether or not the given Emacs mode file (haml or sass)
129
- # has changed since the given version.
130
- #
131
- # @param mode [String, Symbol] The name of the mode
132
- # @param version [String] The version number
133
- # @return [String, nil] The version number if the version has changed
134
- def mode_unchanged?(mode, version)
135
- mode_version = File.read(scope("extra/#{mode}-mode.el")).scan(/^;; Version: (.*)$/).first.first
136
- return false if mode_version == version
137
- return mode_version unless changed_since?(mode_version, "extra/#{mode}-mode.el")
138
- raise "#{mode}-mode.el version is #{version.inspect}, but it has changed as of #{version.inspect}"
139
- return false
140
- end
141
-
142
119
  task :submodules do
143
120
  if File.exist?(File.dirname(__FILE__) + "/.git")
144
121
  sh %{git submodule sync}
145
122
  sh %{git submodule update --init}
146
- elsif !File.exist?(File.dirname(__FILE__) + "/vendor/fssm/lib")
147
- warn <<WARN
148
- WARNING: vendor/fssm doesn't exist, and this isn't a git repository so
149
- I can't get it automatically!
150
- WARN
151
123
  end
152
124
  end
153
125
 
@@ -159,25 +131,11 @@ task :release_edge do
159
131
  sh %{git reset --hard origin/edge-gem}
160
132
  sh %{git merge origin/master}
161
133
 
162
- # Get the current master branch version
163
- version = File.read(scope('VERSION')).strip.split('.')
164
- pr = version[3]
165
- version = version.map {|n| n.to_i}
166
- unless pr || (version[1] % 2 == 1 && version[2] == 0)
167
- raise "#{version.join('.')} is not a development version"
134
+ unless edge_version = bump_edge_version
135
+ puts "master is already a prerelease version, no use building an edge gem"
136
+ next
168
137
  end
169
138
 
170
- # Bump the edge gem version
171
- edge_version = File.read(scope('EDGE_GEM_VERSION')).strip.split('.').map {|n| n.to_i}
172
- if !pr && (edge_version[0..1] != version[0..1])
173
- # A new master branch version was released, reset the edge gem version
174
- edge_version[0..1] = version[0..1]
175
- edge_version[2] = 0
176
- else
177
- # Just bump the teeny version
178
- edge_version[2] += 1
179
- end
180
- edge_version = edge_version.join('.')
181
139
  File.open(scope('EDGE_GEM_VERSION'), 'w') {|f| f.puts(edge_version)}
182
140
  sh %{git commit -m "Bump edge gem version to #{edge_version}." EDGE_GEM_VERSION}
183
141
  sh %{git push origin edge-gem}
@@ -187,9 +145,39 @@ task :release_edge do
187
145
  sh %{rake package}
188
146
  sh %{git checkout VERSION}
189
147
 
190
- sh %{rubyforge add_release haml haml-edge "Bleeding Edge (v#{edge_version})" pkg/haml-edge-#{edge_version}.gem}
191
- sh %{gem push pkg/haml-edge-#{edge_version}.gem}
148
+ sh %{rubyforge add_release haml haml "Bleeding Edge (v#{edge_version})" pkg/haml-#{edge_version}.gem}
149
+ sh %{gem push pkg/haml-#{edge_version}.gem}
150
+ end
151
+ end
152
+
153
+ # Reads the master version and the edge gem version,
154
+ # bump the latter, and return it.
155
+ #
156
+ # Returns nil if the current master version is already a non-alpha prerelease.
157
+ def bump_edge_version
158
+ # Get the current master branch version
159
+ version = File.read(scope('VERSION')).strip.split('.')
160
+ version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
161
+ unless version.size == 5 # prerelease
162
+ raise "master version #{version.join('.')} is not a prerelease version"
163
+ end
164
+
165
+ # Bump the edge gem version
166
+ edge_version = File.read(scope('EDGE_GEM_VERSION')).strip.split('.')
167
+ edge_version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
168
+
169
+ if version[3] != "alpha"
170
+ return
171
+ elsif edge_version[0..2] != version[0..2]
172
+ # A new master branch version was released, reset the edge gem version
173
+ edge_version[0..2] = version[0..2]
174
+ edge_version[4] = 1
175
+ else
176
+ # Just bump the teeny version
177
+ edge_version[4] += 1
192
178
  end
179
+
180
+ edge_version.join('.')
193
181
  end
194
182
 
195
183
  task :watch_for_update do
@@ -210,7 +198,7 @@ begin
210
198
 
211
199
  namespace :doc do
212
200
  task :sass do
213
- require scope('lib/sass')
201
+ require 'sass'
214
202
  Dir[scope("yard/default/**/*.sass")].each do |sass|
215
203
  File.open(sass.gsub(/sass$/, 'css'), 'w') do |f|
216
204
  f.write(Sass::Engine.new(File.read(sass)).render)
@@ -237,9 +225,6 @@ OPTS
237
225
  list.exclude('lib/haml/railtie.rb')
238
226
  list.exclude('lib/haml/helpers/action_view_mods.rb')
239
227
  list.exclude('lib/haml/helpers/xss_mods.rb')
240
- list.exclude('lib/sass/plugin/merb.rb')
241
- list.exclude('lib/sass/plugin/rails.rb')
242
- list.exclude('lib/sass/less.rb')
243
228
  end.to_a
244
229
  t.options << '--incremental' if Rake.application.top_level_tasks.include?('redoc')
245
230
  t.options += FileList.new(scope('yard/*.rb')).to_a.map {|f| ['-e', f]}.flatten
@@ -268,20 +253,19 @@ rescue LoadError
268
253
  end
269
254
 
270
255
  task :pages do
256
+ puts "#{'=' * 50} Running rake pages"
271
257
  ensure_git_cleanup do
272
- puts "#{'=' * 50} Running rake pages PROJ=#{ENV["PROJ"].inspect}"
273
- raise 'No ENV["PROJ"]!' unless proj = ENV["PROJ"]
274
- sh %{git checkout #{proj}-pages}
275
- sh %{git reset --hard origin/#{proj}-pages}
258
+ sh %{git checkout haml-pages}
259
+ sh %{git reset --hard origin/haml-pages}
276
260
 
277
- Dir.chdir("/var/www/#{proj}-pages") do
261
+ Dir.chdir("/var/www/haml-pages") do
278
262
  sh %{git fetch origin}
279
263
 
280
264
  sh %{git checkout stable}
281
265
  sh %{git reset --hard origin/stable}
282
266
 
283
- sh %{git checkout #{proj}-pages}
284
- sh %{git reset --hard origin/#{proj}-pages}
267
+ sh %{git checkout haml-pages}
268
+ sh %{git reset --hard origin/haml-pages}
285
269
  sh %{rake build --trace}
286
270
  sh %{mkdir -p tmp}
287
271
  sh %{touch tmp/restart.txt}
@@ -311,31 +295,21 @@ begin
311
295
 
312
296
  desc <<END
313
297
  Run a profile of haml.
314
- ENGINE=str sets the engine to be profiled. Defaults to Haml.
315
298
  TIMES=n sets the number of runs. Defaults to 1000.
316
- FILE=str sets the file to profile.
317
- Defaults to 'standard' for Haml and 'complex' for Sass.
299
+ FILE=str sets the file to profile. Defaults to 'standard'
318
300
  OUTPUT=str sets the ruby-prof output format.
319
301
  Can be Flat, CallInfo, or Graph. Defaults to Flat. Defaults to Flat.
320
302
  END
321
303
  task :profile do
322
- engine = (ENV['ENGINE'] || 'haml').downcase
323
304
  times = (ENV['TIMES'] || '1000').to_i
324
305
  file = ENV['FILE']
325
306
 
326
- if engine == 'sass'
327
- require 'lib/sass'
307
+ require 'lib/haml'
328
308
 
329
- file = File.read(scope("test/sass/templates/#{file || 'complex'}.sass"))
330
- result = RubyProf.profile { times.times { Sass::Engine.new(file).render } }
331
- else
332
- require 'lib/haml'
333
-
334
- file = File.read(scope("test/haml/templates/#{file || 'standard'}.haml"))
335
- obj = Object.new
336
- Haml::Engine.new(file).def_method(obj, :render)
337
- result = RubyProf.profile { times.times { obj.render } }
338
- end
309
+ file = File.read(scope("test/haml/templates/#{file || 'standard'}.haml"))
310
+ obj = Object.new
311
+ Haml::Engine.new(file).def_method(obj, :render)
312
+ result = RubyProf.profile { times.times { obj.render } }
339
313
 
340
314
  RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
341
315
  end
@@ -404,7 +378,7 @@ end
404
378
 
405
379
  task :handle_update do
406
380
  email_on_error do
407
- unless ENV["REF"] =~ %r{^refs/heads/(master|stable|(?:haml|sass)-pages)$}
381
+ unless ENV["REF"] =~ %r{^refs/heads/(master|stable|haml-pages)$}
408
382
  puts "#{'=' * 20} Ignoring rake handle_update REF=#{ENV["REF"].inspect}"
409
383
  next
410
384
  end
@@ -421,13 +395,11 @@ task :handle_update do
421
395
  sh %{git checkout master}
422
396
  sh %{git reset --hard origin/master}
423
397
 
424
- if branch == "master"
398
+ case branch
399
+ when "master"
425
400
  sh %{rake release_edge --trace}
426
- elsif branch == "stable"
427
- sh %{rake pages --trace PROJ=haml}
428
- sh %{rake pages --trace PROJ=sass}
429
- elsif branch =~ /^(haml|sass)-pages$/
430
- sh %{rake pages --trace PROJ=#{$1}}
401
+ when "stable", "haml-pages"
402
+ sh %{rake pages --trace}
431
403
  end
432
404
 
433
405
  puts 'Done running handle_update'