Files
scaffold/README.md

74 lines
4.2 KiB
Markdown
Raw Normal View History

2023-04-08 11:40:00 -04:00
# scaffold
## Intro
2023-04-15 13:33:09 -04:00
2023-04-13 15:24:15 -04:00
Use scaffold to setup a new project with a directory skeleton of your design, and if you'd like, it can also automatically initialize local, remote and gitea git repositories for the new project.
2023-04-08 11:40:00 -04:00
2023-04-16 00:36:33 -04:00
## What scaffold does
2023-04-16 00:36:33 -04:00
- A new project directory is created
- Your project skeleton/template is copied from your config/projectType/sample directory
- your setup/initialization commmands are run
2023-04-16 01:35:28 -04:00
- And if you enable them
- a git repository is initialized in the project directory
- a remote repository is created and setup
- a gitea repository is created and setup
2023-04-15 16:06:39 -04:00
2023-04-16 00:36:33 -04:00
## Installation
2023-04-15 16:06:39 -04:00
2023-04-17 05:19:25 -04:00
1. Grab a binary version for your system from the releases page.
2023-04-16 01:35:28 -04:00
2. Put it in a directory that is on your path.
3. Now configure your preferred setups/layouts/skeletons/templates for your projects.
2023-04-16 00:36:33 -04:00
## Configuration
2023-04-16 01:35:28 -04:00
On linux, the configuration directory will be at /home/user/.config/devel/scaffold
2023-04-16 00:36:33 -04:00
For the windows versions, you might want to look at your User_Configuration_Directories location, and change it according to your needs. On windows it's value is the %APPDATA% environment variable.
2023-04-15 16:06:39 -04:00
2023-04-16 00:36:33 -04:00
In a PowerShell, use `Get Child-Item Env:` to display all the environment variables.
Then `[Environment]::SetEnvironmentVariable("APPDATA","C:\Users\You\Wherever-you-like\","User")` to set the new value.
2023-04-15 16:06:39 -04:00
2023-04-16 01:35:28 -04:00
It's a little simpler at a command prompt -- type the command `set` and hit `Enter`. See what `APPDATA` is currently set to. Change it with `setx APPDATA "C:\Users\You\SomeWhere"`.
The examples directory contains an example-scaffold-projectType.toml configuration file. Place a copy in each projectType directory, adjusted to your preferences per the given project type.
2023-04-17 05:19:25 -04:00
## Naming convention warning
Creating repositories on gitea via a ssh push has a side effect -- the project name is forced to lowercase. There are no configuration options to change this. Please see gitea and it's documentation for full explanations.
Here are a couple of thoughts:
1. Adapt and only create projects use lowercase (myspecialproject) or lowersnakecase (my_special_project) or use hyphens between words (my-special-project)
- all lowercase is universally accepted but hard to read for multi-word project names
- lowersnakecase is not universally accepted
- hyphens might not be what you are used to, or prefer, but it seems to be universally accepted and reasonably readable.
2. A work around would be to manually create a reposity with the CamelCase name you want via gitea's web UI. And use scaffold with the -g flag
eg. `scaffold -g MySpecialProject go MySpecialProject` to have scaffold clone it, build it out according to your skeleton/templates, and then push the changes.
2023-04-16 00:36:33 -04:00
## The `scaffold` command
| Command | Description |
| ------- | ----------- |
| scaffold | The program name |
| flags:
-i or -Info | Display the available project types and the build and version information about the program. |
2023-04-17 05:19:25 -04:00
| -g GiteaProjectName | Clone a gitea repository, not create one. Then push the new structure to it. |
2023-04-16 00:36:33 -04:00
| **Examples:** | |
| scaffold *ProjectType* *NewProjectName* | Stuff |
## Configuration of samples
![Example Directory Structure](assets/images/dirtree-pic.png)
2023-04-15 16:06:39 -04:00
2023-04-16 00:36:33 -04:00
The image should explain alot quickly. The go, go-cli, go-web, hs, js, py and svelte directories define the project types available to scaffold. Arrange the contents of the sample directory, within each project type directory, to your preferred layout for each language/use-case.
2023-04-15 16:06:39 -04:00
## Git
Git is available to be used as the version control system for new projects. Select/Deselect within the `scaffold-<PROJECTTYPE>.toml` file.
2023-04-16 00:36:33 -04:00
*Please Note* that if you also use git to track your configuration files and sample directories, then a `.gitignore` file within your sample directory will interfere with git's ability to track your skeletons/templates properly. So, to allow for this, put what you normally would in a `.gitignore` file instead into a file named `GITIGNORE` in your sample directory. And scaffold will convert it to a `.gitignore` file within your newProject directory.
2023-04-15 16:06:39 -04:00
If you are NOT using git to track your project types and samples/skeletons/templates, then no problem, just place a .gitignore file within the sample directory as you would any other file.