Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mitamae/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Downloaded mitamae binary
bin/
74 changes: 74 additions & 0 deletions mitamae/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
# bootstrap.sh — download mitamae and run the package recipe
#
# Usage: ./mitamae/bootstrap.sh
#
# Downloads the mitamae binary for the current platform from GitHub releases,
# then runs recipe.rb to install packages.

set -euo pipefail

MITAMAE_VERSION="v1.14.4"
MITAMAE_DIR="$(cd "$(dirname "$0")" && pwd)"
MITAMAE_BIN="${MITAMAE_DIR}/bin/mitamae"

# --- Detect platform ---
detect_platform() {
local os arch

case "$(uname -s)" in
Darwin) os="darwin" ;;
Linux) os="linux" ;;
*)
echo "Unsupported OS: $(uname -s)" >&2
exit 1
;;
esac

case "$(uname -m)" in
x86_64|amd64) arch="x86_64" ;;
aarch64|arm64) arch="aarch64" ;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac

echo "${arch}-${os}"
}

# --- Download mitamae ---
download_mitamae() {
if [[ -x "${MITAMAE_BIN}" ]]; then
local current_version
current_version=$("${MITAMAE_BIN}" version 2>/dev/null || echo "unknown")
if [[ "${current_version}" == *"${MITAMAE_VERSION#v}"* ]]; then
echo "✓ mitamae ${MITAMAE_VERSION} already installed"
return
fi
fi

local platform
platform="$(detect_platform)"
local url="https://github.com/itamae-kitchen/mitamae/releases/download/${MITAMAE_VERSION}/mitamae-${platform}"

echo "→ Downloading mitamae ${MITAMAE_VERSION} for ${platform}..."
mkdir -p "${MITAMAE_DIR}/bin"
curl -fsSL -o "${MITAMAE_BIN}" "${url}"
chmod +x "${MITAMAE_BIN}"
echo "✓ mitamae installed to ${MITAMAE_BIN}"
}

# --- Main ---
echo ""
echo " mitamae bootstrap"
echo " ================="
echo ""

download_mitamae

echo ""
echo "→ Running recipe..."
echo ""

exec "${MITAMAE_BIN}" local "${MITAMAE_DIR}/recipe.rb"
55 changes: 55 additions & 0 deletions mitamae/recipe.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# recipe.rb — cross-platform package installation
#
# Uses mitamae's `package` resource which auto-detects the package manager:
# - Homebrew on macOS
# - apt on Debian/Ubuntu Linux
#
# Run via: mitamae local recipe.rb

# --- Helpers ---
def macos?
node[:platform] == "darwin"
end

def linux?
node[:platform] == "linux"
end

# --- Core packages ---
# These are needed on all platforms.

package "neovim" do
not_if "which nvim"
end

package "gh" do
not_if "which gh"
end

package "tmux" do
not_if "which tmux"
end

package "ripgrep" do
not_if "which rg"
end

package "fzf" do
not_if "which fzf"
end

# --- mise (polyglot version manager) ---
# mise isn't in most distro repos, so install via its official script.
execute "install mise" do
command "curl -fsSL https://mise.jdx.dev/install.sh | sh"
not_if "which mise"
end

# --- macOS-only packages ---
if macos?
# Ghostty is distributed as a macOS app (brew cask)
execute "install ghostty" do
command "brew install --cask ghostty"
not_if "brew list --cask ghostty >/dev/null 2>&1"
end
end