takeltau 0.34.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +674 -0
- data/README.md +235 -0
- data/bin/tau +6 -0
- data/lib/Thorfile +3 -0
- data/lib/takeltau.rb +257 -0
- data/lib/takeltau/bit/check/cli.rb +23 -0
- data/lib/takeltau/bit/check/workspace.rb +37 -0
- data/lib/takeltau/bit/cli.rb +18 -0
- data/lib/takeltau/bit/clipboard/cli.rb +73 -0
- data/lib/takeltau/bit/clipboard/copy.rb +142 -0
- data/lib/takeltau/bit/clipboard/lib.rb +143 -0
- data/lib/takeltau/bit/clipboard/paste.rb +60 -0
- data/lib/takeltau/bit/clipboard/pull.rb +37 -0
- data/lib/takeltau/bit/clipboard/push.rb +37 -0
- data/lib/takeltau/bit/require/cli.rb +57 -0
- data/lib/takeltau/bit/require/export.rb +34 -0
- data/lib/takeltau/bit/require/import.rb +133 -0
- data/lib/takeltau/bit/require/lib.rb +19 -0
- data/lib/takeltau/bit/scope/add.rb +55 -0
- data/lib/takeltau/bit/scope/cli.rb +74 -0
- data/lib/takeltau/bit/scope/list.rb +41 -0
- data/lib/takeltau/bit/scope/new.rb +44 -0
- data/lib/takeltau/bit/scope/ssh.rb +13 -0
- data/lib/takeltau/completion/cli.rb +24 -0
- data/lib/takeltau/default.yml +95 -0
- data/lib/takeltau/docker/check/cli.rb +23 -0
- data/lib/takeltau/docker/check/daemon.rb +27 -0
- data/lib/takeltau/docker/cli.rb +15 -0
- data/lib/takeltau/docker/container/check/cli.rb +57 -0
- data/lib/takeltau/docker/container/check/existing.rb +32 -0
- data/lib/takeltau/docker/container/check/network.rb +32 -0
- data/lib/takeltau/docker/container/check/orphaned.rb +32 -0
- data/lib/takeltau/docker/container/clean.rb +40 -0
- data/lib/takeltau/docker/container/cli.rb +118 -0
- data/lib/takeltau/docker/container/command.rb +38 -0
- data/lib/takeltau/docker/container/daemon.rb +17 -0
- data/lib/takeltau/docker/container/lib.rb +181 -0
- data/lib/takeltau/docker/container/login.rb +58 -0
- data/lib/takeltau/docker/container/prune.rb +31 -0
- data/lib/takeltau/docker/image/cli.rb +39 -0
- data/lib/takeltau/docker/image/tag/check.rb +42 -0
- data/lib/takeltau/docker/image/tag/cli.rb +68 -0
- data/lib/takeltau/docker/image/tag/latest.rb +24 -0
- data/lib/takeltau/docker/image/tag/list.rb +19 -0
- data/lib/takeltau/docker/image/update.rb +27 -0
- data/lib/takeltau/git/check/bit.rb +26 -0
- data/lib/takeltau/git/check/clean.rb +46 -0
- data/lib/takeltau/git/check/cli.rb +49 -0
- data/lib/takeltau/git/check/workspace.rb +34 -0
- data/lib/takeltau/git/cli.rb +9 -0
- data/lib/takeltau/info/cli.rb +12 -0
- data/lib/takeltau/info/project/cli.rb +69 -0
- data/lib/takeltau/info/status/bar.rb +112 -0
- data/lib/takeltau/info/status/cli.rb +107 -0
- data/lib/takeltau/info/status/git.rb +47 -0
- data/lib/takeltau/info/status/gopass.rb +37 -0
- data/lib/takeltau/info/status/gpg.rb +39 -0
- data/lib/takeltau/info/status/lib.rb +46 -0
- data/lib/takeltau/info/status/ssh.rb +46 -0
- data/lib/takeltau/init/cli.rb +12 -0
- data/lib/takeltau/init/lib.rb +86 -0
- data/lib/takeltau/init/packer/cli.rb +82 -0
- data/lib/takeltau/init/packer/docker.rb +64 -0
- data/lib/takeltau/init/packer/templates/ansiblelint.tt +3 -0
- data/lib/takeltau/init/packer/templates/bitrequireyml.tt +13 -0
- data/lib/takeltau/init/packer/templates/groupvarsprojectyml.tt +2 -0
- data/lib/takeltau/init/packer/templates/playbooksiteyml.tt +6 -0
- data/lib/takeltau/init/packer/templates/projectyml.tt +19 -0
- data/lib/takeltau/init/takelage/cli.rb +70 -0
- data/lib/takeltau/init/takelage/rake.rb +61 -0
- data/lib/takeltau/init/takelage/templates/bitrequireyml.tt +5 -0
- data/lib/takeltau/init/takelage/templates/projectyml.tt +3 -0
- data/lib/takeltau/init/templates/Rakefile.tt +3 -0
- data/lib/takeltau/init/templates/gitignore.tt +16 -0
- data/lib/takeltau/lib/config.rb +130 -0
- data/lib/takeltau/lib/logging.rb +49 -0
- data/lib/takeltau/lib/project.rb +72 -0
- data/lib/takeltau/lib/subcmd.rb +18 -0
- data/lib/takeltau/lib/system.rb +194 -0
- data/lib/takeltau/mutagen/check/cli.rb +40 -0
- data/lib/takeltau/mutagen/check/daemon.rb +76 -0
- data/lib/takeltau/mutagen/cli.rb +12 -0
- data/lib/takeltau/mutagen/socket/check.rb +33 -0
- data/lib/takeltau/mutagen/socket/cli.rb +103 -0
- data/lib/takeltau/mutagen/socket/create.rb +47 -0
- data/lib/takeltau/mutagen/socket/list.rb +33 -0
- data/lib/takeltau/mutagen/socket/terminate.rb +32 -0
- data/lib/takeltau/mutagen/socket/tidy.rb +21 -0
- data/lib/takeltau/self/cli.rb +43 -0
- data/lib/takeltau/self/config/cli.rb +82 -0
- data/lib/takeltau/self/list.rb +35 -0
- data/lib/takeltau/version +1 -0
- metadata +319 -0
data/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
[](https://github.com/takelwerk/takelage-cli/blob/main/LICENSE)
|
|
2
|
+
[](https://rubygems.org/gems/takelage)
|
|
3
|
+
[](https://github.com/takelwerk/takelage-cli/actions/workflows/build_test_deploy_project_on_push.yml)
|
|
4
|
+
[](https://github.com/takelwerk/takelage-cli/actions/workflows/test_project_nightly.yml)
|
|
5
|
+
|
|
6
|
+
# takelage-cli
|
|
7
|
+
|
|
8
|
+
*takelage-cli* is a command line interface
|
|
9
|
+
to facilitate the takelage devops workflow.
|
|
10
|
+
The takelage devops workflow helps devops engineers
|
|
11
|
+
build, test and deploy os images.
|
|
12
|
+
|
|
13
|
+
The *takelage-cli* executable *tau* is a
|
|
14
|
+
[ruby](https://www.ruby-lang.org/)
|
|
15
|
+
command line script using the
|
|
16
|
+
[thor](http://whatisthor.com/) toolkit.
|
|
17
|
+
|
|
18
|
+
## Framework Versions
|
|
19
|
+
|
|
20
|
+
| App | Artifact |
|
|
21
|
+
| --- | -------- |
|
|
22
|
+
| *[takelage-doc](https://github.com/takelwerk/takelage-doc)* | [](https://github.com/takelwerk/takelage-doc/blob/main/LICENSE) |
|
|
23
|
+
| *[takelage-dev](https://github.com/takelwerk/takelage-dev)* | [](https://hub.docker.com/r/takelwerk/takelage) |
|
|
24
|
+
| *[takelage-cli](https://github.com/takelwerk/takelage-cli)* | [](https://rubygems.org/gems/takelage) |
|
|
25
|
+
| *[takelage-var](https://github.com/takelwerk/takelage-var)* | [](https://pypi.org/project/takeltest/) |
|
|
26
|
+
| *[takelage-bit](https://github.com/takelwerk/takelage-bit)* | [](https://hub.docker.com/r/takelwerk/bitboard) |
|
|
27
|
+
| *[takelage-img-takelslim](https://github.com/takelwerk/takelage-img-takelslim)* | [](https://hub.docker.com/r/takelwerk/takelslim) |
|
|
28
|
+
| *[takelage-img-takelbase](https://github.com/takelwerk/takelage-img-takelbase)* | [](https://hub.docker.com/r/takelwerk/takelbase) |
|
|
29
|
+
|
|
30
|
+
## Framework Status
|
|
31
|
+
|
|
32
|
+
| App | Deploy project | Test project | Test roles |
|
|
33
|
+
| --- | -------------- | ------------ | ---------- |
|
|
34
|
+
| *[takelage-dev](https://github.com/takelwerk/takelage-dev)* | [](https://github.com/takelwerk/takelage-dev/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/takelwerk/takelage-dev/actions/workflows/build_test_project_nightly.yml) | [](https://github.com/takelwerk/takelage-dev/actions/workflows/build_test_roles_nightly.yml) |
|
|
35
|
+
| *[takelage-cli](https://github.com/takelwerk/takelage-cli)* | [](https://github.com/takelwerk/takelage-cli/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/takelwerk/takelage-cli/actions/workflows/test_project_nightly.yml) |
|
|
36
|
+
| *[takelage-var](https://github.com/takelwerk/takelage-var)* | [](https://github.com/takelwerk/takelage-var/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/takelwerk/takelage-var/actions/workflows/build_test_project_nightly.yml) |
|
|
37
|
+
| *[takelage-bit](https://github.com/takelwerk/takelage-bit)* | [](https://github.com/takelwerk/takelage-bit/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/takelwerk/takelage-bit/actions/workflows/build_test_project_nightly.yml) | [](https://github.com/takelwerk/takelage-bit/actions/workflows/build_test_roles_nightly.yml) |
|
|
38
|
+
| *[takelage-img-takelslim](https://github.com/takelwerk/takelage-img-takelslim)* | [](https://github.com/takelwerk/takelage-img-takelslim/actions/workflows/build_deploy_takelslim_nightly.yml) |
|
|
39
|
+
| *[takelage-img-takelbase](https://github.com/takelwerk/takelage-img-takelbase)* | [](https://github.com/takelwerk/takelage-img-takelbase/actions/workflows/build_deploy_takelbase_nightly.yml) |
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
*tau* is part of *takelage-dev*'s docker image
|
|
44
|
+
but you typically want to install it on the host system as well.
|
|
45
|
+
Install the takelage gem and its dependencies
|
|
46
|
+
through the [gem](https://github.com/rubygems/rubygems)
|
|
47
|
+
command line tool:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
gem install takeltau
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
*takelage-cli* uses [cucumber](https://github.com/cucumber/cucumber)
|
|
56
|
+
to system test its features.
|
|
57
|
+
You are encouraged to read the cucumber feature files
|
|
58
|
+
for the *tau* commands
|
|
59
|
+
to get an idea of how the commands work.
|
|
60
|
+
You can list the *tau* commands by running
|
|
61
|
+
*tau [self list](features/cucumber/features/self/self.list.feature)*
|
|
62
|
+
or *tau list*:
|
|
63
|
+
|
|
64
|
+
Command | Description
|
|
65
|
+
------- | -----------
|
|
66
|
+
tau [bit check workspace](features/cucumber/features/bit/bit.check.workspace.feature) | Check if a bit workspace exists
|
|
67
|
+
tau [bit clipboard copy](features/cucumber/features/bit/bit.clipboard.copy.feature) [DIR] [SCOPE] | Copy new [DIR] to [SCOPE]
|
|
68
|
+
tau [bit clipboard paste](features/cucumber/features/bit/bit.clipboard.paste.feature) [COMPONENT] [DIR] | Paste bit [COMPONENT] into [DIR]
|
|
69
|
+
tau [bit clipboard pull](features/cucumber/features/bit/bit.clipboard.pull.feature) | Pull all updates for bit components from bit remote scopes
|
|
70
|
+
tau [bit clipboard push](features/cucumber/features/bit/bit.clipboard.push.feature) | Push all updates of bit components to bit remote scopes
|
|
71
|
+
tau [bit require export](features/cucumber/features/bit/bit.require.export.feature) | Show requirements file of bit components
|
|
72
|
+
tau [bit require import](features/cucumber/features/bit/bit.require.import.feature) | Import bit components from requirements file
|
|
73
|
+
tau [bit scope add](features/cucumber/features/bit/bit.scope.add.feature) [SCOPE] | Add a bit [SCOPE]
|
|
74
|
+
tau [bit scope ssh](features/cucumber/features/bit/bit.scope.ssh.feature) | Log in to bit remote server
|
|
75
|
+
tau [bit scope list](features/cucumber/features/bit/bit.scope.list.feature) | List bit remote scopes
|
|
76
|
+
tau [bit scope new](features/cucumber/features/bit/bit.scope.new.feature) [SCOPE] | Init a new bit [SCOPE]
|
|
77
|
+
tau [completion bash](features/cucumber/features/completion/completion.bash.feature) | Print bash completion code
|
|
78
|
+
tau [docker check daemon](features/cucumber/features/docker/docker.check.daemon.feature) | Check if docker daemon is running
|
|
79
|
+
tau [docker container check existing](features/cucumber/features/docker/docker.container.check.existing.feature) [CONTAINER] | Check if docker [CONTAINER] is existing
|
|
80
|
+
tau [docker container check network](features/cucumber/features/docker/docker.container.check.network.feature) [NETWORK] | Check if docker [NETWORK] is existing
|
|
81
|
+
tau [docker container check orphaned](features/cucumber/features/docker/docker.container.check.orphaned.feature) [CONTAINER] | Check if docker [CONTAINER] is orphaned
|
|
82
|
+
tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature) | Remove all docker containers
|
|
83
|
+
tau [docker container command](features/cucumber/features/docker/docker.container.command.feature) [CMD] | Run [CMD] in a docker container
|
|
84
|
+
tau [docker container daemon](features/cucumber/features/docker/docker.container.daemon.feature) | Run docker container in daemon mode
|
|
85
|
+
tau [docker container login](features/cucumber/features/docker/docker.container.login.feature) | Log in to latest local docker container
|
|
86
|
+
tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature) | Remove orphaned docker containers
|
|
87
|
+
tau [docker image tag check](features/cucumber/features/docker/docker.image.tag.check.feature) [TAG] | Check if local docker image [TAG] exists
|
|
88
|
+
tau [docker image tag latest](features/cucumber/features/docker/docker.image.tag.latest.feature) | Print latest local docker image tag
|
|
89
|
+
tau [docker image tag list](features/cucumber/features/docker/docker.image.tag.list.feature) | Print local docker image tags
|
|
90
|
+
tau [docker image update](features/cucumber/features/docker/docker.image.update.feature) | Get latest remote docker container
|
|
91
|
+
tau [git check clean](features/cucumber/features/git/git.check.clean.feature) | Check if the git workspace is clean
|
|
92
|
+
tau [git check bit](features/cucumber/features/git/git.check.bit.feature) | Check if we are on the git bit branch
|
|
93
|
+
tau [git check workspace](features/cucumber/features/git/git.check.workspace.feature) | Check if a git workspace exists
|
|
94
|
+
tau [info project active](features/cucumber/features/info/info.project.active.feature) | Print active project info
|
|
95
|
+
tau [info project dir](features/cucumber/features/info/info.project.dir.feature) | Print project root directory
|
|
96
|
+
tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
|
|
97
|
+
tau [info project private](features/cucumber/features/info/info.project.private.feature) | Print private project info
|
|
98
|
+
tau [info status bar](features/cucumber/features/info/info.status.bar.feature) | Print status bar
|
|
99
|
+
tau [info status git](features/cucumber/features/info/info.status.git.feature) | Check git status
|
|
100
|
+
tau [info status gopass](features/cucumber/features/info/info.status.gopass.feature) | Check gopass status
|
|
101
|
+
tau [info status gpg](features/cucumber/features/info/info.status.gpg.feature) | Check gpg status
|
|
102
|
+
tau [info status mutagen](features/cucumber/features/info/info.status.mutagen.feature) | Check mutagen status
|
|
103
|
+
tau [info status ssh](features/cucumber/features/info/info.status.ssh.feature) | Check ssh status
|
|
104
|
+
tau [init packer docker](features/cucumber/features/info/init.packer.docker.feature) | Initialize packer project for docker images
|
|
105
|
+
tau [mutagen check daemon](features/cucumber/features/mutagen/mutagen.check.daemon.feature)) | Check if mutagen host conenction is available
|
|
106
|
+
tau [mutagen socket check](features/cucumber/features/mutagen/mutagen.socket.check.feature) [SOCKET] | Check if mutagen [SOCKET] exists
|
|
107
|
+
tau [mutagen socket create](features/cucumber/features/mutagen/mutagen.socket.create.feature) [NAME] [IN] [OUT] | Create a mutagen socket [NAME] from [IN] to [OUT] of the container
|
|
108
|
+
tau [mutagen socket list](features/cucumber/features/mutagen/mutagen.socket.list.feature) | List mutagen sockets
|
|
109
|
+
tau [mutagen socket tidy](features/cucumber/features/mutagen/mutagen.socket.tidy.feature) | Remove mutagen daemon files
|
|
110
|
+
tau [mutagen socket terminate](features/cucumber/features/mutagen/mutagen.socket.terminate.feature) [SOCKET] | Terminate a mutagen [SOCKET]
|
|
111
|
+
tau [self config active](features/cucumber/features/self/self.config.active.feature) | Print active takelage configuration
|
|
112
|
+
tau [self config default](features/cucumber/features/self/self.config.default.feature) | Print takelage default configuration
|
|
113
|
+
tau [self config home](features/cucumber/features/self/self.config.home.feature) | Print takelage home config file configuration
|
|
114
|
+
tau [self config project](features/cucumber/features/self/self.config.project.feature) | Print takelage project config file configuration
|
|
115
|
+
tau [self list](features/cucumber/features/self/self.list.feature) | List all commands
|
|
116
|
+
tau [self version](features/cucumber/features/self/self.version.feature) | Print tau semantic version number
|
|
117
|
+
tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
|
|
118
|
+
tau config | Alias for tau [self config active](features/cucumber/features/self/self.config.active.feature)
|
|
119
|
+
tau copy [DIR] [SCOPE] | Alias for tau [bit clipboard copy](features/cucumber/features/bit/bit.clipboard.copy.feature)
|
|
120
|
+
tau list | Alias for tau [self list](features/cucumber/features/self/self.list.feature)
|
|
121
|
+
tau login | Alias for tau [docker container login](features/cucumber/features/docker/docker.container.login.feature)
|
|
122
|
+
tau paste [COMPONENT] [DIR] | Alias for tau [bit clipboard paste](features/cucumber/features/bit/bit.clipboard.paste.feature)
|
|
123
|
+
tau project | Alias for tau [info project active](features/cucumber/features/info/info.project.active.feature)
|
|
124
|
+
tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
|
|
125
|
+
tau pull | Alias for tau [bit clipboard pull](features/cucumber/features/bit/bit.clipboard.pull.feature)
|
|
126
|
+
tau push | Alias for tau [bit clipboard push](features/cucumber/features/bit/bit.clipboard.push.feature)
|
|
127
|
+
tau status | Alias for tau [docker info status bar](features/cucumber/features/info/info.status.bar.feature)
|
|
128
|
+
tau update | Alias for tau [docker image update](features/cucumber/features/docker/docker.image.update.feature)
|
|
129
|
+
tau version | Alias for tau [self version](features/cucumber/features/self/self.version.feature)
|
|
130
|
+
|
|
131
|
+
**Warning: *tau update* will call *docker image prune* and remove all dangling images!**
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
### Configuration Files
|
|
136
|
+
|
|
137
|
+
*takelage-cli* uses three different YAML configuration files
|
|
138
|
+
which have different precedences.
|
|
139
|
+
They are merged to an active configuration during runtime
|
|
140
|
+
which can be inspected with
|
|
141
|
+
*tau [self config active](features/cucumber/features/self/self.config.active.feature)*
|
|
142
|
+
or *tau config*.
|
|
143
|
+
|
|
144
|
+
| Filename | Precedence | Description |
|
|
145
|
+
| -------- | ---------- | ----------- |
|
|
146
|
+
| *default.yml* | lowest | Shipped with *takelage-cli*. Sets defaults where applicable. |
|
|
147
|
+
| *~/.takelage.yml* | normal | User-wide configuration file in your home directory. This is your normal custom configuration file. |
|
|
148
|
+
| *takelage.yml* | highest | Project-specific configuration file next to your main Rakefile. Some projects need special configuration. |
|
|
149
|
+
|
|
150
|
+
Please remember that a project directory is identified by the main
|
|
151
|
+
[Rakefile](Rakefile).
|
|
152
|
+
|
|
153
|
+
### Configuration Examples
|
|
154
|
+
|
|
155
|
+
- You should add the following configuration items in your *~/.takelage.yml*
|
|
156
|
+
if you want to use a private bit remote server:
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
---
|
|
160
|
+
bit_remote: 'ssh://bit@bit.example.com:222:/bit'
|
|
161
|
+
bit_ssh: 'ssh -p 222 bit@bit.example.com'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- If you want to pin a specific docker tag for one of your projects
|
|
165
|
+
then create an *takelage.yml* file with:
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
---
|
|
169
|
+
docker_tag: '1.2.3'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
- The cucumber tests make use of an *~/.takelage.yml*
|
|
173
|
+
to overwrite defaults like:
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
---
|
|
177
|
+
docker_repo: takelage-mock
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Furthermore, every external command can be reconfigured.
|
|
181
|
+
|
|
182
|
+
### Project Files
|
|
183
|
+
|
|
184
|
+
*tau* reads two different YAML project files
|
|
185
|
+
which have different precedences.
|
|
186
|
+
They are merged to an active configuration during runtime
|
|
187
|
+
which can be inspected with
|
|
188
|
+
*tau [info project active](features/cucumber/features/info/info.project.active.feature)*
|
|
189
|
+
or *tau project*.
|
|
190
|
+
|
|
191
|
+
| Default filename | Config key | Precedence | Description |
|
|
192
|
+
| -------- | ---------- | ---------- | ----------- |
|
|
193
|
+
| *project.yml* | info_project_main | normal | Main project file. |
|
|
194
|
+
| *private/project.yml* | info_project_private | highest | Private project file. Should be in *.gitignore*. |
|
|
195
|
+
|
|
196
|
+
### Bash Completion
|
|
197
|
+
|
|
198
|
+
Add this to your [bash startup files](https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html):
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
source <(tau completion bash)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Software Tests
|
|
205
|
+
|
|
206
|
+
*takelage-cli* uses
|
|
207
|
+
[minitest](https://github.com/seattlerb/minitest) unit tests.
|
|
208
|
+
|
|
209
|
+
*takelage-cli* ships with
|
|
210
|
+
[cucumber](https://github.com/cucumber/cucumber) ruby system tests.
|
|
211
|
+
It uses cucumber's
|
|
212
|
+
[aruba](https://github.com/cucumber/aruba) extension and especially its
|
|
213
|
+
[filesystem](https://relishapp.com/cucumber/aruba/v/0-11-0/docs/filesystem)
|
|
214
|
+
library.
|
|
215
|
+
|
|
216
|
+
*takelage-cli* [deploys](https://docs.docker.com/registry/deploying/)
|
|
217
|
+
a private docker
|
|
218
|
+
[registry](https://hub.docker.com/_/registry)
|
|
219
|
+
to conduct end-to-end tests of *tau docker* commands.
|
|
220
|
+
The registry exposes port 5005.
|
|
221
|
+
You need to whitelist it in your host's docker engine configuration:
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"insecure-registries": [
|
|
226
|
+
"host.docker.internal:5005"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
*takelage-cli* deploys a
|
|
232
|
+
*[bitboard](https://hub.docker.com/r/takelwerk/bitboard)*
|
|
233
|
+
server created with
|
|
234
|
+
*[takelage-bit](https://github.com/takelwerk/takelage-bit)*
|
|
235
|
+
to end-to-end test the *tau bit* commands.
|
data/bin/tau
ADDED
data/lib/Thorfile
ADDED
data/lib/takeltau.rb
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'etc'
|
|
4
|
+
require 'digest/bubblebabble'
|
|
5
|
+
require 'fileutils'
|
|
6
|
+
require 'fylla'
|
|
7
|
+
require 'json'
|
|
8
|
+
require 'logger'
|
|
9
|
+
require 'rake'
|
|
10
|
+
require 'singleton'
|
|
11
|
+
require 'socket'
|
|
12
|
+
require 'thor'
|
|
13
|
+
require 'timeout'
|
|
14
|
+
require 'version_sorter'
|
|
15
|
+
require 'yaml'
|
|
16
|
+
|
|
17
|
+
require_relative 'takeltau/lib/logging'
|
|
18
|
+
require_relative 'takeltau/lib/subcmd'
|
|
19
|
+
require_relative 'takeltau/lib/system'
|
|
20
|
+
require_relative 'takeltau/lib/config'
|
|
21
|
+
require_relative 'takeltau/lib/project'
|
|
22
|
+
|
|
23
|
+
require_relative 'takeltau/git/check/clean'
|
|
24
|
+
require_relative 'takeltau/git/check/bit'
|
|
25
|
+
require_relative 'takeltau/git/check/workspace'
|
|
26
|
+
require_relative 'takeltau/git/check/cli'
|
|
27
|
+
require_relative 'takeltau/git/cli'
|
|
28
|
+
require_relative 'takeltau/bit/check/workspace'
|
|
29
|
+
require_relative 'takeltau/bit/check/cli'
|
|
30
|
+
require_relative 'takeltau/bit/scope/add'
|
|
31
|
+
require_relative 'takeltau/bit/scope/ssh'
|
|
32
|
+
require_relative 'takeltau/bit/scope/list'
|
|
33
|
+
require_relative 'takeltau/bit/scope/new'
|
|
34
|
+
require_relative 'takeltau/bit/scope/cli'
|
|
35
|
+
require_relative 'takeltau/bit/clipboard/lib'
|
|
36
|
+
require_relative 'takeltau/bit/clipboard/copy'
|
|
37
|
+
require_relative 'takeltau/bit/clipboard/paste'
|
|
38
|
+
require_relative 'takeltau/bit/clipboard/pull'
|
|
39
|
+
require_relative 'takeltau/bit/clipboard/push'
|
|
40
|
+
require_relative 'takeltau/bit/clipboard/cli'
|
|
41
|
+
require_relative 'takeltau/bit/require/lib'
|
|
42
|
+
require_relative 'takeltau/bit/require/export'
|
|
43
|
+
require_relative 'takeltau/bit/require/import'
|
|
44
|
+
require_relative 'takeltau/bit/require/cli'
|
|
45
|
+
require_relative 'takeltau/bit/cli'
|
|
46
|
+
require_relative 'takeltau/completion/cli'
|
|
47
|
+
require_relative 'takeltau/init/lib'
|
|
48
|
+
require_relative 'takeltau/init/packer/docker'
|
|
49
|
+
require_relative 'takeltau/init/packer/cli'
|
|
50
|
+
require_relative 'takeltau/init/takelage/rake'
|
|
51
|
+
require_relative 'takeltau/init/takelage/cli'
|
|
52
|
+
require_relative 'takeltau/init/cli'
|
|
53
|
+
require_relative 'takeltau/mutagen/check/daemon'
|
|
54
|
+
require_relative 'takeltau/mutagen/socket/check'
|
|
55
|
+
require_relative 'takeltau/mutagen/socket/create'
|
|
56
|
+
require_relative 'takeltau/mutagen/socket/terminate'
|
|
57
|
+
require_relative 'takeltau/mutagen/socket/tidy'
|
|
58
|
+
require_relative 'takeltau/docker/check/daemon'
|
|
59
|
+
require_relative 'takeltau/docker/check/cli'
|
|
60
|
+
require_relative 'takeltau/docker/image/tag/list'
|
|
61
|
+
require_relative 'takeltau/docker/image/tag/latest'
|
|
62
|
+
require_relative 'takeltau/docker/image/tag/check'
|
|
63
|
+
require_relative 'takeltau/docker/image/tag/cli'
|
|
64
|
+
require_relative 'takeltau/docker/image/update'
|
|
65
|
+
require_relative 'takeltau/docker/image/cli'
|
|
66
|
+
require_relative 'takeltau/docker/container/check/existing'
|
|
67
|
+
require_relative 'takeltau/docker/container/check/network'
|
|
68
|
+
require_relative 'takeltau/docker/container/check/orphaned'
|
|
69
|
+
require_relative 'takeltau/docker/container/check/cli'
|
|
70
|
+
require_relative 'takeltau/docker/container/lib'
|
|
71
|
+
require_relative 'takeltau/docker/container/command'
|
|
72
|
+
require_relative 'takeltau/docker/container/daemon'
|
|
73
|
+
require_relative 'takeltau/docker/container/login'
|
|
74
|
+
require_relative 'takeltau/docker/container/clean'
|
|
75
|
+
require_relative 'takeltau/docker/container/prune'
|
|
76
|
+
require_relative 'takeltau/docker/container/cli'
|
|
77
|
+
require_relative 'takeltau/docker/cli'
|
|
78
|
+
require_relative 'takeltau/mutagen/check/cli'
|
|
79
|
+
require_relative 'takeltau/mutagen/socket/list'
|
|
80
|
+
require_relative 'takeltau/mutagen/socket/cli'
|
|
81
|
+
require_relative 'takeltau/mutagen/cli'
|
|
82
|
+
require_relative 'takeltau/info/status/lib'
|
|
83
|
+
require_relative 'takeltau/info/status/git'
|
|
84
|
+
require_relative 'takeltau/info/status/gopass'
|
|
85
|
+
require_relative 'takeltau/info/status/gpg'
|
|
86
|
+
require_relative 'takeltau/info/status/ssh'
|
|
87
|
+
require_relative 'takeltau/info/status/bar'
|
|
88
|
+
require_relative 'takeltau/info/status/cli'
|
|
89
|
+
require_relative 'takeltau/info/project/cli'
|
|
90
|
+
require_relative 'takeltau/info/cli'
|
|
91
|
+
require_relative 'takeltau/self/config/cli'
|
|
92
|
+
require_relative 'takeltau/self/list'
|
|
93
|
+
require_relative 'takeltau/self/cli'
|
|
94
|
+
|
|
95
|
+
# Facilitate the takelage devops workflow.
|
|
96
|
+
module Takeltau
|
|
97
|
+
# takeltau
|
|
98
|
+
class CLI < Thor
|
|
99
|
+
include LoggingModule
|
|
100
|
+
include SystemModule
|
|
101
|
+
include ConfigModule
|
|
102
|
+
include ProjectModule
|
|
103
|
+
|
|
104
|
+
check_unknown_options!
|
|
105
|
+
|
|
106
|
+
# @return [String] bash completion code
|
|
107
|
+
attr_reader :bash_fylla
|
|
108
|
+
|
|
109
|
+
option :loglevel,
|
|
110
|
+
aliases: 'l',
|
|
111
|
+
default: 'INFO',
|
|
112
|
+
desc: 'One of: FATAL, ERROR, WARN, INFO, DEBUG'
|
|
113
|
+
# Initialize takelage cli.
|
|
114
|
+
def initialize(args = [], local_options = {}, configuration = {})
|
|
115
|
+
# Initialize thor parent class
|
|
116
|
+
super args, local_options, configuration
|
|
117
|
+
|
|
118
|
+
# Initialize global singleton log
|
|
119
|
+
initialize_logging options[:loglevel].to_s.upcase
|
|
120
|
+
|
|
121
|
+
# Initialize global singleton config
|
|
122
|
+
initialize_config
|
|
123
|
+
|
|
124
|
+
# Initialize global singleton project
|
|
125
|
+
initialize_project
|
|
126
|
+
|
|
127
|
+
# Set defaults
|
|
128
|
+
@docker_daemon_running = false
|
|
129
|
+
@command_available_docker = false
|
|
130
|
+
@mutagen_daemon_available = false
|
|
131
|
+
@command_available_mutagen = false
|
|
132
|
+
|
|
133
|
+
# fylla bash completion code
|
|
134
|
+
@bash_fylla = Fylla.bash_completion self
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
#
|
|
138
|
+
# Subcommands
|
|
139
|
+
#
|
|
140
|
+
|
|
141
|
+
desc 'bit [COMMAND] ', 'Manage bit'
|
|
142
|
+
subcommand 'bit', Bit
|
|
143
|
+
|
|
144
|
+
desc 'completion [COMMAND] ', 'Print shell completion code'
|
|
145
|
+
subcommand 'completion', Completion
|
|
146
|
+
|
|
147
|
+
desc 'docker [COMMAND] ', 'Manage docker containers'
|
|
148
|
+
subcommand 'docker', Docker
|
|
149
|
+
|
|
150
|
+
desc 'git [COMMAND] ', 'Manage git'
|
|
151
|
+
subcommand 'git', Git
|
|
152
|
+
|
|
153
|
+
desc 'info [COMMAND] ', 'Get information'
|
|
154
|
+
subcommand 'info', Info
|
|
155
|
+
|
|
156
|
+
desc 'init [COMMAND] ', 'Init projects'
|
|
157
|
+
subcommand 'init', Init
|
|
158
|
+
|
|
159
|
+
desc 'mutagen [COMMAND] ', 'Manage mutagen'
|
|
160
|
+
subcommand 'mutagen', Mutagen
|
|
161
|
+
|
|
162
|
+
desc 'self [COMMAND] ', 'Manage takelage tools'
|
|
163
|
+
subcommand 'self', Self
|
|
164
|
+
|
|
165
|
+
#
|
|
166
|
+
# Top-level commands
|
|
167
|
+
#
|
|
168
|
+
|
|
169
|
+
desc 'config', 'Alias for tau self config active'
|
|
170
|
+
# takeltau config: {takelage::SelfConfig#active}
|
|
171
|
+
def config
|
|
172
|
+
Takeltau::SelfConfig.new.active
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
desc 'copy [DIR] [SCOPE]', 'Alias for tau bit clipboard copy'
|
|
176
|
+
# takeltau copy: {takelage::BitClipboard#copy}
|
|
177
|
+
def copy(dir_or_file, scope)
|
|
178
|
+
Takeltau::BitClipboard.new.copy dir_or_file, scope
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
desc 'project', 'Alias for tau info project active'
|
|
182
|
+
# takeltau project: {takelage::InfoProject#active}
|
|
183
|
+
def project
|
|
184
|
+
Takeltau::InfoProject.new.active
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
desc 'login', 'Alias for tau docker container login'
|
|
188
|
+
# takeltau login: {takelage::DockerContainer#login}
|
|
189
|
+
def login
|
|
190
|
+
Takeltau::DockerContainer.new.login
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
desc 'list', 'Alias for tau self list'
|
|
194
|
+
# takeltau version: {takelage::Self#list}
|
|
195
|
+
def list
|
|
196
|
+
Takeltau::Self.new.list
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
desc 'clean', 'Alias for tau docker container clean'
|
|
200
|
+
# takeltau clean: {takelage::DockerContainer#clean}
|
|
201
|
+
def clean
|
|
202
|
+
Takeltau::DockerContainer.new.clean
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
desc 'paste [COMPONENT] [DIR]', 'Alias for tau bit clipboard paste'
|
|
206
|
+
# takeltau paste: {takelage::BitClipboard#paste}
|
|
207
|
+
def paste(cid, dir)
|
|
208
|
+
Takeltau::BitClipboard.new.paste cid, dir
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
desc 'pull', 'Alias for tau bit clipboard pull'
|
|
212
|
+
# takeltau pull: {takelage::BitClipboard#pull}
|
|
213
|
+
def pull
|
|
214
|
+
Takeltau::BitClipboard.new.pull
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
desc 'prune', 'Alias for tau docker container prune'
|
|
218
|
+
# takeltau prune: {takelage::DockerContainer#prune}
|
|
219
|
+
def prune
|
|
220
|
+
Takeltau::DockerContainer.new.prune
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
desc 'push', 'Alias for tau bit clipboard push'
|
|
224
|
+
# takeltau push: {takelage::BitClipboard#push}
|
|
225
|
+
def push
|
|
226
|
+
Takeltau::BitClipboard.new.push
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
desc 'status', 'Alias for tau info status bar'
|
|
230
|
+
# takeltau status: {takelage::InfoStatus#bar}
|
|
231
|
+
def status
|
|
232
|
+
Takeltau::InfoStatus.new.bar
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
desc 'update', 'Alias for tau docker image update'
|
|
236
|
+
# takeltau update: {takelage::DockerImage#update}
|
|
237
|
+
def update
|
|
238
|
+
Takeltau::DockerImage.new.update
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
desc 'version', 'Alias for tau self version'
|
|
242
|
+
# takeltau version: {takelage::Self#version}
|
|
243
|
+
def version
|
|
244
|
+
Takeltau::Self.new.version
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
#
|
|
248
|
+
# Administrative functions
|
|
249
|
+
#
|
|
250
|
+
|
|
251
|
+
# Behave as expected by correctly reporting failure in exit status.
|
|
252
|
+
# See https://github.com/erikhuda/thor/wiki/Making-An-Executable
|
|
253
|
+
def self.exit_on_failure?
|
|
254
|
+
true
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
end
|