Skip to content

Commit

Permalink
fix(install): find and replace bug
Browse files Browse the repository at this point in the history
  • Loading branch information
iamfiscus committed Apr 13, 2017
1 parent f86328a commit a43e7a1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
PROJECT="freeboard-aws-iot-ws-mqtt"
pwd
if [ -z "$1" ]; then
PROJECT_PATH="../../plugins"
PROJECT_LOCATION="../../"
PROJECT_PATH="plugins"

if [ ! -d "$PROJECT_PATH" ]; then
if [ ! -d "$PROJECT_LOCATION$PROJECT_PATH" ]; then
echo 'Must be in a valid Freeboard project'
exit
fi

PROJECT_FULL_PATH="${PROJECT_LOCATION}${PROJECT_PATH}/${PROJECT}"
else
PROJECT_PATH=$1
PROJECT_FULL_PATH="${PROJECT_PATH}/${PROJECT}"
fi


PROJECT_FULL_PATH="${PROJECT_PATH}/${PROJECT}"

if [ ! -d "$PROJECT_FULL_PATH" ]; then
mkdir -p $PROJECT_FULL_PATH
echo "Created directory ${PROJECT_FULL_PATH}"
Expand All @@ -29,9 +28,9 @@ cp node_modules/crypto-js/sha256.js out/sha256.js
cp node_modules/moment/min/moment.min.js out/moment.min.js
cp node_modules/paho-mqtt/mqttws31-min.js out/mqttws31-min.js
cp src/index.js out/index.js

sed -i -e "s:plugins:${PROJECT_PATH}:g" out/index.js

if [ -z "$1" ]; then
sed -i -e "s:plugins:${PROJECT_PATH}:g" out/index.js
fi
rm out/index.js-e

cp -R out/* $PROJECT_FULL_PATH
Expand Down

0 comments on commit a43e7a1

Please sign in to comment.