Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CB-5909 Fixed issue where check-reqs skipped checking logic on second…
… pass-through

- Removed dependency on npm in init scripts when modules exist
- Skip logic if _BOTH_ variables are set
  • Loading branch information
jkeshavarzi authored and bryanhiggins committed Jan 31, 2014
1 parent 171c8f9 commit ae20ff58c588b21e2b0b1bba11fc29a46c90c7a6
Showing 2 changed files with 51 additions and 45 deletions.
@@ -12,7 +12,7 @@
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
@@ -23,7 +23,7 @@ LOCAL_NODE_BIN=$CORDOVA_HOME_DIR/bin/dependencies/node/bin
LOCAL_BBTOOLS=$CORDOVA_HOME_DIR/bin/dependencies/bb-tools/bin

#Skip all logic if init has already been run (env variable have been set already...)
if [ -z "$CORDOVA_NODE" ] && [ -z "$CORDOVA_BBTOOLS" ]; then
if [ -z "$CORDOVA_NODE" ] || [ -z "$CORDOVA_BBTOOLS" ]; then

#set CORDOVA_NODE
if [ -x "$LOCAL_NODE_BIN" ]; then
@@ -51,42 +51,44 @@ if [ -z "$CORDOVA_NODE" ] && [ -z "$CORDOVA_BBTOOLS" ]; then
fi
export CORDOVA_BBTOOLS=$CORDOVA_BBTOOLS

#-------------check reqs---------------#
NODE="$CORDOVA_NODE/node"
NPM="$CORDOVA_NODE/npm"
JAVA=$(command -v java)
PACKAGER="$CORDOVA_BBTOOLS/blackberry-nativepackager"
DEPLOYER="$CORDOVA_BBTOOLS/blackberry-deploy"
SIGNER="$CORDOVA_BBTOOLS/blackberry-signer"
DEBUGTOKENREQUEST="$CORDOVA_BBTOOLS/blackberry-debugtokenrequest"
fi

if [ ! -x "$NODE" ]; then
echo node cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$LOCAL_NODE_BIN" ] && [ ! -x "$NPM" ]; then
echo npm cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$JAVA" ]; then
echo java cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$PACKAGER" ]; then
echo blackberry-nativepackager cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$DEPLOYER" ]; then
echo blackberry-deploy cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$SIGNER" ]; then
echo blackberry-signer cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$DEBUGTOKENREQUEST" ]; then
echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
EXIT_CODE=2
else
"$NODE" "$CURRENT_DIR/check_reqs.js" "$@"
fi
#-------------check reqs---------------#
NODE="$CORDOVA_NODE/node"
NPM="$CORDOVA_NODE/npm"
JAVA=$(command -v java)
PACKAGER="$CORDOVA_BBTOOLS/blackberry-nativepackager"
DEPLOYER="$CORDOVA_BBTOOLS/blackberry-deploy"
SIGNER="$CORDOVA_BBTOOLS/blackberry-signer"
DEBUGTOKENREQUEST="$CORDOVA_BBTOOLS/blackberry-debugtokenrequest"
NPM_PACKAGE_JSON="$BIN_DIR"/../package.json

if [ ! -z "$EXIT_CODE" ]; then
exit $EXIT_CODE
fi
if [ ! -x "$NODE" ]; then
echo node cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$LOCAL_NODE_BIN" ] && [ ! -x "$NPM" ] && [ -e "$NPM_PACKAGE_JSON" ]; then
echo npm cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$JAVA" ]; then
echo java cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$PACKAGER" ]; then
echo blackberry-nativepackager cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$DEPLOYER" ]; then
echo blackberry-deploy cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$SIGNER" ]; then
echo blackberry-signer cannot be found on the path. Aborting.
EXIT_CODE=2
elif [ ! -x "$DEBUGTOKENREQUEST" ]; then
echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
EXIT_CODE=2
else
"$NODE" "$CURRENT_DIR/check_reqs.js" "$@"
fi

if [ ! -z "$EXIT_CODE" ]; then
exit $EXIT_CODE
fi

@@ -83,13 +83,19 @@ if exist "%LOCAL_BBTOOLS_BINARY%" (
)
)

if not exist "%LOCAL_NODE_BINARY%" && not exist "%CORDOVA_NODE%\node.exe" (
echo node cannot be found on the path. Aborting.
exit /b 2
:end

if not exist "%LOCAL_NODE_BINARY%" (
if not exist "%CORDOVA_NODE%\node.exe" (
echo node cannot be found on the path. Aborting.
exit /b 2
)
)
if not exist "%CORDOVA_NODE%\npm" (
echo npm cannot be found on the path. Aborting.
exit /b 2
if exist "%~dp0..\package.json" (
if not exist "%CORDOVA_NODE%\npm" (
echo npm cannot be found on the path. Aborting.
exit /b 2
)
)
if not defined FOUNDJAVA (
echo java cannot be found on the path. Aborting.
@@ -114,6 +120,4 @@ if not exist "%CORDOVA_BBTOOLS%\blackberry-debugtokenrequest.bat" (

"%CORDOVA_NODE%\node" "%~dp0\check_reqs.js" %*

:end

exit /b 0

0 comments on commit ae20ff5

Please sign in to comment.