hoodie-cli
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -12,2 +12,4 @@ Usage: $0 new <name> [<template>] | ||
--plugins, -p <plugin(s)> installs hoodie plugin(s) | ||
--keep-git, -k keeps .git folder in cached checkout | ||
--use-ssh will install from `git@github.com:user/repo.git` | ||
--verbose verbose output | ||
@@ -14,0 +16,0 @@ |
var hoodie = require('./main'); | ||
var con = require('./cli/util/console'); | ||
var which = require('which').sync; | ||
var shell = require('shelljs'); | ||
@@ -21,3 +21,3 @@ // | ||
try { | ||
which('git'); | ||
shell.which('git'); | ||
} catch (err) { | ||
@@ -24,0 +24,0 @@ hoodie.emit('warn', 'git command could not be found.'); |
@@ -31,2 +31,4 @@ var hoodie = require('../main'); | ||
plugins: argv._[3] || argv.plugins || argv.p, | ||
keep: argv['keep-git'] || argv.keep || argv.k, | ||
ssh: argv['use-ssh'] || argv.s, | ||
verbose: argv.verbose | ||
@@ -33,0 +35,0 @@ }; |
@@ -17,4 +17,2 @@ var hoodie = require('../main'); | ||
this.logo(); | ||
// display help on $ hoodie reset | ||
@@ -21,0 +19,0 @@ if (argv._.length <= 1) { |
var Command = require('./util/command'); | ||
var packages = require('./util/packages'); | ||
var which = require('which').sync; | ||
var util = require('util'); | ||
var async = require('async'); | ||
var shell = require('shelljs'); | ||
@@ -59,3 +59,3 @@ | ||
self.exec(which('npm'), ['link'], function (err) { | ||
self.exec(shell.which('npm'), ['link'], function (err) { | ||
@@ -91,3 +91,3 @@ if (err) { | ||
self.exec(which('npm'), npmArgs, function (err) { | ||
self.exec(shell.which('npm'), npmArgs, function (err) { | ||
@@ -94,0 +94,0 @@ if (err) { |
var Command = require('./util/command'); | ||
var which = require('which').sync; | ||
var util = require('util'); | ||
@@ -8,3 +7,2 @@ var fs = require('graceful-fs'); | ||
var path = require('path'); | ||
var shell = require('shelljs'); | ||
@@ -68,7 +66,15 @@ | ||
var uriStr = 'https://github.com/' + options.template.entity + '/'; | ||
uriStr += options.template.repo + '.git'; | ||
var uri = function() { | ||
var protocols = ['https://', 'git@']; | ||
var separator = ['/', ':']; | ||
var host = 'github.com'; | ||
options.template.uri = uriStr; | ||
var cProtocol = options.ssh ? protocols[1] : protocols[0]; | ||
var cSeparator = options.ssh ? separator[1] : separator[0]; | ||
return cProtocol + host + cSeparator + options.template.entity + separator[0] + options.template.template + '.git'; | ||
}; | ||
options.template.uri = uri(); | ||
//options.name = options.name || 'my-first-hoodie'; | ||
@@ -94,2 +100,3 @@ options.plugins = options.plugins || []; | ||
return this.hoodie; | ||
}; | ||
@@ -117,3 +124,3 @@ | ||
self.exec(which('git'), options.gitArgs, function (err) { | ||
self.exec(shell.which('git'), options.gitArgs, function (err) { | ||
@@ -144,14 +151,20 @@ if (err) { | ||
rmrf(options.rmArg, function(err) { | ||
if (!options.keep) { | ||
if (err) { | ||
self.hoodie.emit('warn', 'Could not remove folder:'); | ||
process.exit(1); | ||
throw err; | ||
} | ||
rmrf(options.rmArg, function(err) { | ||
self.hoodie.emit('info', 'removing .git folder'); | ||
callback(null); | ||
}); | ||
if (err) { | ||
self.hoodie.emit('warn', 'Could not remove folder:'); | ||
process.exit(1); | ||
throw err; | ||
} | ||
self.hoodie.emit('info', 'removing .git folder'); | ||
callback(null); | ||
}); | ||
} | ||
callback(null); | ||
}; | ||
@@ -204,3 +217,3 @@ | ||
self.exec(which('npm'), npmArgs, function(err) { | ||
self.exec(shell.which('npm'), npmArgs, function(err) { | ||
@@ -241,3 +254,3 @@ if (err) { | ||
return callback(null); | ||
callback(null); | ||
@@ -244,0 +257,0 @@ } else { |
@@ -80,3 +80,3 @@ var Command = require('./util/command'); | ||
// forks hoodie app and listens for messages | ||
// coming throw on the process | ||
// coming through on the process | ||
fork(processArgs).on('message', function (msg) { | ||
@@ -83,0 +83,0 @@ |
var Command = require('./util/command'); | ||
var packages = require('./util/packages'); | ||
var which = require('which').sync; | ||
var util = require('util'); | ||
var async = require('async'); | ||
var shell = require('shelljs'); | ||
@@ -68,3 +68,3 @@ | ||
self.exec(which('npm'), npmArgs, function(err) { | ||
self.exec(shell.which('npm'), npmArgs, function(err) { | ||
if (err) { | ||
@@ -71,0 +71,0 @@ self.hoodie.emit('warn', 'Error uninstalling plugin:' + plugin); |
{ | ||
"name": "hoodie-cli", | ||
"description": "Hoodie command-line interface.", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"preferGlobal": true, | ||
@@ -9,3 +9,2 @@ "dependencies": { | ||
"optimist": "0.6.x", | ||
"which": "1.0.x", | ||
"cli-color": "~0.2.2", | ||
@@ -15,3 +14,2 @@ "prompt": "~0.2.9", | ||
"open": "0.0.4", | ||
"npm": "~1.3.7", | ||
"async": "0.2.9", | ||
@@ -22,3 +20,4 @@ "graceful-fs": "~2.0.1", | ||
"shelljs": "~0.2.6", | ||
"ini": "~1.1.0" | ||
"ini": "~1.1.0", | ||
"npm": "~1.3.25" | ||
}, | ||
@@ -25,0 +24,0 @@ "keywords": [ |
@@ -62,2 +62,4 @@ var hoodie = require('../../lib/main'); | ||
plugins: undefined, | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -77,2 +79,4 @@ }; | ||
plugins: undefined, | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: true | ||
@@ -86,2 +90,18 @@ }; | ||
describe('$ hoodie new "appname"', function() { | ||
it('should try to create the app verbosely without deleting the .git folder', function() { | ||
var args = { | ||
name: 'appname', | ||
template: undefined, | ||
plugins: undefined, | ||
keep: true, | ||
ssh: undefined, | ||
verbose: true | ||
}; | ||
cli.argv({ _: ['new', 'appname'], verbose: true, keep: true}); | ||
expect(hoodie.new.args[0][0]).to.eql(args); | ||
expect(hoodie.new.args[0][1]).to.be.a('function'); | ||
}); | ||
}); | ||
describe('$ hoodie new appname 50p/massive-hoodie-yo', function() { | ||
@@ -93,2 +113,4 @@ it('should try to create the project', function() { | ||
plugins: undefined, | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -108,2 +130,4 @@ }; | ||
plugins: undefined, | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -123,2 +147,4 @@ }; | ||
plugins: undefined, | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -138,2 +164,4 @@ }; | ||
plugins: undefined, | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -153,2 +181,4 @@ }; | ||
plugins: 'users', | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -168,2 +198,4 @@ }; | ||
plugins: 'users,shares', | ||
keep: undefined, | ||
ssh: undefined, | ||
verbose: undefined | ||
@@ -170,0 +202,0 @@ }; |
Sorry, the diff of this file is not supported yet
78547
13
2194
- Removedwhich@1.0.x
- Removedwhich@1.0.9(transitive)
Updatednpm@~1.3.25