Skip to content

Commit

Permalink
Merge pull request #9 from juan-ayala/feature/aem-sdk-change-sdks-dir
Browse files Browse the repository at this point in the history
[aem-sdk] change sdks dir
  • Loading branch information
juan-ayala authored Aug 8, 2024
2 parents 666edaa + 6187fe3 commit c7fd087
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 26 deletions.
28 changes: 16 additions & 12 deletions src/aem-sdk/bin/_globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,26 @@ function get_runmode_jar()
echo "aem-${runmode}-p${port}.jar"
}

function get_sdk_directory()
function get_aem_sdk_zip()
{
local directory="$(pwd)/${AEM_SDK_SDKS_DIRECTORY}"
if [ -d ${directory} ]; then
echo ${directory}
else
echo "$(pwd)/.devcontainer"
local sdks_dir="${AEM_SDK_SDKS_DIRECTORY}"
if [ ! -d ${sdks_dir} ]; then
sdks_dir="$(pwd)"
fi
}

function get_aem_sdk_zip()
{
local sdks_dir=$(get_sdk_directory)
local sdk="${sdks_dir}/aem-sdk-${AEM_SDK_VERSION}.zip"
if [ "${AEM_SDK_VERSION}" = "automatic" ]; then
echo "$(find ${sdks_dir}/aem-sdk-*.zip -maxdepth 0 -type f | sort -V | tail -n1)"
sdk="$(find ${sdks_dir}/aem-sdk-*.zip -maxdepth 0 -type f | sort -V | tail -n1)"
fi

if [ ! -f "${sdk}" ]; then
cat <<EOM
No AEM SDK found.
Search Path: ${sdks_dir}
Search Version: ${AEM_SDK_VERSION}
EOM
exit 1
else
echo "${sdks_dir}/aem-sdk-${AEM_SDK_VERSION}.zip"
echo "${sdk}"
fi
}
1 change: 0 additions & 1 deletion src/aem-sdk/bin/aem-sdk-setup-dispatcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ source "$(dirname $0)/_globals.sh"

# extract the dispatcher install script
sdkzip=$(get_aem_sdk_zip)
[ -z ${sdkzip} ] && exit

sudo unzip -d ${AEM_SDK_FEATURE_DIR} ${sdkzip} 'aem-sdk-dispatcher-tools-*-unix.sh'
installscript="$(find ${AEM_SDK_FEATURE_DIR}/aem-sdk-dispatcher-tools-*-unix.sh -maxdepth 0 -type f | tail -n1)"
Expand Down
1 change: 0 additions & 1 deletion src/aem-sdk/bin/aem-sdk-setup-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ runmode="${1}"

# extract and rename the quickstart jar
sdkzip=$(get_aem_sdk_zip)
[ -z ${sdkzip} ] && exit

runmodedir="${AEM_SDK_FEATURE_DIR}/${runmode}"
sudo unzip -d ${runmodedir} ${sdkzip} 'aem-sdk-quickstart-*.jar'
Expand Down
16 changes: 16 additions & 0 deletions src/aem-sdk/bin/enable-replication.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

source "$(dirname $0)/_globals.sh"

curl -u admin:admin --output /dev/null --silent \
-X POST \
-F enabled='true' \
-F userId='' \
-F transportUri="http://localhost:${AEM_SDK_PUBLISH_PORT}/bin/receive?sling:authRequestLogin=1" \
-F transportUser='admin' \
-F transportPassword='admin' \
http://localhost:${AEM_SDK_AUTHOR_PORT}/etc/replication/agents.author/publish/jcr:content

