Skip to content
/ Sake Public

🍢 Swift-based utility for managing project commands, inspired by Make.

License

Notifications You must be signed in to change notification settings

kattouf/Sake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍢 Sake

Platforms Swift Versions Latest Release codecov Build Status

Swift-based utility for managing project commands, inspired by Make. Write your project commands in Swift and enjoy type safety, code reuse, and seamless integration.

⭐️ Key Features

  • Swift-Native Workflow: Write, execute, and manage all your project commands in Swift with full IDE support, type safety, and seamless integration
  • Command Dependencies: Define commands that depend on other commands
  • Conditional Execution: Skip commands based on custom conditions
  • Command Listing: Display all available commands with their descriptions

πŸƒ Less Talk, More Action

First, take a look at what you can accomplish with Sake, and then we'll dive into how to make it happen:

Define your project commands like this:

// Sakefile.swift

struct Commands: SakeApp {

    // MARK: - Code style

    public static var format: Command {
        Command(
            description: "Format source code",
            dependencies: [BrewCommands.ensureSwiftFormatInstalled],
            run: { context in
                try SwiftShell.runAndPrint("swiftformat", "Sources", "Package.swift")
            }
        )
    }

    // MARK: - Tests

    struct TestArguments: ParsableArguments {
        @Flag(name: .long, help: "Skip building before running tests")
        var skipBuild: Bool = false
    }

    public static var runTests: Command {
        Command(
            description: "Run unit tests",
            dependencies: [buildTests],
            run: { context in
                try SwiftShell.runAndPrint("swift", "test", "--skip-build"")
            }
        )
    }

    public static var buildTests: Command {
        Command(
            description: "Build tests",
            skipIf: { context in
                let arguments = try TestArguments.parse(context.arguments)
                return arguments.skipBuild
            },
            run: { context in
                try SwiftShell.runAndPrint("swift", "build", "--build-tests")
            }
        )
    }
}

Then run them like this:

❯ sake list
Commands:
 * format - Format source code
 * runTests - Run unit tests
 * buildTests - Build tests

❯ sake runTests --skip-build
...
Executed 21 tests, with 0 failures (0 unexpected) in 0.144 (0.146) seconds

Important

Sake is feature-complete but hasn’t been battle-tested in production yet. Use with care.

πŸ“š Documentation β€’ πŸš€ Getting Started β€’ πŸ’» GitHub

πŸš€ Getting Started

  1. Install Sake

    brew install kattouf/sake/sake

    See other installation methods

  2. Initialize a new SakeApp:

    sake init
  3. Run your first command:

    sake hello

πŸ“– Example Use Cases

  • Build Automation: Compile your project with different configurations and run tests
  • Release Management: Automate version updates
  • Code Quality: Run formatters and linters to maintain consistent code style

🀝 Contributing

We welcome contributions! Whether it's:

  • πŸ› Bug Reports
  • πŸ’‘ Feature Requests
  • πŸ“– Documentation Improvements
  • πŸ”§ Code Contributions

πŸ‘‹ Before writing code: We kindly ask that you open a discussion or issue first to discuss your proposed changes. This helps ensure your time is well-spent on features or fixes that align with the project's direction and prevents duplicate efforts.

Check out our Contribution Guide to find more details on how to get started.

πŸ“œ License

Sake is released under the MIT License. See the LICENSE file for details.