Skip to content

Commit

Permalink
Use new file system with the gruntfile API
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jan 6, 2015
1 parent cbbf035 commit cd0eb2a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,19 @@ var Base = module.exports = function Base(args, options) {
// Only instantiate the Gruntfile API when requested
Object.defineProperty(this, 'gruntfile', {
get: function () {
var gruntfile;
if (!this.env.gruntfile) {
// Use actual Gruntfile.js or the default one
try {
gruntfile = this.dest.read('Gruntfile.js');
} catch (e) {}
var gruntfile = this.fs.read(this.destinationPath('Gruntfile.js'), {
defaults: ''
});
this.env.gruntfile = new GruntfileEditor(gruntfile);
}

// Schedule the creation/update of the Gruntfile
this.env.runLoop.add('writing', function (done) {
this.dest.write('Gruntfile.js', this.env.gruntfile.toString());
this.fs.write(
this.destinationPath('Gruntfile.js'),
this.env.gruntfile.toString()
);
done();
}.bind(this), { once: 'gruntfile:write' });

Expand Down

0 comments on commit cd0eb2a

Please sign in to comment.