diff --git a/lib/functions/detectFiles.sh b/lib/functions/detectFiles.sh index ce929927..b13b3d6b 100755 --- a/lib/functions/detectFiles.sh +++ b/lib/functions/detectFiles.sh @@ -437,4 +437,57 @@ function RunAdditionalInstalls() { done fi fi + + ############################### + # Run installs for R language # + ############################### + if [ "${VALIDATE_R}" == "true" ] && [ "${#FILE_ARRAY_R[@]}" -ne 0 ]; then + info "Detected R Language files to lint." + info "Trying to install the R package inside:[${WORKSPACE_PATH}]" + ######################### + # Run the build command # + ######################### + BUILD_CMD=$(R CMD build "${WORKSPACE_PATH}" 2>&1) + + ############## + # Error code # + ############## + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ "${ERROR_CODE}" -ne 0 ]; then + # Error + warn "ERROR! Failed to run:[R CMD build] at location:[${WORKSPACE_PATH}]" + warn "BUILD_CMD:[${BUILD_CMD}]" + else + # Get the build package + BUILD_PKG=$( + cd "${WORKSPACE_PATH}" || exit 0 + echo *.tar.gz 2>&1 + ) + ############################## + # Install the build packages # + ############################## + INSTALL_CMD=$( + cd "${WORKSPACE_PATH}" || exit 0 + R CMD INSTALL "${BUILD_PKG}" 2>&1 + ) + + ############## + # Error code # + ############## + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ "${ERROR_CODE}" -ne 0 ]; then + # Error + warn "ERROR: Failed to install the build package at:[${BUILD_PKG}]" + warn "INSTALL_CMD:[${INSTALL_CMD}]" + fi + fi + fi } diff --git a/lib/functions/worker.sh b/lib/functions/worker.sh index 0d6b36da..96c81205 100755 --- a/lib/functions/worker.sh +++ b/lib/functions/worker.sh @@ -10,7 +10,7 @@ ################################################################################ #### Function LintCodebase ##################################################### function LintCodebase() { - # Call comes thorugh as: + # Call comes through as: # LintCodebase "${LANGUAGE}" "${LINTER_NAME}" "${LINTER_COMMAND}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${TEST_CASE_RUN}" "${!LANGUAGE_FILE_ARRAY}" #################### # Pull in the vars #