Skip to content

Commit

Permalink
Merge branch 'master' into nopt-2.1.1
Browse files Browse the repository at this point in the history
* master:
  quote version number for travis
  add node 0.10 to travis
  Bumping version to 0.4.1 and publishing to npm.
  Fix path.join thrown errors with expandMapping rename. Closes gruntjsgh-725.
  Update copyright date to 2013. Closes gruntjsgh-660.
  Remove some side effects from manually requiring Grunt. Closes gruntjsgh-605.
  grunt.log: add formatting support and implicitly cast msg to a string. Closes gruntjsgh-703.
  Update js-yaml to version 2. Closes gruntjsgh-683.
  The grunt.util.spawn method now falls back to stdout when the `grunt` option is set. Closes gruntjsgh-691.
  Making --verbose "Files:" warnings less scary. Closes gruntjsgh-657.
  Fixing typo: the grunt.fatal method now defaults to FATAL_ERROR. Closes gruntjsgh-656, gruntjsgh-707.
  Removed a duplicate line. Closes gruntjsgh-702.
  Gruntfile name should no longer be case sensitive. Closes gruntjsgh-685.
  The grunt.file.delete method warns and returns false if file doesn't exist. Closes gruntjsgh-635, gruntjsgh-714.
  The grunt.package property is now resolved via require(). Closes gruntjsgh-704.
  The grunt.util.spawn method no longer breaks on multibyte stdio. Closes gruntjsgh-710.
  Fix "path.join arguments must be strings" error in file.expand/recurse when options.cwd is not set. Closes gruntjsgh-722.
  Adding a fairly relevant keyword to package.json.
  Bumping version for development.
  • Loading branch information
