Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
#158: update functionality - windows safe
Browse files Browse the repository at this point in the history
  • Loading branch information
gruppjo committed Apr 29, 2016
1 parent 7c6d77e commit 1f27f91
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions generators/app/templates/gulp/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ var chalk = require('chalk');
var answers = require('../.yo-rc.json')['generator-m-ionic'].answers;

var help = {
projectDir: (function () {
var projectDir = process.cwd().split('/');
projectDir = projectDir[projectDir.length - 1];

return projectDir;
})(),

projectDirVersion: function (version) {
return this.projectDir + '@' + version;
},

getDirectoryDirs: function (dirPath) {
return fs.readdirSync(dirPath)
.filter(function (file) {
Expand All @@ -36,11 +25,11 @@ var help = {
updateWithYo: function (version, cb) {
this.install(version, function () {
// execute generator
var generatorBase = '../' + this.projectDir + '/node_modules/generator-m-ionic';
var generatorGenerators = generatorBase + '/generators';
console.log(chalk.green('running: ') + require('../' + generatorBase + '/package.json').version);
var generatorBase = path.resolve('node_modules/generator-m-ionic');
var generatorGenerators = path.join(generatorBase, 'generators');
console.log(chalk.green('running: ') + require(path.join(generatorBase, '/package.json')).version);

var ctx = yeomanTest.run(path.resolve(generatorGenerators + '/app'));
var ctx = yeomanTest.run(path.join(generatorGenerators, '/app'));
ctx.settings.tmpdir = false; // don't run in tempdir
ctx
.withGenerators(this.getDirectoryDirs(generatorGenerators))
Expand All @@ -58,7 +47,6 @@ var help = {
},

uninstall: function (version, cb) {
process.chdir('../' + this.projectDir);
console.log(chalk.green('uninstalling: ') + version + ' ' + process.cwd());
exec('npm uninstall generator-m-ionic', function (error) {
if (error) {
Expand Down

0 comments on commit 1f27f91

Please sign in to comment.