diff --git a/.gitignore b/.gitignore index bab06b4..a206b57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# System +.DS_Store +__pycache__ + +# Brewfile Brewfile -Brewfile_*.backup -.DS_Store \ No newline at end of file +Brewfile_*.backup \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f2824cd --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# Brewfile Tool + +A tool to manage Homebrew packages from a CSV file. + +## Features + +- Generate a Brewfile from a CSV list of packages. +- Install packages via the Brewfile, automatically resolving required dependencies. +- Check installation status and clean up packages not listed in the Brewfile. + +## Requirements + +- macOS +- [Homebrew](https://brew.sh) +- Python 3 + +## CSV Format + +Packages are defined in `apps.csv`. Each row describes one package. + +![csv_edit](/assets/csv_edit.png) + +### Columns + +| Column | Required | Type | Description | +| ---------------- | -------- | ------ | ------------------------------------------------------------ | +| name | Yes | string | Exact package name used by the installer. | +| type | Yes | enum | One of `formula`, `cask`, `mas`, `vscode`, or `manual`. | +| mas_id | No | string | Mac App Store app ID. Required only when `type` is `mas`. | +| install_on_setup | Yes | bool | `yes` to include the package in the Brewfile, otherwise `no`.| +| description | No | string | Short note about the package, written as a Brewfile comment. | + +* Rows with a `type` of `manual` are ignored during generation. +Thus, setting `install_on_setup` with `manual` type doesn't have any effect. + +* This tool only reads and uses 5 columns stated in this table. +It is free to make more columns to add more metadata for packages. + + +### Types + +| Type | Brewfile Entry | Dependency | +| ------- | ------------------------- | ----------------------------- | +| formula | `brew "..."` | none | +| cask | `cask "..."` | none | +| mas | `mas "...", id: ...` | `mas` (install if missing) | +| vscode | `vscode "..."` | `code` (install if missing) | + +## Usage + +Run the tool and select an option from the menu. + +``` +python3 brewfile_tool.py + +╰─➤ Select option + 1) Create Brewfile + 2) Install packages + 3) Check packages + 4) Cleanup packages + 5) Exit + option: +``` + +| Option | Description | +| --------------- | ------------------------------------------------------------------- | +| Create Brewfile | Generate a Brewfile from `apps.csv`. The old Brewfile is automatically backed up. | +| Install packages| Install dependencies if needed, then run `brew bundle install`. | +| Check packages | Verify that every package in the Brewfile is installed. | +| Cleanup packages| Remove installed packages that are not listed in the Brewfile. | +| Exit | Quit the tool. | diff --git a/__pycache__/brewfile_tool.cpython-314.pyc b/__pycache__/brewfile_tool.cpython-314.pyc deleted file mode 100644 index 0c1b8fe..0000000 Binary files a/__pycache__/brewfile_tool.cpython-314.pyc and /dev/null differ diff --git a/assets/csv_edit.png b/assets/csv_edit.png new file mode 100644 index 0000000..5caaec3 Binary files /dev/null and b/assets/csv_edit.png differ