Skip to content

Commit 18ef6a8

Browse files
committed
Initial commit for RFC 1123: Requirements for Internet Hosts Application and Support
0 parents  commit 18ef6a8

File tree

9 files changed

+276
-0
lines changed

9 files changed

+276
-0
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: macos-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Swift
17+
uses: swift-actions/setup-swift@v2
18+
with:
19+
swift-version: "6.0"
20+
21+
- name: Build
22+
run: swift build
23+
24+
- name: Run tests
25+
run: swift test
26+
27+
- name: Check Swift format
28+
run: |
29+
if command -v swiftformat >/dev/null 2>&1; then
30+
swiftformat --lint .
31+
else
32+
echo "swiftformat not installed, skipping format check"
33+
fi

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Swift Package Manager
2+
.build/
3+
.swiftpm/
4+
Package.resolved
5+
6+
# Xcode
7+
*.xcodeproj/
8+
*.xcworkspace/
9+
xcuserdata/
10+
DerivedData/
11+
*.hmap
12+
*.ipa
13+
*.dSYM.zip
14+
*.dSYM
15+
16+
# macOS
17+
.DS_Store
18+
19+
# AI tools
20+
CLAUDE.md
21+
.claude
22+
.cursor/
23+
.aider*
24+
25+
# IDE
26+
.vscode/
27+
.idea/
28+
29+
# Temporary files
30+
*.tmp
31+
*.swp
32+
*~

