|
| 1 | +# Contributing to Butane |
| 2 | + |
| 3 | +Thank you for your interest in contributing to Butane! |
| 4 | +This guide will help you set up your development environment and get started. |
| 5 | + |
| 6 | +## Development Environment Setup |
| 7 | + |
| 8 | +### Using mise (Recommended) |
| 9 | + |
| 10 | +This project uses [mise](https://mise.jdx.dev/) to manage development tools needed for development. |
| 11 | + |
| 12 | +#### Installing mise |
| 13 | + |
| 14 | +**Package Managers (Recommended):** |
| 15 | + |
| 16 | +mise is available in many package managers. Choose the one for your system: |
| 17 | + |
| 18 | +- **Nix/NixOS:** `nix-env -iA nixpkgs.mise` |
| 19 | +- **macOS (Homebrew):** `brew install mise` |
| 20 | +- **macOS (MacPorts):** `sudo port install mise` |
| 21 | +- **Windows (Chocolatey):** `choco install mise-en-place` |
| 22 | +- **Windows (Scoop):** `scoop install mise` |
| 23 | +- **Arch Linux:** `pacman -S mise` |
| 24 | +- **Alpine Linux:** `apk add mise` |
| 25 | +- **FreeBSD:** `pkg install mise` |
| 26 | + |
| 27 | +For a complete list of package managers and distributions, |
| 28 | +see [mise on Repology](https://repology.org/project/mise/versions). |
| 29 | + |
| 30 | +##### Alternative: Install via Cargo |
| 31 | + |
| 32 | +If you already have Rust installed, you can install mise using cargo: |
| 33 | + |
| 34 | +```bash |
| 35 | +cargo install mise |
| 36 | +``` |
| 37 | + |
| 38 | +**Note:** When installing via cargo, you'll need to manually set up its shell integration. |
| 39 | + |
| 40 | +##### Alternative: Quick Install Script |
| 41 | + |
| 42 | +> ⚠️ **Security Warning:** This alternative is not secure. We recommend using a package manager instead. |
| 43 | +
|
| 44 | +If you prefer the installation script: |
| 45 | + |
| 46 | +**macOS/Linux:** |
| 47 | + |
| 48 | +```bash |
| 49 | +curl https://mise.run | sh |
| 50 | +``` |
| 51 | + |
| 52 | +**Windows (PowerShell):** |
| 53 | + |
| 54 | +```powershell |
| 55 | +irm https://mise.run | iex |
| 56 | +``` |
| 57 | + |
| 58 | +**For other installation methods**, see the [official mise documentation](https://mise.jdx.dev/getting-started.html). |
| 59 | + |
| 60 | +#### Installing Project Tools |
| 61 | + |
| 62 | +Once mise is installed and shell integration is activated, navigate to the project directory and run: |
| 63 | + |
| 64 | +```bash |
| 65 | +mise install |
| 66 | +``` |
| 67 | + |
| 68 | +This will automatically install all required tools defined in `.mise.toml`. |
| 69 | + |
| 70 | +### Without mise |
| 71 | + |
| 72 | +If you prefer not to use mise, you'll need to manually install: |
| 73 | + |
| 74 | +1. **Rust** (stable) - via [rustup](https://rustup.rs/) |
| 75 | +2. **PostgreSQL** - for running tests |
| 76 | +3. **SQLite** - for running tests |
| 77 | +4. **Make** - for running development commands |
| 78 | +5. Other development tools as needed - they will typically be added to `.mise.toml`. |
| 79 | + |
| 80 | +## Building the Project |
| 81 | + |
| 82 | +```bash |
| 83 | +cargo build |
| 84 | +``` |
| 85 | + |
| 86 | +## Running Tests |
| 87 | + |
| 88 | +Run all tests: |
| 89 | + |
| 90 | +```bash |
| 91 | +cargo test |
| 92 | +``` |
| 93 | + |
| 94 | +Run tests for a specific package: |
| 95 | + |
| 96 | +```bash |
| 97 | +cargo test -p butane |
| 98 | +cargo test -p butane_core |
| 99 | +``` |
| 100 | + |
| 101 | +## Code Quality |
| 102 | + |
| 103 | +Before submitting a PR, you may use the following commands locally to ensure that your code passes all checks: |
| 104 | + |
| 105 | +```bash |
| 106 | +make check |
| 107 | +``` |
| 108 | + |
| 109 | +Or run individual checks: |
| 110 | + |
| 111 | +```bash |
| 112 | +# Format code |
| 113 | +make fmt |
| 114 | + |
| 115 | +# Run linter |
| 116 | +make lint |
| 117 | + |
| 118 | +# Check for typos |
| 119 | +make spellcheck |
| 120 | + |
| 121 | +# Check formatting and editor config |
| 122 | +make check-fmt |
| 123 | + |
| 124 | +# Check documentation |
| 125 | +make doclint |
| 126 | +``` |
| 127 | + |
| 128 | +## Project Structure |
| 129 | + |
| 130 | +- `butane/` - Main library crate |
| 131 | +- `butane_core/` - Core functionality |
| 132 | +- `butane_cli/` - Command-line interface |
| 133 | +- `butane_codegen/` - Code generation macros |
| 134 | +- `butane_test_helper/` - Test utilities |
| 135 | +- `examples/` - Example projects |
| 136 | +- `docs/` - Documentation |
| 137 | + |
| 138 | +## Database Migrations |
| 139 | + |
| 140 | +This repository contains generated migrations for the examples. To regenerate migrations: |
| 141 | + |
| 142 | +```bash |
| 143 | +make regenerate-example-migrations |
| 144 | +``` |
| 145 | + |
| 146 | +## Submitting Changes |
| 147 | + |
| 148 | +1. Fork the repository |
| 149 | +2. Create a feature branch (`git checkout -b feature/my-feature`) |
| 150 | +3. Make your changes |
| 151 | +4. Run tests and quality checks |
| 152 | +5. Commit your changes with clear commit messages |
| 153 | +6. Push to your fork |
| 154 | +7. Open a Pull Request |
| 155 | + |
| 156 | +## Getting Help |
| 157 | + |
| 158 | +- Open an issue on [GitHub](https://github.com/Electron100/butane/issues) |
| 159 | +- Check existing issues and PRs |
| 160 | +- Review the [documentation](https://docs.rs/butane) |
| 161 | + |
| 162 | +Thank you for contributing to Butane! |
0 commit comments