Skip to content

Commit 0eafef4

Browse files
committed
Transform into multicultural names generator
- Add Persian, Arabic, and Asian names in Latin characters - Implement name generator with adjective-noun combinations - Add support for numbered names (--number flag) - Add comprehensive documentation and examples - Set up GitHub Actions for CI/CD and releases - Add Homebrew formula generation - Include dual licensing (MIT/Apache-2.0) - Add contribution guidelines and templates Inspired by fnichol/names but extended for global inclusivity.
1 parent 89e2e6a commit 0eafef4

21 files changed

Lines changed: 6089 additions & 117 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Run command '...'
16+
2. See error
17+
18+
**Expected behavior**
19+
A clear and concise description of what you expected to happen.
20+
21+
**System Information:**
22+
- OS: [e.g. macOS 14.0]
23+
- Version: [e.g. 0.1.0]
24+
- Rust version: [e.g. 1.75.0]
25+
26+
**Additional context**
27+
Add any other context about the problem here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest new names or features
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to adding new cultural names?**
11+
If yes, please specify which culture/language and provide example names in Latin characters.
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Additional context**
17+
Add any other context about the feature request here.

.github/pull_request_template.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Description
2+
3+
Please include a summary of the changes and which issue is fixed. Include relevant motivation and context.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
- [ ] New cultural names added
14+
15+
## Checklist
16+
17+
- [ ] My code follows the style guidelines of this project
18+
- [ ] I have performed a self-review of my code
19+
- [ ] I have added tests that prove my fix is effective or that my feature works
20+
- [ ] New and existing unit tests pass locally with my changes
21+
- [ ] I have run `cargo fmt` and `cargo clippy`
22+
- [ ] If adding names: They are in Latin characters and culturally appropriate

.github/workflows/ci.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,49 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
411

512
jobs:
613
test:
14+
name: Test
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
rust: [stable]
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: dtolnay/rust-toolchain@master
23+
with:
24+
toolchain: ${{ matrix.rust }}
25+
- name: Build
26+
run: cargo build --verbose
27+
- name: Run tests
28+
run: cargo test --verbose
29+
30+
lint:
31+
name: Lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: dtolnay/rust-toolchain@stable
36+
with:
37+
components: rustfmt, clippy
38+
- name: Format
39+
run: cargo fmt --all -- --check
40+
- name: Clippy
41+
run: cargo clippy --all-targets -- -D warnings
42+
43+
docker:
44+
name: Docker Build
745
runs-on: ubuntu-latest
846
steps:
9-
- uses: actions/checkout@v4
10-
- uses: dtolnay/rust-toolchain@stable
11-
- name: Build
12-
run: cargo build --all
13-
- name: Clippy
14-
run: cargo clippy --all-targets -- -D warnings
15-
- name: Format
16-
run: cargo fmt -- --check
17-
- name: Test
18-
run: cargo test --all
19-
- name: Docker Build
20-
run: docker build -t ${{ github.repository }} .
47+
- uses: actions/checkout@v4
48+
- name: Docker Build
49+
run: docker build -t ${{ github.repository }} .

