haml_ejs 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +11 -0
- data/CONTRIBUTING +3 -0
- data/MIT-LICENSE +20 -0
- data/README.md +68 -0
- data/Rakefile +419 -0
- data/VERSION +1 -0
- data/VERSION_NAME +1 -0
- data/bin/haml +9 -0
- data/bin/html2haml +7 -0
- data/extra/update_watch.rb +13 -0
- data/init.rb +18 -0
- data/lib/haml.rb +49 -0
- data/lib/haml/buffer.rb +297 -0
- data/lib/haml/compiler.rb +486 -0
- data/lib/haml/engine.rb +312 -0
- data/lib/haml/error.rb +22 -0
- data/lib/haml/exec.rb +362 -0
- data/lib/haml/filters.rb +388 -0
- data/lib/haml/haml_ejs.rb +57 -0
- data/lib/haml/helpers.rb +608 -0
- data/lib/haml/helpers/action_view_extensions.rb +57 -0
- data/lib/haml/helpers/action_view_mods.rb +257 -0
- data/lib/haml/helpers/xss_mods.rb +165 -0
- data/lib/haml/html.rb +412 -0
- data/lib/haml/html/erb.rb +141 -0
- data/lib/haml/parser.rb +760 -0
- data/lib/haml/railtie.rb +19 -0
- data/lib/haml/root.rb +7 -0
- data/lib/haml/shared.rb +78 -0
- data/lib/haml/template.rb +99 -0
- data/lib/haml/template/options.rb +16 -0
- data/lib/haml/template/patch.rb +58 -0
- data/lib/haml/template/plugin.rb +123 -0
- data/lib/haml/util.rb +842 -0
- data/lib/haml/version.rb +109 -0
- data/lib/sass.rb +8 -0
- data/lib/sass/plugin.rb +10 -0
- data/lib/sass/rails2_shim.rb +9 -0
- data/lib/sass/rails3_shim.rb +16 -0
- data/rails/init.rb +1 -0
- data/test/benchmark.rb +91 -0
- data/test/gemfiles/Gemfile.rails-2.0.x +8 -0
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +38 -0
- data/test/gemfiles/Gemfile.rails-2.1.x +8 -0
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +38 -0
- data/test/gemfiles/Gemfile.rails-2.2.x +8 -0
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +38 -0
- data/test/gemfiles/Gemfile.rails-2.3.x +8 -0
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +40 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +8 -0
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +85 -0
- data/test/gemfiles/Gemfile.rails-3.1.x +8 -0
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +98 -0
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +9 -0
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +42 -0
- data/test/haml-ejs/haml-ejs_test.rb +22 -0
- data/test/haml-ejs/templates/conditional.input +3 -0
- data/test/haml-ejs/templates/conditional.output +3 -0
- data/test/haml-ejs/templates/conditional_and_interpolation.input +2 -0
- data/test/haml-ejs/templates/conditional_and_interpolation.output +3 -0
- data/test/haml-ejs/templates/conditional_else.input +5 -0
- data/test/haml-ejs/templates/conditional_else.output +5 -0
- data/test/haml-ejs/templates/conditional_else_elsif.input +7 -0
- data/test/haml-ejs/templates/conditional_else_elsif.output +7 -0
- data/test/haml-ejs/templates/conditional_elsif.input +5 -0
- data/test/haml-ejs/templates/conditional_elsif.output +5 -0
- data/test/haml-ejs/templates/conditional_unless.input +3 -0
- data/test/haml-ejs/templates/conditional_unless.output +3 -0
- data/test/haml-ejs/templates/conditional_unless_else.input +5 -0
- data/test/haml-ejs/templates/conditional_unless_else.output +5 -0
- data/test/haml-ejs/templates/conditional_unless_elsif_else.input +5 -0
- data/test/haml-ejs/templates/conditional_unless_elsif_else.output +5 -0
- data/test/haml-ejs/templates/interpolation.input +2 -0
- data/test/haml-ejs/templates/interpolation.output +1 -0
- data/test/haml-ejs/templates/iteration.input +2 -0
- data/test/haml-ejs/templates/iteration.output +3 -0
- data/test/haml-ejs/templates/suite.input +26 -0
- data/test/haml-ejs/templates/suite.output +27 -0
- data/test/haml/engine_test.rb +1925 -0
- data/test/haml/erb/_av_partial_1.erb +12 -0
- data/test/haml/erb/_av_partial_2.erb +8 -0
- data/test/haml/erb/action_view.erb +62 -0
- data/test/haml/erb/standard.erb +55 -0
- data/test/haml/helper_test.rb +454 -0
- data/test/haml/html2haml/erb_tests.rb +440 -0
- data/test/haml/html2haml_test.rb +336 -0
- data/test/haml/markaby/standard.mab +52 -0
- data/test/haml/mocks/article.rb +6 -0
- data/test/haml/results/content_for_layout.xhtml +12 -0
- data/test/haml/results/eval_suppressed.xhtml +9 -0
- data/test/haml/results/filters.xhtml +62 -0
- data/test/haml/results/helpers.xhtml +70 -0
- data/test/haml/results/helpful.xhtml +10 -0
- data/test/haml/results/just_stuff.xhtml +70 -0
- data/test/haml/results/list.xhtml +12 -0
- data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
- data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
- data/test/haml/results/original_engine.xhtml +20 -0
- data/test/haml/results/partial_layout.xhtml +5 -0
- data/test/haml/results/partials.xhtml +21 -0
- data/test/haml/results/render_layout.xhtml +3 -0
- data/test/haml/results/silent_script.xhtml +74 -0
- data/test/haml/results/standard.xhtml +162 -0
- data/test/haml/results/tag_parsing.xhtml +23 -0
- data/test/haml/results/very_basic.xhtml +5 -0
- data/test/haml/results/whitespace_handling.xhtml +89 -0
- data/test/haml/spec/README.md +97 -0
- data/test/haml/spec/lua_haml_spec.lua +30 -0
- data/test/haml/spec/ruby_haml_test.rb +19 -0
- data/test/haml/spec/tests.json +534 -0
- data/test/haml/spec_test.rb +44 -0
- data/test/haml/template_test.rb +419 -0
- data/test/haml/templates/_av_partial_1.haml +9 -0
- data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
- data/test/haml/templates/_av_partial_2.haml +5 -0
- data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
- data/test/haml/templates/_layout.erb +3 -0
- data/test/haml/templates/_layout_for_partial.haml +3 -0
- data/test/haml/templates/_partial.haml +8 -0
- data/test/haml/templates/_text_area.haml +3 -0
- data/test/haml/templates/action_view.haml +47 -0
- data/test/haml/templates/action_view_ugly.haml +47 -0
- data/test/haml/templates/breakage.haml +8 -0
- data/test/haml/templates/content_for_layout.haml +8 -0
- data/test/haml/templates/eval_suppressed.haml +11 -0
- data/test/haml/templates/filters.haml +66 -0
- data/test/haml/templates/helpers.haml +55 -0
- data/test/haml/templates/helpful.haml +11 -0
- data/test/haml/templates/just_stuff.haml +85 -0
- data/test/haml/templates/list.haml +12 -0
- data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
- data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
- data/test/haml/templates/original_engine.haml +17 -0
- data/test/haml/templates/partial_layout.haml +10 -0
- data/test/haml/templates/partialize.haml +1 -0
- data/test/haml/templates/partials.haml +12 -0
- data/test/haml/templates/render_layout.haml +2 -0
- data/test/haml/templates/silent_script.haml +40 -0
- data/test/haml/templates/standard.haml +43 -0
- data/test/haml/templates/standard_ugly.haml +43 -0
- data/test/haml/templates/tag_parsing.haml +21 -0
- data/test/haml/templates/very_basic.haml +4 -0
- data/test/haml/templates/whitespace_handling.haml +87 -0
- data/test/haml/util_test.rb +300 -0
- data/test/linked_rails.rb +42 -0
- data/test/test_helper.rb +75 -0
- data/vendor/sass/CONTRIBUTING +3 -0
- data/vendor/sass/MIT-LICENSE +20 -0
- data/vendor/sass/README.md +201 -0
- data/vendor/sass/Rakefile +339 -0
- data/vendor/sass/TODO +39 -0
- data/vendor/sass/VERSION +1 -0
- data/vendor/sass/VERSION_NAME +1 -0
- data/vendor/sass/bin/sass +8 -0
- data/vendor/sass/bin/sass-convert +7 -0
- data/vendor/sass/bin/scss +8 -0
- data/vendor/sass/doc-src/FAQ.md +35 -0
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +210 -0
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +2214 -0
- data/vendor/sass/doc-src/SASS_REFERENCE.md +1957 -0
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +155 -0
- data/vendor/sass/ext/extconf.rb +10 -0
- data/vendor/sass/extra/update_watch.rb +13 -0
- data/vendor/sass/init.rb +18 -0
- data/vendor/sass/lib/sass.rb +72 -0
- data/vendor/sass/lib/sass/cache_stores.rb +15 -0
- data/vendor/sass/lib/sass/cache_stores/base.rb +84 -0
- data/vendor/sass/lib/sass/cache_stores/chain.rb +33 -0
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +58 -0
- data/vendor/sass/lib/sass/cache_stores/memory.rb +47 -0
- data/vendor/sass/lib/sass/cache_stores/null.rb +25 -0
- data/vendor/sass/lib/sass/callbacks.rb +66 -0
- data/vendor/sass/lib/sass/css.rb +294 -0
- data/vendor/sass/lib/sass/engine.rb +862 -0
- data/vendor/sass/lib/sass/environment.rb +155 -0
- data/vendor/sass/lib/sass/error.rb +201 -0
- data/vendor/sass/lib/sass/exec.rb +659 -0
- data/vendor/sass/lib/sass/importers.rb +22 -0
- data/vendor/sass/lib/sass/importers/base.rb +138 -0
- data/vendor/sass/lib/sass/importers/filesystem.rb +144 -0
- data/vendor/sass/lib/sass/less.rb +382 -0
- data/vendor/sass/lib/sass/plugin.rb +136 -0
- data/vendor/sass/lib/sass/plugin/compiler.rb +358 -0
- data/vendor/sass/lib/sass/plugin/configuration.rb +125 -0
- data/vendor/sass/lib/sass/plugin/generic.rb +15 -0
- data/vendor/sass/lib/sass/plugin/merb.rb +48 -0
- data/vendor/sass/lib/sass/plugin/rack.rb +60 -0
- data/vendor/sass/lib/sass/plugin/rails.rb +47 -0
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +173 -0
- data/vendor/sass/lib/sass/railtie.rb +9 -0
- data/vendor/sass/lib/sass/repl.rb +58 -0
- data/vendor/sass/lib/sass/root.rb +7 -0
- data/vendor/sass/lib/sass/script.rb +40 -0
- data/vendor/sass/lib/sass/script/bool.rb +18 -0
- data/vendor/sass/lib/sass/script/color.rb +480 -0
- data/vendor/sass/lib/sass/script/css_lexer.rb +29 -0
- data/vendor/sass/lib/sass/script/css_parser.rb +31 -0
- data/vendor/sass/lib/sass/script/funcall.rb +162 -0
- data/vendor/sass/lib/sass/script/functions.rb +1343 -0
- data/vendor/sass/lib/sass/script/interpolation.rb +70 -0
- data/vendor/sass/lib/sass/script/lexer.rb +334 -0
- data/vendor/sass/lib/sass/script/list.rb +76 -0
- data/vendor/sass/lib/sass/script/literal.rb +245 -0
- data/vendor/sass/lib/sass/script/node.rb +91 -0
- data/vendor/sass/lib/sass/script/number.rb +429 -0
- data/vendor/sass/lib/sass/script/operation.rb +91 -0
- data/vendor/sass/lib/sass/script/parser.rb +467 -0
- data/vendor/sass/lib/sass/script/string.rb +51 -0
- data/vendor/sass/lib/sass/script/string_interpolation.rb +94 -0
- data/vendor/sass/lib/sass/script/unary_operation.rb +57 -0
- data/vendor/sass/lib/sass/script/variable.rb +54 -0
- data/vendor/sass/lib/sass/scss.rb +17 -0
- data/vendor/sass/lib/sass/scss/css_parser.rb +46 -0
- data/vendor/sass/lib/sass/scss/parser.rb +920 -0
- data/vendor/sass/lib/sass/scss/rx.rb +127 -0
- data/vendor/sass/lib/sass/scss/sass_parser.rb +11 -0
- data/vendor/sass/lib/sass/scss/script_lexer.rb +15 -0
- data/vendor/sass/lib/sass/scss/script_parser.rb +25 -0
- data/vendor/sass/lib/sass/scss/static_parser.rb +40 -0
- data/vendor/sass/lib/sass/selector.rb +361 -0
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +62 -0
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +81 -0
- data/vendor/sass/lib/sass/selector/sequence.rb +233 -0
- data/vendor/sass/lib/sass/selector/simple.rb +113 -0
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +134 -0
- data/vendor/sass/lib/sass/shared.rb +78 -0
- data/vendor/sass/lib/sass/tree/charset_node.rb +22 -0
- data/vendor/sass/lib/sass/tree/comment_node.rb +77 -0
- data/vendor/sass/lib/sass/tree/debug_node.rb +18 -0
- data/vendor/sass/lib/sass/tree/directive_node.rb +23 -0
- data/vendor/sass/lib/sass/tree/each_node.rb +24 -0
- data/vendor/sass/lib/sass/tree/extend_node.rb +29 -0
- data/vendor/sass/lib/sass/tree/for_node.rb +36 -0
- data/vendor/sass/lib/sass/tree/function_node.rb +27 -0
- data/vendor/sass/lib/sass/tree/if_node.rb +65 -0
- data/vendor/sass/lib/sass/tree/import_node.rb +68 -0
- data/vendor/sass/lib/sass/tree/media_node.rb +32 -0
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +27 -0
- data/vendor/sass/lib/sass/tree/mixin_node.rb +32 -0
- data/vendor/sass/lib/sass/tree/node.rb +204 -0
- data/vendor/sass/lib/sass/tree/prop_node.rb +155 -0
- data/vendor/sass/lib/sass/tree/return_node.rb +18 -0
- data/vendor/sass/lib/sass/tree/root_node.rb +28 -0
- data/vendor/sass/lib/sass/tree/rule_node.rb +129 -0
- data/vendor/sass/lib/sass/tree/variable_node.rb +30 -0
- data/vendor/sass/lib/sass/tree/visitors/base.rb +75 -0
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +134 -0
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +255 -0
- data/vendor/sass/lib/sass/tree/visitors/cssize.rb +175 -0
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +301 -0
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +216 -0
- data/vendor/sass/lib/sass/tree/warn_node.rb +18 -0
- data/vendor/sass/lib/sass/tree/while_node.rb +18 -0
- data/vendor/sass/lib/sass/util.rb +669 -0
- data/vendor/sass/lib/sass/util/subset_map.rb +101 -0
- data/vendor/sass/lib/sass/version.rb +112 -0
- data/vendor/sass/rails/init.rb +1 -0
- data/vendor/sass/sass.gemspec +32 -0
- data/vendor/sass/test/sass/cache_test.rb +74 -0
- data/vendor/sass/test/sass/callbacks_test.rb +61 -0
- data/vendor/sass/test/sass/conversion_test.rb +1203 -0
- data/vendor/sass/test/sass/css2sass_test.rb +364 -0
- data/vendor/sass/test/sass/data/hsl-rgb.txt +319 -0
- data/vendor/sass/test/sass/engine_test.rb +2469 -0
- data/vendor/sass/test/sass/extend_test.rb +1348 -0
- data/vendor/sass/test/sass/functions_test.rb +1025 -0
- data/vendor/sass/test/sass/importer_test.rb +82 -0
- data/vendor/sass/test/sass/less_conversion_test.rb +653 -0
- data/vendor/sass/test/sass/mock_importer.rb +49 -0
- data/vendor/sass/test/sass/more_results/more1.css +9 -0
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/vendor/sass/test/sass/more_results/more_import.css +29 -0
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +2 -0
- data/vendor/sass/test/sass/more_templates/more1.sass +23 -0
- data/vendor/sass/test/sass/more_templates/more_import.sass +11 -0
- data/vendor/sass/test/sass/plugin_test.rb +469 -0
- data/vendor/sass/test/sass/results/alt.css +4 -0
- data/vendor/sass/test/sass/results/basic.css +9 -0
- data/vendor/sass/test/sass/results/compact.css +5 -0
- data/vendor/sass/test/sass/results/complex.css +86 -0
- data/vendor/sass/test/sass/results/compressed.css +1 -0
- data/vendor/sass/test/sass/results/expanded.css +19 -0
- data/vendor/sass/test/sass/results/if.css +3 -0
- data/vendor/sass/test/sass/results/import.css +31 -0
- data/vendor/sass/test/sass/results/import_charset.css +4 -0
- data/vendor/sass/test/sass/results/import_charset_1_8.css +4 -0
- data/vendor/sass/test/sass/results/import_charset_ibm866.css +4 -0
- data/vendor/sass/test/sass/results/line_numbers.css +49 -0
- data/vendor/sass/test/sass/results/mixins.css +95 -0
- data/vendor/sass/test/sass/results/multiline.css +24 -0
- data/vendor/sass/test/sass/results/nested.css +22 -0
- data/vendor/sass/test/sass/results/options.css +1 -0
- data/vendor/sass/test/sass/results/parent_ref.css +13 -0
- data/vendor/sass/test/sass/results/script.css +16 -0
- data/vendor/sass/test/sass/results/scss_import.css +31 -0
- data/vendor/sass/test/sass/results/scss_importee.css +2 -0
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/vendor/sass/test/sass/results/subdir/subdir.css +3 -0
- data/vendor/sass/test/sass/results/units.css +11 -0
- data/vendor/sass/test/sass/results/warn.css +0 -0
- data/vendor/sass/test/sass/results/warn_imported.css +0 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +283 -0
- data/vendor/sass/test/sass/script_test.rb +496 -0
- data/vendor/sass/test/sass/scss/css_test.rb +916 -0
- data/vendor/sass/test/sass/scss/rx_test.rb +156 -0
- data/vendor/sass/test/sass/scss/scss_test.rb +1249 -0
- data/vendor/sass/test/sass/scss/test_helper.rb +37 -0
- data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +4 -0
- data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +4 -0
- data/vendor/sass/test/sass/templates/_partial.sass +2 -0
- data/vendor/sass/test/sass/templates/alt.sass +16 -0
- data/vendor/sass/test/sass/templates/basic.sass +23 -0
- data/vendor/sass/test/sass/templates/bork1.sass +2 -0
- data/vendor/sass/test/sass/templates/bork2.sass +2 -0
- data/vendor/sass/test/sass/templates/bork3.sass +2 -0
- data/vendor/sass/test/sass/templates/bork4.sass +2 -0
- data/vendor/sass/test/sass/templates/compact.sass +17 -0
- data/vendor/sass/test/sass/templates/complex.sass +305 -0
- data/vendor/sass/test/sass/templates/compressed.sass +15 -0
- data/vendor/sass/test/sass/templates/expanded.sass +17 -0
- data/vendor/sass/test/sass/templates/if.sass +11 -0
- data/vendor/sass/test/sass/templates/import.sass +12 -0
- data/vendor/sass/test/sass/templates/import_charset.sass +7 -0
- data/vendor/sass/test/sass/templates/import_charset_1_8.sass +4 -0
- data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +9 -0
- data/vendor/sass/test/sass/templates/importee.less +2 -0
- data/vendor/sass/test/sass/templates/importee.sass +19 -0
- data/vendor/sass/test/sass/templates/line_numbers.sass +13 -0
- data/vendor/sass/test/sass/templates/mixin_bork.sass +5 -0
- data/vendor/sass/test/sass/templates/mixins.sass +76 -0
- data/vendor/sass/test/sass/templates/multiline.sass +20 -0
- data/vendor/sass/test/sass/templates/nested.sass +25 -0
- data/vendor/sass/test/sass/templates/nested_bork1.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_bork2.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_bork3.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_bork4.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_import.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +6 -0
- data/vendor/sass/test/sass/templates/options.sass +2 -0
- data/vendor/sass/test/sass/templates/parent_ref.sass +25 -0
- data/vendor/sass/test/sass/templates/script.sass +101 -0
- data/vendor/sass/test/sass/templates/scss_import.scss +11 -0
- data/vendor/sass/test/sass/templates/scss_importee.scss +1 -0
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +6 -0
- data/vendor/sass/test/sass/templates/units.sass +11 -0
- data/vendor/sass/test/sass/templates/warn.sass +3 -0
- data/vendor/sass/test/sass/templates/warn_imported.sass +4 -0
- data/vendor/sass/test/sass/test_helper.rb +8 -0
- data/vendor/sass/test/sass/util/subset_map_test.rb +91 -0
- data/vendor/sass/test/sass/util_test.rb +254 -0
- data/vendor/sass/test/test_helper.rb +69 -0
- data/vendor/sass/yard/callbacks.rb +29 -0
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +26 -0
- data/vendor/sass/yard/default/layout/html/footer.erb +12 -0
- data/vendor/sass/yard/inherited_hash.rb +41 -0
- metadata +458 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
# allows testing with edge Rails by creating a test/rails symlink
|
2
|
+
linked_rails = File.dirname(__FILE__) + '/rails'
|
3
|
+
|
4
|
+
if File.exists?(linked_rails) && !$:.include?(linked_rails + '/activesupport/lib')
|
5
|
+
puts "[ using linked Rails ]"
|
6
|
+
$:.unshift linked_rails + '/activesupport/lib'
|
7
|
+
$:.unshift linked_rails + '/actionpack/lib'
|
8
|
+
$:.unshift linked_rails + '/railties/lib'
|
9
|
+
end
|
10
|
+
require 'rubygems'
|
11
|
+
require 'action_pack'
|
12
|
+
require 'action_controller'
|
13
|
+
require 'action_view'
|
14
|
+
|
15
|
+
if ActionPack::VERSION::MAJOR >= 3
|
16
|
+
# Necessary for Rails 3
|
17
|
+
require 'rails'
|
18
|
+
else
|
19
|
+
# Necessary for Rails 2.3.*
|
20
|
+
require 'initializer'
|
21
|
+
end
|
22
|
+
|
23
|
+
if defined?(Rails::Application) # Rails 3
|
24
|
+
class TestApp < Rails::Application
|
25
|
+
config.root = File.join(File.dirname(__FILE__), "../..")
|
26
|
+
end
|
27
|
+
Rails.application = TestApp
|
28
|
+
elsif defined?(RAILS_ROOT)
|
29
|
+
RAILS_ROOT.replace(File.join(File.dirname(__FILE__), "../.."))
|
30
|
+
else
|
31
|
+
RAILS_ROOT = File.join(File.dirname(__FILE__), "../..")
|
32
|
+
end
|
33
|
+
|
34
|
+
ActionController::Base.logger = Logger.new(nil)
|
35
|
+
|
36
|
+
# Load plugins from test/plugins.
|
37
|
+
# This will only work with very basic plugins,
|
38
|
+
# since we don't want to load the entirety of Rails.
|
39
|
+
Dir[File.dirname(__FILE__) + '/plugins/*'].each do |plugin|
|
40
|
+
$: << plugin + '/lib'
|
41
|
+
eval(File.read(plugin + '/init.rb'))
|
42
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
lib_dir = File.dirname(__FILE__) + '/../lib'
|
2
|
+
require File.dirname(__FILE__) + '/linked_rails'
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require 'fileutils'
|
6
|
+
$:.unshift lib_dir unless $:.include?(lib_dir)
|
7
|
+
require 'haml'
|
8
|
+
|
9
|
+
require 'haml/template'
|
10
|
+
Haml::Template.options[:ugly] = false
|
11
|
+
Haml::Template.options[:format] = :xhtml
|
12
|
+
|
13
|
+
class Test::Unit::TestCase
|
14
|
+
def assert_warning(message)
|
15
|
+
the_real_stderr, $stderr = $stderr, StringIO.new
|
16
|
+
yield
|
17
|
+
|
18
|
+
if message.is_a?(Regexp)
|
19
|
+
assert_match message, $stderr.string.strip
|
20
|
+
else
|
21
|
+
assert_equal message.strip, $stderr.string.strip
|
22
|
+
end
|
23
|
+
ensure
|
24
|
+
$stderr = the_real_stderr
|
25
|
+
end
|
26
|
+
|
27
|
+
def silence_warnings(&block)
|
28
|
+
Haml::Util.silence_warnings(&block)
|
29
|
+
end
|
30
|
+
|
31
|
+
def rails_block_helper_char
|
32
|
+
return '=' if Haml::Util.ap_geq_3?
|
33
|
+
return '-'
|
34
|
+
end
|
35
|
+
|
36
|
+
def form_for_calling_convention(name)
|
37
|
+
return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq_3?
|
38
|
+
return ":#{name}, @#{name}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def rails_form_attr
|
42
|
+
return 'accept-charset="UTF-8" ' if Haml::Util.ap_geq?("3.0.0.rc")
|
43
|
+
return ''
|
44
|
+
end
|
45
|
+
|
46
|
+
def rails_form_opener
|
47
|
+
return '' unless Haml::Util.ap_geq?("3.0.0.rc")
|
48
|
+
if Haml::Util.ap_geq?("3.0.0.rc2")
|
49
|
+
encoding = 'utf8'
|
50
|
+
char = '✓'
|
51
|
+
else
|
52
|
+
encoding = '_snowman'
|
53
|
+
char = '☃'
|
54
|
+
end
|
55
|
+
return '<div style="margin:0;padding:0;display:inline"><input name="' + encoding +
|
56
|
+
'" type="hidden" value="' + char + '" /></div>'
|
57
|
+
end
|
58
|
+
|
59
|
+
def assert_raise_message(klass, message)
|
60
|
+
yield
|
61
|
+
rescue Exception => e
|
62
|
+
assert_instance_of(klass, e)
|
63
|
+
assert_equal(message, e.message)
|
64
|
+
else
|
65
|
+
flunk "Expected exception #{klass}, none raised"
|
66
|
+
end
|
67
|
+
|
68
|
+
def assert_raise_line(line)
|
69
|
+
yield
|
70
|
+
rescue Sass::SyntaxError => e
|
71
|
+
assert_equal(line, e.sass_line)
|
72
|
+
else
|
73
|
+
flunk "Expected exception on line #{line}, none raised"
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2006-2009 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.
|
@@ -0,0 +1,201 @@
|
|
1
|
+
# 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 CSS files in `public/stylesheets` on every request.
|
58
|
+
|
59
|
+
To use Sass programatically,
|
60
|
+
check out the [YARD documentation](http://sass-lang.com/docs/yardoc/).
|
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://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#variables_
|
75
|
+
[nested]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#nested_rules_
|
76
|
+
[mixins]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
|
77
|
+
[imports]: http://beta.sass-lang.com/docs/yardoc/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://beta.sass-lang.com/docs/yardoc/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://beta.sass-lang.com/docs/yardoc/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://hamptoncatlin.com) (hcatlin).
|
177
|
+
However, Hampton doesn't even know his way around the code anymore and now
|
178
|
+
occasionally consults on the language issues. Hampton lives in Jacksonville,
|
179
|
+
Florida and is the lead mobile developer for Wikimedia.
|
180
|
+
|
181
|
+
[Nathan Weizenbaum](http://nex-3.com) is the primary developer and architect of
|
182
|
+
Sass. His hard work has kept the project alive by endlessly answering forum
|
183
|
+
posts, fixing bugs, refactoring, finding speed improvements, writing
|
184
|
+
documentation, implementing new features, and getting Hampton coffee (a fitting
|
185
|
+
task for a boy-genius). Nathan lives in Seattle, Washington and while not being
|
186
|
+
a student at the University of Washington or working at an internship, he
|
187
|
+
consults for Unspace Interactive.
|
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__.
|
@@ -0,0 +1,339 @@
|
|
1
|
+
# ----- Utility Functions -----
|
2
|
+
|
3
|
+
def scope(path)
|
4
|
+
File.join(File.dirname(__FILE__), path)
|
5
|
+
end
|
6
|
+
|
7
|
+
# ----- Default: Testing ------
|
8
|
+
|
9
|
+
task :default => :test
|
10
|
+
|
11
|
+
require 'rake/testtask'
|
12
|
+
|
13
|
+
Rake::TestTask.new do |t|
|
14
|
+
t.libs << 'test'
|
15
|
+
test_files = FileList[scope('test/**/*_test.rb')]
|
16
|
+
test_files.exclude(scope('test/rails/*'))
|
17
|
+
test_files.exclude(scope('test/plugins/*'))
|
18
|
+
t.test_files = test_files
|
19
|
+
t.verbose = true
|
20
|
+
end
|
21
|
+
|
22
|
+
# ----- Packaging -----
|
23
|
+
|
24
|
+
# Don't use Rake::GemPackageTast because we want prerequisites to run
|
25
|
+
# before we load the gemspec.
|
26
|
+
desc "Build all the packages."
|
27
|
+
task :package => [:revision_file, :submodules, :permissions] do
|
28
|
+
version = get_version
|
29
|
+
File.open(scope('VERSION'), 'w') {|f| f.puts(version)}
|
30
|
+
load scope('sass.gemspec')
|
31
|
+
Gem::Builder.new(SASS_GEMSPEC).build
|
32
|
+
sh %{git checkout VERSION}
|
33
|
+
|
34
|
+
pkg = "#{SASS_GEMSPEC.name}-#{SASS_GEMSPEC.version}"
|
35
|
+
mkdir_p "pkg"
|
36
|
+
verbose(true) {mv "#{pkg}.gem", "pkg/#{pkg}.gem"}
|
37
|
+
|
38
|
+
sh %{rm -f pkg/#{pkg}.tar.gz}
|
39
|
+
verbose(false) {SASS_GEMSPEC.files.each {|f| sh %{tar rf pkg/#{pkg}.tar #{f}}}}
|
40
|
+
sh %{gzip pkg/#{pkg}.tar}
|
41
|
+
end
|
42
|
+
|
43
|
+
task :permissions do
|
44
|
+
sh %{chmod -R a+rx bin}
|
45
|
+
sh %{chmod -R a+r .}
|
46
|
+
require 'shellwords'
|
47
|
+
Dir.glob('test/**/*_test.rb') do |file|
|
48
|
+
next if file =~ %r{^test/haml/spec/}
|
49
|
+
sh %{chmod a+rx #{file}}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task :revision_file do
|
54
|
+
require 'lib/sass'
|
55
|
+
|
56
|
+
release = Rake.application.top_level_tasks.include?('release') || File.exist?(scope('EDGE_GEM_VERSION'))
|
57
|
+
if Sass.version[:rev] && !release
|
58
|
+
File.open(scope('REVISION'), 'w') { |f| f.puts Sass.version[:rev] }
|
59
|
+
elsif release
|
60
|
+
File.open(scope('REVISION'), 'w') { |f| f.puts "(release)" }
|
61
|
+
else
|
62
|
+
File.open(scope('REVISION'), 'w') { |f| f.puts "(unknown)" }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# We also need to get rid of this file after packaging.
|
67
|
+
at_exit { File.delete(scope('REVISION')) rescue nil }
|
68
|
+
|
69
|
+
desc "Install Sass as a gem. Use SUDO=1 to install with sudo."
|
70
|
+
task :install => [:package] do
|
71
|
+
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
|
72
|
+
sh %{#{'sudo ' if ENV["SUDO"]}#{gem} install --no-ri pkg/sass-#{get_version}}
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "Release a new Sass package to Rubyforge."
|
76
|
+
task :release => [:check_release, :package] do
|
77
|
+
name = File.read(scope("VERSION_NAME")).strip
|
78
|
+
version = File.read(scope("VERSION")).strip
|
79
|
+
sh %{rubyforge add_release sass sass "#{name} (v#{version})" pkg/sass-#{version}.gem}
|
80
|
+
sh %{rubyforge add_file sass sass "#{name} (v#{version})" pkg/sass-#{version}.tar.gz}
|
81
|
+
sh %{gem push pkg/sass-#{version}.gem}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Ensures that the VERSION file has been updated for a new release.
|
85
|
+
task :check_release do
|
86
|
+
version = File.read(scope("VERSION")).strip
|
87
|
+
raise "There have been changes since current version (#{version})" if changed_since?(version)
|
88
|
+
raise "VERSION_NAME must not be 'Bleeding Edge'" if File.read(scope("VERSION_NAME")) == "Bleeding Edge"
|
89
|
+
end
|
90
|
+
|
91
|
+
# Reads a password from the command line.
|
92
|
+
#
|
93
|
+
# @param name [String] The prompt to use to read the password
|
94
|
+
def read_password(prompt)
|
95
|
+
require 'readline'
|
96
|
+
system "stty -echo"
|
97
|
+
Readline.readline("#{prompt}: ").strip
|
98
|
+
ensure
|
99
|
+
system "stty echo"
|
100
|
+
puts
|
101
|
+
end
|
102
|
+
|
103
|
+
# Returns whether or not the repository, or specific files,
|
104
|
+
# has/have changed since a given revision.
|
105
|
+
#
|
106
|
+
# @param rev [String] The revision to check against
|
107
|
+
# @param files [Array<String>] The files to check.
|
108
|
+
# If this is empty, checks the entire repository
|
109
|
+
def changed_since?(rev, *files)
|
110
|
+
IO.popen("git diff --exit-code #{rev} #{files.join(' ')}") {}
|
111
|
+
return !$?.success?
|
112
|
+
end
|
113
|
+
|
114
|
+
task :submodules do
|
115
|
+
if File.exist?(File.dirname(__FILE__) + "/.git")
|
116
|
+
sh %{git submodule sync}
|
117
|
+
sh %{git submodule update --init}
|
118
|
+
elsif !File.exist?(File.dirname(__FILE__) + "/vendor/fssm/lib")
|
119
|
+
warn <<WARN
|
120
|
+
WARNING: vendor/fssm doesn't exist, and this isn't a git repository so
|
121
|
+
I can't get it automatically!
|
122
|
+
WARN
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
task :release_edge do
|
127
|
+
ensure_git_cleanup do
|
128
|
+
puts "#{'=' * 50} Running rake release_edge"
|
129
|
+
|
130
|
+
sh %{git checkout master}
|
131
|
+
sh %{git reset --hard origin/master}
|
132
|
+
sh %{rake package}
|
133
|
+
version = get_version
|
134
|
+
sh %{rubyforge add_release sass sass "Bleeding Edge (v#{version})" pkg/sass-#{version}.gem}
|
135
|
+
sh %{gem push pkg/sass-#{version}.gem}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Get the version string. If this is being installed from Git,
|
140
|
+
# this includes the proper prerelease version.
|
141
|
+
def get_version
|
142
|
+
written_version = File.read(scope('VERSION').strip)
|
143
|
+
return written_version unless File.exist?(scope('.git'))
|
144
|
+
|
145
|
+
# Get the current master branch version
|
146
|
+
version = written_version.split('.')
|
147
|
+
version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
|
148
|
+
return written_version unless version.size == 5 && version[3] == "alpha" # prerelease
|
149
|
+
|
150
|
+
return written_version if (commit_count = `git log --pretty=oneline --first-parent stable.. | wc -l`).empty?
|
151
|
+
version[4] = commit_count.strip
|
152
|
+
version.join('.')
|
153
|
+
end
|
154
|
+
|
155
|
+
task :watch_for_update do
|
156
|
+
sh %{ruby extra/update_watch.rb}
|
157
|
+
end
|
158
|
+
|
159
|
+
# ----- Documentation -----
|
160
|
+
|
161
|
+
task :rdoc do
|
162
|
+
puts '=' * 100, <<END, '=' * 100
|
163
|
+
Sass uses the YARD documentation system (http://github.com/lsegal/yard).
|
164
|
+
Install the yard gem and then run "rake doc".
|
165
|
+
END
|
166
|
+
end
|
167
|
+
|
168
|
+
begin
|
169
|
+
require 'yard'
|
170
|
+
|
171
|
+
namespace :doc do
|
172
|
+
task :sass do
|
173
|
+
require scope('lib/sass')
|
174
|
+
Dir[scope("yard/default/**/*.sass")].each do |sass|
|
175
|
+
File.open(sass.gsub(/sass$/, 'css'), 'w') do |f|
|
176
|
+
f.write(Sass::Engine.new(File.read(sass)).render)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
desc "List all undocumented methods and classes."
|
182
|
+
task :undocumented do
|
183
|
+
opts = ENV["YARD_OPTS"] || ""
|
184
|
+
ENV["YARD_OPTS"] = opts.dup + <<OPTS
|
185
|
+
--list --query "
|
186
|
+
object.docstring.blank? &&
|
187
|
+
!(object.type == :method && object.is_alias?)"
|
188
|
+
OPTS
|
189
|
+
Rake::Task['yard'].execute
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
YARD::Rake::YardocTask.new do |t|
|
194
|
+
t.files = FileList.new(scope('lib/**/*.rb')) do |list|
|
195
|
+
list.exclude('lib/sass/plugin/merb.rb')
|
196
|
+
list.exclude('lib/sass/plugin/rails.rb')
|
197
|
+
list.exclude('lib/sass/less.rb')
|
198
|
+
end.to_a
|
199
|
+
t.options << '--incremental' if Rake.application.top_level_tasks.include?('redoc')
|
200
|
+
t.options += FileList.new(scope('yard/*.rb')).to_a.map {|f| ['-e', f]}.flatten
|
201
|
+
files = FileList.new(scope('doc-src/*')).to_a.sort_by {|s| s.size} + %w[MIT-LICENSE VERSION]
|
202
|
+
t.options << '--files' << files.join(',')
|
203
|
+
t.options << '--template-path' << scope('yard')
|
204
|
+
t.options << '--title' << ENV["YARD_TITLE"] if ENV["YARD_TITLE"]
|
205
|
+
|
206
|
+
t.before = lambda do
|
207
|
+
if ENV["YARD_OPTS"]
|
208
|
+
require 'shellwords'
|
209
|
+
t.options.concat(Shellwords.shellwords(ENV["YARD_OPTS"]))
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
Rake::Task['yard'].prerequisites.insert(0, 'doc:sass')
|
214
|
+
Rake::Task['yard'].instance_variable_set('@comment', nil)
|
215
|
+
|
216
|
+
desc "Generate Documentation"
|
217
|
+
task :doc => :yard
|
218
|
+
task :redoc => :yard
|
219
|
+
rescue LoadError
|
220
|
+
desc "Generate Documentation"
|
221
|
+
task :doc => :rdoc
|
222
|
+
task :yard => :rdoc
|
223
|
+
end
|
224
|
+
|
225
|
+
task :pages do
|
226
|
+
ensure_git_cleanup do
|
227
|
+
puts "#{'=' * 50} Running rake pages"
|
228
|
+
sh %{git checkout sass-pages}
|
229
|
+
sh %{git reset --hard origin/sass-pages}
|
230
|
+
|
231
|
+
Dir.chdir("/var/www/sass-pages") do
|
232
|
+
sh %{git fetch origin}
|
233
|
+
|
234
|
+
sh %{git checkout stable}
|
235
|
+
sh %{git reset --hard origin/stable}
|
236
|
+
|
237
|
+
sh %{git checkout sass-pages}
|
238
|
+
sh %{git reset --hard origin/sass-pages}
|
239
|
+
sh %{rake build --trace}
|
240
|
+
sh %{mkdir -p tmp}
|
241
|
+
sh %{touch tmp/restart.txt}
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
# ----- Coverage -----
|
247
|
+
|
248
|
+
begin
|
249
|
+
require 'rcov/rcovtask'
|
250
|
+
|
251
|
+
Rcov::RcovTask.new do |t|
|
252
|
+
t.test_files = FileList[scope('test/**/*_test.rb')]
|
253
|
+
t.rcov_opts << '-x' << '"^\/"'
|
254
|
+
if ENV['NON_NATIVE']
|
255
|
+
t.rcov_opts << "--no-rcovrt"
|
256
|
+
end
|
257
|
+
t.verbose = true
|
258
|
+
end
|
259
|
+
rescue LoadError; end
|
260
|
+
|
261
|
+
# ----- Profiling -----
|
262
|
+
|
263
|
+
begin
|
264
|
+
require 'ruby-prof'
|
265
|
+
|
266
|
+
desc <<END
|
267
|
+
Run a profile of sass.
|
268
|
+
TIMES=n sets the number of runs. Defaults to 1000.
|
269
|
+
FILE=str sets the file to profile. Defaults to 'complex'.
|
270
|
+
OUTPUT=str sets the ruby-prof output format.
|
271
|
+
Can be Flat, CallInfo, or Graph. Defaults to Flat. Defaults to Flat.
|
272
|
+
END
|
273
|
+
task :profile do
|
274
|
+
times = (ENV['TIMES'] || '1000').to_i
|
275
|
+
file = ENV['FILE']
|
276
|
+
|
277
|
+
require 'lib/sass'
|
278
|
+
|
279
|
+
file = File.read(scope("test/sass/templates/#{file || 'complex'}.sass"))
|
280
|
+
result = RubyProf.profile { times.times { Sass::Engine.new(file).render } }
|
281
|
+
|
282
|
+
RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
|
283
|
+
end
|
284
|
+
rescue LoadError; end
|
285
|
+
|
286
|
+
# ----- Handling Updates -----
|
287
|
+
|
288
|
+
def email_on_error
|
289
|
+
yield
|
290
|
+
rescue Exception => e
|
291
|
+
IO.popen("sendmail nex342@gmail.com", "w") do |sm|
|
292
|
+
sm << "From: nex3@nex-3.com\n" <<
|
293
|
+
"To: nex342@gmail.com\n" <<
|
294
|
+
"Subject: Exception when running rake #{Rake.application.top_level_tasks.join(', ')}\n" <<
|
295
|
+
e.message << "\n\n" <<
|
296
|
+
e.backtrace.join("\n")
|
297
|
+
end
|
298
|
+
ensure
|
299
|
+
raise e if e
|
300
|
+
end
|
301
|
+
|
302
|
+
def ensure_git_cleanup
|
303
|
+
email_on_error {yield}
|
304
|
+
ensure
|
305
|
+
sh %{git reset --hard HEAD}
|
306
|
+
sh %{git clean -xdf}
|
307
|
+
sh %{git checkout master}
|
308
|
+
end
|
309
|
+
|
310
|
+
task :handle_update do
|
311
|
+
email_on_error do
|
312
|
+
unless ENV["REF"] =~ %r{^refs/heads/(master|stable|sass-pages)$}
|
313
|
+
puts "#{'=' * 20} Ignoring rake handle_update REF=#{ENV["REF"].inspect}"
|
314
|
+
next
|
315
|
+
end
|
316
|
+
branch = $1
|
317
|
+
|
318
|
+
puts
|
319
|
+
puts
|
320
|
+
puts '=' * 150
|
321
|
+
puts "Running rake handle_update REF=#{ENV["REF"].inspect}"
|
322
|
+
|
323
|
+
sh %{git fetch origin}
|
324
|
+
sh %{git checkout stable}
|
325
|
+
sh %{git reset --hard origin/stable}
|
326
|
+
sh %{git checkout master}
|
327
|
+
sh %{git reset --hard origin/master}
|
328
|
+
|
329
|
+
case branch
|
330
|
+
when "master"
|
331
|
+
sh %{rake release_edge --trace}
|
332
|
+
when "stable", "sass-pages"
|
333
|
+
sh %{rake pages --trace}
|
334
|
+
end
|
335
|
+
|
336
|
+
puts 'Done running handle_update'
|
337
|
+
puts '=' * 150
|
338
|
+
end
|
339
|
+
end
|