Skip to content

Commit

Permalink
Fix rochacbruno#4 URLNAME
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno committed Aug 16, 2021
1 parent 8a238e9 commit 71cca9a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
8 changes: 6 additions & 2 deletions .github/rename_project.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
#!/usr/bin/env bash
while getopts a:n:d: flag
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_name="project_name"
original_author="author_name"
original_name="project_name"
original_urlname="project_urlname"
original_description="project_description"


Expand All @@ -24,6 +27,7 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion .github/templates/flask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is a Flask application.
From source:

```bash
git clone https://github.com/author_name/project_name
git clone https://github.com/author_name/project_urlname
cd project_name
make install
```
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/rename_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ jobs:
fetch-depth: 0
ref: ${{ github.head_ref }}

- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '-' '_')" >> $GITHUB_ENV
- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')" >> $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: Rename the project
run: |
echo "Renaming the project with -a ${{ env.REPOSITORY_OWNER }} -n ${{ env.REPOSITORY_NAME }}"
.github/rename_project.sh -a ${{ env.REPOSITORY_OWNER }} -n ${{ env.REPOSITORY_NAME }} -d "Awesome ${{ env.REPOSITORY_NAME }} created by ${{ env.REPOSITORY_OWNER }}"
echo "Renaming the project with -a(author) ${{ env.REPOSITORY_OWNER }} -n(name) ${{ env.REPOSITORY_NAME }} -u(urlname) ${{ env.REPOSITORY_URLNAME }}"
.github/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: Get last commit message
id: last-commit-message
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ This instructions are for linux base systems. (Linux, MacOS, BSD, etc.)
## Setting up your own fork of this repo.

- On github interface click on `Fork` button.
- Clone your fork of this repo. `git clone [email protected]:YOUR_GIT_USERNAME/project_name.git`
- Enter the directory `cd project_name`
- Add upstream repo `git remote add upstream https://github.com/author_name/project_name`
- Clone your fork of this repo. `git clone [email protected]:YOUR_GIT_USERNAME/project_urlname.git`
- Enter the directory `cd project_urlname`
- Add upstream repo `git remote add upstream https://github.com/author_name/project_urlname`

## Setting up your own virtual environment

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ A low dependency and really simple to start project template for Python Projects
---
# project_name

[![codecov](https://codecov.io/gh/author_name/project_name/branch/main/graph/badge.svg?token=project_name_token_here)](https://codecov.io/gh/author_name/project_name)
[![CI](https://github.com/author_name/project_name/actions/workflows/main.yml/badge.svg)](https://github.com/author_name/project_name/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/author_name/project_urlname/branch/main/graph/badge.svg?token=project_urlname_token_here)](https://codecov.io/gh/author_name/project_urlname)
[![CI](https://github.com/author_name/project_urlname/actions/workflows/main.yml/badge.svg)](https://github.com/author_name/project_urlname/actions/workflows/main.yml)

project_description

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def read_requirements(path):
name="project_name",
version=read("project_name", "VERSION"),
description="project_description",
url="https://github.com/author_name/project_name/",
url="https://github.com/author_name/project_urlname/",
long_description=read("README.md"),
long_description_content_type="text/markdown",
author="author_name",
Expand Down

0 comments on commit 71cca9a

Please sign in to comment.