Skip to content

Commit

Permalink
fix(cli): npm install under windows (#1539)
Browse files Browse the repository at this point in the history
Closes #1445
  • Loading branch information
buchslava authored and jthoms1 committed Oct 28, 2016
1 parent 58cfd8a commit 26486d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var Logging = IonicAppLib.logging;
var log = Logging.logger;
var Q = require('q');
var helpUtil = require('./utils/help');
var EOL = require('os').EOL;

Cli.ALL_TASKS = Tasks;
Cli.IONIC_DASH = 'https://apps.ionic.io';
Expand Down Expand Up @@ -268,7 +269,7 @@ Cli.loadGulpfile = function loadGulpfile() {
var names = ['gulpfile.js', 'Gulpfile.js'];
for (var i = 0, ii = names.length; i < ii; i += 1) {
try {
require(path.resolve(process.cwd() + '/' + names[i]));
require(path.resolve(process.cwd(), names[i]));
log.verbose('Gulpfile found');
return true;
} catch (e) {
Expand Down Expand Up @@ -331,7 +332,7 @@ Cli.runNpmHook = function runNpmHook(hook) {
});
spawned.stdout.pipe(process.stdout);
spawned.stdout.on('data', function(data) {
var dataLines = data.toString().split('\n');
var dataLines = data.toString().split(EOL);
for (var i = 0; i < dataLines.length; i++) {
if (dataLines[i].length) {
if (dataLines[i].indexOf('watch ready') > -1) {
Expand Down Expand Up @@ -360,7 +361,7 @@ Cli.loadNpmScripts = function loadNpmScripts() {
var fileName = 'package.json';

try {
var packageFile = require(path.resolve(process.cwd() + '/' + fileName));
var packageFile = require(path.resolve(process.cwd(), fileName));
log.verbose('Package.json found scripts:', packageFile.scripts);
return packageFile.scripts;
} catch (e) {
Expand Down
7 changes: 4 additions & 3 deletions lib/utils/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var IonicAppLib = require('ionic-app-lib');
var log = IonicAppLib.logging.logger;
var EOL = require('os').EOL;
require('colors');

/**
Expand Down Expand Up @@ -173,7 +174,7 @@ function printTaskDetails(d) {
}
w((indent + ' ' + arg + ' ').bold);

var argDescs = d.args[arg].split('\n');
var argDescs = d.args[arg].split(EOL);
var argIndent = indent + ' ';

for (x = 0; x < arg.length + 1; x += 1) {
Expand Down Expand Up @@ -218,9 +219,9 @@ function printTaskDetails(d) {
var optDescs;

if (typeof taskOpt == 'string') {
optDescs = taskOpt.split('\n');
optDescs = taskOpt.split(EOL);
} else {
optDescs = taskOpt.title.split('\n');
optDescs = taskOpt.title.split(EOL);
}
for (x = 0; x < optDescs.length; x += 1) {
if (x === 0) {
Expand Down
3 changes: 2 additions & 1 deletion spec/utils/templates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var rewire = require('rewire');
var templateUtils = rewire('../../lib/utils/templates');
var IonicAppLib = require('ionic-app-lib');
var log = IonicAppLib.logging.logger;
var EOL = require('os').EOL;

describe('listTemplates method', function() {
it('should should call fetchStarterTemplates pull out templates/sort and send to list', function(done) {
Expand Down Expand Up @@ -148,7 +149,7 @@ describe('list function', function() {
var list = templateUtils.__get__('list');

list(templates);
expect(log.info.calls[0].args).toEqual(['\n']);
expect(log.info.calls[0].args).toEqual([EOL]);
expect(log.info.calls[1].args[0]).toMatch('a-template'); // Use match because of colors
expect(log.info.calls[1].args[1]).toEqual('...........');
expect(log.info.calls[1].args[2]).toEqual(templates[0].description);
Expand Down

0 comments on commit 26486d2

Please sign in to comment.