A plugin for SBT generating shell scripts which run your projects

Download Build Status Join the chat at https://gitter.im/sbt-runfast/Lobby

sbt-runfast

Generates a shell script which lets you easily run your main class without SBT (much faster than sbt run!).

Usage

The plugin is hosted in sbt-plugin-releases repository so you can simply add the following line to your global ~/.sbt/0.13/plugins/plugins.sbt to make it available in all of your projects:

addSbtPlugin("pl.tues" % "sbt-runfast" % "0.1")

Alternatively, you can enable it per-project by adding the above line to <your-project>/project/plugins.sbt.

Next, run:

sbt runfastGenerate

inside your project. It will generate a script called runfast.sh in the target/ directory. Running your program now is straightforward:

target/runfast.sh

The script uses absolute paths, so you can run it from anywhere:

/path/to/your/project/target/runfast.sh

You can even copy it somewhere else and run from there.

The script passes all arguments to your program. This was actually the reason I wrote the plugin, as I wanted to use Bash's temporary files as arguments to my program:

target/runfast.sh foo <(grep bar baz | head)

Speed is a nice side-effect.

Requirements

This plugin requires sbt 0.13.5+, /bin/bash and chmod. I might add support for other platforms in the future, but I don't need it myself, so contributions are welcome.

How does it work?

The plugin simply generates a file target/runfast.sh containing something like:

#!/bin/bash

java -cp '<fullClasspath>' '<mainClass>'

Really simple, but saves a lot of time!

Contributing

Got an idea how to improve the code, tests or docs? All contributions are welcome!

Building your own version

It's really simple, just run:

sbt publishLocal

and the plugin will be published to your local repository (e.g. ~/.ivy2/local/). You can then change the version in your plugins.sbt:

addSbtPlugin("pl.tues" % "sbt-runfast" % "0.2-SNAPSHOT")

Testing

Run sbt scripted for sbt script tests.

Questions?

Feel free to ask in sbt-runfast Gitter room!