improved building

This commit is contained in:
2023-04-15 13:33:09 -04:00
parent e65633a85a
commit aa955c3b4f
4 changed files with 11 additions and 8 deletions

3
.gitignore vendored
View File

@@ -9,5 +9,4 @@ cfg/*.env
cfg/*.toml cfg/*.toml
build/ build/
buildTime.txt build*.txt
buildVersion.txt

View File

@@ -26,6 +26,7 @@ endif
progName = scaffold progName = scaffold
arch = amd64 arch = amd64
winbinName = $(progName).exe winbinName = $(progName).exe
releaseTag = $(shell git describe --abbrev=0)
#---------------------------------------------------------------- #----------------------------------------------------------------
# Helpers # Helpers
@@ -58,6 +59,7 @@ linkerflags = '-s'
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
build: prep linux windows build: prep linux windows
@@ -65,7 +67,7 @@ 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"
windows: windows:
> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(winbinName) . && 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

View File

@@ -1,13 +1,14 @@
# scaffold # scaffold
## Intro ## 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. 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
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 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. ***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. 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.

View File

@@ -48,7 +48,8 @@ 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 = "/"
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" cfg_filename = "scaffold-cfg.toml"
setup ScaffoldSetup setup ScaffoldSetup
npsetup Setup npsetup Setup
@@ -66,9 +67,9 @@ func main() {
fmt.Println("It's a windows system") fmt.Println("It's a windows system")
} }
ucfgd, err := os.UserConfigDir() user_cfg_dir, err := os.UserConfigDir()
ifFerr("Unable to determine user config directory", err) ifFerr("Unable to determine user config directory", err)
fmt.Println("System says -- user config directory: ", ucfgd) fmt.Println("System says -- user config directory: ", user_cfg_dir)
os.Exit(0) os.Exit(0)
} }
@@ -77,7 +78,7 @@ func main() {
u, err := user.Current() u, err := user.Current()
ifFerr("Unable to get current user details", err) ifFerr("Unable to get current user details", err)
homeDir := u.HomeDir 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 cfg_file := scaffold_cfg_dir + sep + cfg_filename
if _, err := os.Stat(scaffold_cfg_dir); err != nil { if _, err := os.Stat(scaffold_cfg_dir); err != nil {