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 helloInstall SwiftJobs with Homebrew:
brew install davepaul0/tap/swiftjobsswiftjobs initSwiftJobs 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 listswiftjobs run <job name>swiftjobscan be run from any descendant folder from aMyJobsproject root, OR any descendant of a folder that HAS aMyJobsproject.swiftjobswill always execute itsJobinstances with the current working directory set to the parent of theMyJobsparent 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/.