-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
- Loading branch information
Showing
10 changed files
with
484 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
toolbox/github/data | ||
toolbox/diver/data | ||
toolbox/gitlab/data | ||
toolbox/utils/_templates/new-GitHub-repository-contributors.fr.template.txt.result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Utils | ||
|
||
# Generate text from template | ||
|
||
## Prerequisites | ||
|
||
- PHP | ||
|
||
## Install prerequisites | ||
|
||
```shell | ||
brew install php | ||
``` | ||
|
||
## Description | ||
|
||
Sometimes as open source reference or software forges administrator, we need so send emails to people. | ||
These emails can be big with lot of details and hyperlinks to resources, and writing them is time expansive. | ||
Because these emails are almost the same (except with some details), we can generate them using a template and variables. | ||
|
||
```shell | ||
php text-generator.php "_templates/new-GitHub-repository-contributors.fr.template.txt" "_templates/values.ini" | ||
``` | ||
|
||
Here we give to the `text-generator.php` PHP script a template to process (first argument) and also an .ini file containing values (second argument). The script will check if all variables are filled, then will replace each entry in the text by the values. | ||
|
||
For example, if we have such .ini file: | ||
|
||
```text | ||
[some_section_which_is_ignored] | ||
; Some comment | ||
VARIABLE_NAME = "Foo-Bar" | ||
``` | ||
|
||
the script will replace all occurences of **%VARIABLE_NAME%** by "Foo-Bar" in the text. Then a file with the new version will be created with quite the same name but _.result_ at the end. |
Oops, something went wrong.