-- Generated by Gleam CI helpers. module CI.ModuleDependencies (ensureFor) where import Prelude import Data.Either (Either(..)) import Effect (Effect) import Effect.Exception (throw, try) import FluentCI.Plugin as P foreign import installDependency :: String -> Effect Unit probe :: Array String -> Effect Unit probe args = do result <- P.pipeline "setup-dependency-preflight" # P.exec args # P.stdout case result of Left error -> throw (P.errorMessage error) Right _ -> pure unit ensure :: String -> Array String -> Effect Unit ensure alias args = do present <- try (probe args) case present of Right _ -> pure unit Left _ -> do installDependency alias probe args ensureFor :: String -> Effect Unit ensureFor _ = do os <- P.getOS >>= case _ of Left error -> throw (P.errorMessage error) Right value -> pure value unless (os == "linux" || os == "macos" || os == "freebsd" || os == "openbsd" || os == "netbsd") $ throw ("Unsupported setup dependency OS: " <> os) ensure "setup-argocd" [ "which", "argocd" ]