|
| 1 | +# Sunzi Modernization Plan |
| 2 | + |
| 3 | +## Overview |
| 4 | +Update Sunzi (server provisioning tool) from 2018-era dependencies to modern Ruby ecosystem. |
| 5 | + |
| 6 | +## Changes |
| 7 | + |
| 8 | +### 1. Confirm minimum Ruby versions |
| 9 | +Verified minimum Ruby version for `net-ssh ~> 7` and `thor ~> 1.3` is 2.6. |
| 10 | +Set `spec.required_ruby_version` accordingly. |
| 11 | + |
| 12 | +### 2. Update gemspec dependencies |
| 13 | +**File:** [sunzi.gemspec](sunzi.gemspec) |
| 14 | + |
| 15 | +| Dependency | Current | New | |
| 16 | +|------------|---------|-----| |
| 17 | +| `thor` | unrestricted | `~> 1.3` | |
| 18 | +| `net-ssh` | `< 5` | `~> 7.0` | |
| 19 | +| `rainbow` | `~> 3.0` | (keep) | |
| 20 | +| `hashugar` | unrestricted | (keep) | |
| 21 | +| `minitest` | unrestricted | `~> 6.0` | |
| 22 | + |
| 23 | +Also add: |
| 24 | +- `spec.required_ruby_version = '>= 2.6'` |
| 25 | + |
| 26 | +### 3. Keep YAML.load for compatibility (document trust boundary) |
| 27 | +**File:** [README.md](README.md) |
| 28 | + |
| 29 | +Leave `YAML.load(ERB.new(File.read('sunzi.yml')).result)` as-is for maximum compatibility. |
| 30 | +Add a short README note that `sunzi.yml` must be fully trusted because ERB executes Ruby |
| 31 | +and YAML.load can instantiate arbitrary objects. |
| 32 | + |
| 33 | +### 4. Replace Travis CI with GitHub Actions |
| 34 | +**Delete:** `.travis.yml` |
| 35 | +**Create:** `.github/workflows/test.yml` |
| 36 | + |
| 37 | +```yaml |
| 38 | +name: Tests |
| 39 | +on: [push, pull_request] |
| 40 | +jobs: |
| 41 | + test: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + ruby: ['3.1', '3.2', '3.3'] |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - uses: ruby/setup-ruby@v1 |
| 49 | + with: |
| 50 | + ruby-version: ${{ matrix.ruby }} |
| 51 | + bundler-cache: true |
| 52 | + - run: bundle exec rake test |
| 53 | +``` |
| 54 | +
|
| 55 | +### 5. Update README badge + requirements |
| 56 | +**File:** [README.md](README.md) |
| 57 | +
|
| 58 | +- Replace Travis badge with GitHub Actions badge (ensure workflow name/branch match the badge URL). |
| 59 | +- Add a short Requirements note for the minimum supported Ruby (from step 1). |
| 60 | +
|
| 61 | +### 6. Add .ruby-version |
| 62 | +**Create:** `.ruby-version` with content `3.2` |
| 63 | + |
| 64 | +### 7. Update template default Ruby version |
| 65 | +**File:** [templates/create/sunzi.yml](templates/create/sunzi.yml) |
| 66 | + |
| 67 | +Update `ruby_version: 2.5` to match the modern baseline (e.g., `3.2`). |
| 68 | + |
| 69 | +### 8. Update CHANGELOG |
| 70 | +**File:** [CHANGELOG.md](CHANGELOG.md) |
| 71 | + |
| 72 | +Add a `3.0.0` entry with the breaking changes (Ruby requirement, dependency bumps, CI migration). |
| 73 | + |
| 74 | +### 9. Bump version |
| 75 | +**File:** [sunzi.gemspec:5](sunzi.gemspec#L5) |
| 76 | + |
| 77 | +Update version from `2.1.0` to `3.0.0` (major bump due to Ruby version requirement change). |
| 78 | +If a version constant exists (e.g., `lib/sunzi/version.rb`), update it too. |
| 79 | + |
| 80 | +## File Summary |
| 81 | +| Action | File | |
| 82 | +|--------|------| |
| 83 | +| Edit | `sunzi.gemspec` | |
| 84 | +| Edit | `README.md` | |
| 85 | +| Edit | `templates/create/sunzi.yml` | |
| 86 | +| Edit | `CHANGELOG.md` | |
| 87 | +| Delete | `.travis.yml` | |
| 88 | +| Create | `.github/workflows/test.yml` | |
| 89 | +| Create | `.ruby-version` | |
| 90 | + |
| 91 | +## Verification |
| 92 | +1. Run `bundle install` to update Gemfile.lock |
| 93 | +2. Run `bundle exec rake test` to verify tests pass |
| 94 | +3. Run `bundle exec sunzi version` and `bundle exec sunzi create test_project` to verify CLI works |
0 commit comments