diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index e7f30a4..1363a2b 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -1,4 +1,4 @@ -name: Astrolib Continuous Integration +name: Mamba Continuous Integration on: push: diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 22ec830..4894be8 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -1,4 +1,4 @@ -name: Astrolib Release +name: Mamba Release on: push: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6edce4e..0ae89e3 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,7 +5,7 @@ before: # - go mod generate builds: - - id: "astrolib" + - id: "mamba" env: - CGO_ENABLED=0 goos: diff --git a/.vscode/settings.json b/.vscode/settings.json index 33afead..2bf9df8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,7 @@ "--fast" ], "cSpell.words": [ - "astrolib", + "mamba", "bodyclose", "chzyer", "cmds", diff --git a/README.md b/README.md index b66ad24..f3aaec0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# 🌟 astrolib: ___Go template for library modules___ +# 🌟 mamba: ___Go template for library modules___ [![A B](https://img.shields.io/badge/branching-commonflow-informational?style=flat)](https://commonflow.org) [![A B](https://img.shields.io/badge/merge-rebase-informational?style=flat)](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) [![A B](https://img.shields.io/badge/branch%20history-linear-blue?style=flat)](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule) -[![Go Reference](https://pkg.go.dev/badge/github.com/snivilised/astrolib.svg)](https://pkg.go.dev/github.com/snivilised/astrolib) -[![Go report](https://goreportcard.com/badge/github.com/snivilised/astrolib)](https://goreportcard.com/report/github.com/snivilised/astrolib) -[![Coverage Status](https://coveralls.io/repos/github/snivilised/astrolib/badge.svg?branch=main)](https://coveralls.io/github/snivilised/astrolib?branch=main&kill_cache=1) -[![Astrolib Continuous Integration](https://github.com/snivilised/astrolib/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/snivilised/astrolib/actions/workflows/ci-workflow.yml) +[![Go Reference](https://pkg.go.dev/badge/github.com/snivilised/mamba.svg)](https://pkg.go.dev/github.com/snivilised/mamba) +[![Go report](https://goreportcard.com/badge/github.com/snivilised/mamba)](https://goreportcard.com/report/github.com/snivilised/mamba) +[![Coverage Status](https://coveralls.io/repos/github/snivilised/mamba/badge.svg?branch=main)](https://coveralls.io/github/snivilised/mamba?branch=main&kill_cache=1) +[![Mamba Continuous Integration](https://github.com/snivilised/mamba/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/snivilised/mamba/actions/workflows/ci-workflow.yml) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![A B](https://img.shields.io/badge/commit-conventional-commits?style=flat)](https://www.conventionalcommits.org/) @@ -53,9 +53,9 @@ By using this template, there is no need to use the cobra-cli to scaffold your a ### 📝 Checklist of required changes -The following is list of actions that must be performed before using this template. Most of the changes concern changing the name `astrolib` to the name of the new application. As the template is instantiated from github, the new name will automatically replace the top level directory name, that being ___astrolib___. +The following is list of actions that must be performed before using this template. Most of the changes concern changing the name `mamba` to the name of the new application. As the template is instantiated from github, the new name will automatically replace the top level directory name, that being ___mamba___. -➕ The following descriptions use owner name ___pandora___ and repo name ___maestro___ as an example. That is to say the client has instantiated ___astrolib___ template into github at url _github.com/pandora/maestro_ +➕ The following descriptions use owner name ___pandora___ and repo name ___maestro___ as an example. That is to say the client has instantiated ___mamba___ template into github at url _github.com/pandora/maestro_ #### 🤖 Automated changes @@ -63,28 +63,28 @@ Automated via `automate-checklist.sh` script. When the user instantiates the rep ##### ✅ Rename import statements -+ `rename import paths`: global search and replace ___snivilised/astrolib___ to ___pandora/maestro___ ++ `rename import paths`: global search and replace ___snivilised/mamba___ to ___pandora/maestro___ ##### ✅ Identifiers -+ `change astrolibTemplData`: perform a refactor rename (_Rename Symbol_) to ___maestroTemplData___ ++ `change mambaTemplData`: perform a refactor rename (_Rename Symbol_) to ___maestroTemplData___ -##### ✅ Global search replace astrolib to maestro +##### ✅ Global search replace mamba to maestro Will take care of the following required changes: + `change module name`: update the module name inside the .mod file in the root directory + `change ApplicationName`: modify to reflect the new application name. This application name is incorporated into the name of any translation files to be loaded. + `update BINARY_NAME`: Inside _Taskfile.yml_, change the value of ___BINARY_NAME___ to the name of the client application. -+ `update github action workflows`: change the name of the workflows in the .yaml files to replace ___astrolib___ to ___Maestro___ (note the change of case, if this is important). ++ `update github action workflows`: change the name of the workflows in the .yaml files to replace ___mamba___ to ___Maestro___ (note the change of case, if this is important). ##### ✅ Localisation/Internationalisation -+ `change the names of the translation files`: eg change ___astrolib.active.en-GB.json___ to ___maestro.active.en-GB.json___ ++ `change the names of the translation files`: eg change ___mamba.active.en-GB.json___ to ___maestro.active.en-GB.json___ ##### ✅ Miscellaneous automated changes -+ `reset version files`: this is optional because the release process automatically updates the version number according to the tag specified by the user, but will initially contain the version number which reflects the current value of astrolib at the time the client project is instantiated. ++ `reset version files`: this is optional because the release process automatically updates the version number according to the tag specified by the user, but will initially contain the version number which reflects the current value of mamba at the time the client project is instantiated. + `change SOURCE_ID`: to "github.com/pandora/maestro" #### 🖐 Manual changes @@ -125,7 +125,7 @@ Of course, its up to the user what settings they use in their repo, these are ju ### 🌐 l10n Translations -This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __src/i18n/deploy/astrolib.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app. +This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __src/i18n/deploy/mamba.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app. Make sure that the go-i18n package has been installed so that it can be invoked as cli, see [go-i18n](https://github.com/nicksnyder/go-i18n) for installation instructions. diff --git a/VERSION b/VERSION index f54b243..b82608c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.3.4 +v0.1.0 diff --git a/go.mod b/go.mod index 33586ba..c8d6883 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/snivilised/astrolib +module github.com/snivilised/mamba go 1.26.0 diff --git a/locale/default/astrolib.active.en-GB.json b/locale/default/mamba.active.en-GB.json similarity index 100% rename from locale/default/astrolib.active.en-GB.json rename to locale/default/mamba.active.en-GB.json diff --git a/locale/deploy/astrolib.active.en-US.json b/locale/deploy/mamba.active.en-US.json similarity index 100% rename from locale/deploy/astrolib.active.en-US.json rename to locale/deploy/mamba.active.en-US.json diff --git a/locale/messages-errors.go b/locale/messages-errors.go index 861a6ce..9140516 100644 --- a/locale/messages-errors.go +++ b/locale/messages-errors.go @@ -13,16 +13,16 @@ import ( // that this message has been removed from the translation files, so // it is not useable at run time. type FooBarTemplData struct { - astrolibTemplData + mambaTemplData Path string Reason error } -// the ID should use spp/library specific code, so replace astrolib with the +// the ID should use spp/library specific code, so replace mamba with the // name of the library implementing this template project. func (td FooBarTemplData) Message() *i18n.Message { return &i18n.Message{ - ID: "foo-bar.astrolib.nav", + ID: "foo-bar.mamba.nav", Description: "Foo Bar description", Other: "foo bar failure '{{.Path}}' (reason: {{.Reason}})", } diff --git a/locale/messages-general.go b/locale/messages-general.go index 3614a5a..21b2933 100644 --- a/locale/messages-general.go +++ b/locale/messages-general.go @@ -5,7 +5,7 @@ import ( ) type UsingConfigFileTemplData struct { - astrolibTemplData + mambaTemplData ConfigFileName string } diff --git a/locale/out/en-US/astrolib.translate.en-US.json b/locale/out/en-US/mamba.translate.en-US.json similarity index 100% rename from locale/out/en-US/astrolib.translate.en-US.json rename to locale/out/en-US/mamba.translate.en-US.json diff --git a/locale/translate-defs.go b/locale/translate-defs.go index 3545fe1..951fa46 100644 --- a/locale/translate-defs.go +++ b/locale/translate-defs.go @@ -1,11 +1,11 @@ package locale // CLIENT-TODO: Should be updated to use url of the implementing project, -// so should not be left as astrolib. (this should be set by auto-check) -const AstrolibSourceID = "github.com/snivilised/astrolib" +// so should not be left as mamba. (this should be set by auto-check) +const MambaSourceID = "github.com/snivilised/mamba" -type astrolibTemplData struct{} +type mambaTemplData struct{} -func (td astrolibTemplData) SourceID() string { - return AstrolibSourceID +func (td mambaTemplData) SourceID() string { + return MambaSourceID } diff --git a/resources/doc/i18n-README.md b/resources/doc/i18n-README.md index b0d7469..08941dc 100644 --- a/resources/doc/i18n-README.md +++ b/resources/doc/i18n-README.md @@ -8,18 +8,18 @@ The local directory structure is as follows: - ___default___: contains the translation file created by the __newt__ (new translation task). Actually, this task creates an __active__ file (`active.en-GB.json`) in the `i18n/out` folder, the result of which needs to be manually copied into the __active__ file in the `default` folder. -- ___deploy___: contains all the translations files that are intended to be deployed with the application. There will be one per supported language and by default this template project includes a translation file for __en-US__ (`astrolib.active.en-US.json`) +- ___deploy___: contains all the translations files that are intended to be deployed with the application. There will be one per supported language and by default this template project includes a translation file for __en-US__ (`mamba.active.en-US.json`) ## ⚙️ Translation Workflow ### ✨ New Translations -__goi18n__ instructs the user to manually create an empty translation message file that they want to add (eg `translate.en-US.json`). This is taken care of by the __newt__ task. Then the requirement is to run the goi18n merge \ command (goi18n merge `astrolib.active.en-US.json` `astrolib.translate.en-US.json`). This has been wrapped up into the __merge__ task and the result is that the translation file `astrolib.translation.en-US.json` is populated with the messages to be translated. So the sequence goes: +__goi18n__ instructs the user to manually create an empty translation message file that they want to add (eg `translate.en-US.json`). This is taken care of by the __newt__ task. Then the requirement is to run the goi18n merge \ command (goi18n merge `mamba.active.en-US.json` `mamba.translate.en-US.json`). This has been wrapped up into the __merge__ task and the result is that the translation file `mamba.translation.en-US.json` is populated with the messages to be translated. So the sequence goes: -- run __newt__ task: (generates default language file `./src/i18n/out/active.en-GB.json` and empty `./src/i18n/out/us-US/astrolib.translation.en-US.json` file). This task can be run from the root folder, __goi18n__ will recursively search the directory tree for files with translate-able content, ie files with template definitions (___i18n.Message___) -- run __merge__ task: derives a translation file for the requested language __en-US__ using 2 files as inputs: source active file (`./src/i18n/out/active.en-GB.json`) and the empty __en-US__ translate file (`./src/i18n/out/us-US/astrolib.translation.en-US.json`), both of which were generated in the previous step. +- run __newt__ task: (generates default language file `./src/i18n/out/active.en-GB.json` and empty `./src/i18n/out/us-US/mamba.translation.en-US.json` file). This task can be run from the root folder, __goi18n__ will recursively search the directory tree for files with translate-able content, ie files with template definitions (___i18n.Message___) +- run __merge__ task: derives a translation file for the requested language __en-US__ using 2 files as inputs: source active file (`./src/i18n/out/active.en-GB.json`) and the empty __en-US__ translate file (`./src/i18n/out/us-US/mamba.translation.en-US.json`), both of which were generated in the previous step. - hand the translate file to your translator for them to translate -- rename the translate file to the active equivalent (`astrolib.translation.en-US.json`). Save this into the __deploy__ folder. This file will be deployed with the application. +- rename the translate file to the active equivalent (`mamba.translation.en-US.json`). Save this into the __deploy__ folder. This file will be deployed with the application. ### 🧩 Update Existing Translations (⚠️ not finalised) @@ -36,7 +36,7 @@ However, in this template, the user can execute the following steps: - run task __update__: this will re-extract messages into `active.en-GB.json` and then runs merge to create an updated translate file. - hand the translate file to your translator for them to translate -- as before, this translated file should be used to update the active file `astrolib.active.en-US.json` inside the __deploy__ folder. +- as before, this translated file should be used to update the active file `mamba.active.en-US.json` inside the __deploy__ folder. ## 🎓 Task Reference @@ -64,7 +64,7 @@ Outputs: Inputs: - ./src/i18n/out/active.en-GB.json -- ./src/i18n/out/en-US/astrolib.translate-en-US.json +- ./src/i18n/out/en-US/mamba.translate-en-US.json Outputs: diff --git a/test/data/l10n/test.astrolib.active.en-US.json b/test/data/l10n/test.mamba.active.en-US.json similarity index 78% rename from test/data/l10n/test.astrolib.active.en-US.json rename to test/data/l10n/test.mamba.active.en-US.json index cdca24b..7c4e9bb 100644 --- a/test/data/l10n/test.astrolib.active.en-US.json +++ b/test/data/l10n/test.mamba.active.en-US.json @@ -1,5 +1,5 @@ { - "foo-bar.astrolib.unit-test": { + "foo-bar.mamba.unit-test": { "description": "foo bar", "hash": "sha1-d53a205a336e07cf9eac45471b3870f9489288ec", "other": "foo bar"