Skip to content

Commit 5b23259

Browse files
committed
Convert variables to snake_case
1 parent 4573fc8 commit 5b23259

File tree

3 files changed

+65
-65
lines changed

3 files changed

+65
-65
lines changed

lib/common.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
export DEFAULT_MAVEN_VERSION="3.9.4"
44

55
install_maven() {
6-
local installDir="${1}"
7-
local buildDir="${2}"
8-
mavenHome="${installDir}/.maven"
6+
local install_dir="${1}"
7+
local build_dir="${2}"
8+
local maven_home="${install_dir}/.maven"
99

10-
definedMavenVersion=$(detect_maven_version "${buildDir}")
10+
defined_maven_version=$(detect_maven_version "${build_dir}")
1111

12-
mavenVersion=${definedMavenVersion:-$DEFAULT_MAVEN_VERSION}
12+
maven_version=${defined_maven_version:-$DEFAULT_MAVEN_VERSION}
1313

14-
status_pending "Installing Maven ${mavenVersion}"
15-
local mavenUrl="https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${mavenVersion}/apache-maven-${mavenVersion}-bin.tar.gz"
16-
if is_supported_maven_version "${mavenVersion}" "${mavenUrl}"; then
17-
download_maven "${mavenUrl}" "${mavenHome}"
14+
status_pending "Installing Maven ${maven_version}"
15+
local maven_url="https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${maven_version}/apache-maven-${maven_version}-bin.tar.gz"
16+
if is_supported_maven_version "${maven_version}" "${maven_url}"; then
17+
download_maven "${maven_url}" "${maven_home}"
1818
status_done
1919
else
2020
error_return "Error, you have defined an unsupported Maven version in the system.properties file.
@@ -24,21 +24,21 @@ The default supported version is ${DEFAULT_MAVEN_VERSION}"
2424
}
2525

2626
download_maven() {
27-
local mavenUrl=$1
28-
local installDir=$2
27+
local maven_url=$1
28+
local install_dir=$2
2929

30-
rm -rf "${installDir}"
31-
mkdir -p "${installDir}"
32-
curl --fail --retry 3 --retry-connrefused --connect-timeout 5 --silent --max-time 60 --location "${mavenUrl}" | tar -xzm --strip-components 1 -C "${installDir}"
33-
chmod +x "${installDir}/bin/mvn"
30+
rm -rf "${install_dir}"
31+
mkdir -p "${install_dir}"
32+
curl --fail --retry 3 --retry-connrefused --connect-timeout 5 --silent --max-time 60 --location "${maven_url}" | tar -xzm --strip-components 1 -C "${install_dir}"
33+
chmod +x "${install_dir}/bin/mvn"
3434
}
3535

