Gilt/AOL Hackathon Scala Bootstrap
Scala Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README
build.sbt
sbt
sbt-launch.jar
sbt.bat

README

Gilt/AOL Hackathon Scala Starter
6 January 2012
Eric Bowman/ebowman@gilt.com

This should "just work" once you've cloned this repo.

I've created a little shell program, that uses actors to stream an http response. We'll modify this starter program to implement a Shoutcast server during the hackathon.

To run it, from a bash shell, do:

./sbt

The first time, this will download a bunch of dependencies:

$ ./sbt
[info] Loading global plugins from /Users/ebowman/.sbt/plugins
[info] Updating {file:/Users/ebowman/.sbt/plugins/}default-a208a2...
[info] Resolving com.github.mpeltonen#sbt-idea;0.11.0 ...
[info] Resolving commons-io#commons-io;2.0.1 ...
[info] Resolving org.apache.commons#commons-parent;15 ...
[info] Resolving org.apache#apache;7 ...
[info] Resolving org.scala-tools.sbt#sbt_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#main_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#actions_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#classfile_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#io_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#control_2.9.1;0.11.2 ...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving org.scala-tools.sbt#interface;0.11.2 ...
[info] Resolving org.scala-tools.sbt#logging_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#process_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#classpath_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#launcher-interface_2.9.1;0.11.2 ...
[info] Resolving org.scala-lang#scala-compiler;2.9.1 ...
[info] Resolving org.scala-tools.sbt#incremental-compiler_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#collections_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#api_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#persist_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.9.0;0.4.0 ...
[info] Resolving org.scala-tools.sbt#compile_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#ivy_2.9.1;0.11.2 ...
[info] Resolving org.apache.ivy#ivy;2.2.0 ...
[info] Resolving org.apache#apache;7 ...
[info] Resolving com.jcraft#jsch;0.1.31 ...
[info] Resolving commons-httpclient#commons-httpclient;3.1 ...
[info] Resolving commons-logging#commons-logging;1.0.4 ...
[info] Resolving commons-codec#commons-codec;1.2 ...
[info] Resolving org.scala-tools.sbt#completion_2.9.1;0.11.2 ...
[info] Resolving jline#jline;0.9.94 ...
[info] Resolving org.scala-tools.sbt#run_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#task-system_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#tasks_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#tracking_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#cache_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#testing_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.testing#test-interface;0.5 ...
[info] Resolving org.scala-tools.sbt#compiler-interface;0.11.2 ...
[info] Resolving org.scala-tools.sbt#precompiled-2_8_1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#precompiled-2_8_0;0.11.2 ...
[info] Resolving org.scala-tools.sbt#precompiled-2_9_0;0.11.2 ...
[info] downloading http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.jar ...
[info]  [SUCCESSFUL ] com.github.mpeltonen#sbt-idea;0.11.0!sbt-idea.jar (3249ms)
[info] downloading http://repo1.maven.org/maven2/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar ...
[info]  [SUCCESSFUL ] commons-io#commons-io;2.0.1!commons-io.jar (2020ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.11.2/jars/sbt_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#sbt_2.9.1;0.11.2!sbt_2.9.1.jar (997ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/main_2.9.1/0.11.2/jars/main_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#main_2.9.1;0.11.2!main_2.9.1.jar (12604ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/compiler-interface/0.11.2/jars/compiler-interface-src.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#compiler-interface;0.11.2!compiler-interface-src.jar (879ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/compiler-interface/0.11.2/jars/compiler-interface-bin.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#compiler-interface;0.11.2!compiler-interface-bin.jar (1437ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/precompiled-2_8_1/0.11.2/jars/compiler-interface-bin.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#precompiled-2_8_1;0.11.2!compiler-interface-bin.jar (1060ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/precompiled-2_8_0/0.11.2/jars/compiler-interface-bin.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#precompiled-2_8_0;0.11.2!compiler-interface-bin.jar (1107ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/precompiled-2_9_0/0.11.2/jars/compiler-interface-bin.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#precompiled-2_9_0;0.11.2!compiler-interface-bin.jar (1205ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/actions_2.9.1/0.11.2/jars/actions_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#actions_2.9.1;0.11.2!actions_2.9.1.jar (2159ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/interface/0.11.2/jars/interface.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#interface;0.11.2!interface.jar (894ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/io_2.9.1/0.11.2/jars/io_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#io_2.9.1;0.11.2!io_2.9.1.jar (1542ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/ivy_2.9.1/0.11.2/jars/ivy_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#ivy_2.9.1;0.11.2!ivy_2.9.1.jar (2328ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/launcher-interface_2.9.1/0.11.2/jars/launcher-interface_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#launcher-interface_2.9.1;0.11.2!launcher-interface_2.9.1.jar (759ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/logging_2.9.1/0.11.2/jars/logging_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#logging_2.9.1;0.11.2!logging_2.9.1.jar (942ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/process_2.9.1/0.11.2/jars/process_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#process_2.9.1;0.11.2!process_2.9.1.jar (1075ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/run_2.9.1/0.11.2/jars/run_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#run_2.9.1;0.11.2!run_2.9.1.jar (1110ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/classfile_2.9.1/0.11.2/jars/classfile_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#classfile_2.9.1;0.11.2!classfile_2.9.1.jar (975ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/classpath_2.9.1/0.11.2/jars/classpath_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#classpath_2.9.1;0.11.2!classpath_2.9.1.jar (997ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/incremental-compiler_2.9.1/0.11.2/jars/incremental-compiler_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#incremental-compiler_2.9.1;0.11.2!incremental-compiler_2.9.1.jar (1122ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/persist_2.9.1/0.11.2/jars/persist_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#persist_2.9.1;0.11.2!persist_2.9.1.jar (1055ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/compile_2.9.1/0.11.2/jars/compile_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#compile_2.9.1;0.11.2!compile_2.9.1.jar (1150ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/completion_2.9.1/0.11.2/jars/completion_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#completion_2.9.1;0.11.2!completion_2.9.1.jar (2207ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/api_2.9.1/0.11.2/jars/api_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#api_2.9.1;0.11.2!api_2.9.1.jar (2809ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/task-system_2.9.1/0.11.2/jars/task-system_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#task-system_2.9.1;0.11.2!task-system_2.9.1.jar (1959ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/tasks_2.9.1/0.11.2/jars/tasks_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#tasks_2.9.1;0.11.2!tasks_2.9.1.jar (1818ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/tracking_2.9.1/0.11.2/jars/tracking_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#tracking_2.9.1;0.11.2!tracking_2.9.1.jar (983ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/testing_2.9.1/0.11.2/jars/testing_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#testing_2.9.1;0.11.2!testing_2.9.1.jar (926ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/control_2.9.1/0.11.2/jars/control_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#control_2.9.1;0.11.2!control_2.9.1.jar (1091ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/collections_2.9.1/0.11.2/jars/collections_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#collections_2.9.1;0.11.2!collections_2.9.1.jar (2065ms)
[info] downloading http://repo1.maven.org/maven2/org/scala-tools/sbinary/sbinary_2.9.0/0.4.0/sbinary_2.9.0-0.4.0.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbinary#sbinary_2.9.0;0.4.0!sbinary_2.9.0.jar (1371ms)
[info] downloading http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar ...
[info]  [SUCCESSFUL ] org.apache.ivy#ivy;2.2.0!ivy.jar (3123ms)
[info] downloading http://repo1.maven.org/maven2/com/jcraft/jsch/0.1.31/jsch-0.1.31.jar ...
[info]  [SUCCESSFUL ] com.jcraft#jsch;0.1.31!jsch.jar (1264ms)
[info] downloading http://repo1.maven.org/maven2/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar ...
[info]  [SUCCESSFUL ] commons-httpclient#commons-httpclient;3.1!commons-httpclient.jar (1517ms)
[info] downloading http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar ...
[info]  [SUCCESSFUL ] commons-logging#commons-logging;1.0.4!commons-logging.jar (997ms)
[info] downloading http://repo1.maven.org/maven2/commons-codec/commons-codec/1.2/commons-codec-1.2.jar ...
[info]  [SUCCESSFUL ] commons-codec#commons-codec;1.2!commons-codec.jar (1001ms)
[info] downloading http://repo1.maven.org/maven2/jline/jline/0.9.94/jline-0.9.94.jar ...
[info]  [SUCCESSFUL ] jline#jline;0.9.94!jline.jar (1046ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/cache_2.9.1/0.11.2/jars/cache_2.9.1.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.sbt#cache_2.9.1;0.11.2!cache_2.9.1.jar (1732ms)
[info] downloading http://repo1.maven.org/maven2/org/scala-tools/testing/test-interface/0.5/test-interface-0.5.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.testing#test-interface;0.5!test-interface.jar (622ms)
[info] Done updating.
[info] Set current project to scala-shoutcast (in build file:/Users/ebowman/src/ScalaBootstrap/)

