-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added arguments to testbed init
- Loading branch information
Showing
1 changed file
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# properties | ||
run_ios=false | ||
run_and=false | ||
run_dep=false | ||
run_cor=false | ||
|
||
# options | ||
usage() { | ||
printf "\n invalid usage" | ||
printf "\n ./rebuild.sh -h -> help" | ||
printf "\n ./rebuild.sh -i -> build ios" | ||
printf "\n ./rebuild.sh -a -> build android" | ||
printf "\n ./rebuild.sh -d -> reset node dependencies" | ||
printf "\n ./rebuild.sh -c -> reset cordova plugin" | ||
printf "\n" | ||
exit 1 | ||
} | ||
|
||
if [[ "$#" < 1 ]]; then usage; fi | ||
|
||
for arg in "$@"; do | ||
if ! [[ "$arg" =~ ^-. ]]; then usage; fi | ||
done | ||
|
||
while getopts ":hiadc" opt; do | ||
case $opt in | ||
h) | ||
usage | ||
;; | ||
i) | ||
run_ios=true | ||
;; | ||
a) | ||
run_and=true | ||
;; | ||
d) | ||
run_dep=true | ||
;; | ||
c) | ||
run_cor=true | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
# validate | ||
gulp prod | ||
|
||
# clean | ||
# npm install -g cordova | ||
npm uninstall mkpath node-version-compare plist xml2js | ||
if [[ "$run_cor" == "true" ]]; then npm install -g cordova; fi | ||
if [[ "$run_dep" == "true" ]]; then npm uninstall mkpath node-version-compare plist xml2js; fi | ||
rm -rf ../.installed | ||
rm -rf ./plugins | ||
rm -rf ./platforms | ||
|
||
# add platforms before plugin because before_plugin_install does not work on file reference | ||
# cordova platform add android | ||
cordova platform add ios | ||
# build (platforms added before plugin because before_plugin_install does not work on file reference) | ||
if [[ "$run_ios" == "true" ]]; then cordova platform add ios; fi | ||
if [[ "$run_and" == "true" ]]; then cordova platform add android; fi | ||
|
||
# plugin | ||
cordova plugin add ../ | ||
|
||
# ios | ||
cordova run ios --device | ||
#open -a Xcode platforms/ios/Branch\ Testing.xcworkspace | ||
|
||
# android | ||
# cordova run android | ||
# run | ||
if [[ "$run_ios" == "true" ]]; then cordova build ios && open -a Xcode platforms/ios/Branch\ Testing.xcworkspace; fi | ||
if [[ "$run_and" == "true" ]]; then cordova run android; fi |