Skip to content

Commit 4655366

Browse files
committed
merged with v1 branch
2 parents 805fb4f + 7f70c87 commit 4655366

File tree

21 files changed

+1088
-882
lines changed

21 files changed

+1088
-882
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.idea
33
.vscode
44
/grml
5+
/bin

README.md

Lines changed: 15 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,168 +1,25 @@
11
# grml - A simple build automation tool written in Go
22

3-
**TODO**: Update the README. The syntax has changed with the latest release.
4-
5-
grml is a simple Makefile alternative. Build targets are defined in a `grml.yaml`
6-
file located in the project's root directory.
3+
grml is a simple Makefile alternative. Build targets are defined in a `grml.yaml` file located in the project's root directory.
74
This file uses the [YAML](http://yaml.org/) syntax.
85

9-
A minimal `grml.yaml` file can be expressed as follows:
10-
11-
```yaml
12-
targets:
13-
app:
14-
help: build the app
15-
default: true
16-
run: |
17-
gb build all
18-
```
19-
20-
The build is triggered with:
21-
22-
```
23-
$ grml app
24-
```
25-
26-
or just with the default target:
27-
28-
```
29-
$ grml
30-
```
31-
32-
33-
The run section is called in a shell (sh) process. All sh expressions (`if`, `elif`, ...) are valid.
34-
35-
## Outputs
36-
37-
For each target multiple outputs can be defined. Targets are skipped if the output files exist.
38-
39-
```yaml
40-
targets:
41-
resources:
42-
help: build the resources
43-
output:
44-
- build/resources
45-
run: |
46-
mkdir -p build
47-
touch build/resources
48-
```
49-
50-
## Dependencies
51-
52-
Dependencies can be specified within the **deps** section.
53-
54-
```yaml
55-
targets:
56-
app:
57-
help: build the app
58-
deps:
59-
- resources
60-
run: |
61-
gb build all
62-
resources:
63-
help: build the resources
64-
output:
65-
- build/resources
66-
run: |
67-
mkdir -p build
68-
touch build/resources
69-
```
6+
A minimal sample can be found within the [sample](sample/grml.yaml) directory. Enter the directory with a terminal and execute `grml`.
707

71-
## Variables
8+
## Installation
9+
### From Source
10+
go install github.com/desertbit/grml@latest
7211

73-
Environment variables can be defined in the **env** section. These variables are passed to all run target processes.
12+
## Specification
13+
- Environment variables can be defined in the **env** section. These variables are passed to all run target processes.
14+
- Variables are also accessible with the `${}` selector within **help** messages and **import** statements.
15+
- Dependencies can be specified within the command's **deps** section.
7416

75-
```yaml
76-
env:
77-
version: 1.0.0
78-
79-
targets:
80-
app:
81-
help: build the app
82-
default: true
83-
run: |
84-
echo "$version"
85-
```
86-
87-
Variables are accessible with the `${}` selector in the **env**, **deps** and **output** section.
88-
89-
```yaml
90-
env:
91-
version: 1.0.0
92-
buildDir: build/
93-
destBin: app-${version}
94-
95-
targets:
96-
app:
97-
help: build the app
98-
deps:
99-
- resources
100-
run: |
101-
echo "building app ${destBin}"
102-
gb build all
103-
104-
resources:
105-
help: build the resources
106-
output:
107-
- ${buildDir}/resources
108-
run: |
109-
mkdir -p ${buildDir}
110-
touch ${buildDir}/resources
111-
```
112-
113-
### Additonal Variables
17+
### Additonal Environment Variables
11418

11519
The process environment is inherited and following additonal variables are set:
11620

117-
| KEY | VALUE |
118-
|:-----|:---------------------------------------------------------------|
119-
| ROOT | Path to the root build directory containing the grml.yaml file |
120-
121-
122-
## Final Example
123-
124-
```yaml
125-
env:
126-
version: 1.0.0
127-
buildDir: build/
128-
destBin: app-${version}
129-
130-
targets:
131-
app:
132-
help: build the app
133-
default: true
134-
deps:
135-
- resources
136-
- db
137-
run: |
138-
echo "building app ${destBin}"
139-
gb build all
140-
141-
resources:
142-
help: build the resources
143-
help-group: Resources
144-
deps:
145-
- images
146-
output:
147-
- ${buildDir}/resources
148-
run: |
149-
mkdir -p ${buildDir}
150-
touch ${buildDir}/resources
151-
152-
images:
153-
help: build the image resources
154-
help-group: Resources
155-
output:
156-
- ${buildDir}/images
157-
run: |
158-
mkdir -p ${buildDir}
159-
touch ${buildDir}/images
160-
161-
db:
162-
help: build the database files
163-
output:
164-
- ${buildDir}/db
165-
run: |
166-
mkdir -p ${buildDir}
167-
touch ${buildDir}/db
168-
```
21+
| KEY | VALUE |
22+
|:--------|:---------------------------------------------------------------|
23+
| ROOT | Path to the root build directory containing the grml.yaml file |
24+
| PROJECT | Project name as specified within the grml file |
25+
| NUMCPU | Number of CPU cores |

TODO.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

exec.go

Lines changed: 0 additions & 131 deletions
This file was deleted.

go.mod

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,36 @@ module github.com/desertbit/grml
33
go 1.15
44

55
require (
6+
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 // indirect
7+
github.com/chzyer/logex v1.2.0 // indirect
8+
github.com/chzyer/test v0.0.0-20210722231415-061457976a23 // indirect
9+
github.com/creack/pty v1.1.17 // indirect
10+
github.com/davecgh/go-spew v1.1.1 // indirect
11+
github.com/desertbit/closer/v3 v3.1.3 // indirect
612
github.com/desertbit/columnize v2.1.0+incompatible
7-
github.com/desertbit/grumble v1.1.0
8-
github.com/fatih/color v1.10.0
13+
github.com/desertbit/go-shlex v0.1.1 // indirect
14+
github.com/desertbit/grumble v1.1.3
15+
github.com/desertbit/readline v1.5.1 // indirect
16+
github.com/fatih/color v1.13.0
17+
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
18+
github.com/hashicorp/errwrap v1.1.0 // indirect
19+
github.com/hashicorp/go-multierror v1.1.1 // indirect
20+
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c // indirect
21+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
22+
github.com/kr/pretty v0.3.0 // indirect
23+
github.com/kr/pty v1.1.8 // indirect
24+
github.com/kr/text v0.2.0 // indirect
25+
github.com/mattn/go-colorable v0.1.12 // indirect
26+
github.com/mattn/go-isatty v0.0.14 // indirect
927
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
28+
github.com/pmezard/go-difflib v1.0.0 // indirect
29+
github.com/rogpeppe/go-internal v1.8.1 // indirect
30+
github.com/stretchr/testify v1.7.0 // indirect
31+
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
32+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
33+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
1034
gopkg.in/AlecAivazis/survey.v1 v1.8.8
35+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
1136
gopkg.in/yaml.v2 v2.4.0
37+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
1238
)

0 commit comments

Comments
 (0)