Skip to content

Commit 8e2ab70

Browse files
committed
add basic kapitan target for freeplande-node
1 parent e285c88 commit 8e2ab70

File tree

9 files changed

+118
-2
lines changed

9 files changed

+118
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
parameters:
3+
kapitan:
4+
compile:
5+
- input_type: jinja2
6+
input_paths:
7+
- templates/bash/functions.bash
8+
output_path: .

inventory/classes/bash/kapitan.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
classes:
3+
- bash.functions
4+
parameters:
5+
bash:
6+
functions:
7+
kapitan_compile: >
8+
(
9+
cd ${kapitan_root}
10+
./kapitan.sh compile -t ${target_name}
11+
)
12+
kapitan_edit_target: >
13+
(
14+
cd ${kapitan_root}
15+
editor `find inventory/targets -type f -name ${target_name}.yml | head -n1`
16+
)
17+

inventory/classes/docker/image.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
parameters:
3+
kapitan:
4+
compile:
5+
- input_paths:
6+
- templates/docker
7+
output_path: .
8+
input_type: jinja2
9+
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
22
parameters:
3-
mindwm_root: /home/bebebeko/mindwm # ugly
4-
compiled_dir: ${mindwm_root}/compiled/${target_name}/
3+
mindwm:
4+
root: ${kapitan_root} # ugly
5+
runtime:
6+
root: /tmp/mindwm
7+
tmux_dir: ${mindwm:runtime:root}/tmux
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
parameters:
3+
bash:
4+
functions:
5+
tmux_session_start: >
6+
TMUXINATOR_CONFIG=${compiled_dir} tmuxinator start tmuxinator
7+
tmux attach -t ${target_name}
8+
9+
kapitan:
10+
compile:
11+
- input_type: jsonnet
12+
input_paths:
13+
- jsonnet/tmuxinator.jsonnet
14+
output_path: .
15+
output_type: "yml"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
parameters:
2+
tmuxinator:
3+
root: ${compiled_dir}
4+
windows:
5+
- kapitan:
6+
layout: main-vertical
7+
pre:
8+
- |
9+
. ${compiled_dir}/functions.bash
10+
panes:
11+
- |
12+
kapitan_edit_target
13+
- |
14+
kapitan_compile

inventory/classes/tmuxp/init.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
parameters:
3+
bash:
4+
functions:
5+
tmux_session_start: >
6+
tmuxp load ${compiled_dir}/tmuxinator.yaml
7+

inventory/classes/vim/init.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
parameters:
3+
bash:
4+
functions:
5+
editor:
6+
vim $*
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
classes:
3+
- common
4+
- mindwm
5+
- vim
6+
- tmuxinator
7+
- bash.kapitan
8+
- tmuxinator
9+
- tmuxinator.kapitan
10+
# - tmuxp
11+
12+
parameters:
13+
14+
target_name: freeplane-node
15+
node_id: ${target_name}
16+
17+
# fifo
18+
tmux_fifo: ${mindwm:runtime:tmux_dir}/tmux-${node_id}.fifo
19+
20+
tmuxinator:
21+
name: freeplane-node-${node_id}
22+
root: ${compiled_dir}
23+
24+
windows:
25+
- shell:
26+
layout: main-vertical
27+
# TODO (@metacoma) move 'pre' section in jsonnet template
28+
pre:
29+
- |
30+
. ${compiled_dir}/functions.bash
31+
panes:
32+
- |
33+
mkdir -p ${mindwm:runtime:tmux_dir}
34+
test -p ${tmux_fifo} -o -f ${tmux_fifo} && rm -v ${tmux_fifo}
35+
mkfifo ${tmux_fifo}
36+
tmux pipe-pane -IO -t ${tmuxinator:name}:1 "cat > ${tmux_fifo}"
37+

0 commit comments

Comments
 (0)