Warning SwiftJobs is not ready for general adoption.
A general use task runner in Swift. Inspired by Rake, Fastlane, and others.
Define your "jobs" in Swift:
@main
struct MyJobs: JobsProvider {
static var jobs: Jobs {
Job("hello", description: "Says hello!") { args in
Output.print("hello!")
}
Job("script", description: "Runs a shell script") { args in
try Command.run("scripts/build.sh")
Output.success("script completed!")
}
}
}
Then run them from the command line:
swiftjobs run hello
Install SwiftJobs with Homebrew:
brew install davepaul0/tap/swiftjobs
swiftjobs init
SwiftJobs will create a "MyJobs" Swift package at your current location. Open the package in Xcode and add your jobs!
List all jobs declared in the local MyJobs
project:
swiftjobs list
swiftjobs run <job name>
swiftjobs
can be run from any descendant folder from aMyJobs
project root, OR any descendant of a folder that HAS aMyJobs
project.swiftjobs
will always execute itsJob
instances with the current working directory set to the parent of theMyJobs
parent root.
Example:
~/
|- MyCodeProject/
|- MyJobs/
| |- Package.swift
| |- ...
|- src/
| |- tests/
| |- ...
|- resources/
|- ...
Given the above project configuration, swiftjobs
can be executed inside of MyJobs, OR inside MyCodeProject or any of its descendants (src, tests, resources, etc).
The current working directory in a Job
will always be ~/MyCodeProject/
.