Verified Commit d0a94af4 authored by Aral Balkan's avatar Aral Balkan
Browse files

Installation script now uses tmp directory + deploys to site

Closes #57, #58
parent 15afdf7b
......@@ -125,6 +125,7 @@ async function build () {
const pathToWebSite = path.resolve(path.join(__dirname, '../../site/'))
const pathToReleasesFolder = path.resolve(path.join(pathToWebSite, 'releases/'))
const pathToDynamicVersionRoute = path.join(pathToWebSite, '.dynamic', 'version.js')
const pathToInstallationScriptFolderOnWebSite = path.join(pathToWebSite, 'installation-script', 'install')
// Check that a local working copy of the Site.js web site exists at the relative location
// that we expect it to. If it doesn’t skip this step.
......@@ -147,11 +148,14 @@ async function build () {
const versionRoute = `module.exports = (request, response) => { response.end('${package.version}') }\n`
fs.writeFileSync(pathToDynamicVersionRoute, versionRoute, {encoding: 'utf-8'})
// Update the install file on the Site.js web site.
const installScriptFile = path.join(pathToWebSite, 'install')
// Update the install file and deploy it to the Site.js web site.
console.log(' • Updating the installation script and deploying it to Site.js web site.')
const installScriptFile = path.join(mainSourceDirectory, 'script', 'install')
let installScript = fs.readFileSync(installScriptFile, 'utf-8')
installScript = installScript.replace(/\d+\.\d+\.\d+/g, package.version)
fs.writeFileSync(installScriptFile, installScript)
fs.copyFileSync(installScriptFile, pathToInstallationScriptFolderOnWebSite)
} else {
console.log(' • No local working copy of Site.js web site found. Skipped copy of release binaries.')
}
......
#!/bin/bash
######################################################################
#
# Site.js v11.0.0 Installer
#
# To use:
#
# wget -qO- https://sitejs.org/install | bash
#
# This script is only for Linux and macOS.
# On Windows, please use Windows Subsystem for Linux.
#
######################################################################
set -e
echo
echo " 📡 Downloading Site.js v11.0.0…"
function cleanUp {
popd > /dev/null
rm -rf /tmp/sitejs.org
}
# Setup
rm -rf /tmp/sitejs.org
mkdir -p /tmp/sitejs.org
pushd /tmp/sitejs.org > /dev/null
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Linux
wget -q https://sitejs.org/releases/linux/11.0.0.tar.gz
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
wget -q https://sitejs.org/releases/macos/11.0.0.tar.gz
else
# Unsupported
echo "\n ❌ Error: this operating system is not supported.\n"
cleanUp
exit 1
fi
echo " 📦 Installing…"
gzip -d 11.0.0.tar.gz
tar -xvf 11.0.0.tar > /dev/null
sudo mv site /usr/local/bin/
cleanUp
echo " 🎉 Done!"
echo
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment