Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sbt plugin for jruby

Is there a plugin for sbt available which automatically installs JRuby and adds some hooks to automatically run scripts at certain points (e.g. before compilation).

Background: For a (lift) project, I want to use sass, or more specifically, compass as a tool for generating the css. A Java or Scala clone of sass would not be enough, unfortunately.

Of course, It wouldn’t be a problem at all to just generate the css manually and then put both inside the repository and no-one ever needs to care about it.

On the other hand, to ease development on several systems, I’d rather have a clear dependency inside sbt which simply does the work.

Is there any way to achieve this?
Or generally: Is there a way to run JRuby scripts from inside Scala?

Edit Added maven-2 to the tags. Maybe there is a maven repo for JRuby which allows me to deliver and use it somehow.

like image 727
Debilski Avatar asked Nov 26 '10 19:11

Debilski


1 Answers

While it's perhaps not the most elegant solution, you can always call external scripts using the Process support in SBT.

import sbt._
import Process._

class Project(info: ProjectInfo) extends DefaultProject(info) {
  lazy val runSomething = task {
    "ruby somescript.rb" ! log
    None
  }
}

There's a bit more info about the external process support available here: http://code.google.com/p/simple-build-tool/wiki/Process

like image 151
Thomas Lockney Avatar answered Sep 28 '22 05:09

Thomas Lockney