Extracted the CSS Validator to a separate gem to keep the compass gem size small.
This commit is contained in:
parent
5f0c20e6a9
commit
e37b3b4d24
@ -1,6 +1,5 @@
|
||||
require File.join(File.dirname(__FILE__), 'project_base')
|
||||
require File.join(File.dirname(__FILE__), 'update_project')
|
||||
require File.join(File.dirname(__FILE__), '..', 'validator')
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
@ -12,6 +11,7 @@ module Compass
|
||||
end
|
||||
|
||||
def perform
|
||||
require File.join(File.dirname(__FILE__), '..', 'validator')
|
||||
UpdateProject.new(working_path, options).perform
|
||||
Validator.new(project_css_subdirectory).validate()
|
||||
end
|
||||
|
@ -1,93 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/base.css" />
|
||||
<title>W3C IPR SOFTWARE NOTICE</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>W3C<sup>®</sup> SOFTWARE NOTICE AND LICENSE</h1>
|
||||
|
||||
<h3>Copyright © 1997-2002 <a href="http://www.w3.org/">World
|
||||
Wide Web Consortium</a>, (<a
|
||||
href="http://www.lcs.mit.edu/">Massachusetts Institute of
|
||||
Technology</a>, <a href="http://www.inria.fr/">Institut National de
|
||||
Recherche en Informatique et en Automatique</a>, <a
|
||||
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
|
||||
Reserved. http://www.w3.org/Consortium/Legal/</h3>
|
||||
|
||||
<p>This W3C work (including software, documents, or other related
|
||||
items) is being provided by the copyright holders under the
|
||||
following license. By obtaining, using and/or copying this work,
|
||||
you (the licensee) agree that you have read, understood, and will
|
||||
comply with the following terms and conditions:</p>
|
||||
|
||||
<p>Permission to use, copy, modify, and distribute this software
|
||||
and its documentation, with or without modification, for any
|
||||
purpose and without fee or royalty is hereby granted, provided that
|
||||
you include the following on ALL copies of the software and
|
||||
documentation or portions thereof, including modifications, that
|
||||
you make:</p>
|
||||
|
||||
<ol>
|
||||
<li>The full text of this NOTICE in a location viewable to users of
|
||||
the redistributed or derivative work.</li>
|
||||
|
||||
<li>Any pre-existing intellectual property disclaimers, notices, or
|
||||
terms and conditions. If none exist, a short notice of the
|
||||
following form (hypertext is preferred, text is permitted) should
|
||||
be used within the body of any redistributed or derivative code:
|
||||
"Copyright © [$date-of-software] <a
|
||||
href="http://www.w3.org/">World Wide Web Consortium</a>, (<a
|
||||
href="http://www.lcs.mit.edu/">Massachusetts Institute of
|
||||
Technology</a>, <a href="http://www.inria.fr/">Institut National de
|
||||
Recherche en Informatique et en Automatique</a>, <a
|
||||
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
|
||||
Reserved. http://www.w3.org/Consortium/Legal/"</li>
|
||||
|
||||
<li>Notice of any changes or modifications to the W3C files,
|
||||
including the date changes were made. (We recommend you provide
|
||||
URIs to the location from which the code is derived.)</li>
|
||||
</ol>
|
||||
|
||||
<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND
|
||||
COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
|
||||
USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD
|
||||
PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
|
||||
|
||||
<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
|
||||
SOFTWARE OR DOCUMENTATION.</p>
|
||||
|
||||
<p>The name and trademarks of copyright holders may NOT be used in
|
||||
advertising or publicity pertaining to the software without
|
||||
specific, written prior permission. Title to copyright in this
|
||||
software and any associated documentation will at all times remain
|
||||
with copyright holders.</p>
|
||||
|
||||
<p>____________________________________</p>
|
||||
|
||||
<p>This formulation of W3C's notice and license became active on
|
||||
August 14 1998 so as to improve compatibility with GPL. This
|
||||
version ensures that W3C software licensing terms are no more
|
||||
restrictive than GPL and consequently W3C software may be
|
||||
distributed in GPL packages. See the <a
|
||||
href="copyright-software-19980519.html">older formulation</a> for
|
||||
the policy prior to this date. Please see our <a
|
||||
href="IPR-FAQ.html">Copyright FAQ</a> for common questions about
|
||||
using materials from our site, including specific terms and
|
||||
conditions for packages like libwww, Amaya, and Jigsaw. Other
|
||||
questions about this notice can be directed to <a
|
||||
href="mailto:site-policy@w3.org">site-policy@w3.org</a>.<br />
|
||||
</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<address><a href="http://www.w3.org/Help/Webmaster.html">webmaster</a><br />
|
||||
(last updated $Date: 2004/05/29 04:04:36 $)</address>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,64 +0,0 @@
|
||||
W3C IPR SOFTWARE NOTICE
|
||||
|
||||
Copyright © 1995-1998 World Wide Web Consortium, (Massachusetts Institute of
|
||||
Technology, Institut National de Recherche en Informatique et en
|
||||
Automatique, Keio University). All Rights Reserved.
|
||||
http://www.w3.org/Consortium/Legal/
|
||||
|
||||
This W3C work (including software, documents, or other related items) is
|
||||
being provided by the copyright holders under the following license. By
|
||||
obtaining, using and/or copying this work, you (the licensee) agree that you
|
||||
have read, understood, and will comply with the following terms and
|
||||
conditions:
|
||||
|
||||
Permission to use, copy, and modify this software and its documentation,
|
||||
with or without modification, for any purpose and without fee or royalty is
|
||||
hereby granted, provided that you include the following on ALL copies of the
|
||||
software and documentation or portions thereof, including modifications,
|
||||
that you make:
|
||||
|
||||
1. The full text of this NOTICE in a location viewable to users of the
|
||||
redistributed or derivative work.
|
||||
2. Any pre-existing intellectual property disclaimers, notices, or terms
|
||||
and conditions. If none exist, a short notice of the following form
|
||||
(hypertext is preferred, text is permitted) should be used within the
|
||||
body of any redistributed or derivative code: "Copyright © World Wide
|
||||
Web Consortium, (Massachusetts Institute of Technology, Institut
|
||||
National de Recherche en Informatique et en Automatique, Keio
|
||||
University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
|
||||
3. Notice of any changes or modifications to the W3C files, including the
|
||||
date changes were made. (We recommend you provide URIs to the location
|
||||
from which the code is derived).
|
||||
|
||||
In addition, creators of derivitive works must include the full text of this
|
||||
NOTICE in a location viewable to users of the derivitive work.
|
||||
|
||||
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
|
||||
MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
|
||||
PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
|
||||
ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
||||
|
||||
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
|
||||
DOCUMENTATION.
|
||||
|
||||
The name and trademarks of copyright holders may NOT be used in advertising
|
||||
or publicity pertaining to the software without specific, written prior
|
||||
permission. Title to copyright in this software and any associated
|
||||
documentation will at all times remain with copyright holders.
|
||||
|
||||
____________________________________
|
||||
|
||||
This formulation of W3C's notice and license became active on August 14
|
||||
1998. See the older formulation for the policy prior to this date. Please
|
||||
see our Copyright FAQ for common questions about using materials from our
|
||||
site, including specific terms and conditions for packages like libwww,
|
||||
Amaya, and Jigsaw. Other questions about this notice can be directed to
|
||||
site-policy@w3.org .
|
||||
|
||||
|
||||
|
||||
|
||||
webmaster
|
||||
(last updated 14-Aug-1998)
|
@ -1,83 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CSS Validator Binary Distribution - Illumit</title>
|
||||
<link title="RSS Feed" type="application/rss+xml" rel="alternate" href="http://www.illumit.com/site.rss" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>CSS Validator Binary Distribution</h1>
|
||||
<p>This a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a>.
|
||||
It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006.
|
||||
No modifications were made.</p>
|
||||
|
||||
<p>This distribution is provided <a href="#asis">as is</a> to make testing a large number of CSS files easier.</p>
|
||||
|
||||
|
||||
<h2>Requirements</h2>
|
||||
<p>A Java 2 Virtual Machine is required to use the validator.
|
||||
You can download one from <a href="http://java.sun.com/">Sun</a> if you do not have one installed.</p>
|
||||
|
||||
<h2>Usage</h2>
|
||||
<h2>Summary</h2>
|
||||
<p><code>java -jar <samp>~/css-validator/</samp>css-validator.jar [-options] files URLs</code></p>
|
||||
<h2>Sample</h2>
|
||||
<pre>
|
||||
java -jar ~/css-validator/css-validator.jar f1.css http://illumit.com/
|
||||
</pre>
|
||||
<h2>Options</h2>
|
||||
<dl>
|
||||
<dt>-e</dt><dd>Show errors only.</dd>
|
||||
<dt>-html</dt><dd>Output HTML.</dd>
|
||||
<dt>-css1 | -css2 | -css21 | -css3 | -svg | -svgbasic | -svgtiny</dt>
|
||||
<dd>Specify CSS version. CSS2 is the default.</dd>
|
||||
</dl>
|
||||
|
||||
<h2>Support</h2>
|
||||
|
||||
<p>If you have questions about how this distribution is built or packaged,
|
||||
<a href="mailto:contact@illumit.com">mailto:contact@illumit.com</a>.</p>
|
||||
|
||||
<p>Use the CSS Validator <a href="http://jigsaw.w3.org/css-validator/Email">Feedback</a>
|
||||
page if you have any questions or problems with the validator itself.</p>
|
||||
|
||||
<p class="Footnote">Updates are announced on via
|
||||
<a class="RSSLink" rel="alternate" type="application/rss+xml" href="http://www.illumit.com/site.rss">RSS</a></p>
|
||||
|
||||
<!--
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="css-validator.jar">css-validator.jar</a> Executable JAR package</li>
|
||||
<li><a href="COPYRIGHT.html">COPYRIGHT.html</a> CSS Validator Copyright Notice</li>
|
||||
<li><a href="css-validator-javadoc.jar">css-validator-javadoc.jar</a> CSS Validator API Docs</li>
|
||||
<li>Required libraries:<ul>
|
||||
<li><a href="jigsaw.jar">jigsaw.jar</a> and <a href="JIGSAW_COPYRIGHT">JIGSAW_COPYRIGHT</a></li>
|
||||
<li><a href="xerces.jar">xerces.jar</a> and <a href="XERCES_COPYING.txt">XERCES_COPYING.txt</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
-->
|
||||
|
||||
<h2>Download</h2>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<h2><a name="asis">License Agreement</a></h2>
|
||||
|
||||
<p>This is a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a> Version 2.0
|
||||
It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006.
|
||||
No modifications were made to the source.</p>
|
||||
|
||||
<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND
|
||||
ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS (W3C) MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
|
||||
USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD
|
||||
PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
|
||||
|
||||
<p>ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
|
||||
SOFTWARE OR DOCUMENTATION.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1999 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xerces" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, International
|
||||
* Business Machines, Inc., http://www.ibm.com. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,56 +1,10 @@
|
||||
require File.join(File.dirname(__FILE__), 'core_ext')
|
||||
begin
|
||||
require 'rubygems'
|
||||
require 'compass-validator'
|
||||
rescue LoadError
|
||||
puts %Q{The Compass CSS Validator could not be loaded. Please install it:
|
||||
|
||||
module Compass
|
||||
# Validates generated CSS against the W3 using Java
|
||||
class Validator
|
||||
VALIDATOR_FILE = File.join(File.dirname(__FILE__), 'validate', 'css-validator.jar')
|
||||
attr_reader :error_count
|
||||
attr_reader :css_directory
|
||||
|
||||
def initialize(css_directory)
|
||||
@css_directory = css_directory
|
||||
@error_count = 0
|
||||
end
|
||||
|
||||
# Validates all three CSS files
|
||||
def validate
|
||||
java_path = `which java`.rstrip
|
||||
raise "You do not have a Java installed, but it is required." if java_path.blank?
|
||||
|
||||
output_header
|
||||
|
||||
Dir.glob(File.join(css_directory, "**", "*.css")).each do |file_name|
|
||||
@error_count += 1 if !validate_css_file(java_path, file_name)
|
||||
end
|
||||
|
||||
output_footer
|
||||
end
|
||||
|
||||
private
|
||||
def validate_css_file(java_path, css_file)
|
||||
puts "\n\nTesting #{css_file}"
|
||||
puts "Output ============================================================\n\n"
|
||||
system("#{java_path} -jar '#{VALIDATOR_FILE}' -e '#{css_file}'")
|
||||
end
|
||||
|
||||
def output_header
|
||||
puts "\n\n"
|
||||
puts "************************************************************"
|
||||
puts "**"
|
||||
puts "** Compass CSS Validator"
|
||||
puts "** Validates output CSS files"
|
||||
puts "**"
|
||||
puts "************************************************************"
|
||||
end
|
||||
|
||||
def output_footer
|
||||
puts "\n\n"
|
||||
puts "************************************************************"
|
||||
puts "**"
|
||||
puts "** Done!"
|
||||
puts "** Your CSS files are#{" not" if error_count > 0} valid.#{" You had #{error_count} error(s) within your files" if error_count > 0}"
|
||||
puts "**"
|
||||
puts "************************************************************"
|
||||
end
|
||||
end
|
||||
sudo gem install chriseppstein-compass-validator --source http://gems.github.com/
|
||||
}
|
||||
exit(1)
|
||||
end
|
Loading…
Reference in New Issue
Block a user