Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7680b34aca | |||
| 5364bfaa8a |
13
Makefile
13
Makefile
@@ -59,20 +59,25 @@ linkerflags = '-s -w'
|
|||||||
prep: clean
|
prep: clean
|
||||||
> date +"%F %a %T %Z" > buildTime.txt
|
> date +"%F %a %T %Z" > buildTime.txt
|
||||||
> git describe --always --tags --dirty --long > buildVersion.txt
|
> git describe --always --tags --dirty --long > buildVersion.txt
|
||||||
> mkdir -p build
|
> @mkdir -p build
|
||||||
|
|
||||||
build: prep linux windows
|
build: prep linux windows
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName) . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName) . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
||||||
|
|
||||||
|
linux-release:
|
||||||
|
> @GOOS=linux GOARCH=$(arch) go build -ldflags=${linkerflags} -o build/linux/$(progName)-linux-$(arch)-$(releaseTag) . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName)-$(arch)-$(releaseTag).exe . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName)-$@-$(arch)-$(releaseTag).exe . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
||||||
|
|
||||||
build-production: prep linx-production
|
build-production: prep linx-production
|
||||||
|
|
||||||
linux-production:
|
linux-production:
|
||||||
> @GOOS=linx GOARCH=$(arch) go build -ldflags=${linkerflags} -o build/$@/$(progName) . && echo "production build success" || echo "[FAILED] production build"
|
> @GOOS=linux GOARCH=$(arch) go build -ldflags=${linkerflags} -o build/$@/$(progName) . && echo "production build success" || echo "[FAILED] production build"
|
||||||
|
|
||||||
|
release: prep linux-release windows
|
||||||
|
|
||||||
#-------------------------------------------------------------
|
#-------------------------------------------------------------
|
||||||
# Install - same as build, but places binary on system path
|
# Install - same as build, but places binary on system path
|
||||||
@@ -85,4 +90,4 @@ install-production: prep
|
|||||||
> @go install -ldflags=${linkerflags} . && echo "Production build and install success" || echo "[FAILED] Production install"
|
> @go install -ldflags=${linkerflags} . && echo "Production build and install success" || echo "[FAILED] Production install"
|
||||||
|
|
||||||
## Commands that don't relate to a specific file
|
## Commands that don't relate to a specific file
|
||||||
.PHONY: help confirm clean prep build build-production linux windows amd64
|
.PHONY: help confirm clean prep build build-production linux windows amd64 release
|
||||||
49
README.md
49
README.md
@@ -4,28 +4,55 @@
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
## The Process
|
## What scaffold does
|
||||||
|
|
||||||
- The new project directory is created
|
- A new project directory is created
|
||||||
- Your project skeleton is copied from your sample directory
|
- Your project skeleton/template is copied from your config/projectType/sample directory
|
||||||
- your setup/initialization commmands are run
|
- your setup/initialization commmands are run
|
||||||
- a git repository is initialized in the project directory
|
- And if you enable them
|
||||||
- and if you enable it, a remote repository is created and setup
|
- a git repository is initialized in the project directory
|
||||||
|
- a remote repository is created and setup
|
||||||
|
- a gitea repository is created and setup
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Grab a version for your system from the releases page.
|
||||||
|
2. Put it in a directory that is on your path.
|
||||||
|
3. Now configure your preferred setups/layouts/skeletons/templates for your projects.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
On linux, the configuration directory will be at /home/user/.config/devel/scaffold
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## 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. |
|
||||||
|
| **Examples:** | |
|
||||||
|
| scaffold *ProjectType* *NewProjectName* | Stuff |
|
||||||
|
|
||||||
## Configuration of samples
|
## Configuration of samples
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
The image should explain alot.
|
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.
|
||||||
|
|
||||||
The important description goes here.
|
|
||||||
|
|
||||||
More paragraphs of stuff.
|
|
||||||
|
|
||||||
## Git
|
## Git
|
||||||
|
|
||||||
Git is available to be used as the version control system for new projects. Select/Deselect within the `scaffold-<PROJECTTYPE>.toml` file.
|
Git is available to be used as the version control system for new projects. Select/Deselect within the `scaffold-<PROJECTTYPE>.toml` file.
|
||||||
|
|
||||||
***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.
|
*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.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
13
main.go
13
main.go
@@ -48,7 +48,6 @@ var (
|
|||||||
infoFlag = flag.Bool("Info", false, "Displays the program build information and exits.")
|
infoFlag = flag.Bool("Info", false, "Displays the program build information and exits.")
|
||||||
infoFlag2 = flag.Bool("i", false, "Displays the program build information and exits.")
|
infoFlag2 = flag.Bool("i", false, "Displays the program build information and exits.")
|
||||||
sep = "/"
|
sep = "/"
|
||||||
user_cfg_dir string
|
|
||||||
cfg_dir = "devel/scaffold" // relative to <USER_CONFIG_DIR>, on linux /home/user/.config
|
cfg_dir = "devel/scaffold" // relative to <USER_CONFIG_DIR>, on linux /home/user/.config
|
||||||
cfg_filename = "scaffold-cfg.toml"
|
cfg_filename = "scaffold-cfg.toml"
|
||||||
setup ScaffoldSetup
|
setup ScaffoldSetup
|
||||||
@@ -59,6 +58,9 @@ func main() {
|
|||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
user_cfg_dir, err := os.UserConfigDir()
|
||||||
|
ifFerr("Unable to determine user config directory", err)
|
||||||
|
|
||||||
if *infoFlag || *infoFlag2 {
|
if *infoFlag || *infoFlag2 {
|
||||||
fmt.Printf("Scaffold version: %s", buildVersion)
|
fmt.Printf("Scaffold version: %s", buildVersion)
|
||||||
fmt.Printf("Built: %s\n", buildTime)
|
fmt.Printf("Built: %s\n", buildTime)
|
||||||
@@ -67,8 +69,10 @@ func main() {
|
|||||||
fmt.Println("It's a windows system")
|
fmt.Println("It's a windows system")
|
||||||
}
|
}
|
||||||
|
|
||||||
user_cfg_dir, err := os.UserConfigDir()
|
at, err := availableProjectTypes(user_cfg_dir + sep + cfg_dir)
|
||||||
ifFerr("Unable to determine user config directory", err)
|
ifFerr("Unable to get available project types", err)
|
||||||
|
fmt.Printf("Avaiable types: %v\n", at)
|
||||||
|
|
||||||
fmt.Println("System says -- user config directory: ", user_cfg_dir)
|
fmt.Println("System says -- user config directory: ", user_cfg_dir)
|
||||||
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
@@ -304,6 +308,9 @@ func availableProjectTypes(adir string) ([]string, error) {
|
|||||||
|
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
if e.IsDir() {
|
if e.IsDir() {
|
||||||
|
if e.Name() == ".git" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
res = append(res, e.Name())
|
res = append(res, e.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user