Skip to content

Commit

Permalink
Fix domain name replacement in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jamonholmgren committed Nov 29, 2023
1 parent 237f19f commit a5f2a0d
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 2 deletions.
9 changes: 9 additions & 0 deletions jamon.dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# jamon.dev QBasic Website

This is a website powered by [QB64](https://www.qb64.org/) and [Qub](https://qub.jamon.dev).

## Running Locally

Run `./bin/install_qb64` to install dependencies.

Run `./bin/serve` to build and run the website locally.
Empty file added jamon.dev/app.bas
Empty file.
73 changes: 73 additions & 0 deletions jamon.dev/bin/install_qb64
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash

echo "This installs QB64 on a computer or server."

ROOT_FOLDER=$(pwd)

# Check if $ROOT_FOLDER/app.bas exists (if not, exit with an error)
if [ ! -f $ROOT_FOLDER/app.bas ]; then
echo "Error: app.bas not found in $ROOT_FOLDER"
echo "(are you running this from the right folder?)"
exit 1
fi

# Figure out if we're on macos or linux
OS=$(uname -s)

# Set up some constants

if [ "$OS" == "Darwin" ]; then
echo "Installing QB64 on macos"
SOURCE_CODE_URL="https://github.com/QB64Official/qb64/releases/download/v2.1/qb64_dev_2022-09-08-07-14-00_47f5044_osx.tar.gz"
UNZIPPED_FOLDER="qb64_2022-09-08-23-37-44_47f5044_osx"
SETUP_SCRIPT="setup_osx.command"
SETUP_SCRIPT_RELATIVE="./qb64/$SETUP_SCRIPT"
fi

if [ "$OS" == "Linux" ]; then
echo "Installing QB64 on linux"
SOURCE_CODE_URL="https://github.com/QB64Official/qb64/releases/download/v2.1/qb64_dev_2022-09-08-07-14-00_47f5044_lnx.tar.gz"
UNZIPPED_FOLDER="qb64_2022-09-08-23-38-12_47f5044_lnx"
SETUP_SCRIPT="setup_lnx.sh"
SETUP_SCRIPT_RELATIVE="./qb64/$SETUP_SCRIPT"
fi

# If ./qb64/qb64 exists, then we can skip the install step.
if [ -d $ROOT_FOLDER/qb64 ]; then
echo "./qb64 exists ... skipping install step."
echo "To force reinstall, delete the ./qb64 folder"
exit 0
fi

# Download the latest qb64 source code
curl -L -o ./qb64_src.tgz.gz $SOURCE_CODE_URL

# Unzip the file
tar -xf ./qb64_src.tgz.gz

# Remove the zip file
rm ./qb64_src.tgz.gz

# Let's use ./qb64 as the folder name
mv $UNZIPPED_FOLDER ./qb64

cd ./qb64

# Run the setup script

if [ "$OS" == "Darwin" ]; then
# Remove the "run qb64" step of the script
sed -i '' 's/ .\/qb64/# .\/qb64/' $SETUP_SCRIPT
open $SETUP_SCRIPT
fi

if [ "$OS" == "Linux" ]; then
# We are (potentially) running as root, so we need to tell the script to ignore the root check
# In ./qb64/setup_lnx.sh, replace the first instance of "exit 1" with "# exit 1"
sed -i 's/exit 1/# exit 1/' $SETUP_SCRIPT

# Also remove the "run qb64" step of the script
sed -i 's/ .\/qb64 &/# .\/qb64 &/' $SETUP_SCRIPT
sh $SETUP_SCRIPT
fi

14 changes: 12 additions & 2 deletions src/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

VERSION="0.0.1"

# colors
# What OS are we running on?

OS=$(uname -s)

# Colors

BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
Expand Down Expand Up @@ -84,7 +89,12 @@ if [[ $1 == "create" ]]; then
chmod +x $DOMAIN/bin/*

# Replace the domain name in the README
sed -i "s/\$DOMAIN/$DOMAIN/g" $DOMAIN/README.md

if [[ $OS == "Darwin" ]]; then
sed -i '' "s/\$DOMAIN/$DOMAIN/g" $DOMAIN/README.md
elif [[ $OS == "Linux" ]]; then
sed -i "s/\$DOMAIN/$DOMAIN/g" $DOMAIN/README.md
fi

exit 0
fi

0 comments on commit a5f2a0d

Please sign in to comment.