GitHub - andrewoma/kotlin-scripting-kickstarter: A kickstarter demonstrating Kotlin as a scripting language with IDE development (original) (raw)

Kotlin Scripting Kickstarter

Kotlin Scripting Kickstarter demonstrates how Kotlin can be used as a scripting language.

Clone this project as a starting point for developing scripts in Kotlin.

Kickstarter Features

Quick Start

All you need to get going is a JDK installed and a unix-ish environment.

$ git clone https://github.com/andrewoma/kotlin-scripting-kickstarter kotlin-scripts $ cd kotlin-scripts/ $ ./gradlew check copyToLib $ export PATH=$PATH:pwd/kotlin $ helloworld.kt $ vi which helloworld.kt # Make some changes $ helloworld.kt # See the results (takes a few seconds to compile) $ helloworld.kt # Runs in around 100ms now that it is pre-compiled

Now open the cloned project in IntelliJ and edit and run the scripts within the IDE.

Examples

See histogram.kt for a sample script that generates a chart usingarg4j for command line parsing and jfreechart for chart generation.

How it works

Limitations

Stuck behind an authenticating proxy?

Both git and gradle need to be configured to work via a proxy.

For git, add the following to ~/.gitconfig :

[http]
    proxy = http://<user>:<password>@<proxy_host>:<proxy_port>

For gradle, the following seems to work with both gradle and gradlew:

export GRADLE_OPTS='-Dhttp.proxyHost=<proxy_host> -Dhttp.proxyPort=<proxy_port> -Dhttp.proxyUser=<user> -Dhttp.proxyPassword=<password>'

Alternatives

kotlin-script provides traditional scripting support for Kotlin. The main advantage of the kickstarter approach is that supports full IDE development.

License

This project is licensed under a MIT license.

Build Status