Skip to content

Commit 1b6eede

Browse files
committedDec 2, 2016
Remove Gruntfile api - Fix #744
1 parent fedb2fb commit 1b6eede

File tree

3 files changed

+0
-64
lines changed

3 files changed

+0
-64
lines changed
 

‎lib/index.js

-28
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ var minimist = require('minimist');
1212
var runAsync = require('run-async');
1313
var through = require('through2');
1414
var userHome = require('user-home');
15-
var GruntfileEditor = require('gruntfile-editor');
1615
var FileEditor = require('mem-fs-editor');
1716
var pathIsAbsolute = require('path-is-absolute');
1817
var pathExists = require('path-exists');
@@ -137,33 +136,6 @@ var Base = module.exports = function Base(args, options) {
137136

138137
// ensure source/destination path, can be configured from subclasses
139138
this.sourceRoot(path.join(path.dirname(this.resolved), 'templates'));
140-
141-
// Only instantiate the Gruntfile API when requested
142-
Object.defineProperty(this, 'gruntfile', {
143-
get: function () {
144-
if (!this.env.gruntfile) {
145-
var gruntfile = '';
146-
var gruntPath = this.destinationPath('Gruntfile.js');
147-
148-
if (this.fs.exists(gruntPath)) {
149-
gruntfile = this.fs.read(gruntPath);
150-
}
151-
152-
this.env.gruntfile = new GruntfileEditor(gruntfile);
153-
}
154-
155-
// Schedule the creation/update of the Gruntfile
156-
this.env.runLoop.add('writing', function (done) {
157-
this.fs.write(
158-
this.destinationPath('Gruntfile.js'),
159-
this.env.gruntfile.toString()
160-
);
161-
done();
162-
}.bind(this), { once: 'gruntfile:write' });
163-
164-
return this.env.gruntfile;
165-
}
166-
});
167139
};
168140

169141
util.inherits(Base, events.EventEmitter);

‎package.json

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"find-up": "^1.0.0",
4646
"github-username": "^2.0.0",
4747
"glob": "^7.0.3",
48-
"gruntfile-editor": "^1.0.0",
4948
"istextorbinary": "^2.1.0",
5049
"lodash": "^4.11.1",
5150
"mem-fs-editor": "^2.0.0",

‎test/base.js

-35
Original file line numberDiff line numberDiff line change
@@ -913,41 +913,6 @@ describe('Base', function () {
913913
});
914914
});
915915

916-
describe('#gruntfile', function () {
917-
beforeEach(function () {
918-
this.GruntfileGenerator = Base.extend({
919-
grunt: function () {
920-
this.gruntfile.insertConfig('foo', '{}');
921-
}
922-
});
923-
924-
this.gruntGenerator = new this.GruntfileGenerator([], {
925-
resolved: 'unknown',
926-
namespace: 'dummy',
927-
env: this.env,
928-
'skip-install': true,
929-
force: true
930-
});
931-
});
932-
933-
it('expose the gruntfile editor API', function () {
934-
assert(this.gruntGenerator.gruntfile instanceof require('gruntfile-editor'));
935-
});
936-
937-
it('uses the gruntfile editor of the Env if available', function () {
938-
this.gruntGenerator.env.gruntfile = 'foo';
939-
assert.equal(this.gruntGenerator.gruntfile, 'foo');
940-
});
941-
942-
it('schedule gruntfile writing on the write Queue', function (done) {
943-
this.gruntGenerator.run(function () {
944-
var gruntfile = this.dummy.fs.read(this.dummy.destinationPath('Gruntfile.js'));
945-
assert(gruntfile.indexOf('foo:') > 0);
946-
done();
947-
}.bind(this));
948-
});
949-
});
950-
951916
describe('#templatePath()', function () {
952917
it('joins path to the source root', function () {
953918
assert.equal(

0 commit comments

Comments
 (0)
Please sign in to comment.