]> njoseph.me Git - babashka-scripts.git/blobdiff - scripts/debian.clj
Shift from standalone scripts to babashka tasks
[babashka-scripts.git] / scripts / debian.clj
similarity index 66%
rename from utils.clj
rename to scripts/debian.clj
index a19a9aa63e63ac795cc22b5458e7f53eb5739ef8..6c07149cf15a83c06fc6d9f51812b6b7f33ea6dd 100644 (file)
--- a/utils.clj
@@ -1,35 +1,11 @@
-(ns utils
+(ns debian
   (:require [clojure.string :as str]
             [clojure.java.io :as io]
             [cheshire.core :as json]
             [org.httpkit.client :as http]
             [lib :refer [download-binary run-cmd]]))
 
-(defn git-pull-rebase-branch
-  "Do git pull and rebase branch with master"
-  []
-  (let [current-branch (str/trim (run-cmd ["git" "branch" "--show-current"]))]
-    (print (run-cmd ["git" "pull" "--rebase"]))
-    (when (not (contains? #{"master" "main"} current-branch))
-      (run! print
-            (map run-cmd
-              '[["git" "checkout" "master"] ["git" "pull" "--rebase"]
-                ["git" "checkout" "-"] ["git" "rebase" "master"]])))))
-
-(defn run-seq
-  "Run a sequence of shell commands on a sequence of arguments.
-
-  Examples:
-
-  1. Play and delete each video from a folder
-     ls | bb -i '(run-seq [\"mpv\" \"rm\"] *input*)'
-  "
-  [commands arguments]
-  (doseq [argument arguments
-          command commands]
-    (println (run-cmd [command argument]))))
-
-(defn install-deb
+(defn install-deb-from-url
   "Install a Debian package given a direct URL to the .deb file."
   [url]
   (println "Downloading deb package...")
@@ -69,4 +45,4 @@
           assets (get-assets api-url)
           deb-url (find-url-to-deb assets)]
       ;; Download and install Debian package
-      (install-deb deb-url))))
+      (install-deb-from-url deb-url))))