version license

A utility library for Elixir covering file operations, Git management, Docker/Podman containers, cryptography, environment handling, config files, OS detection, and process management.

Quick Start

def deps do
  [
    {:apero, path: "../apero"}
  ]
end

Modules

Apero.VFS — File Operations

Unified file, path, and watch operations.

Apero.VFS.dir?("lib")               # => true
Apero.VFS.file?("mix.exs")          # => true
Apero.VFS.exists?("priv/data")      # => false

{:ok, content} = Apero.VFS.read("config/settings.json")
Apero.VFS.write("tmp/scratch.txt", "hello world")

# Checksums
Apero.VFS.checksum("mix.exs", :sha256)

# Temporary resources (auto-cleaned)
Apero.VFS.with_tmp_file(fn path ->
  process_file(path)
end)

Apero.Compress — Compression

Archive and decompress files.

Apero.Compress.zip("/tmp/backup.zip", ["lib/", "config/"])
Apero.Compress.unzip("/tmp/backup.zip", output: "extracted/")

Apero.Compress.tar("/tmp/archive.tar.gz", "lib/", compressed: :gzip)
Apero.Compress.untar("/tmp/archive.tar.gz", output: "unpacked/")

Apero.Git — Git Operations

Repository management and Git commands.

repo = %{url: "git@github.com:org/repo.git", path: "/tmp/repo"}

Apero.Git.ensure_clone(repo, "/tmp/workspace")
Apero.Git.add(repo.path, :all)
Apero.Git.commit(repo, "feat: add feature")
Apero.Git.push(repo.path, "main")

# Check for uncommitted changes
Apero.Git.has_uncommitted_changes?(repo.path)

Apero.Docker — Docker/Podman

Container lifecycle management.

Apero.Docker.up(cd: "infra/", build: true)
Apero.Docker.down(cd: "infra/", volumes: true)
Apero.Docker.restart(cd: "infra/", services: ["app"])

Apero.Docker.exec("app", ["mix", "ecto.migrate"], cd: "infra/")

Apero.Crypto — Cryptography

Hashing, encryption, and secure random generation.

Apero.Crypto.sha256("password")
Apero.Crypto.random_hex(16)

{:ok, ciphertext} = Apero.Crypto.encrypt("secret data")
{:ok, plaintext} = Apero.Crypto.decrypt(ciphertext, key)

Apero.Conf — Config Files

Load and parse configuration files.

{:ok, config} = Apero.Conf.load("config/settings.json")
{:ok, config} = Apero.Conf.load("config/app.yaml", format: :yaml)

Apero.Env — Environment Variables

Environment variable handling.

Apero.Env.load(".env")
Apero.Env.fetch!("DATABASE_URL")

Apero.OS — OS Detection

System information and detection.

Apero.OS.info()
# => %{type: :linux, arch: :x86_64, hostname: "server", distro: "Ubuntu", ...}

Apero.OS.in_container?()  # => true/false

Apero.Proc — Process Management

Process utilities and command execution.

Apero.Proc.command_exists?("git")  # => true
Apero.Proc.which("elixir")        # => "/usr/local/bin/elixir"

{:ok, processes} = Apero.Proc.ps()

Apero.Pkg — Package Management

Package manager abstraction.

Apero.Pkg.install("curl")
Apero.Pkg.update()

Apero.Cache — Caching

In-memory caching with ETS backend.

Apero.Cache.put(:my_cache, :key, "value")
{:ok, value} = Apero.Cache.get(:my_cache, :key)

Architecture

Apero is organized into focused modules:

  • VFS — File operations (read, write, copy, move, delete, glob, watch)
  • Compress — Archive operations (zip, tar, gzip)
  • Git — Git command wrappers
  • Docker — Container lifecycle
  • Crypto — Hashing and random generation
  • Conf — Config file parsing (JSON, YAML, TOML)
  • Env — .env file loading
  • OS — Operating system detection
  • Proc — Process and command utilities
  • Pkg — Package manager interface
  • Cache — In-memory caching

License

MIT