Compare commits
5 Commits
b010d63351
...
v0.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d2d293b21 | |||
| aa955c3b4f | |||
| e65633a85a | |||
| d53ad8993c | |||
| 7b7fdc0113 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -9,5 +9,4 @@ cfg/*.env
|
||||
cfg/*.toml
|
||||
|
||||
build/
|
||||
buildTime.txt
|
||||
buildVersion.txt
|
||||
build*.txt
|
||||
|
||||
23
Makefile
23
Makefile
@@ -24,6 +24,9 @@ endif
|
||||
# Variables
|
||||
#----------------------------------------------------------------
|
||||
progName = scaffold
|
||||
arch = amd64
|
||||
winbinName = $(progName).exe
|
||||
releaseTag = $(shell git describe --abbrev=0)
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Helpers
|
||||
@@ -51,17 +54,25 @@ clean:
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# build strips debugging info from binary
|
||||
linkerflags = '-s'
|
||||
linkerflags = '-s -w'
|
||||
|
||||
prep: clean
|
||||
> date +"%F %a %T %Z" > buildTime.txt
|
||||
> git describe --always --tags --dirty --long > buildVersion.txt
|
||||
> mkdir -p build
|
||||
|
||||
build: prep
|
||||
> @go build -o build/$(progName) . && echo "Build success" || echo "[FAILED] go build"
|
||||
build: prep linux windows
|
||||
|
||||
build-production: prep
|
||||
> @go build -ldflags=${linkerflags} -o build/$(progName) . && echo "production build success" || echo "[FAILED] production build"
|
||||
linux:
|
||||
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName) . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
||||
|
||||
windows:
|
||||
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName)-$(arch)-$(releaseTag).exe . && echo $@ "Build success" || echo $@ "[FAILED] go build"
|
||||
|
||||
build-production: prep linx-production
|
||||
|
||||
linux-production:
|
||||
> @GOOS=linx GOARCH=$(arch) go build -ldflags=${linkerflags} -o build/$@/$(progName) . && echo "production build success" || echo "[FAILED] production build"
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Install - same as build, but places binary on system path
|
||||
@@ -74,4 +85,4 @@ install-production: prep
|
||||
> @go install -ldflags=${linkerflags} . && echo "Production build and install success" || echo "[FAILED] Production install"
|
||||
|
||||
## Commands that don't relate to a specific file
|
||||
.PHONY: help confirm clean prep build build-production
|
||||
.PHONY: help confirm clean prep build build-production linux windows amd64
|
||||
27
README.md
27
README.md
@@ -1,16 +1,9 @@
|
||||
# scaffold
|
||||
|
||||
## Intro
|
||||
|
||||
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.
|
||||
|
||||
## Git
|
||||
|
||||
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 it for 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 into a GITIGNORE file 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.
|
||||
|
||||
## The Process
|
||||
|
||||
- The new project directory is created
|
||||
@@ -18,3 +11,21 @@ If you are NOT using git to track your project types and samples/skeletons/templ
|
||||
- your setup/initialization commmands are run
|
||||
- a git repository is initialized in the project directory
|
||||
- and if you enable it, a remote repository is created and setup
|
||||
|
||||
## Configuration of samples
|
||||
|
||||

|
||||
|
||||
The image should explain alot.
|
||||
|
||||
The important description goes here.
|
||||
|
||||
More paragraphs of stuff.
|
||||
|
||||
## Git
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
BIN
assets/images/dirtree-pic.png
Normal file
BIN
assets/images/dirtree-pic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@@ -11,85 +11,6 @@ scaffold go NewGoProject
|
||||
scaffold py aPythonProject
|
||||
`
|
||||
|
||||
// var gi_template = `%s
|
||||
// .env
|
||||
// *.env
|
||||
// .env.toml
|
||||
|
||||
// cfg/*.toml
|
||||
// cfg/.env
|
||||
// cfg/*.env
|
||||
// cfg/.env*
|
||||
// *.toml
|
||||
|
||||
// build/
|
||||
// buildTime.txt
|
||||
// buildVersion.txt
|
||||
// `
|
||||
|
||||
// var gi_py_template = `%s
|
||||
// .env
|
||||
// *.env
|
||||
// .env.toml
|
||||
|
||||
// cfg/*.toml
|
||||
// cfg/.env
|
||||
// cfg/*.env
|
||||
// cfg/.env*
|
||||
// *.toml
|
||||
|
||||
// bin/
|
||||
// `
|
||||
|
||||
// var cfg_content = `# New Go Project configuration file
|
||||
|
||||
// # Format: TOML - see https://toml.io for details
|
||||
|
||||
// # Go specific
|
||||
// # Go module path is of the form basePath/projectName
|
||||
// # must be addressable if you are going to publish
|
||||
// module_basepath = "officallygood.com"
|
||||
|
||||
// # where to put new project directories
|
||||
// # within the user's home directory
|
||||
// projects_basedir = "devel/GoMyApps"
|
||||
// #def_project_name = "new-go-project"
|
||||
|
||||
// # Must be string, will be parsed to correct type
|
||||
// # Remember perms are in octal
|
||||
// project_dir_permissions = "0700"
|
||||
// file_permissions = "0660"
|
||||
|
||||
// # Git
|
||||
// setup_git = true
|
||||
|
||||
// # Do you have a remote location?
|
||||
// # Do you have autologins setup correctly with ssh keys?
|
||||
// # Using your .ssh/config file might be helpful
|
||||
|
||||
// # setup remote repo?
|
||||
// create_remote_repo = false
|
||||
|
||||
// # remote repo user@location
|
||||
// remote_user = "user@server"
|
||||
|
||||
// # remote repo base dir
|
||||
// # relative to remote user home dir
|
||||
// # eg unix/linux server
|
||||
// # for user@server:/home/user/git -- absolute path
|
||||
// user@server:git -- relative to home dir
|
||||
// # eg windows server
|
||||
// # ???
|
||||
|
||||
// ############################
|
||||
// # remote location MUST already exist on remote server
|
||||
// ############################
|
||||
// remote_location = "git"
|
||||
|
||||
// # default remote short name
|
||||
// remote_shortname = "origin"
|
||||
//`
|
||||
|
||||
var cfg_content = `# Scaffold program configuration
|
||||
|
||||
# Format: TOML - see https://toml.io for details
|
||||
|
||||
16
main.go
16
main.go
@@ -10,6 +10,7 @@ import (
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
@@ -47,7 +48,8 @@ var (
|
||||
infoFlag = flag.Bool("Info", false, "Displays the program build information and exits.")
|
||||
infoFlag2 = flag.Bool("i", false, "Displays the program build information and exits.")
|
||||
sep = "/"
|
||||
cfg_dir = ".config/devel/scaffold"
|
||||
user_cfg_dir string
|
||||
cfg_dir = "devel/scaffold" // relative to <USER_CONFIG_DIR>, on linux /home/user/.config
|
||||
cfg_filename = "scaffold-cfg.toml"
|
||||
setup ScaffoldSetup
|
||||
npsetup Setup
|
||||
@@ -60,6 +62,15 @@ func main() {
|
||||
if *infoFlag || *infoFlag2 {
|
||||
fmt.Printf("Scaffold version: %s", buildVersion)
|
||||
fmt.Printf("Built: %s\n", buildTime)
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
fmt.Println("It's a windows system")
|
||||
}
|
||||
|
||||
user_cfg_dir, err := os.UserConfigDir()
|
||||
ifFerr("Unable to determine user config directory", err)
|
||||
fmt.Println("System says -- user config directory: ", user_cfg_dir)
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@@ -67,7 +78,7 @@ func main() {
|
||||
u, err := user.Current()
|
||||
ifFerr("Unable to get current user details", err)
|
||||
homeDir := u.HomeDir
|
||||
scaffold_cfg_dir := homeDir + sep + cfg_dir
|
||||
scaffold_cfg_dir := user_cfg_dir + sep + cfg_dir
|
||||
cfg_file := scaffold_cfg_dir + sep + cfg_filename
|
||||
|
||||
if _, err := os.Stat(scaffold_cfg_dir); err != nil {
|
||||
@@ -84,6 +95,7 @@ func main() {
|
||||
_, err = cfgfd.WriteString(cfg_content)
|
||||
ifFerr("Unable to write scaffold configuration file content", err)
|
||||
fmt.Println("Wrote new scaffold configuration file")
|
||||
|
||||
_, err = toml.Decode(cfg_content, &setup)
|
||||
ifFerr("[Failed] to parse config file", err)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user