-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from tschaub/royriojas-any-newer-fixed
Run task with all src files if corresponding dest file is absent.
- Loading branch information
Showing
7 changed files
with
160 additions
and
4 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
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,110 @@ | ||
var path = require('path'); | ||
|
||
|
||
/** | ||
* @param {Object} grunt Grunt. | ||
*/ | ||
module.exports = function(grunt) { | ||
|
||
var log = []; | ||
|
||
grunt.initConfig({ | ||
newer: { | ||
options: { | ||
timestamps: path.join(__dirname, '.cache') | ||
} | ||
}, | ||
clean: { | ||
one: 'dest/one.js', | ||
all: 'dest' | ||
}, | ||
modified: { | ||
one: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'src/', | ||
src: 'one.coffee', | ||
dest: 'dest/', | ||
ext: '.js' | ||
}] | ||
}, | ||
all: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'src/', | ||
src: '**/*.coffee', | ||
dest: 'dest/', | ||
ext: '.js' | ||
}] | ||
}, | ||
none: { | ||
src: [] | ||
} | ||
}, | ||
log: { | ||
all: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'src/', | ||
src: '**/*.coffee', | ||
dest: 'dest/', | ||
ext: '.js' | ||
}], | ||
getLog: function() { | ||
return log; | ||
} | ||
} | ||
}, | ||
assert: { | ||
that: { | ||
getLog: function() { | ||
return log; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadTasks('../../../node_modules/grunt-contrib-clean/tasks'); | ||
|
||
grunt.loadTasks('../../../tasks'); | ||
grunt.loadTasks('../../../test/tasks'); | ||
|
||
grunt.registerTask('default', function() { | ||
|
||
grunt.task.run([ | ||
// run the log task with newer, expect all files | ||
'newer:log', | ||
'assert:that:modified:all', | ||
|
||
// HFS+ filesystem mtime resolution | ||
'wait:1001', | ||
|
||
// modify one file | ||
'modified:one', | ||
|
||
// run assert task again, expect one file | ||
'newer:log', | ||
'assert:that:modified:one', | ||
|
||
// HFS+ filesystem mtime resolution | ||
'wait:1001', | ||
|
||
// modify nothing, expect no files | ||
'newer:log', | ||
'assert:that:modified:none', | ||
|
||
// remove one dest file, expect one file | ||
'clean:one', | ||
'newer:log', | ||
'assert:that:modified:one', | ||
|
||
// remove all dest file, expect all | ||
'clean:all', | ||
'newer:log', | ||
'assert:that:modified:all' | ||
|
||
]); | ||
|
||
}); | ||
|
||
}; |
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,3 @@ | ||
coffee = | ||
is: 'good' | ||
hot: true |
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,3 @@ | ||
semicolons = true | ||
coffee = true | ||
semicolons = false if coffee |
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 @@ | ||
var path = require('path'); | ||
|
||
var helper = require('./helper'); | ||
|
||
var name = 'newer-clean-dest'; | ||
var gruntfile = path.join(name, 'gruntfile.js'); | ||
|
||
describe(name, function() { | ||
var fixture; | ||
|
||
it('runs the default task (see ' + gruntfile + ')', function(done) { | ||
this.timeout(3000); | ||
helper.buildFixture(name, function(error, dir) { | ||
fixture = dir; | ||
done(error); | ||
}); | ||
}); | ||
|
||
after(function(done) { | ||
helper.afterFixture(fixture, 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