Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liquidz/dad
Small configuration management tool for Clojure
https://github.com/liquidz/dad
clojure graalvm infrastructure-as-code
Last synced: 3 months ago
JSON representation
Small configuration management tool for Clojure
- Host: GitHub
- URL: https://github.com/liquidz/dad
- Owner: liquidz
- License: epl-2.0
- Created: 2019-09-08T21:19:27.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-02T22:40:01.000Z (over 2 years ago)
- Last Synced: 2024-10-18T06:19:29.440Z (4 months ago)
- Topics: clojure, graalvm, infrastructure-as-code
- Language: Clojure
- Homepage:
- Size: 244 KB
- Stars: 133
- Watchers: 6
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGELOG.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Dad
image:https://github.com/liquidz/dad/workflows/test/badge.svg[link="https://github.com/liquidz/dad/actions/workflows/test.yml"]
image:https://github.com/liquidz/dad/actions/workflows/lint.yml/badge.svg[link="https://github.com/liquidz/dad/actions/workflows/lint.yml"]
image:https://github.com/liquidz/dad/actions/workflows/dependency.yml/badge.svg[link="https://github.com/liquidz/dad/actions/workflows/dependency.yml"]
image:https://img.shields.io/github/release/liquidz/dad.svg?logo=Github[link="https://github.com/liquidz/dad/releases"]> My father is a greate chef :)
Dad is a small configuration management tool for Clojure.
This project is heavily inspired by https://github.com/itamae-kitchen/mitamae[mitamae].== Concept
=== 🤯 Minimum to remember
* May not write code for Dad often.
//* Minimum to remember -- May not write code for Dad often
* Write codes as a https://github.com/babashka/pods[babashka pod].
** You can gain benefits from code completion and docstring references.
//* Easy to start -- Download single binary and run it.=== 🍟 Easy to start
* Download single binary and run it.
* Run the code written as a babashka pod as it is.
** Dad ignores codes related to loading pods.== Getting Started
Download binary from https://github.com/liquidz/dad/releases[releases].
[source,terminal]
----
# Download latest dad to the current working directory
curl -L https://raw.githubusercontent.com/liquidz/dad/main/script/download | bash
./dad your_task.clj
----Here is a example to install Clojure https://clojure.org/guides/deps_and_cli[command line tools].
You can generate a template file by `./dad --init example.core`.
// cf. example/clojure/cli.clj
[source,clojure]
----
#!/usr/bin/env dad --no-color --dry-run
(ns example.core
(:require
[babashka.pods :as pods]));; Load dad as a babashka pod
(pods/load-pod "dad")
(require '[pod.liquidz.dad :as dad])(dad/package {:name ["curl" "rlwrap"]})
;; You can define function as you like
(defn curl [m]
(let [{:keys [path url]} m]
;; `file-exists?` is a built-in function in dad.
(when (and (not (dad/file-exists? path))
(string? url))
(dad/execute {:command (str "curl -sfLo " path " " url)}))))(curl {:path "/tmp/install.sh"
:url "https://download.clojure.org/install/linux-install-1.10.3.1087.sh"})(dad/file {:path "/tmp/install.sh" :mode "755"})
(dad/execute {:cwd "/tmp" :command "./install.sh"})
(dad/file {:path "/tmp/install.sh" :action :delete})
----== Supports
- [x] Ubuntu (`apt`)
- [x] macOS (link:https://brew.sh[Homebrew])== Example
- link:./example/vim[Building vim by source]
- link:./test/resources/test_task/tasks.clj[Test task]== Reference
NOTE: You can refer all documents in *codes*. (evaluate `(dad/doc)` or `(help)`)
=== Built-in vars / functions
|===
| Name | Var/Func | Description| link:doc/doc.md[doc]
| Func
| Print dad documents.| link:doc/file-exists.md[file-exists?]
| Func
| Return true if the specified path exists.| link:doc/os-type.md[os-type]
| Func
| OS name string such as `"linux"` or `"mac"`.| link:doc/render.md[render]
| Func
| Render a template string with a data.| link:doc/load-file.md[load-file]
| Func
| Load another recipe file.|===
See https://github.com/borkdude/sci/blob/master/src/sci/impl/namespaces.cljc[sci/impl/namespaces.cljc] for other core functions.
=== Resources
|===
| Resource name | Description| link:doc/directory.md[directory] | Create directories.
| link:doc/download.md[download] | Download a file from remote host.
| link:doc/execute.md[execute] | Execute a shell command.
| link:doc/file.md[file] | Create a file.
| link:doc/git.md[git] | Execute `git` command.
| link:doc/link.md[link] | Create a symbolic link.
| link:doc/package.md[package] | Install packages.
| link:doc/template.md[template] | Create a text file from the specified template files.|===
== REPL
Dad also provides REPL mode that does not affect your environment. (same as `--dry-run` option)
[source,console]
----
$ dad --repluser=> (println "hello from dad")
hello from dad
niluser=> (+ 1 2 3)
6user=> (package "sl")
apt-update [sl] ... will change
package-install [sl] ... will changeuser=> (package "sl" {:action :uninstall})
package-uninstall [sl] ... WILL NOT change
----== License
Copyright © 2019-2022 https://twitter.com/uochan[Masashi Iizuka]
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html.
// vim:fdm=marker:fdl=0