1 | var 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 |
|
9 | var 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 |
|
28 | function helpTitle() {
|
29 | print.title(config)
|
30 | }
|
31 |
|
32 | function helpCommand() {
|
33 | print.command(config)
|
34 | }
|
35 |
|
36 | var 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 |
|
53 | function 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 |
|
64 | function run() {
|
65 | if (argv.h || argv.help) {
|
66 | helpCommand()
|
67 | return
|
68 | }
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | }
|
90 |
|
91 | module.exports = {
|
92 | run: run,
|
93 | config: config,
|
94 | helpTitle: helpTitle,
|
95 | helpCommand: helpCommand
|
96 | } |
\ | No newline at end of file |