UNPKG

2.25 kBJavaScriptView Raw
1var argv = require('yargs').argv,
2 erosUpdate = require('./update'),
3 inquirer = require('inquirer'),
4 print = require('../../utils/print'),
5 logger = require('../../utils/logger'),
6 util = require('./util')
7
8
9var config = {
10 name: 'install',
11 explain: "install eros platform and components' librarys.",
12 command: 'eros install',
13 options: [{
14 keys: ['-h', '--help'],
15 describe: 'read help'
16 }, {
17 keys: ['ios'],
18 describe: 'install ios platform base library.'
19 }, {
20 keys: ['android'],
21 describe: 'install android platform base library.'
22 }, {
23 keys: ['all'],
24 describe: 'install android and ios platform base library.'
25 }]
26}
27
28function helpTitle() {
29 print.title(config)
30}
31
32function helpCommand() {
33 print.command(config)
34}
35
36var questions = [{
37 type: 'list',
38 name: 'platform',
39 message: 'You can install or update eros sdk and librarys.',
40 choices: [{
41 name: "eros-sdk | ios ",
42 value: "runiOSInstallScript"
43 }, {
44 name: "eros-sdk | android",
45 value: "runAndroidInstallScript"
46 }, {
47 name: "eros-sdk | ios & android",
48 value: "runAllInstallScript"
49 }
50 ]
51}]
52
53function installSelect() {
54 inquirer.prompt(questions).then(function(answers) {
55 var platform = JSON.parse(JSON.stringify(answers)).platform
56 util[platform] && util[platform]()
57 }, (error) => {
58 logger.fatal('input error'.red)
59 logger.fatal(error)
60 })
61}
62
63
64function run() {
65 if (argv.h || argv.help) {
66 helpCommand()
67 return
68 }
69 // if (argv._[1] === 'ios'){
70 // util.runiOSInstallScript()
71 // return
72 // }
73 // if(argv._[1] === 'android') {
74 // util.runAndroidInstallScript()
75 // return
76 // }
77 // if(argv._[1] === 'all') {
78 // util.runAllInstallScript()
79 // return
80 // }
81
82 // if (argv.ios) {
83 // util.installIosDep()
84 // } else if (argv.android) {
85 // util.installAndroidDep()
86 // } else {
87 // installSelect()
88 // }
89}
90
91module.exports = {
92 run: run,
93 config: config,
94 helpTitle: helpTitle,
95 helpCommand: helpCommand
96}
\No newline at end of file