haml 2.2.24 → 3.0.0.beta.1
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 +0 -1
- data/README.md +91 -151
- data/REMEMBER +11 -1
- data/Rakefile +73 -55
- data/VERSION +1 -1
- data/VERSION_NAME +1 -1
- data/bin/css2sass +7 -1
- data/bin/sass-convert +7 -0
- data/extra/haml-mode.el +2 -1
- data/lib/haml/buffer.rb +22 -4
- data/lib/haml/engine.rb +5 -1
- data/lib/haml/exec.rb +231 -46
- data/lib/haml/filters.rb +19 -8
- data/lib/haml/helpers.rb +47 -20
- data/lib/haml/helpers/action_view_extensions.rb +2 -4
- data/lib/haml/helpers/action_view_mods.rb +11 -8
- data/lib/haml/helpers/xss_mods.rb +13 -2
- data/lib/haml/html.rb +179 -48
- data/lib/haml/html/erb.rb +141 -0
- data/lib/haml/precompiler.rb +40 -15
- data/lib/haml/railtie.rb +1 -5
- data/lib/haml/root.rb +3 -0
- data/lib/haml/template.rb +4 -14
- data/lib/haml/util.rb +120 -30
- data/lib/haml/version.rb +25 -2
- data/lib/sass.rb +5 -1
- data/lib/sass/callbacks.rb +50 -0
- data/lib/sass/css.rb +40 -191
- data/lib/sass/engine.rb +170 -74
- data/lib/sass/environment.rb +8 -2
- data/lib/sass/error.rb +163 -25
- data/lib/sass/files.rb +31 -28
- data/lib/sass/plugin.rb +268 -87
- data/lib/sass/plugin/rails.rb +9 -4
- data/lib/sass/repl.rb +1 -1
- data/lib/sass/script.rb +31 -29
- data/lib/sass/script/bool.rb +1 -0
- data/lib/sass/script/color.rb +290 -23
- data/lib/sass/script/css_lexer.rb +22 -0
- data/lib/sass/script/css_parser.rb +28 -0
- data/lib/sass/script/funcall.rb +22 -3
- data/lib/sass/script/functions.rb +523 -33
- data/lib/sass/script/interpolation.rb +42 -0
- data/lib/sass/script/lexer.rb +169 -52
- data/lib/sass/script/literal.rb +58 -9
- data/lib/sass/script/node.rb +79 -1
- data/lib/sass/script/number.rb +20 -5
- data/lib/sass/script/operation.rb +49 -3
- data/lib/sass/script/parser.rb +162 -28
- data/lib/sass/script/string.rb +50 -2
- data/lib/sass/script/unary_operation.rb +25 -2
- data/lib/sass/script/variable.rb +21 -4
- data/lib/sass/scss.rb +14 -0
- data/lib/sass/scss/css_parser.rb +39 -0
- data/lib/sass/scss/parser.rb +683 -0
- data/lib/sass/scss/rx.rb +112 -0
- data/lib/sass/scss/script_lexer.rb +13 -0
- data/lib/sass/scss/script_parser.rb +25 -0
- data/lib/sass/tree/comment_node.rb +69 -27
- data/lib/sass/tree/debug_node.rb +7 -2
- data/lib/sass/tree/directive_node.rb +41 -35
- data/lib/sass/tree/for_node.rb +6 -0
- data/lib/sass/tree/if_node.rb +13 -1
- data/lib/sass/tree/import_node.rb +52 -27
- data/lib/sass/tree/mixin_def_node.rb +18 -0
- data/lib/sass/tree/mixin_node.rb +41 -6
- data/lib/sass/tree/node.rb +197 -70
- data/lib/sass/tree/prop_node.rb +152 -57
- data/lib/sass/tree/root_node.rb +118 -0
- data/lib/sass/tree/rule_node.rb +193 -96
- data/lib/sass/tree/variable_node.rb +9 -5
- data/lib/sass/tree/while_node.rb +4 -0
- data/test/benchmark.rb +5 -5
- data/test/haml/engine_test.rb +147 -10
- data/test/haml/{rhtml/_av_partial_1.rhtml → erb/_av_partial_1.erb} +1 -1
- data/test/haml/{rhtml/_av_partial_2.rhtml → erb/_av_partial_2.erb} +1 -1
- data/test/haml/{rhtml/action_view.rhtml → erb/action_view.erb} +1 -1
- data/test/haml/{rhtml/standard.rhtml → erb/standard.erb} +0 -0
- data/test/haml/helper_test.rb +91 -24
- data/test/haml/html2haml/erb_tests.rb +410 -0
- data/test/haml/html2haml_test.rb +210 -66
- data/test/haml/results/filters.xhtml +1 -1
- data/test/haml/results/just_stuff.xhtml +2 -0
- data/test/haml/spec_test.rb +44 -0
- data/test/haml/template_test.rb +22 -2
- data/test/haml/templates/helpers.haml +0 -13
- data/test/haml/templates/just_stuff.haml +2 -0
- data/test/haml/util_test.rb +48 -0
- data/test/sass/callbacks_test.rb +61 -0
- data/test/sass/conversion_test.rb +884 -0
- data/test/sass/css2sass_test.rb +99 -18
- data/test/sass/data/hsl-rgb.txt +319 -0
- data/test/sass/engine_test.rb +1049 -131
- data/test/sass/functions_test.rb +398 -47
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/more_templates/more_import.sass +3 -3
- data/test/sass/plugin_test.rb +184 -10
- data/test/sass/results/compact.css +1 -1
- data/test/sass/results/complex.css +5 -5
- data/test/sass/results/compressed.css +1 -1
- data/test/sass/results/expanded.css +1 -1
- data/test/sass/results/import.css +3 -1
- data/test/sass/results/mixins.css +12 -12
- data/test/sass/results/nested.css +1 -1
- data/test/sass/results/options.css +1 -0
- data/test/sass/results/parent_ref.css +4 -4
- data/test/sass/results/script.css +3 -3
- data/test/sass/results/scss_import.css +15 -0
- data/test/sass/results/scss_importee.css +2 -0
- data/test/sass/script_conversion_test.rb +153 -0
- data/test/sass/script_test.rb +137 -70
- data/test/sass/scss/css_test.rb +811 -0
- data/test/sass/scss/rx_test.rb +156 -0
- data/test/sass/scss/scss_test.rb +871 -0
- data/test/sass/scss/test_helper.rb +37 -0
- data/test/sass/templates/alt.sass +2 -2
- data/test/sass/templates/bork1.sass +2 -0
- data/test/sass/templates/bork3.sass +2 -0
- data/test/sass/templates/bork4.sass +2 -0
- data/test/sass/templates/import.sass +4 -4
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/line_numbers.sass +1 -1
- data/test/sass/templates/mixin_bork.sass +5 -0
- data/test/sass/templates/mixins.sass +2 -2
- data/test/sass/templates/nested_bork1.sass +2 -0
- data/test/sass/templates/nested_bork2.sass +2 -0
- data/test/sass/templates/nested_bork3.sass +2 -0
- data/test/sass/templates/nested_bork4.sass +2 -0
- data/test/sass/templates/nested_mixin_bork.sass +6 -0
- data/test/sass/templates/options.sass +2 -0
- data/test/sass/templates/parent_ref.sass +2 -2
- data/test/sass/templates/script.sass +69 -69
- data/test/sass/templates/scss_import.scss +10 -0
- data/test/sass/templates/scss_importee.scss +1 -0
- data/test/sass/templates/units.sass +10 -10
- data/test/test_helper.rb +20 -8
- data/vendor/fssm/LICENSE +20 -0
- data/vendor/fssm/README.markdown +55 -0
- data/vendor/fssm/Rakefile +59 -0
- data/vendor/fssm/VERSION.yml +5 -0
- data/vendor/fssm/example.rb +9 -0
- data/vendor/fssm/fssm.gemspec +77 -0
- data/vendor/fssm/lib/fssm.rb +33 -0
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
- data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
- data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
- data/vendor/fssm/lib/fssm/monitor.rb +26 -0
- data/vendor/fssm/lib/fssm/path.rb +91 -0
- data/vendor/fssm/lib/fssm/pathname.rb +502 -0
- data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
- data/vendor/fssm/lib/fssm/state/file.rb +24 -0
- data/vendor/fssm/lib/fssm/support.rb +63 -0
- data/vendor/fssm/lib/fssm/tree.rb +176 -0
- data/vendor/fssm/profile/prof-cache.rb +40 -0
- data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
- data/vendor/fssm/profile/prof-pathname.rb +68 -0
- data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
- data/vendor/fssm/profile/prof.html +2379 -0
- data/vendor/fssm/spec/path_spec.rb +75 -0
- 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 +14 -0
- metadata +94 -14
- data/test/sass/templates/bork.sass +0 -2
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -21,7 +21,7 @@ After you convert some HTML to Haml or some CSS to Sass,
|
|
21
21
|
you can run
|
22
22
|
|
23
23
|
haml document.haml
|
24
|
-
sass style.
|
24
|
+
sass style.scss
|
25
25
|
|
26
26
|
to compile them.
|
27
27
|
For more information on these commands, check out
|
@@ -129,171 +129,110 @@ like `if` and `while`:
|
|
129
129
|
= "Happy new " + "year!"
|
130
130
|
|
131
131
|
Haml provides far more tools than those presented here.
|
132
|
-
Check out the reference documentation
|
132
|
+
Check out the [reference documentation](http://beta.haml-lang.com/docs/yardoc/file.HAML_REFERENCE.md)
|
133
|
+
for full details.
|
133
134
|
|
134
|
-
|
135
|
-
|
136
|
-
At its most basic,
|
137
|
-
Sass is just another way of writing CSS.
|
138
|
-
Although it's very much like normal CSS,
|
139
|
-
the basic syntax offers a few helpful features:
|
140
|
-
indentation indicates the properties in a rule,
|
141
|
-
rather than non-DRY brackets;
|
142
|
-
and newlines indicate the end of a properties,
|
143
|
-
rather than a semicolon.
|
144
|
-
For example:
|
135
|
+
#### Indentation
|
145
136
|
|
146
|
-
|
147
|
-
|
148
|
-
|
137
|
+
Haml's indentation can be made up of one or more tabs or spaces.
|
138
|
+
However, indentation must be consistent within a given document.
|
139
|
+
Hard tabs and spaces can't be mixed,
|
140
|
+
and the same number of tabs or spaces must be used throughout.
|
149
141
|
|
150
|
-
|
142
|
+
### Sass
|
151
143
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
144
|
+
Sass is an extension of CSS
|
145
|
+
that adds power and elegance to the basic language.
|
146
|
+
It allows you to use [variables][vars], [nested rules][nested],
|
147
|
+
[mixins][mixins], [inline imports][imports],
|
148
|
+
and more, all with a fully CSS-compatible syntax.
|
149
|
+
Sass helps keep large stylesheets well-organized,
|
150
|
+
and get small stylesheets up and running quickly,
|
151
|
+
particularly with the help of
|
152
|
+
[the Compass style library](http://compass-style.org).
|
153
|
+
|
154
|
+
[vars]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.md#variables_
|
155
|
+
[nested]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.md#nested_rules_
|
156
|
+
[mixins]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
|
157
|
+
[imports]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.md#import
|
158
|
+
|
159
|
+
Sass has two syntaxes.
|
160
|
+
The one presented here, known as "SCSS" (for "Sassy CSS"),
|
161
|
+
is fully CSS-compatible.
|
162
|
+
The other (older) syntax, known as the indented syntax or just "Sass",
|
163
|
+
is whitespace-sensitive and indentation-based.
|
164
|
+
For more information, see the [reference documentation][syntax].
|
165
|
+
|
166
|
+
[syntax]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.md#syntax
|
167
|
+
|
168
|
+
To run the following examples and see the CSS they produce,
|
169
|
+
put them in a file called `test.scss` and run `sass test.scss`.
|
170
|
+
|
171
|
+
#### Nesting
|
172
|
+
|
173
|
+
Sass avoids repetition by nesting selectors within one another.
|
174
|
+
The same thing works for properties.
|
175
|
+
|
176
|
+
table.hl {
|
177
|
+
margin: 2em 0;
|
178
|
+
td.ln { text-align: right; }
|
173
179
|
}
|
174
|
-
#main p {
|
175
|
-
border-style: solid;
|
176
|
-
border-width: 1px;
|
177
|
-
border-color: #00f;
|
178
|
-
}
|
179
|
-
#main p a {
|
180
|
-
text-decoration: none;
|
181
|
-
font-weight: bold;
|
182
|
-
}
|
183
|
-
#main p a:hover {
|
184
|
-
text-decoration: underline;
|
185
|
-
}
|
186
|
-
|
187
|
-
becomes:
|
188
|
-
|
189
|
-
#main
|
190
|
-
width: 90%
|
191
|
-
p
|
192
|
-
border-style: solid
|
193
|
-
border-width: 1px
|
194
|
-
border-color: #00f
|
195
|
-
a
|
196
|
-
text-decoration: none
|
197
|
-
font-weight: bold
|
198
|
-
a:hover
|
199
|
-
text-decoration: underline
|
200
|
-
|
201
|
-
Pretty nice, no? Well, it gets better.
|
202
|
-
One of the main complaints against CSS is that it doesn't allow variables.
|
203
|
-
What if have a color or a width you re-use all the time?
|
204
|
-
In CSS, you just have to re-type it each time,
|
205
|
-
which is a nightmare when you decide to change it later.
|
206
|
-
Not so for Sass!
|
207
|
-
You can use the `!` character to set variables.
|
208
|
-
Then, if you put `=` after your property name,
|
209
|
-
you can set it to a variable.
|
210
|
-
For example:
|
211
|
-
|
212
|
-
!note_bg= #55aaff
|
213
180
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
becomes:
|
223
|
-
|
224
|
-
#main {
|
225
|
-
width: 70%; }
|
226
|
-
#main .note {
|
227
|
-
background-color: #55aaff; }
|
228
|
-
#main p {
|
229
|
-
width: 5em;
|
230
|
-
background-color: #55aaff; }
|
231
|
-
|
232
|
-
You can even do simple arithmetic operations with variables,
|
233
|
-
adding numbers and even colors together:
|
234
|
-
|
235
|
-
!main_bg= #46ar12
|
236
|
-
!main_width= 40em
|
237
|
-
|
238
|
-
#main
|
239
|
-
background-color = !main_bg
|
240
|
-
width = !main_width
|
241
|
-
.sidebar
|
242
|
-
background-color = !main_bg + #333333
|
243
|
-
width = !main_width - 25em
|
181
|
+
li {
|
182
|
+
font: {
|
183
|
+
family: serif;
|
184
|
+
weight: bold;
|
185
|
+
size: 1.2em;
|
186
|
+
}
|
187
|
+
}
|
244
188
|
|
245
|
-
|
189
|
+
#### Variables
|
246
190
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
#main .sidebar {
|
251
|
-
background-color: #79d645;
|
252
|
-
width: 15em; }
|
191
|
+
Use the same color all over the place?
|
192
|
+
Need to do some math with height and width and text size?
|
193
|
+
Sass supports variables, math operations, and many useful functions.
|
253
194
|
|
254
|
-
|
255
|
-
|
256
|
-
directive and then include those anywhere you want:
|
195
|
+
$blue: #3bbfce;
|
196
|
+
$margin: 16px;
|
257
197
|
|
258
|
-
|
259
|
-
border:
|
260
|
-
|
261
|
-
|
262
|
-
style: dotted
|
198
|
+
.content_navigation {
|
199
|
+
border-color: $blue;
|
200
|
+
color: darken($blue, 10%);
|
201
|
+
}
|
263
202
|
|
264
|
-
.
|
265
|
-
|
266
|
-
|
267
|
-
|
203
|
+
.border {
|
204
|
+
padding: $margin / 2;
|
205
|
+
margin: $margin / 2;
|
206
|
+
border-color: $blue;
|
207
|
+
}
|
268
208
|
|
269
|
-
|
270
|
-
+blue-border
|
209
|
+
#### Mixins
|
271
210
|
|
272
|
-
|
211
|
+
Even more powerful than variables,
|
212
|
+
mixins allow you to re-use whole chunks of CSS,
|
213
|
+
properties or selectors.
|
214
|
+
You can even give them arguments.
|
273
215
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
216
|
+
@mixin table-scaffolding {
|
217
|
+
th {
|
218
|
+
text-align: center;
|
219
|
+
font-weight: bold;
|
220
|
+
}
|
221
|
+
td, th { padding: 2px; }
|
280
222
|
}
|
281
223
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
border-style: dotted;
|
224
|
+
@mixin left($dist) {
|
225
|
+
float: left;
|
226
|
+
margin-left: $dist;
|
286
227
|
}
|
287
228
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
229
|
+
#data {
|
230
|
+
@include left(10px);
|
231
|
+
@include table-scaffolding;
|
232
|
+
}
|
292
233
|
|
293
|
-
|
294
|
-
|
295
|
-
Hard tabs and spaces can't be mixed,
|
296
|
-
and the same number of tabs or spaces must be used throughout.
|
234
|
+
A comprehensive list of features is available
|
235
|
+
in the [Sass reference](http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.md).
|
297
236
|
|
298
237
|
## Executables
|
299
238
|
|
@@ -318,11 +257,12 @@ Since HTML is so variable, this transformation is not always perfect;
|
|
318
257
|
it's a good idea to have a human check the output of this tool.
|
319
258
|
See `html2haml --help` for further information and options.
|
320
259
|
|
321
|
-
### `
|
260
|
+
### `sass-convert`
|
322
261
|
|
323
|
-
The `
|
324
|
-
|
325
|
-
|
262
|
+
The `sass-convert` executable converts between CSS, Sass, and SCSS.
|
263
|
+
When converting from CSS to Sass or SCSS,
|
264
|
+
nesting is applied where appropriate.
|
265
|
+
See `sass-convert --help` for further information and options.
|
326
266
|
|
327
267
|
## Authors
|
328
268
|
|
data/REMEMBER
CHANGED
@@ -1,2 +1,12 @@
|
|
1
|
+
Deprecate .foo& in stable
|
2
|
+
Make .#{} work in extend
|
3
|
+
Test newly-invalid selectors, including post-resolution parse errors in Sass
|
1
4
|
Be smart about default namespaces (http://www.w3.org/TR/css3-namespace/#declaration)
|
2
|
-
|
5
|
+
Don't conflict with Object#extend.
|
6
|
+
|
7
|
+
http://camendesign.com/design/ provides some interesting formatting and nesting issues for sass-convert
|
8
|
+
Charles Roper's example code for media queries doesn't fare well in css2sass either
|
9
|
+
|
10
|
+
Handle unicode escapes (and other escapes?) gracefully in script idents with sass-convert
|
11
|
+
Add period to SCSS syntax errors?
|
12
|
+
Better #{} in prop names
|
data/Rakefile
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
1
|
# ----- Utility Functions -----
|
5
2
|
|
6
3
|
def scope(path)
|
@@ -66,13 +63,14 @@ task :revision_file do
|
|
66
63
|
end
|
67
64
|
end
|
68
65
|
Rake::Task[:package].prerequisites.insert(0, :revision_file)
|
66
|
+
Rake::Task[:package].prerequisites.insert(0, :submodules)
|
69
67
|
|
70
68
|
# We also need to get rid of this file after packaging.
|
71
69
|
at_exit { File.delete(scope('REVISION')) rescue nil }
|
72
70
|
|
73
71
|
desc "Install Haml as a gem."
|
74
72
|
task :install => [:package] do
|
75
|
-
sudo = RUBY_PLATFORM =~ /win32
|
73
|
+
sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
|
76
74
|
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
|
77
75
|
sh %{#{sudo} #{gem} install --no-ri pkg/haml-#{File.read(scope('VERSION')).strip}}
|
78
76
|
end
|
@@ -94,6 +92,7 @@ task :release_elpa do
|
|
94
92
|
require 'time'
|
95
93
|
require scope('lib/haml')
|
96
94
|
|
95
|
+
next if Haml.version[:prerelease]
|
97
96
|
version = Haml.version[:number]
|
98
97
|
|
99
98
|
haml_unchanged = mode_unchanged?(:haml, version)
|
@@ -171,6 +170,18 @@ def mode_unchanged?(mode, version)
|
|
171
170
|
return false
|
172
171
|
end
|
173
172
|
|
173
|
+
task :submodules do
|
174
|
+
if File.exist?(File.dirname(__FILE__) + "/.git")
|
175
|
+
sh %{git submodule sync}
|
176
|
+
sh %{git submodule update --init}
|
177
|
+
elsif !File.exist?(File.dirname(__FILE__) + "/vendor/fssm/lib")
|
178
|
+
warn <<WARN
|
179
|
+
WARNING: vendor/fssm doesn't exist, and this isn't a git repository so
|
180
|
+
I can't get it automatically!
|
181
|
+
WARN
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
174
185
|
task :release_edge do
|
175
186
|
ensure_git_cleanup do
|
176
187
|
puts "#{'=' * 50} Running rake release_edge"
|
@@ -205,8 +216,8 @@ task :release_edge do
|
|
205
216
|
sh %{rake package}
|
206
217
|
sh %{git checkout VERSION}
|
207
218
|
|
208
|
-
sh %{rubyforge login}
|
209
219
|
sh %{rubyforge add_release haml haml-edge "Bleeding Edge (v#{edge_version})" pkg/haml-edge-#{edge_version}.gem}
|
220
|
+
sh %{gem push pkg/haml-edge-#{edge_version}.gem}
|
210
221
|
end
|
211
222
|
end
|
212
223
|
|
@@ -226,7 +237,7 @@ end
|
|
226
237
|
begin
|
227
238
|
require 'yard'
|
228
239
|
|
229
|
-
namespace :
|
240
|
+
namespace :yard do
|
230
241
|
task :sass do
|
231
242
|
require scope('lib/sass')
|
232
243
|
Dir[scope("yard/default/**/*.sass")].each do |sass|
|
@@ -235,27 +246,12 @@ begin
|
|
235
246
|
end
|
236
247
|
end
|
237
248
|
end
|
238
|
-
|
239
|
-
desc "List all undocumented methods and classes."
|
240
|
-
task :undocumented do
|
241
|
-
opts = ENV["YARD_OPTS"] || ""
|
242
|
-
ENV["YARD_OPTS"] = opts.dup + <<OPTS
|
243
|
-
--list --query "
|
244
|
-
object.docstring.blank? &&
|
245
|
-
!(object.type == :method && object.is_alias?)"
|
246
|
-
OPTS
|
247
|
-
Rake::Task['yard'].execute
|
248
|
-
end
|
249
249
|
end
|
250
250
|
|
251
251
|
YARD::Rake::YardocTask.new do |t|
|
252
252
|
t.files = FileList.new(scope('lib/**/*.rb')) do |list|
|
253
253
|
list.exclude('lib/haml/template/*.rb')
|
254
|
-
list.exclude('lib/haml/railtie.rb')
|
255
254
|
list.exclude('lib/haml/helpers/action_view_mods.rb')
|
256
|
-
list.exclude('lib/haml/helpers/xss_mods.rb')
|
257
|
-
list.exclude('lib/sass/plugin/merb.rb')
|
258
|
-
list.exclude('lib/sass/plugin/rails.rb')
|
259
255
|
end.to_a
|
260
256
|
t.options << '--incremental' if Rake.application.top_level_tasks.include?('redoc')
|
261
257
|
t.options += FileList.new(scope('yard/*.rb')).to_a.map {|f| ['-e', f]}.flatten
|
@@ -263,15 +259,8 @@ OPTS
|
|
263
259
|
t.options << '--files' << files.join(',')
|
264
260
|
t.options << '--template-path' << scope('yard')
|
265
261
|
t.options << '--title' << ENV["YARD_TITLE"] if ENV["YARD_TITLE"]
|
266
|
-
|
267
|
-
t.before = lambda do
|
268
|
-
if ENV["YARD_OPTS"]
|
269
|
-
require 'shellwords'
|
270
|
-
t.options.concat(Shellwords.shellwords(ENV["YARD_OPTS"]))
|
271
|
-
end
|
272
|
-
end
|
273
262
|
end
|
274
|
-
Rake::Task['yard'].prerequisites.insert(0, '
|
263
|
+
Rake::Task['yard'].prerequisites.insert(0, 'yard:sass')
|
275
264
|
Rake::Task['yard'].instance_variable_set('@comment', nil)
|
276
265
|
|
277
266
|
desc "Generate Documentation"
|
@@ -290,8 +279,18 @@ task :pages do
|
|
290
279
|
sh %{git checkout #{proj}-pages}
|
291
280
|
sh %{git reset --hard origin/#{proj}-pages}
|
292
281
|
|
293
|
-
|
294
|
-
|
282
|
+
Dir.chdir("/var/www/#{proj}-pages") do
|
283
|
+
sh %{git fetch origin}
|
284
|
+
|
285
|
+
sh %{git checkout stable}
|
286
|
+
sh %{git reset --hard origin/stable}
|
287
|
+
|
288
|
+
sh %{git checkout #{proj}-pages}
|
289
|
+
sh %{git reset --hard origin/#{proj}-pages}
|
290
|
+
sh %{rake build --trace}
|
291
|
+
sh %{mkdir -p tmp}
|
292
|
+
sh %{touch tmp/restart.txt}
|
293
|
+
end
|
295
294
|
end
|
296
295
|
end
|
297
296
|
|
@@ -386,8 +385,22 @@ end
|
|
386
385
|
|
387
386
|
# ----- Handling Updates -----
|
388
387
|
|
389
|
-
def
|
388
|
+
def email_on_error
|
390
389
|
yield
|
390
|
+
rescue Exception => e
|
391
|
+
IO.popen("sendmail nex342@gmail.com", "w") do |sm|
|
392
|
+
sm << "From: nex3@nex-3.com\n" <<
|
393
|
+
"To: nex342@gmail.com\n" <<
|
394
|
+
"Subject: Exception when running rake #{Rake.application.top_level_tasks.join(', ')}\n" <<
|
395
|
+
e.message << "\n\n" <<
|
396
|
+
e.backtrace.join("\n")
|
397
|
+
end
|
398
|
+
ensure
|
399
|
+
raise e if e
|
400
|
+
end
|
401
|
+
|
402
|
+
def ensure_git_cleanup
|
403
|
+
email_on_error {yield}
|
391
404
|
ensure
|
392
405
|
sh %{git reset --hard HEAD}
|
393
406
|
sh %{git clean -xdf}
|
@@ -395,29 +408,34 @@ ensure
|
|
395
408
|
end
|
396
409
|
|
397
410
|
task :handle_update do
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
411
|
+
email_on_error do
|
412
|
+
unless ENV["REF"] =~ %r{^refs/heads/(master|stable|(?:haml|sass)-pages)$}
|
413
|
+
puts "#{'=' * 20} Ignoring rake handle_update REF=#{ENV["REF"].inspect}"
|
414
|
+
next
|
415
|
+
end
|
416
|
+
branch = $1
|
417
|
+
|
418
|
+
puts
|
419
|
+
puts
|
420
|
+
puts '=' * 150
|
421
|
+
puts "Running rake handle_update REF=#{ENV["REF"].inspect}"
|
422
|
+
|
423
|
+
sh %{git fetch origin}
|
424
|
+
sh %{git checkout stable}
|
425
|
+
sh %{git reset --hard origin/stable}
|
426
|
+
sh %{git checkout master}
|
427
|
+
sh %{git reset --hard origin/master}
|
428
|
+
|
429
|
+
if branch == "master"
|
430
|
+
sh %{rake release_edge --trace}
|
431
|
+
elsif branch == "stable"
|
432
|
+
sh %{rake pages --trace PROJ=haml}
|
433
|
+
sh %{rake pages --trace PROJ=sass}
|
434
|
+
elsif branch =~ /^(haml|sass)-pages$/
|
435
|
+
sh %{rake pages --trace PROJ=#{$1}}
|
436
|
+
end
|
408
437
|
|
409
|
-
|
410
|
-
|
411
|
-
sh %{git reset --hard origin/master}
|
412
|
-
|
413
|
-
if branch == "master"
|
414
|
-
sh %{rake release_edge --trace}
|
415
|
-
sh %{rake pages --trace PROJ=haml}
|
416
|
-
sh %{rake pages --trace PROJ=sass}
|
417
|
-
elsif branch =~ /^(haml|sass)-pages$/
|
418
|
-
sh %{rake pages --trace PROJ=#{$1}}
|
438
|
+
puts 'Done running handle_update'
|
439
|
+
puts '=' * 150
|
419
440
|
end
|
420
|
-
|
421
|
-
puts 'Done running handle_update'
|
422
|
-
puts '=' * 150
|
423
441
|
end
|