Skip to content

Commit

Permalink
Pass baseDirectory to coffee and less compilation commands.
Browse files Browse the repository at this point in the history
Before we were running them based on the current working directory; however, in
situations where sbt-resource-management is attached to subprojects, the base
directory for the commands should be the subproject directories rather than the
project directory. This particular bug had been corrected for compass, but not for
coffee and less.
  • Loading branch information
Shadowfiend committed Aug 19, 2013
1 parent da0dd85 commit 63c63d9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/scala/com/openstudy/sbt/ResourceManagementPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ package com.openstudy { package sbt {


object ResourceManagementPlugin extends Plugin {
case class PathInformation(source:String, target:String)
case class PathInformation(source:String, target:String, workingDirectory: File)
abstract class CompileResult {
protected val runtime = java.lang.Runtime.getRuntime

Expand All @@ -35,12 +35,18 @@ package com.openstudy { package sbt {
class CsCompileResult(info:PathInformation) extends CompileResult {
protected lazy val process = runtime.exec(
("coffee" :: "-o" :: info.target ::
"-c" :: info.source :: Nil).toArray)
"-c" :: info.source :: Nil).toArray,
null, // inherit environment
info.workingDirectory
)
}
class LessCompileResult(info:PathInformation) extends CompileResult {
protected lazy val process = {
runtime.exec(
("lessc" :: info.source :: info.target :: Nil).toArray)
("lessc" :: info.source :: info.target :: Nil).toArray,
null, // inherit environment
info.workingDirectory
)
}
}

Expand Down Expand Up @@ -132,7 +138,8 @@ package com.openstudy { package sbt {
if (targetIsDirectory)
IO.relativize(baseDirectory, destinationDirectory).get
else
IO.relativize(baseDirectory, destinationDirectory / (file.base + "." + targetExtension)).get
IO.relativize(baseDirectory, destinationDirectory / (file.base + "." + targetExtension)).get,
baseDirectory
)
}

Expand Down

0 comments on commit 63c63d9

Please sign in to comment.