aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-12 14:52:49 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-12 14:52:49 +0300
commit62057bd84dd0b26f3ae4a35c1d562311dd83632b (patch)
tree032125c8e520e51c450197fa22f35e4986a078ca
parenta2b4dc764a3bab0756803c992873ae6ece621f0f (diff)
downloadit-kariera-exam-template-62057bd84dd0b26f3ae4a35c1d562311dd83632b.tar
it-kariera-exam-template-62057bd84dd0b26f3ae4a35c1d562311dd83632b.tar.gz
it-kariera-exam-template-62057bd84dd0b26f3ae4a35c1d562311dd83632b.zip
Added info about delete features template and rename namespaces scripts and updated README
-rw-r--r--README.md29
-rwxr-xr-xtools/delete-feature-template.sh2
-rwxr-xr-xtools/rename-namespaces.sh11
3 files changed, 38 insertions, 4 deletions
diff --git a/README.md b/README.md
index 19e2e5f..e1b3692 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,35 @@ All of the models have all given properties **and a "Guid Id" property**. Only t
Controller and Service have **very basic** CRUD of the model. No view links are added, so you'll need to provide them (and to test out if everything work: just edit the link in the browser).
+### delete-feature-template
+
+As the name suggests, it just removes any feature, generated with [add-feature-template](#add-feature-template). Or more precisely, it removes all created files and removes references in edited files.
+
+**Example**: Let's say we have a project named `CarShop` and we generated a feature called `Car` that we don't want anymore
+- The first argument is the name of the project, and the second is that of the feature
+```bash
+./delete-feature-template.sh CarShop Car
+```
+
+### rename-namespaces
+
+`rename-project` and `add-feature-template` use and require all namespaces to start with `ProjectName.` (so, for example, `CarShop.Data.Models`). If you want that first word to be changed to something else or entirely removed, you can use this script.
+
+**Example**: rename all namespaces from `ExamTemplate....` to `MyShop....`
+```bash
+./rename-namespaces.sh MyShop
+```
+
+**Example**: rename all namespaces from `MyShop....` to `CarShop....`
+```bash
+./rename-namespaces.sh MyShop CarShop
+```
+
+**Example**: remove the start portion of all namespaces in the `CarShop` project (so form `CarShop.Data.Models` we have `Data.Models`)
+```bash
+./rename-namespaces.sh -r CarShop
+```
+
## Notes
There are some configs that I've made that you may want to change. This section explains them.
diff --git a/tools/delete-feature-template.sh b/tools/delete-feature-template.sh
index 0ceba5b..47218a0 100755
--- a/tools/delete-feature-template.sh
+++ b/tools/delete-feature-template.sh
@@ -40,3 +40,5 @@ rm -rf $dir/Models/$feature_name
rm -rf $dir/Views/$feature_name
sed -i "/$feature_name/d" $dir/Views/_ViewImports.cshtml
sed -i "/$feature_name/d" $dir/Startup.cs
+
+# }}} =============================<
diff --git a/tools/rename-namespaces.sh b/tools/rename-namespaces.sh
index 6e988f8..fa2130c 100755
--- a/tools/rename-namespaces.sh
+++ b/tools/rename-namespaces.sh
@@ -7,11 +7,14 @@ fi
# Defaults
original_name="ExamTemplate."
-new_name="$1"
+new_name="$1."
-if [ ! -z "$2" ]; then
- original_name="$1"
- new_name="$2"
+if [ "$1" -eq "-r" ]; then
+ original_name="$2."
+ new_name=""
+elif [ ! -z "$2" ]; then
+ original_name="$1."
+ new_name="$2."
fi
find ../ -type f -exec sed -i "s/namespace $original_name/namespace $new_name/g" {} \;