Skip to content

Commit 197b610

Browse files
committed
Update dependencies
1 parent 9675b4f commit 197b610

File tree

7 files changed

+123
-10
lines changed

7 files changed

+123
-10
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
ruby: ['3.1', '3.2', '3.3', '3.4', '4.0']
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: ruby/setup-ruby@v1
12+
with:
13+
ruby-version: ${{ matrix.ruby }}
14+
bundler-cache: true
15+
- run: bundle exec rake test

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.0.0, release 2026-01-14
2+
* Update dependencies (thor, net-ssh, minitest).
3+
* Replace Travis CI with GitHub Actions.
4+
15
## 2.1, release 2018-01-15
26
* Dotfiles (files that start with '.') in recipes, roles and files are now included.
37
* `sunzi.yml` is now evaluated as ERB to access environment variables. (e.g. `<%= ENV['MY_PASSWORD'] %>`)

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Sunzi
22
=====
33

4-
[![Build Status](https://secure.travis-ci.org/kenn/sunzi.png)](http://travis-ci.org/kenn/sunzi)
4+
[![Tests](https://github.com/kenn/sunzi/actions/workflows/test.yml/badge.svg)](https://github.com/kenn/sunzi/actions/workflows/test.yml)
55

66
```
77
"The supreme art of war is to subdue the enemy without fighting." - Sunzi
@@ -95,6 +95,9 @@ sunzi/
9595
# remote server (do not edit directly)
9696
```
9797

98+
Security note: `sunzi.yml` is evaluated with ERB and loaded via `YAML.load`.
99+
Only use configs you fully trust.
100+
98101
How do you pass dynamic values?
99102
-------------------------------
100103

plan.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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

sunzi.gemspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gem::Specification.new do |spec|
44
spec.name = 'sunzi'
5-
spec.version = '2.1.0' # retrieve this value by: Gem.loaded_specs['sunzi'].version.to_s
5+
spec.version = '3.0.0' # retrieve this value by: Gem.loaded_specs['sunzi'].version.to_s
66
spec.authors = ['Kenn Ejima']
77
spec.email = ['kenn.ejima@gmail.com']
88
spec.summary = %q{Server provisioning utility for minimalists}
@@ -14,10 +14,11 @@ Gem::Specification.new do |spec|
1414
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
1515
spec.require_paths = ['lib']
1616

17-
spec.add_dependency 'thor'
17+
spec.add_dependency 'thor', '~> 1.3'
1818
spec.add_dependency 'rainbow', '~> 3.0'
19-
spec.add_dependency 'net-ssh', '< 5' # 4.x only supports ruby-2.0
19+
spec.add_dependency 'net-ssh', '~> 7.0'
20+
spec.add_dependency 'logger'
2021
spec.add_dependency 'hashugar'
2122
spec.add_development_dependency 'rake'
22-
spec.add_development_dependency 'minitest'
23+
spec.add_development_dependency 'minitest', '~> 6.0'
2324
end

templates/create/sunzi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
vars:
44
github_username: kenn
55
environment: production
6-
ruby_version: 2.5
6+
ruby_version: 3.3
77

88
# Remote recipes here will be downloaded to compiled/recipes.
99
recipes:

0 commit comments

Comments
 (0)