Permalink
Browse files

Updated docs, changelog.

  • Loading branch information...
1 parent bf439a3 commit dd53fcddfbbd2d3fa2a228a5b95f41be8be6ca68 @arthurakay committed Dec 14, 2012
Showing with 188 additions and 0 deletions.
  1. +8 −0 CHANGELOG
  2. +1 −0 docs/output/LintRoller.util.js
  3. +174 −0 docs/source/util.html
  4. +5 −0 npm_update.sh
View
8 CHANGELOG
@@ -2,6 +2,14 @@
VERSION 2.x
===============
+Version 2.1.0 (December 14, 2012) - BREAKING CHANGES
+ - Moved code into /src/ folder
+ - Added "util" namespace and utilities
+ - Moved examples into /examples/ folder
+ - Updated documentation
+ - General refactoring
+
+
Version 2.0.0 (December 11, 2012) - BREAKING CHANGES ALL AROUND!
- Changed name from "PhantomLint" to "LintRoller"
- added JSHint support
View
1 docs/output/LintRoller.util.js
@@ -0,0 +1 @@
+Ext.data.JsonP.LintRoller_util({"mixedInto":[],"mixins":[],"code_type":"assignment","inheritable":false,"parentMixins":[],"meta":{},"uses":[],"aliases":{},"superclasses":[],"html":"<div><pre class=\"hierarchy\"><h4>Files</h4><div class='dependency'><a href='source/util.html#LintRoller-util' target='_blank'>util.js</a></div></pre><div class='doc-contents'><p>Some additional utilities for cleaning up JavaScript lint.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-findLintErrors' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='LintRoller.util'>LintRoller.util</span><br/><a href='source/util.html#LintRoller-util-method-findLintErrors' target='_blank' class='view-source'>view source</a></div><a href='#!/api/LintRoller.util-method-findLintErrors' class='name expandable'>findLintErrors</a>( <span class='pre'>Object linter, Object options, Object msg</span> )<strong class='private signature'>private</strong></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>linter</span> : Object<div class='sub-desc'>\n</div></li><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n</div></li><li><span class='pre'>msg</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-fixOffendingFiles' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='LintRoller.util'>LintRoller.util</span><br/><a href='source/util.html#LintRoller-util-method-fixOffendingFiles' target='_blank' class='view-source'>view source</a></div><a href='#!/api/LintRoller.util-method-fixOffendingFiles' class='name expandable'>fixOffendingFiles</a>( <span class='pre'>Object offendingFiles, Object spacingChars</span> )<strong class='private signature'>private</strong></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>offendingFiles</span> : Object<div class='sub-desc'>\n</div></li><li><span class='pre'>spacingChars</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getLintOptions' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='LintRoller.util'>LintRoller.util</span><br/><a href='source/util.html#LintRoller-util-method-getLintOptions' target='_blank' class='view-source'>view source</a></div><a href='#!/api/LintRoller.util-method-getLintOptions' class='name expandable'>getLintOptions</a>( <span class='pre'>Object linter</span> )<strong class='private signature'>private</strong></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>linter</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-init' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='LintRoller.util'>LintRoller.util</span><br/><a href='source/util.html#LintRoller-util-method-init' target='_blank' class='view-source'>view source</a></div><a href='#!/api/LintRoller.util-method-init' class='name expandable'>init</a>( <span class='pre'>Object parent</span> )<strong class='private signature'>private</strong></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>parent</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-locateOffenders' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='LintRoller.util'>LintRoller.util</span><br/><a href='source/util.html#LintRoller-util-method-locateOffenders' target='_blank' class='view-source'>view source</a></div><a href='#!/api/LintRoller.util-method-locateOffenders' class='name expandable'>locateOffenders</a>( <span class='pre'>Object msg</span> )<strong class='private signature'>private</strong></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>msg</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-replaceTabsWithSpaces' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='LintRoller.util'>LintRoller.util</span><br/><a href='source/util.html#LintRoller-util-method-replaceTabsWithSpaces' target='_blank' class='view-source'>view source</a></div><a href='#!/api/LintRoller.util-method-replaceTabsWithSpaces' class='name expandable'>replaceTabsWithSpaces</a>( <span class='pre'>Object config, Number spacingChars</span> )</div><div class='description'><div class='short'>A utility that will eliminate all \"Mixed spaces with tabs.\" warnings by replacing tab characters with spaces. ...</div><div class='long'><p>A utility that will eliminate all \"Mixed spaces with tabs.\" warnings by replacing tab characters with spaces.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>config</span> : Object<div class='sub-desc'><p>A configuration object</p>\n</div></li><li><span class='pre'>spacingChars</span> : Number<div class='sub-desc'><p>The number of spaces to replace a tab</p>\n</div></li></ul></div></div></div></div></div></div></div>","subclasses":[],"members":{"event":[],"property":[],"css_var":[],"method":[{"meta":{"private":true},"owner":"LintRoller.util","tagname":"method","name":"findLintErrors","id":"method-findLintErrors"},{"meta":{"private":true},"owner":"LintRoller.util","tagname":"method","name":"fixOffendingFiles","id":"method-fixOffendingFiles"},{"meta":{"private":true},"owner":"LintRoller.util","tagname":"method","name":"getLintOptions","id":"method-getLintOptions"},{"meta":{"private":true},"owner":"LintRoller.util","tagname":"method","name":"init","id":"method-init"},{"meta":{"private":true},"owner":"LintRoller.util","tagname":"method","name":"locateOffenders","id":"method-locateOffenders"},{"meta":{},"owner":"LintRoller.util","tagname":"method","name":"replaceTabsWithSpaces","id":"method-replaceTabsWithSpaces"}],"css_mixin":[],"cfg":[]},"html_meta":{},"tagname":"class","extends":null,"name":"LintRoller.util","alternateClassNames":[],"inheritdoc":null,"component":false,"singleton":true,"id":"class-LintRoller.util","statics":{"property":[],"event":[],"css_var":[],"method":[],"css_mixin":[],"cfg":[]},"requires":[],"files":[{"href":"util.html#LintRoller-util","filename":"util.js"}]});
View
174 docs/source/util.html
@@ -0,0 +1,174 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+ <style type="text/css">
+ .highlight { display: block; background-color: #ddd; }
+ </style>
+ <script type="text/javascript">
+ function highlight() {
+ document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+ }
+ </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+ <pre class="prettyprint lang-js"><span id='LintRoller-util'>/**
+</span> * @class LintRoller.util
+ * @singleton
+ *
+ * Some additional utilities for cleaning up JavaScript lint.
+ */
+util = {
+
+<span id='LintRoller-util-method-init'> /**
+</span> * @private
+ */
+ init : function (parent) {
+ this.parent = parent;
+ return this;
+ },
+
+
+<span id='LintRoller-util-method-replaceTabsWithSpaces'> /**
+</span> * A utility that will eliminate all &quot;Mixed spaces with tabs.&quot; warnings by replacing tab characters with spaces.
+ *
+ * @param {Object} config A configuration object
+ * @param {Number} spacingChars The number of spaces to replace a tab
+ */
+ replaceTabsWithSpaces : function (config, spacingChars) {
+ this.parent.initConfigs(config);
+ this.parent.parseTree(config.filepaths);
+
+ this.parent.log('\nFilesystem has been parsed. Looping through available files...', true);
+
+ var msg = 'Mixed spaces and tabs.';
+ var offendingFiles = this.locateOffenders(msg);
+
+ //HOW MANY ERRORS?!?
+ this.parent.log(
+ 'Found ' + offendingFiles.length +
+ ' files matching the error &quot;' + msg +
+ '&quot; between ' + this.parent.linters.length + ' linters.',
+ true
+ );
+
+ try {
+ this.fixOffendingFiles(offendingFiles, spacingChars);
+ }
+ catch (e) {
+ this.parent.log(
+ 'An error has occurred: ' + e,
+ true
+ );
+
+ process.exit(1);
+ }
+
+ this.parent.log(
+ 'LintRoller has attempted to replace all tabs with ' + spacingChars + ' spaces.',
+ true
+ );
+
+ process.exit(0);
+ },
+
+
+<span id='LintRoller-util-method-locateOffenders'> /**
+</span> * @private
+ */
+ locateOffenders : function (msg) {
+ var offendingFiles = [],
+ linter, newFiles, i;
+
+ //find offending files
+ for (i = 0; i &lt; this.parent.linters.length; i++) {
+ linter = this.parent.linters[i];
+
+ newFiles = this.findLintErrors(linter, this.getLintOptions(linter), msg);
+ offendingFiles = offendingFiles.concat(newFiles);
+ }
+
+ return offendingFiles;
+ },
+
+
+<span id='LintRoller-util-method-fixOffendingFiles'> /**
+</span> * @private
+ */
+ fixOffendingFiles : function(offendingFiles, spacingChars) {
+ var i = 0,
+ spaces = '',
+ file, js;
+
+ for (i; i&lt;spacingChars; i++) {
+ spaces += ' ';
+ }
+
+ for (i=0; i &lt; offendingFiles.length; i++) {
+ file = offendingFiles[i];
+ js = this.parent.fs.readFileSync(file, 'utf8');
+
+ js = js.replace(/\t/g, spaces);
+
+ this.parent.fs.writeFileSync(file, js, 'utf8');
+ }
+ },
+
+
+<span id='LintRoller-util-method-getLintOptions'> /**
+</span> * @private
+ */
+ getLintOptions : function (linter) {
+ if (linter === this.parent.jsLint.lib) {
+ return this.parent.jsLint.options;
+ }
+
+ if (linter === this.parent.jsHint.lib) {
+ return this.parent.jsHint.options;
+ }
+
+ return {};
+ },
+
+
+<span id='LintRoller-util-method-findLintErrors'> /**
+</span> * @private
+ */
+ findLintErrors : function (linter, options, msg) {
+ var j = 0,
+ offendingFiles = [],
+ file, js;
+
+ for (j; j &lt; this.parent.files.length; j++) {
+
+ file = this.parent.files[j];
+ js = this.parent.fs.readFileSync(file, 'utf8');
+
+ var i = 0,
+ result = linter(js, options),
+ totalErrors = linter.errors.length,
+ error;
+
+ if (!result) {
+ for (i; i &lt; totalErrors; i++) {
+ error = linter.errors[i];
+
+ if (error &amp;&amp; error.reason === msg) {
+ offendingFiles.push(file);
+ break;
+ }
+ }
+ }
+ }
+
+ return offendingFiles;
+ }
+
+};
+
+module.exports = util;</pre>
+</body>
+</html>
View
5 npm_update.sh
@@ -0,0 +1,5 @@
+clear
+
+echo 'Updating NMP...'
+
+npm publish

0 comments on commit dd53fcd

Please sign in to comment.