When it's ready to go, it will give you a prompt like:

>

Here you type "run", and it will compile and startup a server:

> run
[info] Updating {file:/Users/ebowman/src/ScalaBootstrap/}default-a3c2fb...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving cc.spray.can#spray-can;0.9.1 ...
[info] Resolving se.scalablesolutions.akka#akka-actor;1.2 ...
[info] Resolving org.slf4j#slf4j-api;1.6.1 ...
[info] Resolving org.slf4j#slf4j-parent;1.6.1 ...
[info] Resolving ch.qos.logback#logback-classic;0.9.28 ...
[info] Resolving ch.qos.logback#logback-parent;0.9.28 ...
[info] Resolving ch.qos.logback#logback-core;0.9.28 ...
[info] Resolving ch.qos.logback#logback-parent;0.9.28 ...
[info] Resolving org.scalatest#scalatest_2.9.1;1.6.1 ...
[info] Resolving org.scala-tools.testing#scalacheck_2.9.1;1.9 ...
[info] Resolving org.scala-tools.testing#test-interface;0.5 ...
[info] downloading http://scala-tools.org/repo-releases/cc/spray/can/spray-can/0.9.1/spray-can-0.9.1.jar ...
[info]  [SUCCESSFUL ] cc.spray.can#spray-can;0.9.1!spray-can.jar (3371ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/ch/qos/logback/logback-classic/0.9.28/logback-classic-0.9.28.jar ...
[info]  [SUCCESSFUL ] ch.qos.logback#logback-classic;0.9.28!logback-classic.jar (1913ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/ch/qos/logback/logback-core/0.9.28/logback-core-0.9.28.jar ...
[info]  [SUCCESSFUL ] ch.qos.logback#logback-core;0.9.28!logback-core.jar (1759ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/se/scalablesolutions/akka/akka-actor/1.2/akka-actor-1.2.jar ...
[info]  [SUCCESSFUL ] se.scalablesolutions.akka#akka-actor;1.2!akka-actor.jar (5238ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar ...
[info]  [SUCCESSFUL ] org.slf4j#slf4j-api;1.6.1!slf4j-api.jar (664ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/org/scalatest/scalatest_2.9.1/1.6.1/scalatest_2.9.1-1.6.1.jar ...
[info]  [SUCCESSFUL ] org.scalatest#scalatest_2.9.1;1.6.1!scalatest_2.9.1.jar (13181ms)
[info] downloading http://repo.typesafe.com/typesafe/releases/org/scala-tools/testing/scalacheck_2.9.1/1.9/scalacheck_2.9.1-1.9.jar ...
[info]  [SUCCESSFUL ] org.scala-tools.testing#scalacheck_2.9.1;1.9!scalacheck_2.9.1.jar (2524ms)
[info] Done updating.
[info] Compiling 1 Scala source to /Users/ebowman/src/ScalaBootstrap/target/scala-2.9.1/classes...
[info] Running com.gilt.hackathon.Main 
01/10 22:36:16.180 INFO [run-main] c.s.c.HttpServer - Starting spray-can HTTP server on localhost/127.0.0.1:8080

