Skip to content

Commit

Permalink
Experimental changes not to be merged
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaniuk committed Feb 28, 2024
1 parent 5a9f3f2 commit 04b0c12
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# This file is for you! Please, updated to the versions agreed by your team.

terraform 1.7.0
golang 1.21.4
nodejs 21.2.0 # Always check cloud providers runtime support
poetry 1.7.1
pre-commit 3.6.0
python 3.12.0 # Always check cloud providers runtime support
terraform 1.7.0
yarn 1.22.21

# ==============================================================================
# The section below is reserved for Docker image versions.
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ clean:: # Clean-up project resources (main) @Operations

config:: # Configure development environment (main) @Configuration
# TODO: Use only 'make' targets that are specific to this project, e.g. you may not need to install Node.js
make _install-dependencies

# ==============================================================================

Expand Down
36 changes: 36 additions & 0 deletions docs/developer-guides/Project_structure_by_examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Project structure by examples

- [Project structure by examples](#project-structure-by-examples)
- [Golang](#golang)
- [Directory structure](#directory-structure)
- [Commands](#commands)

## Golang

### Directory structure

```console
build/
.gitignore
cmd/
${program-name}/
arguments.go
arguments_test.go
config.go
config_test.go
main.go
main_test.go
go.mod
go.sum
```

### Commands

```console
go test -coverprofile=coverage.out -v ./...
go tool cover -html=coverage.out -o coverage.html
```

```console
go build -o ./build/${program-name} ./cmd/${program-name}/
```
16 changes: 13 additions & 3 deletions scripts/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,22 @@ githooks-run: # Run git hooks configured in this repository @Operations
--all-files

_install-dependency: # Install asdf dependency - mandatory: name=[listed in the '.tool-versions' file]; optional: version=[if not listed]
echo ${name}
asdf plugin add ${name} ||:
asdf install ${name} $(or ${version},)
asdf install ${name} $(or ${version},) ||:

_install-dependencies: # Install all the dependencies listed in .tool-versions
for plugin in $$(grep ^[a-z] .tool-versions | sed 's/[[:space:]].*//'); do
make _install-dependency name="$${plugin}"
done

asdf-install: # Install asdf @Installation
if [ -d "${HOME}/.asdf" ]; then
( cd "${HOME}/.asdf"; git pull )
else
git clone https://github.com/asdf-vm/asdf.git "${HOME}/.asdf" ||:
fi
asdf plugin update --all

clean:: # Remove all generated and temporary files (common) @Operations
rm -rf \
.scannerwork \
Expand All @@ -61,7 +68,9 @@ clean:: # Remove all generated and temporary files (common) @Operations

config:: # Configure development environment (common) @Configuration
make \
githooks-config
asdf-install \
_install-dependencies \
githooks-config \

help: # Print help @Others
printf "\nUsage: \033[3m\033[93m[arg1=val1] [arg2=val2] \033[0m\033[0m\033[32mmake\033[0m\033[34m <command>\033[0m\n\n"
Expand Down Expand Up @@ -146,6 +155,7 @@ HELP_SCRIPT = \
${VERBOSE}.SILENT: \
_install-dependencies \
_install-dependency \
asdf-install \
clean \
config \
githooks-config \
Expand Down

0 comments on commit 04b0c12

Please sign in to comment.