jrolfs committed Mar 16, 2013
2 parents 0398fa9 + aefe877 commit cd61df1
Show file tree
Hide file tree
Showing 26 changed files with 371 additions and 119 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- 0.8
- "0.8"
- "0.10"
before_script:
- npm install -g grunt-cli
- npm install -g grunt-cli
23 changes: 23 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
v0.4.1:
date: 2013-03-13
changes:
- Fix path.join thrown errors with expandMapping rename. Closes gh-725.
- Update copyright date to 2013. Closes gh-660.
- Remove some side effects from manually requiring Grunt. Closes gh-605.
- grunt.log: add formatting support and implicitly cast msg to a string. Closes gh-703.
- Update js-yaml to version 2. Closes gh-683.
- The grunt.util.spawn method now falls back to stdout when the `grunt` option is set. Closes gh-691.
- Making --verbose "Files:" warnings less scary. Closes gh-657.
- Fixing typo: the grunt.fatal method now defaults to FATAL_ERROR. Closes gh-656, gh-707.
- Removed a duplicate line. Closes gh-702.
- Gruntfile name should no longer be case sensitive. Closes gh-685.
- The grunt.file.delete method warns and returns false if file doesn't exist. Closes gh-635, gh-714.
- The grunt.package property is now resolved via require(). Closes gh-704.
- The grunt.util.spawn method no longer breaks on multibyte stdio. Closes gh-710.
- Fix "path.join arguments must be strings" error in file.expand/recurse when options.cwd is not set. Closes gh-722.
- Adding a fairly relevant keyword to package.json (task).
v0.4.0:
date: 2013-02-18
changes:
- Initial release of 0.4.0.
- See http://gruntjs.com/upgrading-from-0.3-to-0.4 for a list of changes / migration guide.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012 "Cowboy" Ben Alman
Copyright (c) 2013 "Cowboy" Ben Alman

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ Before you make an issue, please read our [Contributing](http://gruntjs.com/cont
You can find the grunt team in [#grunt on irc.freenode.net](irc://irc.freenode.net/#grunt).

### Release History

* 2013-02-18 - v0.4.0 - Initial release of 0.4.0. See http://gruntjs.com/upgrading-from-0.3-to-0.4 for a list of changes / migration guide.
See the [CHANGELOG](CHANGELOG).
24 changes: 15 additions & 9 deletions lib/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand All @@ -26,7 +26,7 @@ var util = gRequire('util');
gRequire('template');
gRequire('event');
var fail = gRequire('fail');
var file = gRequire('file');
gRequire('file');
var option = gRequire('option');
var config = gRequire('config');
var task = gRequire('task');
Expand All @@ -36,7 +36,7 @@ gRequire('cli');
var verbose = grunt.verbose = log.verbose;

// Expose some grunt metadata.
grunt.package = file.readJSON(path.join(__dirname, '../package.json'));
grunt.package = require('../package.json');
grunt.version = grunt.package.version;

// Expose specific grunt lib methods on grunt.
Expand All @@ -48,17 +48,11 @@ gExpose(task, 'registerMultiTask');
gExpose(task, 'registerInitTask');
gExpose(task, 'renameTask');
gExpose(task, 'loadTasks');
gExpose(task, 'registerTask');
gExpose(task, 'loadNpmTasks');
gExpose(config, 'init', 'initConfig');
gExpose(fail, 'warn');
gExpose(fail, 'fatal');

// Handle otherwise unhandleable (probably asynchronous) exceptions.
process.on('uncaughtException', function (e) {
fail.fatal(e, fail.code.TASK_FAILURE);
});

// Expose the task interface. I've never called this manually, and have no idea
// how it will work. But it might.
grunt.tasks = function(tasks, options, done) {
Expand Down Expand Up @@ -124,12 +118,24 @@ grunt.tasks = function(tasks, options, done) {
}
verbose.writeflags(tasks, 'Running tasks');

// Handle otherwise unhandleable (probably asynchronous) exceptions.
var uncaughtHandler = function(e) {
fail.fatal(e, fail.code.TASK_FAILURE);
};
process.on('uncaughtException', uncaughtHandler);

// Report, etc when all tasks have completed.
task.options({
error: function(e) {
fail.warn(e, fail.code.TASK_FAILURE);
},
done: function() {
// Stop handling uncaught exceptions so that we don't leave any
// unwanted process-level side effects behind. There is no need to do
// this in the error callback, because fail.warn() will either kill
// the process, or with --force keep on going all the way here.
process.removeListener('uncaughtException', uncaughtHandler);

// Output a final fail / success report.
fail.report();

Expand Down
2 changes: 1 addition & 1 deletion lib/grunt/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/grunt/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/grunt/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/grunt/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down Expand Up @@ -54,7 +54,7 @@ function dumpStack(e) {
fail.fatal = function(e, errcode) {
writeln(e, 'fatal');
dumpStack(e);
process.exit(typeof errcode === 'number' ? errcode : fail.code.GENERAL_ERROR);
process.exit(typeof errcode === 'number' ? errcode : fail.code.FATAL_ERROR);
};

// Keep track of error and warning counts.
Expand Down
14 changes: 10 additions & 4 deletions lib/grunt/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down Expand Up @@ -114,7 +114,7 @@ file.expand = function() {
// Filter result set?
if (options.filter) {
matches = matches.filter(function(filepath) {
filepath = path.join(options.cwd, filepath);
filepath = path.join(options.cwd || '', filepath);
try {
if (typeof options.filter === 'function') {
return options.filter(filepath);
Expand All @@ -137,7 +137,7 @@ var pathSeparatorRe = /[\/\\]/g;
file.expandMapping = function(patterns, destBase, options) {
options = grunt.util._.defaults({}, options, {
rename: function(destBase, destPath) {
return path.join(destBase, destPath);
return path.join(destBase || '', destPath);
}
});
var files = [];
Expand Down Expand Up @@ -204,7 +204,7 @@ file.recurse = function recurse(rootdir, callback, subdir) {
fs.readdirSync(abspath).forEach(function(filename) {
var filepath = path.join(abspath, filename);
if (fs.statSync(filepath).isDirectory()) {
recurse(rootdir, callback, unixifyPath(path.join(subdir, filename)));
recurse(rootdir, callback, unixifyPath(path.join(subdir || '', filename || '')));
} else {
callback(unixifyPath(filepath), rootdir, subdir, filename);
}
Expand Down Expand Up @@ -334,6 +334,12 @@ file.delete = function(filepath, options) {

grunt.verbose.write((nowrite ? 'Not actually deleting ' : 'Deleting ') + filepath + '...');

if (!file.exists(filepath)) {
grunt.verbose.error();
grunt.log.warn('Cannot delete nonexistent file.');
return false;
}

// Only delete cwd or outside cwd if --force enabled. Be careful, people!
if (!options.force) {
if (file.isPathCwd(filepath)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/grunt/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
Expand Down
Loading

0 comments on commit cd61df1

Please sign in to comment.