apleshkov/saber
Dependency injection (DI) & Inversion of Control (IoC) command line tool for Swift based on code generation
Documentation
Installation
Building on macOS requires Xcode w/ Swift 4.2 and Swift Package Manager.
Mint
$ mint install apleshkov/saberHomebrew
TODO (not notable enough yet)
Make
Clone & run make install in the root directory of this project.
Run make uninstall to uninstall.
Usage
$ saber help
Available commands:
help Display general or command-specific help
sources Generate containers from sources
version Print current version
xcodeproj Generate containers from Xcode projectsources
Saber traverses swift-files --from recursively and generates container classes to --out.
Example: saber sources --workDir . --from Sources --out Sources/Saber
$ saber help sources
Generate containers from sources
[--workDir (string)]
Working directory (optional)
[--from (string)]
Directory with sources (is relative to --workDir if any)
[--out (string)]
Output directory (is relative to --workDir if any)
[--config (string)]
Path to *.yml or YAML text (optional)
[--log (string)]
Could be 'info' (by default) or 'debug' (optional)xcodeproj (on macOS only)
Saber parses Xcode project at --path, traverses enumerated --targets and generates container classes to --out. The main difference from the sources command is an ability to work with Swift modules.
Example: saber xcodeproj --workDir . --path MyProject.xcodeproj --targets Target1,Target2 --out Sources/Saber
$ saber help xcodeproj
Generate containers from Xcode project
[--workDir (string)]
Working directory (optional)
[--path (string)]
Path to *.xcodeproj (is relative to --workDir if any)
[--targets (string)]
Comma-separated list of project target names
[--out (string)]
Output directory (is relative to --workDir if any)
[--config (string)]
Path to *.yml or YAML text (optional)
[--log (string)]
Could be 'info' (by default) or 'debug' (optional)Configuration
Provide it via --config as text or file:
# Access level for generated classes (internal by default)
accessLevel: internal # public, open, ...
# Identation for generated files (4 spaces by default)
indentation:
type: space # or tab
size: 4
# Lazy typealias (see wiki; none by default)
lazyTypealias: LazyInjectionDevelopment
Xcode: clone, run make xcodeproj and then open a generated Saber.xcodeproj. Use make docker_linux_test to test on Linux inside a docker container.
Linux: make clean, make build and make test
License
MIT
Package Metadata
Repository: apleshkov/saber
Stars: 20
Forks: 3
Open issues: 0
Default branch: master
Primary language: swift
License: MIT
Topics: dependency-injection, inversion-of-control, saber, swift
README: README.md