From 828e257453d337d8aa6081fa5bd767d38676f38b Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 27 Nov 2024 20:09:05 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Ready=20to=20clone=20and=20code.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/rename_project.sh | 40 ---------------- .gitea/template.yml | 1 - .gitea/workflows/release.yml | 2 +- .gitea/workflows/rename_project.yml | 48 ------------------- .gitea/workflows/sonar.yml | 4 +- CONTRIBUTING.md | 8 ++-- Containerfile | 4 +- .../DotnetTestLib.Tests.csproj | 2 +- .../UnitTest1.cs | 4 +- project_name.sln => DotnetTestLib.sln | 4 +- .../DotnetTestLib.csproj | 0 .../HelloWorldProvider.cs | 2 +- {project_name => DotnetTestLib}/VERSION | 0 MANIFEST.in | 2 +- Makefile | 18 +++---- README.md | 4 +- mkdocs.yml | 2 +- 17 files changed, 28 insertions(+), 117 deletions(-) delete mode 100755 .gitea/rename_project.sh delete mode 100644 .gitea/template.yml delete mode 100644 .gitea/workflows/rename_project.yml rename project_name.Tests/project_name.Tests.csproj => DotnetTestLib.Tests/DotnetTestLib.Tests.csproj (87%) rename {project_name.Tests => DotnetTestLib.Tests}/UnitTest1.cs (78%) rename project_name.sln => DotnetTestLib.sln (81%) rename project_name/project_name.csproj => DotnetTestLib/DotnetTestLib.csproj (100%) rename {project_name => DotnetTestLib}/HelloWorldProvider.cs (90%) rename {project_name => DotnetTestLib}/VERSION (100%) diff --git a/.gitea/rename_project.sh b/.gitea/rename_project.sh deleted file mode 100755 index 022fc64..0000000 --- a/.gitea/rename_project.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash -while getopts a:n:u:d: flag -do - case "${flag}" in - a) author=${OPTARG};; - n) name=${OPTARG};; - u) urlname=${OPTARG};; - d) description=${OPTARG};; - esac -done - -echo "Author: $author"; -echo "Project Name: $name"; -echo "Project URL name: $urlname"; -echo "Description: $description"; - -echo "Renaming project..." - -original_author="author_name" -original_name="project_name" -original_urlname="project_urlname" -original_description="project_description" -# for filename in $(find . -name "*.*") -for filename in $(git ls-files) -do - sed -i "s/$original_author/$author/g" $filename - sed -i "s/$original_name/$name/g" $filename - sed -i "s/$original_urlname/$urlname/g" $filename - sed -i "s/$original_description/$description/g" $filename - echo "Renamed $filename" -done - -mv project_name $name -mv project_name.Tests $name.Tests -mv project_name.sln $name.sln -mv $name/project_name.csproj $name/$name.csproj -mv $name.Tests/project_name.Tests.csproj $name.Tests/$name.Tests.csproj - -# This command runs only once on GHA! -rm -rf .gitea/template.yml diff --git a/.gitea/template.yml b/.gitea/template.yml deleted file mode 100644 index 3386bee..0000000 --- a/.gitea/template.yml +++ /dev/null @@ -1 +0,0 @@ -author: rochacbruno diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index fcb534b..31ef3fe 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -60,6 +60,6 @@ jobs: REPOSITORY_OWNER=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $1}') REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}' | tr '-' '_'') dotnet nuget add source --name gitea --username $GITEA_USERNAME --password $GITEA_PASSWORD https://git.disi.dev/api/packages/$REPOSITORY_OWNER/nuget/index.json - dotnet pack --include-symbols --include-source -p:PackageVersion=$(cat $REPOSITORY_NAME/VERSION) project_name.sln + dotnet pack --include-symbols --include-source -p:PackageVersion=$(cat $REPOSITORY_NAME/VERSION) DotnetTestLib.sln dotnet nuget push --source gitea $REPOSITORY_NAME/bin/Release/$REPOSITORY_NAME.$(cat $REPOSITORY_NAME/VERSION).nupkg dotnet nuget push --source gitea $REPOSITORY_NAME/bin/Release/$REPOSITORY_NAME.$(cat $REPOSITORY_NAME/VERSION).symbols.nupkg diff --git a/.gitea/workflows/rename_project.yml b/.gitea/workflows/rename_project.yml deleted file mode 100644 index f43225e..0000000 --- a/.gitea/workflows/rename_project.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Rename the project from template - -on: [push] - -permissions: write-all - -jobs: - rename-project: - if: ${{ !endsWith (gitea.repository, 'Templates/Dotnet_Library') }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - # by default, it uses a depth of 1 - # this fetches all history so that we can read each commit - fetch-depth: 0 - ref: ${{ gitea.head_ref }} - - - run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}' | tr '-' '_')" >> $GITHUB_ENV - shell: bash - - - run: echo "REPOSITORY_URLNAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}')" >> $GITHUB_ENV - shell: bash - - - run: echo "REPOSITORY_OWNER=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $1}')" >> $GITHUB_ENV - shell: bash - - - name: Is this still a template - id: is_template - run: echo "::set-output name=is_template::$(ls .gitea/template.yml &> /dev/null && echo true || echo false)" - - - name: Rename the project - if: steps.is_template.outputs.is_template == 'true' - run: | - echo "Renaming the project with -a(author) ${{ env.REPOSITORY_OWNER }} -n(name) ${{ env.REPOSITORY_NAME }} -u(urlname) ${{ env.REPOSITORY_URLNAME }}" - .gitea/rename_project.sh -a ${{ env.REPOSITORY_OWNER }} -n ${{ env.REPOSITORY_NAME }} -u ${{ env.REPOSITORY_URLNAME }} -d "Awesome ${{ env.REPOSITORY_NAME }} created by ${{ env.REPOSITORY_OWNER }}" - - - name: Remove renaming workflow - if: steps.is_template.outputs.is_template == 'true' - run: | - rm .gitea/workflows/rename_project.yml - rm .gitea/rename_project.sh - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "✅ Ready to clone and code." - # commit_options: '--amend --no-edit' - push_options: --force diff --git a/.gitea/workflows/sonar.yml b/.gitea/workflows/sonar.yml index 7f62db9..c05d2e6 100644 --- a/.gitea/workflows/sonar.yml +++ b/.gitea/workflows/sonar.yml @@ -10,7 +10,7 @@ jobs: sonarqube: name: SonarQube Trigger runs-on: ubuntu-latest - if: ${{ !contains ('project_name', format('{0}_{1}', 'project', 'name')) }} + if: ${{ !contains ('DotnetTestLib', format('{0}_{1}', 'project', 'name')) }} steps: - name: Checking out uses: actions/checkout@v4 @@ -24,4 +24,4 @@ jobs: SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} with: args: > - -Dsonar.projectKey=project_name \ No newline at end of file + -Dsonar.projectKey=DotnetTestLib \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aff917f..83ee4c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # How to develop on this project -project_name welcomes contributions from the community. +DotnetTestLib welcomes contributions from the community. **You need Dotnet 9!** @@ -8,9 +8,9 @@ This instructions are for linux base systems. (Linux, MacOS, BSD, etc.) ## Setting up your own fork of this repo. - On gitea interface click on `Fork` button. -- Clone your fork of this repo. `git clone git@git.disi.dev:YOUR_GIT_USERNAME/project_urlname.git` -- Enter the directory `cd project_urlname` -- Add upstream repo `git remote add upstream https://git.disi.dev/author_name/project_urlname` +- Clone your fork of this repo. `git clone git@git.disi.dev:YOUR_GIT_USERNAME/DotnetTestLib.git` +- Enter the directory `cd DotnetTestLib` +- Add upstream repo `git remote add upstream https://git.disi.dev/Projects/DotnetTestLib` ## Run the tests to ensure everything is working diff --git a/Containerfile b/Containerfile index 21c0a2b..7ff279f 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,4 @@ FROM mcr.microsoft.com/dotnet/runtime:9.0 -COPY ./project_name/bin/Release/net9.0/ /app +COPY ./DotnetTestLib/bin/Release/net9.0/ /app WORKDIR /app -CMD ["project_name"] +CMD ["DotnetTestLib"] diff --git a/project_name.Tests/project_name.Tests.csproj b/DotnetTestLib.Tests/DotnetTestLib.Tests.csproj similarity index 87% rename from project_name.Tests/project_name.Tests.csproj rename to DotnetTestLib.Tests/DotnetTestLib.Tests.csproj index 184e6f4..aa9be2a 100644 --- a/project_name.Tests/project_name.Tests.csproj +++ b/DotnetTestLib.Tests/DotnetTestLib.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/project_name.Tests/UnitTest1.cs b/DotnetTestLib.Tests/UnitTest1.cs similarity index 78% rename from project_name.Tests/UnitTest1.cs rename to DotnetTestLib.Tests/UnitTest1.cs index 2e6a555..48fd4c4 100644 --- a/project_name.Tests/UnitTest1.cs +++ b/DotnetTestLib.Tests/UnitTest1.cs @@ -1,6 +1,6 @@ -namespace project_name.Tests; +namespace DotnetTestLib.Tests; -using project_name; +using DotnetTestLib; public class UnitTest1 { diff --git a/project_name.sln b/DotnetTestLib.sln similarity index 81% rename from project_name.sln rename to DotnetTestLib.sln index 5098aa7..6aba54a 100644 --- a/project_name.sln +++ b/DotnetTestLib.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "project_name", "project_name\project_name.csproj", "{5AF6E15A-7BFC-49EB-AC97-A2AA1B131608}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotnetTestLib", "DotnetTestLib\DotnetTestLib.csproj", "{5AF6E15A-7BFC-49EB-AC97-A2AA1B131608}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "project_name.Tests", "project_name.Tests\project_name.Tests.csproj", "{FD1B8A2E-3BA7-4FDD-96FB-18551A15A5F3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotnetTestLib.Tests", "DotnetTestLib.Tests\DotnetTestLib.Tests.csproj", "{FD1B8A2E-3BA7-4FDD-96FB-18551A15A5F3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/project_name/project_name.csproj b/DotnetTestLib/DotnetTestLib.csproj similarity index 100% rename from project_name/project_name.csproj rename to DotnetTestLib/DotnetTestLib.csproj diff --git a/project_name/HelloWorldProvider.cs b/DotnetTestLib/HelloWorldProvider.cs similarity index 90% rename from project_name/HelloWorldProvider.cs rename to DotnetTestLib/HelloWorldProvider.cs index 141d83a..ecbac23 100644 --- a/project_name/HelloWorldProvider.cs +++ b/DotnetTestLib/HelloWorldProvider.cs @@ -1,4 +1,4 @@ -namespace project_name; +namespace DotnetTestLib; public class HelloWorldProvider { diff --git a/project_name/VERSION b/DotnetTestLib/VERSION similarity index 100% rename from project_name/VERSION rename to DotnetTestLib/VERSION diff --git a/MANIFEST.in b/MANIFEST.in index ef198d6..88ba790 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,4 @@ include LICENSE include HISTORY.md include Containerfile graft tests -graft project_name +graft DotnetTestLib diff --git a/Makefile b/Makefile index 2797c77..401c003 100644 --- a/Makefile +++ b/Makefile @@ -7,39 +7,39 @@ help: ## Show the help. .PHONY: buildrel buildrel: ## Format code. - dotnet build -c Release project_name.sln + dotnet build -c Release DotnetTestLib.sln .PHONY: build build: ## Format code. - dotnet build project_name.sln + dotnet build DotnetTestLib.sln .PHONY: publish publish: ## Format code. - dotnet publish -c Release project_name.sln + dotnet publish -c Release DotnetTestLib.sln .PHONY: fmt fmt: ## Format code. - dotnet format project_name.sln + dotnet format DotnetTestLib.sln .PHONY: lint lint: ## Lint code. - dotnet format --verify-no-changes --verbosity diagnostic project_name.sln + dotnet format --verify-no-changes --verbosity diagnostic DotnetTestLib.sln .PHONY: test test: ## Run tests and generate coverage report. - dotnet test project_name.sln + dotnet test DotnetTestLib.sln .PHONY: clean clean: ## Clean unused files. - dotnet clean project_name.sln + dotnet clean DotnetTestLib.sln .PHONY: release release: ## Create a new tag for release. @echo "WARNING: This operation will create a version tag and push to gitea" @read -p "Version? (provide the next x.y.z semver) : " TAG - @echo "$${TAG}" > project_name/VERSION + @echo "$${TAG}" > DotnetTestLib/VERSION @$(ENV_PREFIX)gitchangelog > HISTORY.md - @git add project_name/VERSION HISTORY.md + @git add DotnetTestLib/VERSION HISTORY.md @git commit -m "release: version $${TAG} 🚀" @echo "creating git tag : $${TAG}" @git tag $${TAG} diff --git a/README.md b/README.md index f14c4b0..5430fec 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ --- -# project_name +# DotnetTestLib -project_description +Awesome DotnetTestLib created by Projects ## Usage diff --git a/mkdocs.yml b/mkdocs.yml index 33a69ca..f98d275 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,2 +1,2 @@ -site_name: project_name +site_name: DotnetTestLib theme: readthedocs