Skip to content

Commit

Permalink
Fix [FEATURE] Create installation scripts and use README template wit…
Browse files Browse the repository at this point in the history
…h gitauto model (#11)

* Update install.ps1

* Update install.sh

* Update install.bat

* Update README.template.md

* Update README.md

* Update README.md

---------

Co-authored-by: gitauto-ai[bot] <161652217+gitauto-ai[bot]@users.noreply.github.com>
Co-authored-by: Guilherme Branco Stracini <[email protected]>
  • Loading branch information
gitauto-ai[bot] and guibranco authored Jul 26, 2024
1 parent f8b0a8f commit 14d4654
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
29 changes: 29 additions & 0 deletions README.template.md
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
powershell -ExecutionPolicy Bypass -File install.ps1
35 changes: 35 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 14d4654

Please sign in to comment.