Now you can hit http://localhost:8080, and get a page with a link to stream a file. We'll develop this as part of the hackathon.

Type ctl-c to stop the server.

Subsequent runs are a lot less hassle:

$ ./sbt
[info] Loading global plugins from /Users/ebowman/.sbt/plugins
[info] Set current project to scala-shoutcast (in build file:/Users/ebowman/src/ScalaBootstrap/)
> run
[info] Running com.gilt.hackathon.Main 
01/10 22:37:25.124 INFO [run-main] c.s.c.HttpServer - Starting spray-can HTTP server on localhost/127.0.0.1:8080

SBT & IDEs
==========

To integrate sbt with IntelliJ:

    Add the following lines to ~/.sbt/plugins/build.sbt or PROJECT_DIR/project/plugins.sbt

    resolvers += "boboco-repo" at "http://boboco.ie/repo"

    addSbtPlugin("com.github.mpeltonen" %% "sbt-idea" % "0.11.0")

    use gen-idea sbt task to create Idea project files

    (e.g., ./sbt gen-idea)

    See https://github.com/mpeltonen/sbt-idea

To integrate sbt with Eclipse:

    Add the following lines to ~/.sbt/plugins/build.sbt or PROJECT_DIR/project/plugins.sbt

    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0-M3")

    use eclipse sbt task to create Eclipse project files

    (e.g., ./sbt eclipse)

    See https://github.com/typesafehub/sbteclipse