From a10665a247500121f54b198be8aa531876e624ef Mon Sep 17 00:00:00 2001 From: alephao <7674479+alephao@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:22:24 -0300 Subject: [PATCH] feat: rename to swift-rlp, SwiftRLP --- Makefile | 2 +- Package.swift | 14 +++++------ README.md | 24 ++++++++++++------- .../{RLPSwift => SwiftRLP}/RLPDecoder.swift | 0 .../{RLPSwift => SwiftRLP}/RLPEncoder.swift | 0 Sources/{RLPSwift => SwiftRLP}/RLPError.swift | 0 Sources/{RLPSwift => SwiftRLP}/RLPValue.swift | 0 Sources/cli/RLPCli.swift | 2 +- .../RLPDecoderTests.swift | 2 +- .../RLPEncoderTests.swift | 2 +- 10 files changed, 27 insertions(+), 19 deletions(-) rename Sources/{RLPSwift => SwiftRLP}/RLPDecoder.swift (100%) rename Sources/{RLPSwift => SwiftRLP}/RLPEncoder.swift (100%) rename Sources/{RLPSwift => SwiftRLP}/RLPError.swift (100%) rename Sources/{RLPSwift => SwiftRLP}/RLPValue.swift (100%) rename Tests/{RLPSwiftTests => SwiftRLPTests}/RLPDecoderTests.swift (98%) rename Tests/{RLPSwiftTests => SwiftRLPTests}/RLPEncoderTests.swift (99%) diff --git a/Makefile b/Makefile index 19427ea..6ac5c15 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: build build: swift build \ - --target RLPSwift + --target SwiftRLP .PHONY: test test: diff --git a/Package.swift b/Package.swift index abd996f..d618f38 100644 --- a/Package.swift +++ b/Package.swift @@ -3,15 +3,15 @@ import PackageDescription let package = Package( - name: "RLPSwift", + name: "SwiftRLP", platforms: [ .iOS(.v12), .macOS(.v10_14), ], products: [ .library( - name: "RLPSwift", - targets: ["RLPSwift"] + name: "SwiftRLP", + targets: ["SwiftRLP"] ), .executable(name: "cli", targets: ["cli"]), ], @@ -19,16 +19,16 @@ let package = Package( .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0") ], targets: [ - .target(name: "RLPSwift"), + .target(name: "SwiftRLP"), .testTarget( - name: "RLPSwiftTests", - dependencies: ["RLPSwift"] + name: "SwiftRLPTests", + dependencies: ["SwiftRLP"] ), .executableTarget( name: "cli", dependencies: [ .product(name: "ArgumentParser", package: "swift-argument-parser"), - .target(name: "RLPSwift"), + .target(name: "SwiftRLP"), ] ), ] diff --git a/README.md b/README.md index 5e7724f..4d70425 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# RLPSwift +# SwiftRLP [![Swift 5.9.2](https://img.shields.io/badge/Swift-5.9.2-orange.svg?style=flat)](https://developer.apple.com/swift/) -[![Version](https://img.shields.io/badge/SPM-0.0.6-orange.svg?stlyle=flat)](https://github.com/alephao/RLPSwift/releases/tag/v0.0.6) +[![Version](https://img.shields.io/badge/SPM-0.0.6-orange.svg?stlyle=flat)](https://github.com/alephao/swift-rlp/releases/tag/v0.0.6) This is a simple, pure Swift implementation of Recursive Length Prefix Encoding, a serialisation method for encoding arbitrarily structured binary data (byte arrays). @@ -10,20 +10,28 @@ RLP Encoding is used in Ethereum. You can read more about it here: ## Library Usage -RLPSwift is available through [Swift Package Manager](https://swift.org/package-manager/). +SwiftRLP is available through [Swift Package Manager](https://swift.org/package-manager/). -Adding RLPSwift as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. +Adding SwiftRLP as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. ```swift dependencies: [ - .package(url: "https://github.com/alephao/RLPSwift.git", from: "0.0.6") + .package(url: "https://github.com/alephao/swift-rlp.git", from: "0.0.6") +], +targets: [ + .target( + name: "MyTarget", + dependencies: [ + .product(name: "SwiftRLP", package: "swift-rlp") + ] + ), ] ``` ### Encoding ```swift -import RLPSwift +import SwiftRLP let encoder = RLPEncoder() @@ -38,7 +46,7 @@ try encoder.encode(.array(["d", "o", "g"])) ### Decoding ```swift -import RLPSwift +import SwiftRLP let encodedData = try RLPEncoder().encode(string: "dog") @@ -66,4 +74,4 @@ $ swift run cli decode 0x83646F67 ## License -RLPSwift is released under an [MIT](https://tldrlegal.com/license/mit-license) license. See [LICENSE](LICENSE) for more information. +SwiftRLP is released under an [MIT](https://tldrlegal.com/license/mit-license) license. See [LICENSE](LICENSE) for more information. diff --git a/Sources/RLPSwift/RLPDecoder.swift b/Sources/SwiftRLP/RLPDecoder.swift similarity index 100% rename from Sources/RLPSwift/RLPDecoder.swift rename to Sources/SwiftRLP/RLPDecoder.swift diff --git a/Sources/RLPSwift/RLPEncoder.swift b/Sources/SwiftRLP/RLPEncoder.swift similarity index 100% rename from Sources/RLPSwift/RLPEncoder.swift rename to Sources/SwiftRLP/RLPEncoder.swift diff --git a/Sources/RLPSwift/RLPError.swift b/Sources/SwiftRLP/RLPError.swift similarity index 100% rename from Sources/RLPSwift/RLPError.swift rename to Sources/SwiftRLP/RLPError.swift diff --git a/Sources/RLPSwift/RLPValue.swift b/Sources/SwiftRLP/RLPValue.swift similarity index 100% rename from Sources/RLPSwift/RLPValue.swift rename to Sources/SwiftRLP/RLPValue.swift diff --git a/Sources/cli/RLPCli.swift b/Sources/cli/RLPCli.swift index 15db1a5..66620cc 100644 --- a/Sources/cli/RLPCli.swift +++ b/Sources/cli/RLPCli.swift @@ -1,6 +1,6 @@ import ArgumentParser import Foundation -import RLPSwift +import SwiftRLP @main struct RLPCli: ParsableCommand { diff --git a/Tests/RLPSwiftTests/RLPDecoderTests.swift b/Tests/SwiftRLPTests/RLPDecoderTests.swift similarity index 98% rename from Tests/RLPSwiftTests/RLPDecoderTests.swift rename to Tests/SwiftRLPTests/RLPDecoderTests.swift index 29d5ff2..8300dcd 100644 --- a/Tests/RLPSwiftTests/RLPDecoderTests.swift +++ b/Tests/SwiftRLPTests/RLPDecoderTests.swift @@ -1,6 +1,6 @@ import XCTest -@testable import RLPSwift +@testable import SwiftRLP class DecodingTests: XCTestCase {} diff --git a/Tests/RLPSwiftTests/RLPEncoderTests.swift b/Tests/SwiftRLPTests/RLPEncoderTests.swift similarity index 99% rename from Tests/RLPSwiftTests/RLPEncoderTests.swift rename to Tests/SwiftRLPTests/RLPEncoderTests.swift index 8399f59..5403c04 100644 --- a/Tests/RLPSwiftTests/RLPEncoderTests.swift +++ b/Tests/SwiftRLPTests/RLPEncoderTests.swift @@ -1,6 +1,6 @@ import XCTest -@testable import RLPSwift +@testable import SwiftRLP class EncodingTests: XCTestCase {}