mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-17 17:28:07 +00:00
feat: separate brew dumps per device
This commit is contained in:
@@ -2,7 +2,7 @@ return {
|
||||
"chenasraf/text-transform.nvim",
|
||||
branch = "develop",
|
||||
-- version = "*",
|
||||
dir = "~/Dev/text-transform.nvim",
|
||||
-- dir = "~/Dev/text-transform.nvim",
|
||||
opts = {
|
||||
-- debug = true,
|
||||
keymap = {
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ bin/
|
||||
tests/
|
||||
_local.sh
|
||||
.tmux_local.yml
|
||||
.device_uid
|
||||
|
||||
178
brew/planck/Brewfile
Normal file
178
brew/planck/Brewfile
Normal file
@@ -0,0 +1,178 @@
|
||||
tap "eddieantonio/eddieantonio"
|
||||
tap "heroku/brew"
|
||||
tap "homebrew/bundle"
|
||||
tap "homebrew/cask-versions"
|
||||
tap "homebrew/services"
|
||||
tap "jesseduffield/lazygit"
|
||||
# TIFF library and utilities
|
||||
brew "libtiff"
|
||||
# Color management engine supporting ICC profiles
|
||||
brew "little-cms2"
|
||||
# Image format providing lossless and lossy compression for web images
|
||||
brew "webp"
|
||||
# New file format for still image compression
|
||||
brew "jpeg-xl"
|
||||
# Codec library for encoding and decoding AV1 video streams
|
||||
brew "aom"
|
||||
# Tool for generating GNU Standards-compliant Makefiles
|
||||
brew "automake"
|
||||
# Interpreted, interactive, object-oriented programming language
|
||||
brew "python@3.11"
|
||||
# Official Amazon AWS command-line interface
|
||||
brew "awscli", link: false
|
||||
# Bourne-Again SHell, a UNIX command interpreter
|
||||
brew "bash"
|
||||
# Parser generator
|
||||
brew "bison"
|
||||
# Get/set bluetooth power and discoverable state
|
||||
brew "blueutil"
|
||||
# Interpreted, interactive, object-oriented programming language
|
||||
brew "python@3.12"
|
||||
# C parser in Python
|
||||
brew "pycparser"
|
||||
# C Foreign Function Interface for Python
|
||||
brew "cffi"
|
||||
# Toolkit for image loading and pixel buffer manipulation
|
||||
brew "gdk-pixbuf"
|
||||
# OpenType text shaping engine
|
||||
brew "harfbuzz"
|
||||
# Framework for layout and rendering of i18n text
|
||||
brew "pango"
|
||||
# Library to render SVG files using Cairo
|
||||
brew "librsvg"
|
||||
# Versatile and fast Unicode/ASCII/ANSI graphics renderer
|
||||
brew "chafa"
|
||||
# Console Matrix
|
||||
brew "cmatrix"
|
||||
# C library implementing the SSH2 protocol
|
||||
brew "libssh2"
|
||||
# Get a file from an HTTP, HTTPS or FTP server
|
||||
brew "curl"
|
||||
# Reference implementation for the Development Containers specification
|
||||
brew "devcontainer"
|
||||
# Text processing system for reStructuredText
|
||||
brew "docutils"
|
||||
# Select default apps for documents and URL schemes on macOS
|
||||
brew "duti"
|
||||
# GNU compiler collection
|
||||
brew "gcc"
|
||||
# Validating, recursive, caching DNS resolver
|
||||
brew "unbound"
|
||||
# GNU Transport Layer Security (TLS) Library
|
||||
brew "gnutls"
|
||||
# Image processing and image analysis library
|
||||
brew "leptonica"
|
||||
# Subtitle renderer for the ASS/SSA subtitle format
|
||||
brew "libass"
|
||||
# Open Visual Inference And Optimization toolkit for AI inference
|
||||
brew "openvino"
|
||||
# OCR (Optical Character Recognition) engine
|
||||
brew "tesseract"
|
||||
# Play, record, convert, and stream audio and video
|
||||
brew "ffmpeg"
|
||||
# Banner-like program prints strings as ASCII art
|
||||
brew "figlet"
|
||||
# Fast Lexical Analyzer, generates Scanners (tokenizers)
|
||||
brew "flex"
|
||||
# Fast and simple Node.js version manager
|
||||
brew "fnm"
|
||||
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
||||
brew "freetds"
|
||||
# Command-line fuzzy finder written in Go
|
||||
brew "fzf"
|
||||
# Library for encoding and decoding .avif files
|
||||
brew "libavif"
|
||||
# Graphics library to dynamically manipulate images
|
||||
brew "gd"
|
||||
# GNU database manager
|
||||
brew "gdbm"
|
||||
# GitHub command-line tool
|
||||
brew "gh"
|
||||
# Git extension for versioning large files
|
||||
brew "git-lfs"
|
||||
# Open-source GitLab command-line tool
|
||||
brew "glab"
|
||||
# Render markdown on the CLI
|
||||
brew "glow"
|
||||
# GNU Pretty Good Privacy (PGP) package
|
||||
brew "gnupg"
|
||||
# Manage compile and link flags for libraries
|
||||
brew "pkg-config"
|
||||
# GNU Ubiquitous Intelligent Language for Extensions
|
||||
brew "guile"
|
||||
# Database of common MIME types
|
||||
brew "shared-mime-info"
|
||||
# ISO/IEC 23008-12:2017 HEIF file format decoder and encoder
|
||||
brew "libheif"
|
||||
# Tools and libraries to manipulate images in many formats
|
||||
brew "imagemagick"
|
||||
# Lightweight and flexible command-line JSON processor
|
||||
brew "jq"
|
||||
# Portable Foreign Function Interface library
|
||||
brew "libffi"
|
||||
# YAML Parser
|
||||
brew "libyaml"
|
||||
# Rainbows and unicorns in your console!
|
||||
brew "lolcat"
|
||||
# Parsing Expression Grammars For Lua
|
||||
brew "lpeg"
|
||||
# Utility for directing compilation
|
||||
brew "make"
|
||||
# MongoDB Shell to connect, configure, query, and work with your MongoDB database
|
||||
brew "mongosh"
|
||||
# Ambitious Vim-fork focused on extensibility and agility
|
||||
brew "neovim"
|
||||
# HTTP/2 C Library
|
||||
brew "nghttp2"
|
||||
# Platform built on V8 to build network applications
|
||||
brew "node@16"
|
||||
# General-purpose scripting language
|
||||
brew "php", restart_service: true, link: false
|
||||
# Execute binaries from Python packages in isolated environments
|
||||
brew "pipx"
|
||||
# Python version management
|
||||
brew "pyenv"
|
||||
# Pyenv plugin to manage virtualenv
|
||||
brew "pyenv-virtualenv"
|
||||
# Generic syntax highlighter
|
||||
brew "pygments"
|
||||
# Interpreted, interactive, object-oriented programming language
|
||||
brew "python@3.10"
|
||||
# Interpreted, interactive, object-oriented programming language
|
||||
brew "python@3.9", link: false
|
||||
# Install various Ruby versions and implementations
|
||||
brew "ruby-build"
|
||||
# Ruby version manager
|
||||
brew "rbenv"
|
||||
# Search tool like grep and The Silver Searcher
|
||||
brew "ripgrep"
|
||||
# Static analysis and lint tool, for (ba)sh scripts
|
||||
brew "shellcheck"
|
||||
# Opinionated Lua code formatter
|
||||
brew "stylua"
|
||||
# Log file highlighter
|
||||
brew "tailspin"
|
||||
# Terminal multiplexer
|
||||
brew "tmux"
|
||||
# Minimal, todo.txt-focused editor
|
||||
brew "todo-txt"
|
||||
# Display directories as trees (with optional color/HTML output)
|
||||
brew "tree"
|
||||
# Build, bundle & ship your Rust WASM application to the web
|
||||
brew "trunk"
|
||||
# Executes a program periodically, showing output fullscreen
|
||||
brew "watch"
|
||||
# Process YAML, JSON, XML, CSV and properties documents from the CLI
|
||||
brew "yq"
|
||||
# It's like cat(1), but for images
|
||||
brew "eddieantonio/eddieantonio/imgcat"
|
||||
# A simple terminal UI for git commands, written in Go
|
||||
brew "jesseduffield/lazygit/lazygit"
|
||||
# Android SDK component
|
||||
cask "android-platform-tools"
|
||||
# Tools for the Android SDK
|
||||
cask "android-sdk"
|
||||
# Quick Look plugin for plaintext files without an extension
|
||||
cask "qlstephen"
|
||||
# GPU-accelerated cross-platform terminal emulator and multiplexer
|
||||
cask "wezterm-nightly"
|
||||
3827
brew/planck/Brewfile.lock.json
Normal file
3827
brew/planck/Brewfile.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
10
install.sh
10
install.sh
@@ -23,6 +23,16 @@ done
|
||||
cwd="$(pwd)"
|
||||
pushd $DOTFILES
|
||||
|
||||
|
||||
if [[ ! -f "$DOTFILES/.device_uid" || -z $(cat "$DOTFILES/.device_uid") ]]; then
|
||||
echo
|
||||
echo_yellow "Unique device UID not set up. Enter device uid: "
|
||||
read duid
|
||||
echo
|
||||
echo $duid >$DOTFILES/.device_uid
|
||||
echo_cyan "Device UID set to \"$duid\""
|
||||
fi
|
||||
|
||||
if is_mac; then
|
||||
echo_cyan "Setting defaults..."
|
||||
write_default "PMPrintingExpandedStateForPrint" "-bool TRUE"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as os from 'node:os'
|
||||
import { MassargCommand } from 'massarg/command'
|
||||
import { DF_DIR, HomeOpts } from './common'
|
||||
import { DF_DIR, HomeOpts, checkGitChanges, getDeviceUID } from './common'
|
||||
import { massarg } from 'massarg'
|
||||
import { runCommand } from '../common'
|
||||
|
||||
@@ -11,11 +11,16 @@ async function backup(opts: HomeOpts) {
|
||||
return
|
||||
}
|
||||
const syncDate = new Date().toISOString()
|
||||
const DEVICE_UID = await getDeviceUID()
|
||||
const gitChanges = await checkGitChanges(opts)
|
||||
if (gitChanges) {
|
||||
console.error('There are other changes waiting to be pushed')
|
||||
process.exit(1)
|
||||
}
|
||||
await runCommand(opts, [
|
||||
`pushd "${DF_DIR}"`,
|
||||
`git diff --quiet`,
|
||||
`[[ $? -ne 0 ]] && echo "There are other changes waiting to be pushed" && exit 1`,
|
||||
`brew bundle dump -f --describe`,
|
||||
`mkdir -p "${DF_DIR}/brew/${DEVICE_UID}"`,
|
||||
`pushd "${DF_DIR}/brew/${DEVICE_UID}"`,
|
||||
`brew bundle dump --formula --cask --tap --describe --force`,
|
||||
`git add Brewfile`,
|
||||
`git commit -m "backup(brew): Update Brewfile (${syncDate})"`,
|
||||
`git push`,
|
||||
@@ -24,7 +29,8 @@ async function backup(opts: HomeOpts) {
|
||||
}
|
||||
|
||||
async function restore(opts: HomeOpts) {
|
||||
await runCommand(opts, [`pushd "${DF_DIR}"`, `brew bundle`, `popd`])
|
||||
const DEVICE_UID = await getDeviceUID()
|
||||
await runCommand(opts, [`pushd "${DF_DIR}/brew/${DEVICE_UID}"`, `brew bundle`, `popd`])
|
||||
}
|
||||
|
||||
const backupCommand = new MassargCommand<HomeOpts>({
|
||||
|
||||
@@ -1,7 +1,32 @@
|
||||
import * as path from 'node:path'
|
||||
import * as os from 'node:os'
|
||||
import { Opts } from '../common'
|
||||
import os from 'node:os'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { Opts, runCommand } from '../common'
|
||||
|
||||
export type HomeOpts = Opts
|
||||
|
||||
export const DF_DIR = path.join(os.homedir(), '/.dotfiles')
|
||||
|
||||
export const DEVICE_UID_FILE = path.join(DF_DIR, '.device_uid')
|
||||
|
||||
let DEVICE_UID: string
|
||||
|
||||
export async function getDeviceUID() {
|
||||
if (!DEVICE_UID) {
|
||||
try {
|
||||
DEVICE_UID = (await fs.readFile(DEVICE_UID_FILE)).toString().trim()
|
||||
} catch (e) {
|
||||
console.error(
|
||||
`Problem getting specific device UID. Make sure you create the file ${DEVICE_UID_FILE} and write your device UID inside.`,
|
||||
)
|
||||
console.error('Original error:')
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
return DEVICE_UID
|
||||
}
|
||||
|
||||
export async function checkGitChanges(opts: HomeOpts): Promise<boolean> {
|
||||
const code = await runCommand(opts, `git -C ${DF_DIR} diff --quiet`).catch((code) => code)
|
||||
return code !== 0
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CommandConfig, MassargCommand } from 'massarg/command'
|
||||
import { DF_DIR, HomeOpts } from './common'
|
||||
import { DF_DIR, HomeOpts, checkGitChanges } from './common'
|
||||
import { runCommand } from '../common'
|
||||
|
||||
type PushOpts = HomeOpts & {
|
||||
@@ -47,8 +47,8 @@ export const gitCommand = createGitCommand<GitOpts>(
|
||||
export const pushCommand = new MassargCommand<PushOpts>({
|
||||
name: 'push',
|
||||
run: async (opts) => {
|
||||
const code = await runCommand(opts, `git -C ${DF_DIR} diff --quiet`).catch((code) => code)
|
||||
if (code !== 0) {
|
||||
const gitHasChanges = await checkGitChanges(opts)
|
||||
if (gitHasChanges) {
|
||||
await runCommand(opts, `git -C ${DF_DIR} add .`)
|
||||
await runCommand(
|
||||
opts,
|
||||
|
||||
Reference in New Issue
Block a user