Skip to content

Commit

Permalink
style(generators): unify export syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
passy committed Sep 21, 2013
1 parent c76c702 commit 9254cfb
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 52 deletions.
6 changes: 2 additions & 4 deletions common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ var util = require('util');
var yeoman = require('yeoman-generator');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
yeoman.generators.Base.apply(this, arguments);
}
};

util.inherits(Generator, yeoman.generators.Base);

Expand Down
6 changes: 2 additions & 4 deletions constant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ var util = require('util');
var ScriptBase = require('../script-base.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);

// if the controller name is suffixed with ctrl, remove the suffix
// if the controller name is just "ctrl," don't append/remove "ctrl"
if (this.name && this.name.toLowerCase() !== 'ctrl' && this.name.substr(-4).toLowerCase() === 'ctrl') {
this.name = this.name.slice(0, -4);
}
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions directive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions factory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions filter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var yeoman = require('yeoman-generator');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
7 changes: 3 additions & 4 deletions route/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
this.hookFor('angular:controller');
this.hookFor('angular:view');
}
};

util.inherits(Generator, ScriptBase);

Generator.prototype.rewriteAppJs = function () {
Expand Down
6 changes: 2 additions & 4 deletions script-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var path = require('path');
var yeoman = require('yeoman-generator');
var angularUtils = require('./util.js');

module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
yeoman.generators.NamedBase.apply(this, arguments);

try {
Expand Down Expand Up @@ -60,7 +58,7 @@ function Generator() {
}

this.sourceRoot(path.join(__dirname, sourceRoot));
}
};

util.inherits(Generator, yeoman.generators.NamedBase);

Expand Down
6 changes: 2 additions & 4 deletions service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions value/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
}
};

util.inherits(Generator, ScriptBase);

Expand Down
6 changes: 2 additions & 4 deletions view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var util = require('util');
var yeoman = require('yeoman-generator');


module.exports = Generator;

function Generator() {
var Generator = module.exports = function Generator() {
yeoman.generators.NamedBase.apply(this, arguments);
this.sourceRoot(path.join(__dirname, '../templates'));

Expand All @@ -16,7 +14,7 @@ function Generator() {
} catch (e) {}
this.env.options.appPath = this.env.options.appPath || 'app';
}
}
};

util.inherits(Generator, yeoman.generators.NamedBase);

Expand Down

0 comments on commit 9254cfb

Please sign in to comment.