Skip to content

Commit 27f31ed

Browse files
author
Joel Weirauch
committed
Renaming the app task to deploy. Switching up some params
1 parent 3d716a9 commit 27f31ed

2 files changed

Lines changed: 43 additions & 14 deletions

File tree

lib/ionic.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,19 @@ var TASKS = [
225225
module: './ionic/serve'
226226
},
227227
{
228-
title: 'app',
229-
name: 'app',
230-
// summary: 'Deploy a new Ionic app version or list versions',
228+
title: 'deploy',
229+
name: 'deploy',
230+
// summary: 'Deploy a new Ionic app version or list uploaded versions',
231+
//args: {
232+
// '[options]': '',
233+
// '<uuid>': 'UUID to deploy',
234+
//},
231235
// options: {
232-
// '--versions|-v': 'List recently uploaded versions of this app',
236+
// '--list|-l': 'List recently uploaded versions of this app',
233237
// '--deploy|-d': 'Upload the current working copy and mark it as deployed',
234238
// '--note|-n': 'Add a note to a deploy',
235-
// '--uuid|-u': 'Mark an already uploaded version as deployed'
236239
// },
237-
module: './ionic/app'
240+
module: './ionic/deploy'
238241
}
239242
];
240243

lib/ionic/app.js renamed to lib/ionic/deploy.js

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var fs = require('fs'),
33
parseUrl = require('url').parse,
44
request = require('request'),
55
argv = require('optimist').argv,
6+
prompt = require('prompt'),
67
FormData = require('form-data'),
78
IonicProject = require('./project'),
89
IonicTask = require('./task').IonicTask,
@@ -30,16 +31,36 @@ IonicTask.prototype.run = function(ionic) {
3031
login.get(ionic, function(jar) {
3132
self.jar = jar;
3233

33-
if (argv['versions'] || argv.v) {
34+
if (argv['list'] || argv.l) {
3435
self.versions(self);
35-
} else if (argv['deploy'] || argv.d) {
36+
} else {
3637
if (!self.inputValues['uuid']) {
37-
// Deploying a new version
38-
var upload = new IonicUploadTask();
3938

40-
upload.setNote(self.inputValues['note'] || '');
41-
upload.run(self.ionic, function() {
42-
self.deploy(self);
39+
var schema = [{
40+
name: 'confirm',
41+
description: 'Deploy the current working copy? (yes/no)'.yellow,
42+
required: true
43+
}];
44+
45+
prompt.override = argv;
46+
prompt.message = '';
47+
prompt.delimiter = '';
48+
prompt.start();
49+
50+
prompt.get(schema, function (err, result) {
51+
if(err) {
52+
return ionic.fail('Error logging in: ' + err);
53+
}
54+
55+
if (result.confirm == 'yes' || result.confirm == 'y') {
56+
// Deploying a new version
57+
var upload = new IonicUploadTask();
58+
59+
upload.setNote(self.inputValues['note'] || '');
60+
upload.run(self.ionic, function() {
61+
self.deploy(self);
62+
});
63+
}
4364
});
4465
} else {
4566
self.deploy(self);
@@ -163,7 +184,12 @@ IonicTask.prototype.getCmdLineOptions = function() {
163184
}
164185

165186
getCmdArgValue('note', 'n');
166-
getCmdArgValue('uuid', 'u');
187+
188+
var uuid = argv._[1];
189+
190+
if (typeof uuid !== 'undefined' && uuid) {
191+
self.inputValues['uuid'] = uuid;
192+
}
167193
};
168194

169195
IonicTask.prototype.getCsrfToken = function(jar) {

0 commit comments

Comments
 (0)