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.
- data/.yardopts +1 -1
- data/CONTRIBUTING +0 -1
- data/EDGE_GEM_VERSION +1 -0
- data/MIT-LICENSE +1 -1
- data/README.md +10 -175
- data/Rakefile +56 -84
- data/VERSION +1 -1
- data/VERSION_NAME +1 -1
- data/init.rb +1 -1
- data/lib/haml.rb +14 -12
- data/lib/haml/engine.rb +1 -1
- data/lib/haml/exec.rb +19 -316
- data/lib/haml/helpers/action_view_extensions.rb +1 -1
- data/lib/haml/html.rb +69 -76
- data/lib/haml/precompiler.rb +34 -41
- data/lib/haml/railtie.rb +4 -6
- data/lib/haml/template/plugin.rb +6 -16
- data/lib/haml/util.rb +91 -107
- data/lib/haml/version.rb +7 -0
- data/test/benchmark.rb +2 -9
- data/test/haml/engine_test.rb +195 -92
- data/test/haml/html2haml/erb_tests.rb +0 -14
- data/test/haml/util_test.rb +32 -0
- data/test/test_helper.rb +0 -39
- metadata +96 -324
- data/bin/css2sass +0 -13
- data/bin/sass +0 -8
- data/bin/sass-convert +0 -7
- data/extra/haml-mode.el +0 -753
- data/extra/sass-mode.el +0 -207
- data/lib/haml/util/subset_map.rb +0 -101
- data/lib/sass.rb +0 -29
- data/lib/sass/callbacks.rb +0 -52
- data/lib/sass/css.rb +0 -294
- data/lib/sass/engine.rb +0 -720
- data/lib/sass/environment.rb +0 -143
- data/lib/sass/error.rb +0 -198
- data/lib/sass/files.rb +0 -160
- data/lib/sass/less.rb +0 -382
- data/lib/sass/plugin.rb +0 -279
- data/lib/sass/plugin/configuration.rb +0 -221
- data/lib/sass/plugin/generic.rb +0 -15
- data/lib/sass/plugin/merb.rb +0 -37
- data/lib/sass/plugin/rack.rb +0 -47
- data/lib/sass/plugin/rails.rb +0 -32
- data/lib/sass/plugin/staleness_checker.rb +0 -123
- data/lib/sass/repl.rb +0 -58
- data/lib/sass/script.rb +0 -63
- data/lib/sass/script/bool.rb +0 -18
- data/lib/sass/script/color.rb +0 -491
- data/lib/sass/script/css_lexer.rb +0 -29
- data/lib/sass/script/css_parser.rb +0 -31
- data/lib/sass/script/funcall.rb +0 -77
- data/lib/sass/script/functions.rb +0 -861
- data/lib/sass/script/interpolation.rb +0 -70
- data/lib/sass/script/lexer.rb +0 -337
- data/lib/sass/script/literal.rb +0 -236
- data/lib/sass/script/node.rb +0 -112
- data/lib/sass/script/number.rb +0 -423
- data/lib/sass/script/operation.rb +0 -95
- data/lib/sass/script/parser.rb +0 -401
- data/lib/sass/script/string.rb +0 -67
- data/lib/sass/script/string_interpolation.rb +0 -93
- data/lib/sass/script/unary_operation.rb +0 -57
- data/lib/sass/script/variable.rb +0 -48
- data/lib/sass/scss.rb +0 -17
- data/lib/sass/scss/css_parser.rb +0 -46
- data/lib/sass/scss/parser.rb +0 -855
- data/lib/sass/scss/rx.rb +0 -126
- data/lib/sass/scss/sass_parser.rb +0 -11
- data/lib/sass/scss/script_lexer.rb +0 -15
- data/lib/sass/scss/script_parser.rb +0 -25
- data/lib/sass/scss/static_parser.rb +0 -40
- data/lib/sass/selector.rb +0 -361
- data/lib/sass/selector/abstract_sequence.rb +0 -62
- data/lib/sass/selector/comma_sequence.rb +0 -82
- data/lib/sass/selector/sequence.rb +0 -237
- data/lib/sass/selector/simple.rb +0 -113
- data/lib/sass/selector/simple_sequence.rb +0 -136
- data/lib/sass/tree/charset_node.rb +0 -37
- data/lib/sass/tree/comment_node.rb +0 -128
- data/lib/sass/tree/debug_node.rb +0 -36
- data/lib/sass/tree/directive_node.rb +0 -75
- data/lib/sass/tree/extend_node.rb +0 -65
- data/lib/sass/tree/for_node.rb +0 -55
- data/lib/sass/tree/if_node.rb +0 -69
- data/lib/sass/tree/import_node.rb +0 -102
- data/lib/sass/tree/mixin_def_node.rb +0 -48
- data/lib/sass/tree/mixin_node.rb +0 -111
- data/lib/sass/tree/node.rb +0 -464
- data/lib/sass/tree/prop_node.rb +0 -220
- data/lib/sass/tree/root_node.rb +0 -163
- data/lib/sass/tree/rule_node.rb +0 -261
- data/lib/sass/tree/variable_node.rb +0 -39
- data/lib/sass/tree/warn_node.rb +0 -42
- data/lib/sass/tree/while_node.rb +0 -36
- data/test/haml/util/subset_map_test.rb +0 -91
- data/test/sass/callbacks_test.rb +0 -61
- data/test/sass/conversion_test.rb +0 -1218
- data/test/sass/css2sass_test.rb +0 -364
- data/test/sass/data/hsl-rgb.txt +0 -319
- data/test/sass/engine_test.rb +0 -2267
- data/test/sass/extend_test.rb +0 -1348
- data/test/sass/functions_test.rb +0 -556
- data/test/sass/less_conversion_test.rb +0 -653
- data/test/sass/more_results/more1.css +0 -9
- data/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/test/sass/more_results/more_import.css +0 -29
- data/test/sass/more_templates/_more_partial.sass +0 -2
- data/test/sass/more_templates/more1.sass +0 -23
- data/test/sass/more_templates/more_import.sass +0 -11
- data/test/sass/plugin_test.rb +0 -433
- data/test/sass/results/alt.css +0 -4
- data/test/sass/results/basic.css +0 -9
- data/test/sass/results/compact.css +0 -5
- data/test/sass/results/complex.css +0 -86
- data/test/sass/results/compressed.css +0 -1
- data/test/sass/results/expanded.css +0 -19
- data/test/sass/results/import.css +0 -31
- data/test/sass/results/import_charset.css +0 -4
- data/test/sass/results/import_charset_1_8.css +0 -4
- data/test/sass/results/import_charset_ibm866.css +0 -4
- data/test/sass/results/line_numbers.css +0 -49
- data/test/sass/results/mixins.css +0 -95
- data/test/sass/results/multiline.css +0 -24
- data/test/sass/results/nested.css +0 -22
- data/test/sass/results/options.css +0 -1
- data/test/sass/results/parent_ref.css +0 -13
- data/test/sass/results/script.css +0 -16
- data/test/sass/results/scss_import.css +0 -31
- data/test/sass/results/scss_importee.css +0 -2
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/test/sass/results/subdir/subdir.css +0 -3
- data/test/sass/results/units.css +0 -11
- data/test/sass/results/warn.css +0 -0
- data/test/sass/results/warn_imported.css +0 -0
- data/test/sass/script_conversion_test.rb +0 -314
- data/test/sass/script_test.rb +0 -470
- data/test/sass/scss/css_test.rb +0 -916
- data/test/sass/scss/rx_test.rb +0 -156
- data/test/sass/scss/scss_test.rb +0 -1122
- data/test/sass/scss/test_helper.rb +0 -37
- data/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/test/sass/templates/_partial.sass +0 -2
- data/test/sass/templates/alt.sass +0 -16
- data/test/sass/templates/basic.sass +0 -23
- data/test/sass/templates/bork1.sass +0 -2
- data/test/sass/templates/bork2.sass +0 -2
- data/test/sass/templates/bork3.sass +0 -2
- data/test/sass/templates/bork4.sass +0 -2
- data/test/sass/templates/compact.sass +0 -17
- data/test/sass/templates/complex.sass +0 -305
- data/test/sass/templates/compressed.sass +0 -15
- data/test/sass/templates/expanded.sass +0 -17
- data/test/sass/templates/import.sass +0 -12
- data/test/sass/templates/import_charset.sass +0 -7
- data/test/sass/templates/import_charset_1_8.sass +0 -4
- data/test/sass/templates/import_charset_ibm866.sass +0 -9
- data/test/sass/templates/importee.less +0 -2
- data/test/sass/templates/importee.sass +0 -19
- data/test/sass/templates/line_numbers.sass +0 -13
- data/test/sass/templates/mixin_bork.sass +0 -5
- data/test/sass/templates/mixins.sass +0 -76
- data/test/sass/templates/multiline.sass +0 -20
- data/test/sass/templates/nested.sass +0 -25
- data/test/sass/templates/nested_bork1.sass +0 -2
- data/test/sass/templates/nested_bork2.sass +0 -2
- data/test/sass/templates/nested_bork3.sass +0 -2
- data/test/sass/templates/nested_bork4.sass +0 -2
- data/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/test/sass/templates/options.sass +0 -2
- data/test/sass/templates/parent_ref.sass +0 -25
- data/test/sass/templates/script.sass +0 -101
- data/test/sass/templates/scss_import.scss +0 -11
- data/test/sass/templates/scss_importee.scss +0 -1
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/test/sass/templates/subdir/subdir.sass +0 -6
- data/test/sass/templates/units.sass +0 -11
- data/test/sass/templates/warn.sass +0 -3
- data/test/sass/templates/warn_imported.sass +0 -4
- data/vendor/fssm/LICENSE +0 -20
- data/vendor/fssm/README.markdown +0 -55
- data/vendor/fssm/Rakefile +0 -59
- data/vendor/fssm/VERSION.yml +0 -5
- data/vendor/fssm/example.rb +0 -9
- data/vendor/fssm/fssm.gemspec +0 -77
- data/vendor/fssm/lib/fssm.rb +0 -33
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/fssm/lib/fssm/monitor.rb +0 -26
- data/vendor/fssm/lib/fssm/path.rb +0 -91
- data/vendor/fssm/lib/fssm/pathname.rb +0 -502
- data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
- data/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/fssm/lib/fssm/support.rb +0 -63
- data/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/fssm/spec/path_spec.rb +0 -75
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- 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
|
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
|
data/CONTRIBUTING
CHANGED
data/EDGE_GEM_VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.0.alpha.2
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2006-2009 Hampton Catlin
|
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
|
1
|
+
# Haml
|
2
2
|
|
3
|
-
Haml
|
4
|
-
|
5
|
-
HTML
|
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
|
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
|
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
|
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
|
-
|
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
|
-
|
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
|
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
|
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
|
-
|
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
|
-
|
163
|
-
|
164
|
-
|
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
|
191
|
-
sh %{gem push pkg/haml
|
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
|
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
|
-
|
273
|
-
|
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
|
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
|
284
|
-
sh %{git reset --hard origin
|
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
|
-
|
327
|
-
require 'lib/sass'
|
307
|
+
require 'lib/haml'
|
328
308
|
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
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|
|
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
|
-
|
398
|
+
case branch
|
399
|
+
when "master"
|
425
400
|
sh %{rake release_edge --trace}
|
426
|
-
|
427
|
-
sh %{rake pages --trace
|
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'
|