'use strict';
var util   = require('util');
var yeoman = require('yeoman-generator');
var path   = require('path');
var base   = require('../base.js')

var ControlGenerator = module.exports = function ControlGenerator(args, options, config) {
  base.apply(this, arguments);
};

util.inherits(ControlGenerator, base);

ControlGenerator.prototype.askForName = base.namePrompt('Please enter the path to the control eg.: controls/users:');

ControlGenerator.prototype._nameWithoutExtension = function _nameWithoutExtension(){
  return this._fullName().replace(/\.js$/, '');
}

ControlGenerator.prototype._toRoot = function _toRoot(){
  var length = this._fullPath().split('/').length - 1;
  return this._.repeat('../', length);
}

ControlGenerator.prototype._fullPath = function _fullPath(){
  var nameWithoutExtension = this._nameWithoutExtension();
  return path.join(nameWithoutExtension, nameWithoutExtension.split('/').pop());
}

ControlGenerator.prototype._baseName = function _fullPath(){
  return this._nameWithoutExtension().split('/').pop();
}

ControlGenerator.prototype._ejsHello = function _ejsHello(){
  return '<%= engine %>';
}

ControlGenerator.prototype.files = function files() {
  var template = this._isUsingRequireJS() ? 'requirejs' : 'none',
      fullPath = this._fullPath();
  if(this.name){
    this._mkdirp(this.name + '/');
    this.template(template + '.js', fullPath + '.js');
    this.template(template + '.html', fullPath + '.html');
    this.copy('init.mustache', path.join(this.name, 'init.mustache'));
    this.template('init.ejs', path.join(this.name, 'init.ejs'));
  } else {
    console.log('You must provide path to the model!');
  }
};
'use strict';
var util   = require('util');
var yeoman = require('yeoman-generator');
var path   = require('path');
var base   = require('../base.js')

var ControlGenerator = module.exports = function ControlGenerator(args, options, config) {
  base.apply(this, arguments);
};

util.inherits(ControlGenerator, base);

ControlGenerator.prototype.askForName = base.namePrompt('Please enter the path to the control eg.: controls/users:');

ControlGenerator.prototype._nameWithoutExtension = function _nameWithoutExtension(){
  return this._fullName().replace(/\.js$/, '');
}

ControlGenerator.prototype._toRoot = function _toRoot(){
  var length = this._fullPath().split('/').length - 1;
  return this._.repeat('../', length);
}

ControlGenerator.prototype._fullPath = function _fullPath(){
  var nameWithoutExtension = this._nameWithoutExtension();
  return path.join(nameWithoutExtension, nameWithoutExtension.split('/').pop());
}

ControlGenerator.prototype._baseName = function _fullPath(){
  return this._nameWithoutExtension().split('/').pop();
}

ControlGenerator.prototype._ejsHello = function _ejsHello(){
  return '<%= engine %>';
}

ControlGenerator.prototype.files = function files() {
  var template = this._isUsingRequireJS() ? 'requirejs' : 'none',
      fullPath = this._fullPath();
  if(this.name){
    this._mkdirp(this.name + '/');
    this.template(template + '.js', fullPath + '.js');
    this.template(template + '.html', fullPath + '.html');
    this.copy('init.mustache', path.join(this.name, 'init.mustache'));
    this.template('init.ejs', path.join(this.name, 'init.ejs'));
  } else {
    console.log('You must provide path to the control!');
  }
};
Fix typo