chriseppstein-compass 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. data/Manifest +143 -0
  2. data/README.markdown +18 -0
  3. data/Rakefile +104 -0
  4. data/VERSION +1 -0
  5. data/bin/compass +8 -0
  6. data/compass.gemspec +37 -0
  7. data/examples/blueprint_default/index.html +73 -0
  8. data/examples/blueprint_default/parts/elements.html +246 -0
  9. data/examples/blueprint_default/parts/forms.html +100 -0
  10. data/examples/blueprint_default/parts/grid.html +206 -0
  11. data/examples/blueprint_default/parts/test-small.jpg +0 -0
  12. data/examples/blueprint_default/parts/test.jpg +0 -0
  13. data/examples/blueprint_default/parts/valid.png +0 -0
  14. data/examples/blueprint_default/stylesheets/ie.sass +4 -0
  15. data/examples/blueprint_default/stylesheets/images/grid.png +0 -0
  16. data/examples/blueprint_default/stylesheets/print.sass +4 -0
  17. data/examples/blueprint_default/stylesheets/screen.sass +9 -0
  18. data/examples/blueprint_plugins/index.html +60 -0
  19. data/examples/blueprint_plugins/parts/fancy_type.html +84 -0
  20. data/examples/blueprint_plugins/parts/test-small.jpg +0 -0
  21. data/examples/blueprint_plugins/parts/test.jpg +0 -0
  22. data/examples/blueprint_plugins/parts/valid.png +0 -0
  23. data/examples/blueprint_plugins/stylesheets/ie.sass +4 -0
  24. data/examples/blueprint_plugins/stylesheets/images/grid.png +0 -0
  25. data/examples/blueprint_plugins/stylesheets/print.sass +4 -0
  26. data/examples/blueprint_plugins/stylesheets/screen.sass +11 -0
  27. data/examples/blueprint_scoped/stylesheets/ie.sass +4 -0
  28. data/examples/blueprint_scoped/stylesheets/print.sass +4 -0
  29. data/examples/blueprint_scoped/stylesheets/screen.sass +5 -0
  30. data/examples/blueprint_scoped_form/stylesheets/ie.sass +4 -0
  31. data/examples/blueprint_scoped_form/stylesheets/print.sass +4 -0
  32. data/examples/blueprint_scoped_form/stylesheets/screen.sass +9 -0
  33. data/examples/blueprint_semantic/index.html +68 -0
  34. data/examples/blueprint_semantic/parts/fancy_type.html +84 -0
  35. data/examples/blueprint_semantic/parts/liquid.html +84 -0
  36. data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
  37. data/examples/blueprint_semantic/parts/test.jpg +0 -0
  38. data/examples/blueprint_semantic/parts/valid.png +0 -0
  39. data/examples/blueprint_semantic/stylesheets/ie.sass +4 -0
  40. data/examples/blueprint_semantic/stylesheets/images/grid.png +0 -0
  41. data/examples/blueprint_semantic/stylesheets/liquid.sass +70 -0
  42. data/examples/blueprint_semantic/stylesheets/print.sass +4 -0
  43. data/examples/blueprint_semantic/stylesheets/screen.sass +69 -0
  44. data/examples/compass/compass.html +19 -0
  45. data/examples/compass/stylesheets/compass.sass +47 -0
  46. data/examples/compass/stylesheets/images/blue_arrow.gif +0 -0
  47. data/examples/compass/stylesheets/utilities.sass +65 -0
  48. data/examples/compass/utilities.html.haml +136 -0
  49. data/examples/yui/divisions.html.haml +179 -0
  50. data/examples/yui/index.html.haml +19 -0
  51. data/examples/yui/stylesheets/screen.sass +13 -0
  52. data/examples/yui/sub_divisions.html.haml +169 -0
  53. data/examples/yui/templates.html.haml +54 -0
  54. data/examples/yui/test.jpg +0 -0
  55. data/examples/yui/typography.html.haml +132 -0
  56. data/frameworks/blueprint/lib/blueprint/constants.rb +17 -0
  57. data/frameworks/blueprint/lib/blueprint/grid_builder.rb +54 -0
  58. data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +19 -0
  59. data/frameworks/blueprint/stylesheets/blueprint/_print.sass +69 -0
  60. data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
  61. data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +25 -0
  62. data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
  63. data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +85 -0
  64. data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +43 -0
  65. data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +140 -0
  66. data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +55 -0
  67. data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +140 -0
  68. data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +29 -0
  69. data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +131 -0
  70. data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +39 -0
  71. data/frameworks/blueprint/templates/project/grid.png +0 -0
  72. data/frameworks/blueprint/templates/project/ie.sass +4 -0
  73. data/frameworks/blueprint/templates/project/print.sass +4 -0
  74. data/frameworks/blueprint/templates/project/screen.sass +9 -0
  75. data/frameworks/compass/stylesheets/compass/_reset.sass +19 -0
  76. data/frameworks/compass/stylesheets/compass/_utilities.sass +5 -0
  77. data/frameworks/compass/stylesheets/compass/utilities/_general.sass +4 -0
  78. data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
  79. data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
  80. data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +1 -0
  81. data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
  82. data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +11 -0
  83. data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
  84. data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +32 -0
  85. data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
  86. data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
  87. data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
  88. data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
  89. data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
  90. data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
  91. data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +20 -0
  92. data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
  93. data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +25 -0
  94. data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
  95. data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -0
  96. data/frameworks/compass/templates/project/grid.png +0 -0
  97. data/frameworks/compass/templates/project/ie.sass +3 -0
  98. data/frameworks/compass/templates/project/print.sass +4 -0
  99. data/frameworks/compass/templates/project/screen.sass +4 -0
  100. data/frameworks/yui/COPYRIGHT +15 -0
  101. data/frameworks/yui/stylesheets/yui/_screen.sass +7 -0
  102. data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
  103. data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
  104. data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
  105. data/frameworks/yui/templates/project/screen.sass +5 -0
  106. data/lib/compass.rb +19 -0
  107. data/lib/compass/commands/base.rb +94 -0
  108. data/lib/compass/commands/create_project.rb +30 -0
  109. data/lib/compass/commands/install_rails.rb +115 -0
  110. data/lib/compass/commands/print_version.rb +23 -0
  111. data/lib/compass/commands/update_project.rb +91 -0
  112. data/lib/compass/commands/watch_project.rb +42 -0
  113. data/lib/compass/core_ext.rb +39 -0
  114. data/lib/compass/exec.rb +156 -0
  115. data/lib/compass/frameworks.rb +27 -0
  116. data/lib/compass/frameworks/blueprint.rb +2 -0
  117. data/lib/compass/frameworks/compass.rb +2 -0
  118. data/lib/compass/frameworks/yui.rb +2 -0
  119. data/lib/compass/merb.rb +43 -0
  120. data/lib/compass/test_case.rb +37 -0
  121. data/lib/compass/validate.rb +13 -0
  122. data/lib/compass/validate/COPYRIGHT.html +93 -0
  123. data/lib/compass/validate/JIGSAW_COPYRIGHT +64 -0
  124. data/lib/compass/validate/README.html +83 -0
  125. data/lib/compass/validate/XERCES_COPYING.txt +56 -0
  126. data/lib/compass/validate/css-validator-javadoc.jar +0 -0
  127. data/lib/compass/validate/css-validator.jar +0 -0
  128. data/lib/compass/validate/jigsaw.jar +0 -0
  129. data/lib/compass/validate/xerces.jar +0 -0
  130. data/lib/compass/validator.rb +59 -0
  131. data/lib/compass/version.rb +48 -0
  132. data/lib/sass_extensions.rb +13 -0
  133. data/test/compass_test.rb +142 -0
  134. data/test/fixtures/stylesheets/default/sass/ie.sass +4 -0
  135. data/test/fixtures/stylesheets/default/sass/print.sass +4 -0
  136. data/test/fixtures/stylesheets/default/sass/screen.sass +18 -0
  137. data/test/fixtures/stylesheets/yui/css/mixins.css +16 -0
  138. data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
  139. data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
  140. data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
  141. data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
  142. data/test/sass_extensions_test.rb +26 -0
  143. data/test/test_helper.rb +37 -0
  144. metadata +247 -0
