forked from ionic-team/ionic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.js
More file actions
46 lines (41 loc) · 1.13 KB
/
upload.js
File metadata and controls
46 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
var extend = require('../utils/extend');
var IonicAppLib = require('ionic-app-lib');
var Login = IonicAppLib.login;
var LoginTask = require('./login');
var Upload = IonicAppLib.upload;
var log = IonicAppLib.logging.logger;
var appLibUtils = IonicAppLib.utils;
var settings = {
title: 'upload',
name: 'upload',
summary: 'Upload an app to your Ionic account',
options: {
'--email|-e': 'Ionic account email',
'--password|-p': 'Ionic account password',
'--note': 'The note to signify the upload',
'--deploy <channel_tag>': 'Deploys the upload to the given channel. Defaults to the Dev channel'
},
isProjectTask: true
};
function run(ionic, argv) {
var note = argv.note;
var deploy = argv.deploy || false;
return Login.retrieveLogin()
.then(function(jar) {
if (!jar) {
log.info('No previous login existed. Attempting to log in now.');
return LoginTask.login(argv);
}
return jar;
})
.then(function(jar) {
return Upload.doUpload(process.cwd(), jar, note, deploy);
})
.catch(function(ex) {
appLibUtils.fail(ex);
});
}
module.exports = extend(settings, {
run: run
});