Skip to content

Commit f2c660f

Browse files
committed
download examples from cloudflare r2 bucket
1 parent aa7e7f7 commit f2c660f

2 files changed

Lines changed: 10 additions & 22 deletions

File tree

‎install/bash/examples.sh‎

100644100755
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ NC="${NC:-\033[0m}"
1313

1414
# Examples configuration
1515
EXAMPLES_FOLDER_NAME="plainlang-examples"
16-
EXAMPLES_DOWNLOAD_URL="https://github.com/Codeplain-ai/plainlang-examples/archive/refs/tags/0.1.zip"
16+
EXAMPLES_DOWNLOAD_URL="https://codeplain.ai/examples/unix"
1717

1818
# Show current directory and ask for extraction path
1919
CURRENT_DIR=$(pwd)
@@ -55,18 +55,12 @@ if [ "$SKIP_DOWNLOAD" = false ]; then
5555
if [ $? -eq 0 ] && [ -s "$TEMP_ZIP" ]; then
5656
echo -e " ${GRAY}Extracting to ${EXTRACT_PATH}...${NC}"
5757

58-
# Extract the zip file
59-
unzip -q -o "$TEMP_ZIP" -d "$EXTRACT_PATH" 2>/dev/null
58+
# Extract the zip file (contents are at the zip root, so extract into the target folder)
59+
EXTRACTED_DIR="${EXTRACT_PATH}/${EXAMPLES_FOLDER_NAME}"
60+
rm -rf "$EXTRACTED_DIR" 2>/dev/null # Remove existing if present
61+
unzip -q -o "$TEMP_ZIP" -d "$EXTRACTED_DIR" 2>/dev/null
6062

6163
if [ $? -eq 0 ]; then
62-
# Find and rename extracted directory to remove version number
63-
EXTRACTED_DIR="${EXTRACT_PATH}/${EXAMPLES_FOLDER_NAME}"
64-
VERSIONED_DIR=$(find "$EXTRACT_PATH" -maxdepth 1 -type d -name "${EXAMPLES_FOLDER_NAME}-*" | head -1)
65-
if [ -n "$VERSIONED_DIR" ]; then
66-
rm -rf "$EXTRACTED_DIR" 2>/dev/null # Remove existing if present
67-
mv "$VERSIONED_DIR" "$EXTRACTED_DIR"
68-
fi
69-
7064
# Remove the .gitignore file from the root of the extracted directory
7165
if [ -f "${EXTRACTED_DIR}/.gitignore" ]; then
7266
rm -f "${EXTRACTED_DIR}/.gitignore"

‎install/powershell/examples.ps1‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (-not $env:NC) { $NC = "$([char]27)[0m" } else
1111

1212
# Examples configuration
1313
$EXAMPLES_FOLDER_NAME = "plainlang-examples"
14-
$EXAMPLES_DOWNLOAD_URL = "https://github.com/Codeplain-ai/plainlang-examples/archive/refs/tags/0.1.zip"
14+
$EXAMPLES_DOWNLOAD_URL = "https://codeplain.ai/examples/windows"
1515

1616
# Show current directory and ask for extraction path
1717
$CURRENT_DIR = Get-Location
@@ -58,18 +58,12 @@ if (-not $SKIP_DOWNLOAD) {
5858
Write-Host " ${GRAY}Extracting to ${EXTRACT_PATH}...${NC}"
5959

6060
try {
61-
Expand-Archive -Path $TEMP_ZIP -DestinationPath $EXTRACT_PATH -Force
62-
63-
# Find and rename extracted directory to remove version number
61+
# Extract the zip file (contents are at the zip root, so extract into the target folder)
6462
$EXTRACTED_DIR = Join-Path $EXTRACT_PATH $EXAMPLES_FOLDER_NAME
65-
$VERSIONED_DIR = Get-ChildItem -Path $EXTRACT_PATH -Directory -Filter "${EXAMPLES_FOLDER_NAME}-*" | Select-Object -First 1
66-
67-
if ($VERSIONED_DIR) {
68-
if (Test-Path $EXTRACTED_DIR) {
69-
Remove-Item -Path $EXTRACTED_DIR -Recurse -Force -ErrorAction SilentlyContinue
70-
}
71-
Rename-Item -Path $VERSIONED_DIR.FullName -NewName $EXAMPLES_FOLDER_NAME
63+
if (Test-Path $EXTRACTED_DIR) {
64+
Remove-Item -Path $EXTRACTED_DIR -Recurse -Force -ErrorAction SilentlyContinue
7265
}
66+
Expand-Archive -Path $TEMP_ZIP -DestinationPath $EXTRACTED_DIR -Force
7367

7468
# Remove the .gitignore file from the root of the extracted directory
7569
$GITIGNORE_PATH = Join-Path $EXTRACTED_DIR ".gitignore"

0 commit comments

Comments
 (0)