@@ -0,0 +1,83 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>CSS Validator Binary Distribution - Illumit</title>
5
+ <link title="RSS Feed" type="application/rss+xml" rel="alternate" href="http://www.illumit.com/site.rss" />
6
+ </head>
7
+ <body>
8
+ <h1>CSS Validator Binary Distribution</h1>
9
+ <p>This a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a>.
10
+ It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006.
11
+ No modifications were made.</p>
12
+
13
+ <p>This distribution is provided <a href="#asis">as is</a> to make testing a large number of CSS files easier.</p>
14
+
15
+
16
+ <h2>Requirements</h2>
17
+ <p>A Java 2 Virtual Machine is required to use the validator.
18
+ You can download one from <a href="http://java.sun.com/">Sun</a> if you do not have one installed.</p>
19
+
20
+ <h2>Usage</h2>
21
+ <h2>Summary</h2>
22
+ <p><code>java -jar <samp>~/css-validator/</samp>css-validator.jar [-options] files URLs</code></p>
23
+ <h2>Sample</h2>
24
+ <pre>
25
+ java -jar ~/css-validator/css-validator.jar f1.css http://illumit.com/
26
+ </pre>
27
+ <h2>Options</h2>
28
+ <dl>
29
+ <dt>-e</dt><dd>Show errors only.</dd>
30
+ <dt>-html</dt><dd>Output HTML.</dd>
31
+ <dt>-css1 | -css2 | -css21 | -css3 | -svg | -svgbasic | -svgtiny</dt>
32
+ <dd>Specify CSS version. CSS2 is the default.</dd>
33
+ </dl>
34
+
35
+ <h2>Support</h2>
36
+
37
+ <p>If you have questions about how this distribution is built or packaged,
38
+ <a href="mailto:contact@illumit.com">mailto:contact@illumit.com</a>.</p>
39
+
40
+ <p>Use the CSS Validator <a href="http://jigsaw.w3.org/css-validator/Email">Feedback</a>
41
+ page if you have any questions or problems with the validator itself.</p>
42
+
43
+ <p class="Footnote">Updates are announced on via
44
+ <a class="RSSLink" rel="alternate" type="application/rss+xml" href="http://www.illumit.com/site.rss">RSS</a></p>
45
+
46
+ <!--
47
+ <h2>Contents</h2>
48
+ <ul>
49
+ <li><a href="css-validator.jar">css-validator.jar</a> Executable JAR package</li>
50
+ <li><a href="COPYRIGHT.html">COPYRIGHT.html</a> CSS Validator Copyright Notice</li>
51
+ <li><a href="css-validator-javadoc.jar">css-validator-javadoc.jar</a> CSS Validator API Docs</li>
52
+ <li>Required libraries:<ul>
53
+ <li><a href="jigsaw.jar">jigsaw.jar</a> and <a href="JIGSAW_COPYRIGHT">JIGSAW_COPYRIGHT</a></li>
54
+ <li><a href="xerces.jar">xerces.jar</a> and <a href="XERCES_COPYING.txt">XERCES_COPYING.txt</a></li>
55
+ </ul>
56
+ </li>
57
+ </ul>
58
+ -->
59
+
60
+ <h2>Download</h2>
61
+
62
+ <p>Download the css validator binary distribution <a href="css-validator.zip">css-validator.zip</a>. Extract the files (OS X and *ix users can use unzip).</p>
63
+
64
+
65
+ <h2><a name="asis">License Agreement</a></h2>
66
+
67
+ <p>This is a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a> Version 2.0
68
+ It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006.
69
+ No modifications were made to the source.</p>
70
+
71
+ <p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND
72
+ ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS (W3C) MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
73
+ IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF
74
+ MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
75
+ USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD
76
+ PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
77
+
78
+ <p>ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
79
+ SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
80
+ SOFTWARE OR DOCUMENTATION.</p>
81
+
82
+ </body>
83
+ </html>
@@ -0,0 +1,56 @@
1
+ /*
2
+ * The Apache Software License, Version 1.1
3
+ *
4
+ *
5
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
6
+ * reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
11
+ *
12
+ * 1. Redistributions of source code must retain the above copyright
13
+ * notice, this list of conditions and the following disclaimer.
14
+ *
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ * notice, this list of conditions and the following disclaimer in
17
+ * the documentation and/or other materials provided with the
18
+ * distribution.
19
+ *
20
+ * 3. The end-user documentation included with the redistribution,
21
+ * if any, must include the following acknowledgment:
22
+ * "This product includes software developed by the
23
+ * Apache Software Foundation (http://www.apache.org/)."
24
+ * Alternately, this acknowledgment may appear in the software itself,
25
+ * if and wherever such third-party acknowledgments normally appear.
26
+ *
27
+ * 4. The names "Xerces" and "Apache Software Foundation" must
28
+ * not be used to endorse or promote products derived from this
29
+ * software without prior written permission. For written
30
+ * permission, please contact apache@apache.org.
31
+ *
32
+ * 5. Products derived from this software may not be called "Apache",
33
+ * nor may "Apache" appear in their name, without prior written
34
+ * permission of the Apache Software Foundation.
35
+ *
36
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47
+ * SUCH DAMAGE.
48
+ * ====================================================================
49
+ *
50
+ * This software consists of voluntary contributions made by many
51
+ * individuals on behalf of the Apache Software Foundation and was
52
+ * originally based on software copyright (c) 1999, International
53
+ * Business Machines, Inc., http://www.ibm.com. For more
54
+ * information on the Apache Software Foundation, please see
55
+ * <http://www.apache.org/>.
56
+ */
Binary file
Binary file
@@ -0,0 +1,59 @@
1
+ require File.join(File.dirname(__FILE__), 'core_ext')
2
+ require File.join(File.dirname(__FILE__), 'constants')
3
+
4
+ module Compass
5
+ # Validates generated CSS against the W3 using Java
6
+ class Validator
7
+ VALIDATOR_FILE = File.join(File.dirname(__FILE__), 'validate', 'css-validator.jar')
8
+ attr_reader :error_count
9
+
10
+ def initialize
11
+ @error_count = 0
12
+ end
13
+
14
+ # Validates all three CSS files
15
+ def validate
16
+ java_path = `which java`.rstrip
17
+ raise "You do not have a Java installed, but it is required." if java_path.blank?
18
+
19
+ output_header
20
+
21
+ Dir.new(Compass::Constants::BLUEPRINT_ROOT_PATH).each do |file_name|
22
+ puts "#{file_name}"
23
+ if file_name =~ /\.css$/
24
+ css_file = File.join(Compass::Constants::BLUEPRINT_ROOT_PATH, file_name)
25
+ @error_count += 1 if !validate_css_file(java_path, css_file)
26
+ end
27
+ end
28
+
29
+ output_footer
30
+ end
31
+
32
+ private
33
+ def validate_css_file(java_path, css_file)
34
+ puts "\n\n Testing #{css_file}"
35
+ puts " Output ============================================================\n\n"
36
+ system("#{java_path} -jar '#{VALIDATOR_FILE}' -e '#{css_file}'")
37
+ end
38
+
39
+ def output_header
40
+ puts "\n\n"
41
+ puts " ************************************************************"
42
+ puts " **"
43
+ puts " ** Compass CSS Validator"
44
+ puts " ** Validates output CSS files"
45
+ puts " **"
46
+ puts " ************************************************************"
47
+ end
48
+
49
+ def output_footer
50
+ puts "\n\n"
51
+ puts " ************************************************************"
52
+ puts " **"
53
+ puts " ** Done!"
54
+ puts " ** Your CSS files are#{" not" if error_count > 0} valid.#{" You had #{error_count} error(s) within your files" if error_count > 0}"
55
+ puts " **"
56
+ puts " ************************************************************"
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,48 @@
1
+ module Compass
2
+ module Version
3
+ # Returns a hash representing the version.
4
+ # The :major, :minor, and :teeny keys have their respective numbers.
5
+ # The :string key contains a human-readable string representation of the version.
6
+ # If checked out from Git,
7
+ # the :rev key will have the revision hash.
8
+ #
9
+ # This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum
10
+ attr_writer :version
11
+ def version
12
+ return @version if defined?(@version)
13
+
14
+ @version = {
15
+ :string => File.read(scope('VERSION')).strip
16
+ }
17
+ dotted_string, label = @version[:string].split(/-/, 2)
18
+ numbers = dotted_string.split('.').map { |n| n.to_i }
19
+ @version[:major] = numbers[0]
20
+ @version[:minor] = numbers[1]
21
+ @version[:teeny] = numbers[2]
22
+ @version[:label] = label
23
+
24
+ if File.exists?(scope('REVISION'))
25
+ rev = File.read(scope('REVISION')).strip
26
+ rev = nil if rev !~ /[a-f0-9]+/
27
+ end
28
+
29
+ if rev.nil? && File.exists?(scope('.git/HEAD'))
30
+ rev = File.read(scope('.git/HEAD')).strip
31
+ if rev =~ /^ref: (.*)$/
32
+ rev = File.read(scope(".git/#{$1}")).strip
33
+ end
34
+ end
35
+
36
+ if rev
37
+ @version[:rev] = rev
38
+ @version[:string] << " [#{rev[0...7]}]"
39
+ end
40
+
41
+ @version
42
+ end
43
+
44
+ def scope(file) # :nodoc:
45
+ File.join(File.dirname(__FILE__), '..', '..', file)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ require 'sass'
2
+
3
+ module Sass::Script::Functions
4
+ COMMA_SEPARATOR = /\s*,\s*/
5
+ def nest(*arguments)
6
+ nested = arguments.map{|a| a.value}.inject do |memo,arg|
7
+ ancestors = memo.split(COMMA_SEPARATOR)
8
+ descendants = arg.split(COMMA_SEPARATOR)
9
+ ancestors.map{|a| descendants.map{|d| "#{a} #{d}"}.join(", ")}.join(", ")
10
+ end
11
+ Sass::Script::String.new(nested)
12
+ end
13
+ end
@@ -0,0 +1,142 @@
1
+ require File.dirname(__FILE__)+'/test_helper'
2
+ require 'fileutils'
3
+ require 'compass'
4
+
5
+ class CompassTest < Test::Unit::TestCase
6
+ def setup
7
+ setup_fixtures :default, :yui, :empty
8
+ @original_options = Sass::Plugin.options
9
+ end
10
+
11
+ def setup_fixtures(*folders)
12
+ folders.each do |folder|
13
+ FileUtils.mkdir_p stylesheet_fixtures(folder)
14
+ mkdir_clean tempfile_loc(folder)
15
+ end
16
+ end
17
+
18
+ def teardown
19
+ teardown_fixtures :default, :yui, :empty
20
+ Sass::Plugin.options = @original_options
21
+ end
22
+
23
+ def teardown_fixtures(*folders)
24
+ folders.each do |folder|
25
+ FileUtils.rm_rf tempfile_loc(folder)
26
+ end
27
+ end
28
+
29
+ def test_blueprint_generates_no_files
30
+ with_templates(:empty) do
31
+ Dir.new(tempfile_loc(:empty)).each do |f|
32
+ fail "This file should not have been generated: #{f}" unless f == "." || f == ".."
33
+ end
34
+ end
35
+ end
36
+
37
+ def test_default
38
+ with_templates(:default) do
39
+ each_css_file(tempfile_loc(:default)) do |css_file|
40
+ assert_no_errors css_file, :default
41
+ end
42
+ end
43
+ end
44
+ def test_yui
45
+ with_templates('yui') do
46
+ each_css_file(tempfile_loc('yui')) do |css_file|
47
+ assert_no_errors css_file, 'yui'
48
+ end
49
+ assert_renders_correctly :mixins
50
+ end
51
+ end
52
+ private
53
+ def assert_no_errors(css_file, folder)
54
+ file = css_file[(tempfile_loc(folder).size+1)..-1]
55
+ msg = "Syntax Error found in #{file}. Results saved into #{save_loc(folder)}/#{file}"
56
+ assert_equal 0, open(css_file).readlines.grep(/Sass::SyntaxError/).size, msg
57
+ end
58
+ def assert_renders_correctly(*arguments)
59
+ options = arguments.last.is_a?(Hash) ? arguments.pop : {}
60
+ name = arguments.shift
61
+ actual_result_file = "#{tempfile_loc(@current_template_folder)}/#{name}.css"
62
+ expected_result_file = "#{result_loc(@current_template_folder)}/#{name}.css"
63
+ actual_lines = File.read(actual_result_file).split("\n")
64
+ expected_lines = File.read(expected_result_file).split("\n")
65
+ expected_lines.zip(actual_lines).each_with_index do |pair, line|
66
+ message = "template: #{name}\nline: #{line + 1}"
67
+ assert_equal(pair.first, pair.last, message)
68
+ end
69
+ if expected_lines.size < actual_lines.size
70
+ assert(false, "#{actual_lines.size - expected_lines.size} Trailing lines found in #{actual_result_file}.css: #{actual_lines[expected_lines.size..-1].join('\n')}")
71
+ end
72
+ end
73
+ def with_templates(folder)
74
+ old_template_loc = Sass::Plugin.options[:template_location]
75
+ Sass::Plugin.options[:template_location] = old_template_loc.dup
76
+ @current_template_folder = folder
77
+ begin
78
+ Sass::Plugin.options[:template_location][template_loc(folder)] = tempfile_loc(folder)
79
+ Compass::Frameworks::ALL.each do |framework|
80
+ Sass::Plugin.options[:template_location][framework.stylesheets_directory] = tempfile_loc(folder)
81
+ end
82
+ Sass::Plugin.update_stylesheets
83
+ yield
84
+ ensure
85
+ @current_template_folder = nil
86
+ Sass::Plugin.options[:template_location] = old_template_loc
87
+ end
88
+ rescue
89
+ save_output(folder)
90
+ raise
91
+ end
92
+
93
+ def each_css_file(dir)
94
+ Dir.glob("#{dir}/**/*.css").each do |css_file|
95
+ yield css_file
96
+ end
97
+ end
98
+
99
+ def save_output(dir)
100
+ FileUtils.rm_rf(save_loc(dir))
101
+ FileUtils.cp_r(tempfile_loc(dir), save_loc(dir))
102
+ end
103
+
104
+ def mkdir_clean(dir)
105
+ begin
106
+ FileUtils.mkdir dir
107
+ rescue Errno::EEXIST
108
+ FileUtils.rm_r dir
109
+ FileUtils.mkdir dir
110
+ end
111
+ end
112
+
113
+ def stylesheet_fixtures(folder)
114
+ absolutize("fixtures/stylesheets/#{folder}")
115
+ end
116
+
117
+ def tempfile_loc(folder)
118
+ "#{stylesheet_fixtures(folder)}/tmp"
119
+ end
120
+
121
+ def template_loc(folder)
122
+ "#{stylesheet_fixtures(folder)}/sass"
123
+ end
124
+
125
+ def result_loc(folder)
126
+ "#{stylesheet_fixtures(folder)}/css"
127
+ end
128
+
129
+ def save_loc(folder)
130
+ "#{stylesheet_fixtures(folder)}/saved"
131
+ end
132
+
133
+ def absolutize(path)
134
+ if path.blank?
135
+ File.dirname(__FILE__)
136
+ elsif path[0] == ?/
137
+ "#{File.dirname(__FILE__)}#{path}"
138
+ else
139
+ "#{File.dirname(__FILE__)}/#{path}"
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,4 @@
1
+ @import blueprint/ie
2
+
3
+ body
4
+ +blueprint-ie
@@ -0,0 +1,4 @@
1
+ @import blueprint/print
2
+
3
+ body
4
+ +blueprint-print
@@ -0,0 +1,18 @@
1
+ @import blueprint/screen
2
+ @import compass/reset
3
+
4
+ body
5
+ +blueprint
6
+ #main.container
7
+ #top
8
+ +column(24, last)
9
+ #middle
10
+ +column(24, last)
11
+ #left
12
+ +column(6)
13
+ #content
14
+ +column(12)
15
+ #right
16
+ +column(6, last)
17
+ #bottom
18
+ +column(24, last)