.swiftlint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
disabled_rules:
2+
- trailing_whitespace
3+
- line_length
4+
5+
opt_in_rules:
6+
- empty_count
7+
- file_header
8+
9+
included:
10+
- Sources
11+
- Tests
12+
13+
excluded:
14+
- .build
15+
- .swiftpm
16+
17+
file_header:
18+
required_pattern: |
19+
\/\/
20+
\/\/ .*\.swift
21+
\/\/ swift-rfc-.*
22+
\/\/
23+
\/\/ Created by .* on .*\.
24+
\/\/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Swift Web Standards
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Package.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// swift-tools-version:6.0
2+
3+
import Foundation
4+
import PackageDescription
5+
6+
extension String {
7+
static let rfc1123: Self = "RFC_1123"
8+
}
9+
10+
extension Target.Dependency {
11+
static var rfc1123: Self { .target(name: .rfc1123) }
12+
}
13+
14+
let package = Package(
15+
name: "swift-rfc-1123",
16+
platforms: [
17+
.macOS(.v13),
18+
.iOS(.v16)
19+
],
20+
products: [
21+
.library(name: .rfc1123, targets: [.rfc1123]),
22+
],
23+
dependencies: [
24+
// Add RFC dependencies here as needed
25+
// .package(url: "https://github.com/swift-web-standards/swift-rfc-1123.git", branch: "main"),
26+
],
27+
targets: [
28+
.target(
29+
name: .rfc1123,
30+
dependencies: [
31+
// Add target dependencies here
32+
]
33+
),
34+
.testTarget(
35+
name: .rfc1123.tests,
36+
dependencies: [
37+
.rfc1123
38+
]
39+
),
40+
],
41+
swiftLanguageModes: [.v6]
42+
)
43+
44+
extension String { var tests: Self { self + " Tests" } }

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# swift-rfc-1123
2+
3+
Swift implementation of [RFC 1123: Requirements for Internet Hosts Application and Support](https://www.rfc-editor.org/rfc/rfc1123.html)
4+
5+
## Installation
6+
7+
### Swift Package Manager
8+
9+
Add this to your Package.swift:
10+
11+
```swift
12+
dependencies: [
13+
.package(url: "https://github.com/swift-web-standards/swift-rfc-1123.git", branch: "main")
14+
]
15+
```
16+
17+
## Usage
18+
19+
```swift
20+
import RFC_1123
21+
22+
// TODO: Add usage examples
23+
```
24+
25+
## Documentation
26+
27+
For complete documentation of RFC 1123, see the [official RFC document](https://www.rfc-editor.org/rfc/rfc1123.html).
28+
29+
## License
30+
31+
This project is licensed under the MIT License - see the LICENSE file for details.

Scripts/setup-rfc.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# Setup script for new RFC repository
4+
# Usage: ./Scripts/setup-rfc.sh <RFC_NUMBER> <RFC_TITLE> [AUTHOR_NAME]
5+
6+
set -e
7+
8+
if [ $# -lt 2 ]; then
9+
echo "Usage: $0 <RFC_NUMBER> <RFC_TITLE> [AUTHOR_NAME]"
10+
echo "Example: $0 2822 'Internet Message Format' 'John Doe'"
11+
exit 1
12+
fi
13+
14+
RFC_NUMBER=$1
15+
RFC_TITLE=$2
16+
AUTHOR_NAME=${3:-"Generated"}
17+
CREATION_DATE=$(date +"%d/%m/%Y")
18+
19+
echo "Setting up RFC $RFC_NUMBER: $RFC_TITLE"
20+
echo "Author: $AUTHOR_NAME"
21+
echo "Date: $CREATION_DATE"
22+
23+
# Function to process template files
24+
process_template() {
25+
local file=$1
26+
local new_file="${file%.template}"
27+
28+
sed "s/XXXX/$RFC_NUMBER/g; s/RFC_TITLE/$RFC_TITLE/g; s/RFC_AUTHOR_NAME/$AUTHOR_NAME/g; s/RFC_CREATION_DATE/$CREATION_DATE/g" "$file" > "$new_file"
29+
rm "$file"
30+
echo "Processed: $new_file"
31+
}
32+
33+
# Process all template files
34+
find . -name "*.template" -type f | while read -r file; do
35+
process_template "$file"
36+
done
37+
38+
# Rename directories
39+
if [ -d "Sources/RFC_XXXX" ]; then
40+
mv "Sources/RFC_XXXX" "Sources/RFC_$RFC_NUMBER"
41+
echo "Renamed: Sources/RFC_$RFC_NUMBER"
42+
fi
43+
44+
if [ -d "Tests/RFC_XXXX Tests" ]; then
45+
mv "Tests/RFC_XXXX Tests" "Tests/RFC_${RFC_NUMBER} Tests"
46+
echo "Renamed: Tests/RFC_${RFC_NUMBER} Tests"
47+
fi
48+
49+
# Initialize git repository if not already initialized
50+
if [ ! -d ".git" ]; then
51+
git init
52+
echo "Initialized git repository"
53+
fi
54+
55+
echo ""
56+
echo "✅ RFC $RFC_NUMBER setup complete!"
57+
echo ""
58+
echo "Next steps:"
59+
echo "1. Review and commit the generated files"
60+
echo "2. Create GitHub repository: swift-rfc-$RFC_NUMBER"
61+
echo "3. Push to GitHub"
62+
echo "4. Start implementing RFC $RFC_NUMBER types in Sources/RFC_$RFC_NUMBER/"

Sources/RFC_1123/RFC_XXXX.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// RFC_1123.swift
3+
// swift-rfc-1123
4+
//
5+
// Created by Coen ten Thije Boonkkamp on 26-07-2025.
6+
//
7+
8+
/// Implementation of RFC 1123: Requirements for Internet Hosts Application and Support
9+
///
10+
/// See: https://www.rfc-editor.org/rfc/rfc1123.html
11+
public enum RFC_1123 {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// RFC_1123 Tests.swift
3+
// RFC_1123 Tests
4+
//
5+
// Created by Coen ten Thije Boonkkamp on 26-07-2025.
6+
//
7+
8+
import Testing
9+
@testable import RFC_1123
10+
11+
@Suite("RFC 1123 Tests")
12+
struct RFC_1123_Tests {
13+
14+
@Test("RFC 1123 basic functionality")
15+
func testBasicFunctionality() {
16+
// TODO: Add tests for RFC 1123 implementation
17+
}
18+
}

0 commit comments

Comments
 (0)