Skip to content

Commit

Permalink
feat: added arguments to testbed init
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanneff committed Feb 10, 2017
1 parent 0ffeb99 commit 1cb5f63
Showing 1 changed file with 55 additions and 11 deletions.
66 changes: 55 additions & 11 deletions testbed/rebuild.sh
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

0 comments on commit 1cb5f63

Please sign in to comment.