Skip to content

Commit

Permalink
Merge branch 'develop' into feat/tokenized-ece-product-page-compatibi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
frosso authored Dec 12, 2024
2 parents b3157ca + 9d22a75 commit 0d9739e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ tests/e2e-pw/playwright/.cache/
tests/e2e-pw/tests/e2e-pw/.auth/*
# Slate docs
docs/rest-api/build/*

# Jurassic Tube files
bin/jurassictube/
43 changes: 31 additions & 12 deletions bin/jurassic-tube-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@
# Exit if any command fails.
set -e

echo "Checking if ${PWD}/docker/bin/jt directory exists..."
# Define Jurassic Tube directory using bin directory
JT_DIR="${PWD}/bin/jurassictube"

if [ -d "${PWD}/docker/bin/jt" ]; then
echo "${PWD}/docker/bin/jt already exists."
echo "Checking if ${JT_DIR} directory exists..."

if [ -d "${JT_DIR}" ]; then
echo "${JT_DIR} already exists."
else
echo "Creating ${PWD}/docker/bin/jt directory..."
mkdir -p "${PWD}/docker/bin/jt"
echo "Creating ${JT_DIR} directory..."
mkdir -p "${JT_DIR}"
fi

echo "Downloading the latest version of the installer script..."
echo "Checking if the installer is present and downloading it if not..."
echo

# Download the installer (if it's not already present):
if [ ! -f "${PWD}/docker/bin/jt/installer.sh" ]; then
# Download the installer script:
curl "https://jurassic.tube/get-installer.php?env=wcpay" -o ${PWD}/docker/bin/jt/installer.sh && chmod +x ${PWD}/docker/bin/jt/installer.sh
if [ ! -f "${JT_DIR}/installer.sh" ]; then
echo "Downloading the standalone installer..."
curl "https://jurassic.tube/installer-standalone.sh" -o "${JT_DIR}/installer.sh" && chmod +x "${JT_DIR}/installer.sh"
fi

echo "Running the installation script..."
echo

# Run the installer script
source $PWD/docker/bin/jt/installer.sh
"${JT_DIR}/installer.sh"

echo
read -p "Go to https://jurassic.tube/ in a browser, paste your public key which was printed above into the box, and click 'Add Public Key'. Press enter to continue"
Expand All @@ -40,8 +43,24 @@ echo
read -p "Please enter your Automattic/WordPress.com username: " username
echo

${PWD}/docker/bin/jt/config.sh username ${username}
${PWD}/docker/bin/jt/config.sh subdomain ${subdomain}
if [ ! -f "${JT_DIR}/config.env" ]; then
touch "${JT_DIR}/config.env"
else
> "${JT_DIR}/config.env"
fi

# Find the WordPress container section and get its port
PORT=$(docker ps | grep woocommerce_payments_wordpress | sed -En "s/.*0:([0-9]+).*/\1/p")

# Use default if extraction failed
if [ -z "$PORT" ]; then
PORT=8082 # Default fallback
echo "Could not extract WordPress container port, using default: ${PORT}"
fi

echo "username=${username}" >> "${JT_DIR}/config.env"
echo "subdomain=${subdomain}" >> "${JT_DIR}/config.env"
echo "localhost=localhost:${PORT}" >> "${JT_DIR}/config.env"

echo "Setup complete!"
echo "Use the command: npm run tube:start from the root directory of your WC Payments project to start running Jurassic Tube."
Expand Down
4 changes: 4 additions & 0 deletions changelog/update-to-standalone-jt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Update the tunelling setup.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"format:css": "npm run format:provided '**/*.scss' '**/*.css'",
"format:provided": "prettier --write",
"tube:setup": "./bin/jurassic-tube-setup.sh",
"tube:start": "./docker/bin/jt/tunnel.sh",
"tube:stop": "./docker/bin/jt/tunnel.sh break",
"tube:start": "source ./bin/jurassictube/config.env && jurassictube -u \"$username\" -s \"$subdomain\" -h \"$localhost\"",
"tube:stop": "source ./bin/jurassictube/config.env && jurassictube -b -s \"$subdomain\"",
"psalm": "./bin/run-psalm.sh",
"xdebug:toggle": "docker compose exec -u root wordpress /var/www/html/wp-content/plugins/woocommerce-payments/bin/xdebug-toggle.sh",
"changelog": "./vendor/bin/changelogger add",
Expand Down

0 comments on commit 0d9739e

Please sign in to comment.