.github/workflows/release.yml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
create-release:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
outputs:
16+
upload_url: ${{ steps.release.outputs.upload_url }}
17+
release_version: ${{ env.RELEASE_VERSION }}
18+
steps:
19+
- name: Get the release version from the tag
20+
shell: bash
21+
run: |
22+
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
23+
echo "version is: ${{ env.RELEASE_VERSION }}"
24+
25+
- name: Create GitHub release
26+
id: release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
tag_name: ${{ env.RELEASE_VERSION }}
32+
release_name: ${{ env.RELEASE_VERSION }}
33+
draft: false
34+
prerelease: false
35+
36+
build-release:
37+
name: Build Release
38+
needs: ['create-release']
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
build:
43+
- linux
44+
- macos
45+
- macos-arm
46+
- windows
47+
include:
48+
- build: linux
49+
os: ubuntu-latest
50+
rust: stable
51+
target: x86_64-unknown-linux-gnu
52+
archive: tar.gz
53+
archive-command: tar czf
54+
- build: macos
55+
os: macos-latest
56+
rust: stable
57+
target: x86_64-apple-darwin
58+
archive: tar.gz
59+
archive-command: tar czf
60+
- build: macos-arm
61+
os: macos-latest
62+
rust: stable
63+
target: aarch64-apple-darwin
64+
archive: tar.gz
65+
archive-command: tar czf
66+
- build: windows
67+
os: windows-latest
68+
rust: stable
69+
target: x86_64-pc-windows-msvc
70+
archive: zip
71+
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v3
75+
76+
- name: Install Rust
77+
uses: dtolnay/rust-toolchain@master
78+
with:
79+
toolchain: ${{ matrix.rust }}
80+
targets: ${{ matrix.target }}
81+
82+
- name: Build release binary
83+
run: cargo build --verbose --release --target ${{ matrix.target }}
84+
85+
- name: Strip release binary (unix)
86+
if: matrix.os != 'windows-latest'
87+
run: strip "target/${{ matrix.target }}/release/names"
88+
89+
- name: Build archive
90+
shell: bash
91+
run: |
92+
staging="names-${{ needs.create-release.outputs.release_version }}-${{ matrix.target }}"
93+
mkdir -p "$staging"
94+
95+
cp {README.md,LICENSE-MIT,LICENSE-APACHE,CHANGELOG.md} "$staging/"
96+
97+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
98+
cp "target/${{ matrix.target }}/release/names.exe" "$staging/"
99+
7z a "$staging.zip" "$staging"
100+
echo "ASSET=$staging.zip" >> $GITHUB_ENV
101+
else
102+
cp "target/${{ matrix.target }}/release/names" "$staging/"
103+
tar czf "$staging.tar.gz" "$staging"
104+
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
105+
fi
106+
107+
- name: Upload release archive
108+
uses: actions/upload-release-asset@v1
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
with:
112+
upload_url: ${{ needs.create-release.outputs.upload_url }}
113+
asset_path: ${{ env.ASSET }}
114+
asset_name: ${{ env.ASSET }}
115+
asset_content_type: application/octet-stream
116+
117+
publish-cargo:
118+
name: Publish to crates.io
119+
runs-on: ubuntu-latest
120+
needs: ['build-release']
121+
steps:
122+
- uses: actions/checkout@v3
123+
- uses: dtolnay/rust-toolchain@stable
124+
- run: cargo publish
125+
env:
126+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
127+
128+
update-homebrew:
129+
name: Update Homebrew Formula
130+
runs-on: ubuntu-latest
131+
needs: ['create-release', 'build-release']
132+
steps:
133+
- name: Checkout repository
134+
uses: actions/checkout@v3
135+
136+
- name: Update Homebrew Formula
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
140+
run: |
141+
VERSION="${{ needs.create-release.outputs.release_version }}"
142+
VERSION="${VERSION#v}" # Remove 'v' prefix
143+
144+
# Download the release assets to calculate SHA256
145+
curl -L -o names-darwin.tar.gz \
146+
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/names-v${VERSION}-x86_64-apple-darwin.tar.gz"
147+
curl -L -o names-darwin-arm.tar.gz \
148+
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/names-v${VERSION}-aarch64-apple-darwin.tar.gz"
149+
curl -L -o names-linux.tar.gz \
150+
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/names-v${VERSION}-x86_64-unknown-linux-gnu.tar.gz"
151+
152+
# Calculate SHA256
153+
SHA_DARWIN=$(sha256sum names-darwin.tar.gz | cut -d' ' -f1)
154+
SHA_DARWIN_ARM=$(sha256sum names-darwin-arm.tar.gz | cut -d' ' -f1)
155+
SHA_LINUX=$(sha256sum names-linux.tar.gz | cut -d' ' -f1)
156+
157+
# Create formula file
158+
cat > names.rb << EOF
159+
class Names < Formula
160+
desc "Multicultural random name generator with Persian, Arabic, and Asian names"
161+
homepage "https://github.com/${{ github.repository }}"
162+
version "${VERSION}"
163+
license any_of: ["MIT", "Apache-2.0"]
164+
165+
on_macos do
166+
if Hardware::CPU.arm?
167+
url "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/names-v${VERSION}-aarch64-apple-darwin.tar.gz"
168+
sha256 "${SHA_DARWIN_ARM}"
169+
else
170+
url "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/names-v${VERSION}-x86_64-apple-darwin.tar.gz"
171+
sha256 "${SHA_DARWIN}"
172+
end
173+
end
174+
175+
on_linux do
176+
url "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/names-v${VERSION}-x86_64-unknown-linux-gnu.tar.gz"
177+
sha256 "${SHA_LINUX}"
178+
end
179+
180+
def install
181+
bin.install "names"
182+
end
183+
184+
test do
185+
assert_match(/\w+-\w+/, shell_output("#{bin}/names"))
186+
end
187+
end
188+
EOF
189+
190+
# If you have a separate homebrew tap repository, you can push to it
191+
# For now, we'll just create the formula file
192+
echo "Homebrew formula created successfully"

.gitignore

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
1-
/target
1+
# Generated by Cargo
2+
/target/
23
**/*.rs.bk
34
Cargo.lock
4-
.DS_Store
5-
instruction.md
5+
6+
# OS specific
7+
.DS_Store
8+
Thumbs.db
9+
10+
# Editor directories and files
11+
.idea/
12+
.vscode/
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Python scripts artifacts
18+
__pycache__/
19+
*.py[cod]
20+
*$py.class
21+
22+
# Temporary files
23+
*.tmp
24+
*.temp
25+
*.log
26+
27+
# Build artifacts
28+
/dist/
29+
/build/
30+
31+
# Local development
32+
instruction.md
33+
.env
34+
.env.local
35+
36+
# Homebrew formula (generated during release)
37+
/names.rb

0 commit comments

Comments
 (0)