curl -u admin:admin \
-X GET \
http://localhost:${AEM_SDK_AUTHOR_PORT}/etc/replication/agents.author/publish.test.html
6 changes: 3 additions & 3 deletions src/aem-sdk/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id": "aem-sdk",
"version": "1.1.1",
"version": "1.2.0",
"name": "Adobe Experience Manager SDK",
"description": "Setup author and publish services. And the dispatcher tools. Requires the AEM as a Cloud Service SDK.",
"options": {
"sdksDirectory": {
"type": "string",
"description": "Path to directory that contains one or more SDKs. This should be relative to the container workspace folder.",
"default": ".devcontainer"
"description": "Path to directory that contains one or more SDKs.",
"default": ""
},
"sdkVersion": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/aem-sdk/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ mkdir -p ${AEM_SDK_FEATURE_DIR}

# save feature properties
propertiesFile="${AEM_SDK_FEATURE_DIR}/options.sh"
echo "AEM_SDK_SDKS_DIRECTORY=\"${SDKSDIRECTORY}\"" >> ${propertiesFile}
echo "AEM_SDK_VERSION=\"${SDKVERSION:-'automatic'}\"" >> ${propertiesFile}
echo "AEM_SDK_SDKS_DIRECTORY=\"${SDKSDIRECTORY:-'.devcontainer'}\"" >> ${propertiesFile}
echo "AEM_SDK_AUTHOR_PORT=\"${AUTHORPORT:-'4502'}\"" >> ${propertiesFile}
echo "AEM_SDK_PUBLISH_PORT=\"${PUBLISHPORT:-'4503'}\"" >> ${propertiesFile}
echo "AEM_SDK_DISPATCHER_PORT=\"${DISPATCHERPORT:-'8080'}\"" >> ${propertiesFile}
Expand Down
4 changes: 2 additions & 2 deletions test/aem-sdk/defaults-with-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ source dev-container-features-test-lib

# Check options file created with defaults
source ${AEM_SDK_FEATURE_DIR}/options.sh
check "sdks directory default" \
echo "${AEM_SDK_SDKS_DIRECTORY}" | grep -E "^/workspaces/[0-9]+/.devcontainer$"
check "sdk version default" \
[ "${AEM_SDK_VERSION}" = "automatic" ]
check "sdks directory default" \
[ "${AEM_SDK_SDKS_DIRECTORY}" = ".devcontainer" ]
check "author port default" \
[ "${AEM_SDK_AUTHOR_PORT}" = "4502" ]
check "publish port default" \
Expand Down
4 changes: 2 additions & 2 deletions test/aem-sdk/options-with-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ source dev-container-features-test-lib

# Check options file created with defaults
source ${AEM_SDK_FEATURE_DIR}/options.sh
check "sdks directory default" \
echo "${AEM_SDK_SDKS_DIRECTORY}" | grep -E "^/workspaces/[0-9]+/.devcontainer/sdksfolder$"
check "sdk version default" \
[ "${AEM_SDK_VERSION}" = "mock-2024.02.01" ]
check "sdks directory default" \
[ "${AEM_SDK_SDKS_DIRECTORY}" = ".devcontainer/sdksfolder" ]
check "author port default" \
[ "${AEM_SDK_AUTHOR_PORT}" = "3001" ]
check "publish port default" \
Expand Down
6 changes: 4 additions & 2 deletions test/aem-sdk/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"ghcr.io/devcontainers/features/java:1": {},
"aem-sdk": {}
"aem-sdk": {
"sdksDirectory": "${containerWorkspaceFolder}/.devcontainer"
}
}
},
"options-with-sdk": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/java:1": {},
"aem-sdk": {
"sdksDirectory": ".devcontainer/sdksfolder",
"sdksDirectory": "${containerWorkspaceFolder}/.devcontainer/sdksfolder",
"sdkVersion": "mock-2024.02.01",
"authorPort": "3001",
"publishPort": "3002",
Expand Down
4 changes: 2 additions & 2 deletions test/aem-sdk/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ source dev-container-features-test-lib

# Check options file created with defaults
source ${AEM_SDK_FEATURE_DIR}/options.sh
check "sdks directory default" \
[ -z "${AEM_SDK_SDKS_DIRECTORY}" ]
check "sdk version default" \
[ "${AEM_SDK_VERSION}" = "automatic" ]
check "sdks directory default" \
[ "${AEM_SDK_SDKS_DIRECTORY}" = ".devcontainer" ]
check "author port default" \
[ "${AEM_SDK_AUTHOR_PORT}" = "4502" ]
check "publish port default" \
Expand Down

0 comments on commit c7fd087

Please sign in to comment.