https://github.com/digipolitan/polymorph-gen
https://github.com/digipolitan/polymorph-gen
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/digipolitan/polymorph-gen
- Owner: Digipolitan
- License: bsd-3-clause
- Created: 2017-08-09T09:49:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-06T22:12:42.000Z (over 6 years ago)
- Last Synced: 2025-01-17T00:20:10.432Z (4 months ago)
- Language: Swift
- Size: 45.9 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
PolymorphGen
=================================[](https://developer.apple.com/swift/)
[](https://swift.org/package-manager/)
[](http://twitter.com/Digipolitan)Base library to generate files, part of the [Polymorph](https://github.com/Digipolitan/polymorph-cli) project
## Installation
### SPM
To install PolymorphGen with SwiftPackageManager, add the following lines to your `Package.swift`.
```swift
let package = Package(
name: "XXX",
products: [
.library(
name: "XXX",
targets: ["XXX"]),
],
dependencies: [
.package(url: "https://github.com/Digipolitan/polymorph-gen.git", from: "1.0.0")
],
targets: [
.target(
name: "XXX",
dependencies: ["PolymorphGen"])
]
)
```## The Basics
All child platform must implements the PlatformGen interface and override all fields & methods
```swift
class ExampleGen: PlatformGen {
static var name: String {
return "Example"
}
static var shared: PlatformGen = ExampleGen()private init() { }
func generate(_ project: Project, options: PolymorphGen.Options) throws -> [File] {
// TODO
}
}
```After that register your platform when initializing the PolymorphGen instance
```swift
let generator = PolymorphGen(platforms: [
ExampleGen.self
])
```## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details!
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report
unacceptable behavior to [[email protected]](mailto:[email protected]).## License
PolymorphGen is licensed under the [BSD 3-Clause license](LICENSE).