Skip to content

Commit

Permalink
Merge pull request #7 from juan-ayala/bugfix/aem-sdk
Browse files Browse the repository at this point in the history
[aem-sdk] get rid of troublesome aliases
  • Loading branch information
juan-ayala authored Aug 7, 2024
2 parents 34a8030 + d8b54da commit 219ee95
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 28 deletions.
5 changes: 0 additions & 5 deletions src/aem-sdk/bin/_globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,3 @@ function get_aem_sdk_zip()
echo "${sdks_dir}/aem-sdk-${AEM_SDK_VERSION}.zip"
fi
}

function add_line_to_shell_rc()
{
echo "${1}" >> "${HOME}/.$(basename ${SHELL})rc"
}
3 changes: 0 additions & 3 deletions src/aem-sdk/bin/aem-sdk-setup-dispatcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ cd ${cwd}

# rename directory
sudo find ${AEM_SDK_FEATURE_DIR}/dispatcher-sdk-* -maxdepth 0 -type d -execdir mv {} dispatcher \;

# alias to start dispatcher
add_line_to_shell_rc "alias start-dispatcher='docker_run.sh src host.docker.internal:${AEM_SDK_PUBLISH_PORT} ${AEM_SDK_DISPATCHER_PORT}'"
9 changes: 0 additions & 9 deletions src/aem-sdk/bin/aem-sdk-setup-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,3 @@ sudo find ${runmodedir}/aem-sdk-quickstart-*.jar -maxdepth 0 -type f -execdir mv

# make user owner of crx-quickstart (it is a volume mount)
sudo chown ${USER} "${runmodedir}/crx-quickstart"

port=$(get_runmode_port ${runmode})
jvm_opts="-agentlib:\"jdwp=transport=dt_socket,address=*:3${port},server=y,suspend=n\""
cq_opts="-nofork -nobrowser -nointeractive"

# alias to start the instance
add_line_to_shell_rc "alias start-${runmode}='cd ${runmodedir} && java ${jvm_opts} -jar ${jar_file} ${cq_opts}'"
# alias to tail the error.log
add_line_to_shell_rc "alias tail-${runmode}='tail -f ${runmodedir}/crx-quickstart/logs/error.log'"
14 changes: 10 additions & 4 deletions src/aem-sdk/bin/start-aem
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ source "$(dirname $0)/_globals.sh"
if [[ "${service}" == "dispatcher" ]]; then

toolsdir="${AEM_SDK_FEATURE_DIR}/dispatcher"
# setup if dispatcher directory is missing
if [[ ! -d ${toolsdir} ]]; then
# install it
$(dirname $0)/aem-sdk-setup-dispatcher.sh
fi
# run it
docker_run.sh src host.docker.internal:${AEM_SDK_PUBLISH_PORT} ${AEM_SDK_DISPATCHER_PORT}

elif [[ "${service}" == "author" || "${service}" == "publish" ]]; then

jar="${AEM_SDK_FEATURE_DIR}/${service}/$(get_runmode_jar ${service})"
# setup aem if jar file is missing
if [[ ! -f ${jar} ]]; then
# install it
$(dirname $0)/aem-sdk-setup-service.sh ${service}
fi
# run it
port=$(get_runmode_port ${service})
jvm_opts="-agentlib:jdwp=transport=dt_socket,address=*:3${port},server=y,suspend=n"
cq_opts="-nofork -nobrowser -nointeractive"
cd "$(dirname ${jar})"
java ${jvm_opts} -jar ${jar} ${cq_opts}
fi

bash -ci "start-${service}"
2 changes: 1 addition & 1 deletion src/aem-sdk/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "aem-sdk",
"version": "1.1.0",
"version": "1.1.1",
"name": "Adobe Experience Manager SDK",
"description": "Setup author and publish services. And the dispatcher tools. Requires the AEM as a Cloud Service SDK.",
"options": {
Expand Down
6 changes: 3 additions & 3 deletions test/aem-sdk/defaults-with-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ check "start-aem is +x" \
stat -c '%A' $(which start-aem) | grep 'x.*x.*x'
# Check that author/publish/dispatcher installs and starts
check "can install & run author" \
bash -ci "start-aem author | grep 'hello, world'"
bash -c "start-aem author | grep 'hello, world'"
check "can install & run publish" \
bash -ci "start-aem publish | grep 'hello, world'"
bash -c "start-aem publish | grep 'hello, world'"
check "can install & run dispatcher" \
bash -ci "start-aem dispatcher | grep 'All your base are belong to us'"
bash -c "start-aem dispatcher | grep 'All your base are belong to us'"

reportResults
6 changes: 3 additions & 3 deletions test/aem-sdk/options-with-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ check "start-aem is +x" \
stat -c '%A' $(which start-aem) | grep 'x.*x.*x'
# Check that author/publish/dispatcher installs and starts
check "can install & run author" \
bash -ci "start-aem author | grep 'hello, world'"
bash -c "start-aem author | grep 'hello, world'"
check "can install & run publish" \
bash -ci "start-aem publish | grep 'hello, world'"
bash -c "start-aem publish | grep 'hello, world'"
check "can install & run dispatcher" \
bash -ci "start-aem dispatcher | grep 'All your base are belong to us'"
bash -c "start-aem dispatcher | grep 'All your base are belong to us'"

reportResults

0 comments on commit 219ee95

Please sign in to comment.