diff --git a/README.md b/README.md index b175c83..f168a7c 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,25 @@ A template repository for .NET PoC (Proof of Concept) - Create a new repository using this one as a template (click the green button at the top right of this page). - Edit [README.md](README.md) file to align with your PoC. - Change the solution and projects to suit your investigation/test/concept. + +## Installation Guide + +Follow these steps to set up the project. This guide includes installation scripts for PowerShell, Shell/Bash, and Batch. + +### PowerShell + +```ps +.\install.ps1 +``` + +### Shell/Bash + +```bash +./install.sh +``` + +### Batch + +```batch +.\install.bat +``` diff --git a/README.template.md b/README.template.md new file mode 100644 index 0000000..bbe79a2 --- /dev/null +++ b/README.template.md @@ -0,0 +1,29 @@ +# Project Title + +One Paragraph of project description goes here. + +## Getting Started + +These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. + +### Prerequisites + +What things you need to install the software and how to install them + +``` +Give examples +``` + +### Installing + +A step by step series of examples that tell you how to get a development env running + +Say what the step will be + +``` +Give the example +``` + +Repeat until finished + +End with an example of getting some data out of the system or using it for a little demo \ No newline at end of file diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..197e18d --- /dev/null +++ b/install.bat @@ -0,0 +1 @@ +powershell -ExecutionPolicy Bypass -File install.ps1 \ No newline at end of file diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..c8e45d9 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,35 @@ +$POCName = Read-Host -Prompt 'POC name (readable version)' +$MainProjectFile = "Src/POCTemplate/POCTemplate.csproj" +$UnitTestProjectFile = "Tests/POCTemplate.Tests/POCTemplate.Tests.csproj" +$MainDir = "Src/POCTemplate" +$UnitTestDir = "Tests/POCTemplate.Tests" + +rm README.md +mv "README.template.md" "README.md" + +(Get-Content README.md) | ForEach-Object {$_ -replace "POCTemplate", $POCName} | Set-Content README.md +(Get-Content .wakatime-project) | ForEach-Object {$_ -replace "POCTemplate", "$POCName"} | Set-Content .wakatime-project +(Get-Content _config.yml) | ForEach-Object {$_ -replace "POCTemplate", $POCName} | Set-Content _config.yml + +(Get-ChildItem -Recurse -Include *.cs*) | ForEach-Object { + $Content = Get-Content $_ + $Content = $Content -replace "POCTemplate", $POCName + Set-Content -Path $_.fullname -Value $Content +} + +(Get-ChildItem -Recurse -Include *.csproj*) | ForEach-Object { + $Content = Get-Content $_ + $Content = $Content -replace "POCTemplate", $POCName + Set-Content -Path $_.fullname -Value $Content +} + +(Get-Content POCTemplate.sln) | ForEach-Object {$_ -replace "POCTemplate", $POCName} | Set-Content POCTemplate.sln +Rename-Item -Path ".\POCTemplate.sln" ".\$POCName.sln" +Rename-Item -Path $MainProjectFile -NewName "$POCName.csproj" +Rename-Item -Path $UnitTestProjectFile -NewName "$POCName.Tests.csproj" +Rename-Item -Path $MainDir $POCName +Rename-Item -Path $UnitTestDir "$POCName.Tests" + +Remove-Item install.bat +Remove-Item install.ps1 +Remove-Item install.sh \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..0812fd6 --- /dev/null +++ b/install.sh @@ -0,0 +1,33 @@ +#!/bin/bash +read -p 'POC name (readable version): ' POCName + +MainProjectFile="Src/POCTemplate/POCTemplate.csproj" +UnitTestProjectFile="Tests/POCTemplate.Tests/POCTemplate.Tests.csproj" +MainDir="Src/POCTemplate" +UnitTestDir="Tests/POCTemplate.Tests" + +rm README.md +mv "README.template.md" "README.md" + +sed -i "s/POCTemplate/$POCName/g" README.md +sed -i "s/POCTemplate/$POCName/g" .wakatime-project +sed -i "s/POCTemplate/$POCName/g" _config.yml + +for file in $(find . -type f -name '*.cs*'); do + sed -i "s/POCTemplate/$POCName/g" "$file" +done + +for file in $(find . -type f -name '*.csproj*'); do + sed -i "s/POCTemplate/$POCName/g" "$file" +done + +sed -i "s/POCTemplate/$POCName/" "POCTemplate.sln" +mv "POCTemplate.sln" "$POCName.sln" +mv "$MainProjectFile" "$POCName.csproj" +mv "$UnitTestProjectFile" "$POCName.Tests.csproj" +mv "$MainDir" "$POCName" +mv "$UnitTestDir" "$POCName.Tests" + +rm install.bat +rm install.ps1 +rm install.sh \ No newline at end of file