From fd0070ffaef83c277e404bfc157f4b91d9f7ed20 Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Tue, 3 Mar 2020 16:22:12 -0800 Subject: [PATCH] update install script and readme --- README.md | 8 +++++++- install.sh | 24 +++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) mode change 100644 => 100755 install.sh diff --git a/README.md b/README.md index ac63a5a..5c258cb 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,13 @@ Template and build tasks for developing a cross-platform multi-target .NET Frame ## Installation - Download this repository -- Run `install.sh` if you are on Linux/OSX or `install.ps1` if you are on Windows and follow the instructions +- Run `install.sh` if you are on Linux/OSX or `install.ps1` if you are on Windows +- Move the newly created project directory wherever you want + +## Usage + +- Open the project directory in VSCode +- Press Ctrl-Shift-B to open the build tasks menu ## Acknowledgments diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index e0ed1a5..781542a --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ # This file is heavily borrowed from Caleb Cornett's template install script. # Get the directory of this script -MY_DIR=$(dirname "$BASH_SOURCE") +MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # Checks if git is installed function checkGit() @@ -60,25 +60,27 @@ function getLibs() getLibs -read -p "Enter the project name to use for your folder and csproj file or 'exit' to quit: " newProjectName +read -p "Enter your project name or 'exit' to quit: " newProjectName if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then exit 1 fi # copy everything into new dir -cd .. -NEW_PROJECT_DIR=$(pwd "./${newProjectName}") +NEW_PROJECT_DIR="$MY_DIR/../$newProjectName" cp -R $MY_DIR $NEW_PROJECT_DIR cd $NEW_PROJECT_DIR files=(ProjectName.Core.sln ProjectName.Framework.sln .gitignore ProjectName/ProjectName.Core.csproj ProjectName/ProjectName.Framework.csproj ProjectName/ProjectNameGame.cs ProjectName/Program.cs .vscode/tasks.json .vscode/launch.json) for file in "${files[@]}"; do - sed -i '' "s/ProjectName/$newProjectName/g" $file + sed -i -e "s/ProjectName/$newProjectName/g" "./$file" done -mv ProjectName.Core.sln "$newProjectName.Core.sln" -mv ProjectName.Framework.sln "$newProjectName.Framework.sln" -mv ProjectName/ProjectName.Core.csproj "ProjectName/$newProjectName.Core.csproj" -mv ProjectName/ProjectName.Framework.csproj "ProjectName/$newProjectName.Framework.csproj" -mv ProjectName/ProjectNameGame.cs ProjectName/${newProjectName}Game.cs -mv ProjectName "$newProjectName" +mv ./ProjectName.Core.sln "./$newProjectName.Core.sln" +mv ./ProjectName.Framework.sln "./$newProjectName.Framework.sln" +mv ./ProjectName/ProjectName.Core.csproj "./ProjectName/$newProjectName.Core.csproj" +mv ./ProjectName/ProjectName.Framework.csproj "./ProjectName/$newProjectName.Framework.csproj" +mv ./ProjectName/ProjectNameGame.cs ./ProjectName/${newProjectName}Game.cs +mv ./ProjectName "./$newProjectName" +rm ./install.sh + +echo "Project $newProjectName created at $(readlink -f $NEW_PROJECT_DIR)"