Skip to content

Marathon makes it easy to write, run and manage your Swift scripts ๐Ÿƒ

License

Notifications You must be signed in to change notification settings

gradyjenkins/Marathon

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

87 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Marathon

Welcome to Marathon, a command line tool that makes it easy to write, run and manage your Swift scripts. It's powered by the Swift Package Manager and requires no modification to your existing scripts or dependency packages.

Features

๐Ÿฃ Create scripts

$ marathon create helloWorld "import Foundation; print(\"Hello world\")"

๐Ÿƒโ€โ™€๏ธ Run scripts

$ marathon run helloWorld
> Hello world

๐Ÿ“ฆ Hassle free dependency management. Simply add a package...

$ marathon add [email protected]:JohnSundell/Files.git

...and use it without any additional work

import Files

for file in try Folder(path: "MyFolder").files {
    print(file.name)
}

๐Ÿš€ Update all of your scripting dependencies with a single call

$ marathon update

โš’ Edit, run & debug your scripts using Xcode...

$ marathon edit helloWorld

...or in your favorite text editor

$ marathon edit helloWorld --no-xcode

๐Ÿ’ป Install scripts as binaries and run them independently from anywhere...

$ marathon install helloWorld
$ helloWorld
> Hello world

...you can even install remote scripts (+ their dependencies) from a URL:

$ marathon install https://raw.githubusercontent.com/JohnSundell/Marathon-Examples/master/AddSuffix/AddSuffix.swift
$ cd myImages
$ addSuffix "@2x"
> Added suffix "@2x" to 15 files

๐Ÿ‘ช Share your scripts with your team and automatically install their dependencies:

$ echo "[email protected]:JohnSundell/Files.git" > Marathonfile
$ marathon run mySharedScript

Installing

Using Make:

$ git clone [email protected]:JohnSundell/Marathon.git
$ cd Marathon
$ make

Using the Swift Package Manager:

$ git clone [email protected]:JohnSundell/Marathon.git
$ cd Marathon
$ swift build -c release -Xswiftc -static-stdlib
$ cp -f .build/release/Marathon /usr/local/bin/marathon

If you encounter a permissions failure while installing, you may need to prepend sudo to the commands. To update Marathon, simply repeat any of the above two series of commands, except cloning the repo.

Requirements

Marathon requires the following to be installed on your system:

  • Swift 3.1 or later (bundled with Xcode 8.3 or later)
  • Git
  • Xcode (if you want to edit scripts using it)

Examples

Check out this repository for a few example Swift scripts that you can run using Marathon.

Using a Marathonfile

To easily define dependencies for a script in a declarative way, you can create a Marathonfile in the same folder as your script. This file is simply a new line separated list of URLs pointing to either:

  • The URL to a git repository of a local or remote package to install before running your script.
  • The path to another script that should be linked to your script before running it.

By using a Marathonfile you can ensure that the required dependencies will be installed when sharing your script with team members, friends or the wider community.

Here is an example of a Marathonfile:

[email protected]:JohnSundell/Files.git
[email protected]:JohnSundell/Unbox.git
[email protected]:JohnSundell/Wrap.git
~/packages/MyPackage
otherScript.swift

Help, feedback or suggestions?

  • Run $ marathon help to display help for the tool itself or for any specific command.
  • Open an issue if you need help, if you found a bug, or if you want to discuss a feature request.
  • Open a PR if you want to make some change to Marathon.
  • Contact @johnsundell on Twitter for discussions, news & announcements about Marathon.

About

Marathon makes it easy to write, run and manage your Swift scripts ๐Ÿƒ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 99.7%
  • Makefile 0.3%