forked from CSSLint/csslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing: Update the YUI Test harness for Grunt
- Fails the build on test failure - Splits out our custom Grunt tasks - Update the relative require paths after moving the tasks from the Gruntfile
- Loading branch information
Showing
5 changed files
with
208 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* jshint node:true */ | ||
module.exports = function( grunt ) { | ||
"use strict"; | ||
grunt.registerMultiTask("changelog", "Write the changelog file", function() { | ||
var done = this.async(); | ||
var lastTag; | ||
var files = this.filesSrc; | ||
|
||
|
||
grunt.util.spawn({ | ||
cmd: "git", | ||
args: ["tag"] | ||
}, function(error, result) { | ||
//Find the latest git tag | ||
var tags = result.stdout.split("\n"), | ||
semver = tags[0].replace("v","").split("."), | ||
major = parseInt(semver[0], 10), | ||
minor = parseInt(semver[1], 10), | ||
patch = parseInt(semver[2], 10); | ||
|
||
//A simple array sort can't be used because of the comparison of | ||
//the strings "0.9.9" > "0.9.10" | ||
for (var i = 1, len = tags.length; i < len; i++) { | ||
semver = tags[i].replace("v", "").split("."); | ||
|
||
var currentMajor = parseInt(semver[0], 10); | ||
if (currentMajor < major) { | ||
continue; | ||
} else if (currentMajor > major) { | ||
major = currentMajor; | ||
} | ||
|
||
var currentMinor = parseInt(semver[1], 10); | ||
if (currentMinor < minor) { | ||
continue; | ||
} else if (currentMinor > minor) { | ||
minor = currentMinor; | ||
} | ||
|
||
var currentPatch = parseInt(semver[2], 10); | ||
if (currentPatch < patch) { | ||
continue; | ||
} else if (currentPatch > patch) { | ||
patch = currentPatch; | ||
} | ||
} | ||
|
||
lastTag = "v" + major + "." + minor + "." + patch; | ||
|
||
grunt.verbose.write("Last tag: " + lastTag).writeln(); | ||
|
||
// | ||
grunt.util.spawn({ | ||
cmd: "git", | ||
args: ["log", "--pretty=format:'* %s (%an)'", lastTag + "..HEAD"] | ||
}, function(error, result) { | ||
var prettyPrint = result.stdout.split("'\n'").join("\n").replace(/\"$/, "").replace(/^\"/, ""); | ||
|
||
grunt.verbose.writeln().write(prettyPrint).writeln(); | ||
|
||
var template = "<%= grunt.template.today('mmmm d, yyyy') %> - v<%= pkg.version %>\n\n" + | ||
prettyPrint + "\n\n" + | ||
grunt.file.read(files[0]); | ||
|
||
grunt.file.write(files[0], grunt.template.process(template)); | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* jshint node:true */ | ||
module.exports = function( grunt ) { | ||
"use strict"; | ||
// Run test suite through rhino | ||
grunt.registerMultiTask("test_rhino", "Run the test suite through rhino", function() { | ||
var done = this.async(); | ||
var files = this.filesSrc; | ||
var progress = files.length; | ||
|
||
files.forEach(function(filepath) { | ||
grunt.util.spawn({ | ||
cmd: "java", | ||
args: ["-jar", "lib/js.jar", "lib/yuitest-rhino-cli.js", "build/csslint.js", filepath], | ||
opts: {stdio: "inherit"} | ||
}, function() { | ||
progress--; | ||
if (progress === 0) { | ||
done(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; |
Oops, something went wrong.