3636
is_supported_maven_version() {
37-
local mavenVersion=${1}
38-
local mavenUrl=${2:?}
39-
if [ "$mavenVersion" = "$DEFAULT_MAVEN_VERSION" ]; then
37+
local maven_version=${1}
38+
local maven_url=${2:?}
39+
if [ "$maven_version" = "$DEFAULT_MAVEN_VERSION" ]; then
4040
return 0
41-
elif curl -I --retry 3 --retry-connrefused --connect-timeout 5 --fail --silent --max-time 5 --location "${mavenUrl}" >/dev/null; then
41+
elif curl -I --retry 3 --retry-connrefused --connect-timeout 5 --fail --silent --max-time 5 --location "${maven_url}" >/dev/null; then
4242
return 0
4343
else
4444
return 1
@@ -48,9 +48,9 @@ is_supported_maven_version() {
4848
detect_maven_version() {
4949
local baseDir=${1}
5050
if [ -f "${baseDir}/system.properties" ]; then
51-
mavenVersion=$(get_app_system_value "${baseDir}/system.properties" "maven.version")
52-
if [ -n "$mavenVersion" ]; then
53-
echo "${mavenVersion}"
51+
maven_version=$(get_app_system_value "${baseDir}/system.properties" "maven.version")
52+
if [ -n "$maven_version" ]; then
53+
echo "${maven_version}"
5454
else
5555
echo ""
5656
fi

lib/frameworks.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
#!/usr/bin/env bash
22

33
is_spring_boot() {
4-
local buildDir=${1:?}
5-
test -f "${buildDir}/pom.xml" &&
6-
test -n "$(grep "<groupId>org.springframework.boot" "${buildDir}/pom.xml")" &&
7-
test -n "$(grep "<artifactId>spring-boot" "${buildDir}/pom.xml")"
4+
local build_dir=${1:?}
5+
test -f "${build_dir}/pom.xml" &&
6+
test -n "$(grep "<groupId>org.springframework.boot" "${build_dir}/pom.xml")" &&
7+
test -n "$(grep "<artifactId>spring-boot" "${build_dir}/pom.xml")"
88
}
99

1010
is_wildfly_swarm() {
11-
local buildDir=${1:?}
12-
test -f "${buildDir}/pom.xml" &&
13-
test -n "$(grep "<groupId>org.wildfly.swarm" "${buildDir}/pom.xml")"
11+
local build_dir=${1:?}
12+
test -f "${build_dir}/pom.xml" &&
13+
test -n "$(grep "<groupId>org.wildfly.swarm" "${build_dir}/pom.xml")"
1414
}
1515

1616
is_micronaut() {
17-
local buildDir=${1:?}
18-
test -f "${buildDir}/pom.xml" &&
19-
test -n "$(grep "<groupId>io.micronaut" "${buildDir}/pom.xml")"
17+
local build_dir=${1:?}
18+
test -f "${build_dir}/pom.xml" &&
19+
test -n "$(grep "<groupId>io.micronaut" "${build_dir}/pom.xml")"
2020
}
2121

2222
is_quarkus() {
23-
local buildDir=${1:?}
24-
test -f "${buildDir}/pom.xml" &&
25-
test -n "$(grep "<groupId>io.quarkus" "${buildDir}/pom.xml")"
23+
local build_dir=${1:?}
24+
test -f "${build_dir}/pom.xml" &&
25+
test -n "$(grep "<groupId>io.quarkus" "${build_dir}/pom.xml")"
2626
}
2727

2828
has_postgres() {
29-
local buildDir=${1:?}
29+
local build_dir=${1:?}
3030
# shellcheck disable=SC2235
31-
test -f "${buildDir}/pom.xml" && (
32-
test -n "$(grep "<groupId>org.postgresql" "${buildDir}/pom.xml")" ||
33-
test -n "$(grep "<groupId>postgresql" "${buildDir}/pom.xml")" ||
34-
test -n "$(grep "<groupId>com.impossibl.pgjdbc-ng" "${buildDir}/pom.xml")"
31+
test -f "${build_dir}/pom.xml" && (
32+
test -n "$(grep "<groupId>org.postgresql" "${build_dir}/pom.xml")" ||
33+
test -n "$(grep "<groupId>postgresql" "${build_dir}/pom.xml")" ||
34+
test -n "$(grep "<groupId>com.impossibl.pgjdbc-ng" "${build_dir}/pom.xml")"
3535
)
3636
}

lib/maven.sh

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ _mvn_cmd_opts() {
3030

3131
_mvn_settings_opt() {
3232
local home="${1}"
33-
local mavenInstallDir="${2}"
33+
local maven_install_dir="${2}"
3434

3535
if [ -n "$MAVEN_SETTINGS_PATH" ]; then
3636
echo -n "-s $MAVEN_SETTINGS_PATH"
3737
elif [ -n "$MAVEN_SETTINGS_URL" ]; then
38-
local settingsXml="${mavenInstallDir}/.m2/settings.xml"
39-
mkdir -p "$(dirname "${settingsXml}")"
40-
curl --retry 3 --retry-connrefused --connect-timeout 5 --silent --max-time 10 --location "${MAVEN_SETTINGS_URL}" --output "${settingsXml}"
41-
if [ -f "${settingsXml}" ]; then
42-
echo -n "-s ${settingsXml}"
38+
local settings_xml="${maven_install_dir}/.m2/settings.xml"
39+
mkdir -p "$(dirname "${settings_xml}")"
40+
curl --retry 3 --retry-connrefused --connect-timeout 5 --silent --max-time 10 --location "${MAVEN_SETTINGS_URL}" --output "${settings_xml}"
41+
if [ -f "${settings_xml}" ]; then
42+
echo -n "-s ${settings_xml}"
4343
else
4444
error "Could not download settings.xml from the URL defined in MAVEN_SETTINGS_URL!"
4545
return 1
@@ -63,8 +63,8 @@ has_maven_wrapper() {
6363
}
6464

6565
get_cache_status() {
66-
local cacheDir=${1}
67-
if [ ! -d "${cacheDir}/.m2" ]; then
66+
local cache_dir=${1}
67+
if [ ! -d "${cache_dir}/.m2" ]; then
6868
echo "not-found"
6969
else
7070
echo "valid"
@@ -74,41 +74,41 @@ get_cache_status() {
7474
run_mvn() {
7575
local scope=${1}
7676
local home=${2}
77-
local mavenInstallDir=${3}
77+
local maven_install_dir=${3}
7878

79-
mkdir -p "${mavenInstallDir}"
79+
mkdir -p "${maven_install_dir}"
8080
if has_maven_wrapper "${home}"; then
81-
cache_copy ".m2/wrapper" "${mavenInstallDir}" "${home}"
81+
cache_copy ".m2/wrapper" "${maven_install_dir}" "${home}"
8282
chmod +x "${home}/mvnw"
83-
local mavenExe="./mvnw"
83+
local maven_exe="./mvnw"
8484
else
8585
# shellcheck disable=SC2164
86-
cd "${mavenInstallDir}"
86+
cd "${maven_install_dir}"
8787

88-
install_maven "${mavenInstallDir}" "${home}"
89-
PATH="${mavenInstallDir}/.maven/bin:$PATH"
90-
local mavenExe="mvn"
88+
install_maven "${maven_install_dir}" "${home}"
89+
PATH="${maven_install_dir}/.maven/bin:$PATH"
90+
local maven_exe="mvn"
9191
# shellcheck disable=SC2164
9292
cd "${home}"
9393
fi
9494

9595
local mvn_settings_opt
96-
mvn_settings_opt="$(_mvn_settings_opt "${home}" "${mavenInstallDir}")"
96+
mvn_settings_opt="$(_mvn_settings_opt "${home}" "${maven_install_dir}")"
9797

98-
MAVEN_OPTS="$(_mvn_java_opts "${scope}" "${home}" "${mavenInstallDir}")"
98+
MAVEN_OPTS="$(_mvn_java_opts "${scope}" "${home}" "${maven_install_dir}")"
9999
export MAVEN_OPTS
100100

101101
# shellcheck disable=SC2164
102102
cd "${home}"
103-
local mvnOpts
104-
mvnOpts="$(_mvn_cmd_opts "${scope}")"
103+
local mvn_opts
104+
mvn_opts="$(_mvn_cmd_opts "${scope}")"
105105

106106
status "Executing Maven"
107-
echo "$ ${mavenExe} ${mvnOpts}" | indent
107+
echo "$ ${maven_exe} ${mvn_opts}" | indent
108108

109-
# We rely on word splitting for mvn_settings_opt and mvnOpts:
109+
# We rely on word splitting for mvn_settings_opt and mvn_opts:
110110
# shellcheck disable=SC2086
111-
if ! ${mavenExe} -DoutputFile=target/mvn-dependency-list.log -B ${mvn_settings_opt} ${mvnOpts} | indent; then
111+
if ! ${maven_exe} -DoutputFile=target/mvn-dependency-list.log -B ${mvn_settings_opt} ${mvn_opts} | indent; then
112112
error "Failed to build app with Maven
113113
We're sorry this build is failing! If you can't find the issue in application code,
114114
please submit a ticket so we can help: https://help.heroku.com/"
@@ -129,9 +129,9 @@ write_mvn_profile() {
129129

130130
remove_mvn() {
131131
local home=${1}
132-
local mavenInstallDir=${2}
132+
local maven_install_dir=${2}
133133
if has_maven_wrapper "${home}"; then
134-
cache_copy ".m2/wrapper" "$home" "$mavenInstallDir"
134+
cache_copy ".m2/wrapper" "$home" "$maven_install_dir"
135135
rm -rf "$home/.m2"
136136
fi
137137
}

0 commit comments

Comments
 (0)