forked from jxcore/jxcore-cordova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_and_run.sh
executable file
·56 lines (43 loc) · 1.43 KB
/
install_and_run.sh
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
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# The script automates creating cordova project and running on **posix** platforms:
# See https://github.com/jxcore/jxcore-cordova/blob/master/install_and_run.md
# Save it into an empty folder and run.
# create project
cordova create hello com.example.hello HelloWorld
cd hello
# get small downloader tool
jx install download-cli
# get plugin
echo Downloading the file. Please wait...
jx node_modules/download-cli/cli.js http://az836273.vo.msecnd.net/0.0.8/io.jxcore.node.jx
# downloader tool not needed any more
rm -rf ./node_modules
# unpack plugin
jx io.jxcore.node.jx
# replace original sample if given
if [[ "$1" != "" ]]; then
DIR="./io.jxcore.node/sample/$1/www"
if [[ -e $DIR/jxcore/package.json ]]; then
# installing node modules if sample needs it
cd $DIR/jxcore/
jx install --autoremove ".*,*.md,*.MD"
cd ../../../../../
fi
if [[ -d $DIR ]]; then
# escaping spaces in sample folder names
DIR=$(printf %q "$DIR")
eval cp -rf "${DIR}/*" ./www/ && echo "Copied '${DIR}' sample successfully."
else
echo "Incorrect sample folder '${DIR}'."
read -p "Continue with default sample? [y/n] " answer
if [[ $answer != "y" ]]; then exit; fi
fi
fi
# add plugin to the project
cordova plugins add io.jxcore.node
# run on android
cordova platforms add android
cordova run android
# or run on ios
#cordova platforms add ios
#cordova run ios