Skip to content

Commit

Permalink
small refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
softprops committed Aug 18, 2013
1 parent 90d31a1 commit f960641
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions build.sbt
Expand Up @@ -9,11 +9,10 @@ name := "less-sbt"
//scalaVersion in Global := "2.10.2"

version <<= sbtVersion(v =>
if (v.startsWith("0.11") || v.startsWith("0.12") || v.startsWith("0.13")) "0.2.0-SNAPSHOT"
if (v.startsWith("0.11") || v.startsWith("0.12") || v.startsWith("0.13")) "0.2.0"
else error("unsupported sbt version %s" format v)
)


scalacOptions ++= Seq("-deprecation")//, "-feature")

resolvers += "softprops-maven" at "http://dl.bintray.com/content/softprops/maven"
Expand All @@ -31,8 +30,8 @@ description := "Sbt plugin for compiling Less CSS sources"
// ls bug https://github.com/softprops/ls/issues/54
//(externalResolvers in LsKeys.lsync) <<= (publishTo) map { _.get :: Nil }

homepage :=
Some(url("https://github.com/softprops/less-sbt"))
homepage <<= (name)( name =>
Some(url("https://github.com/softprops/%s".format(name))))

publishTo := Some(Classpaths.sbtPluginReleases)

Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/less.scala
Expand Up @@ -17,7 +17,7 @@ object NonFatal {
def unapply(t: Throwable): Option[Throwable] = if (apply(t)) Some(t) else None
}

/** An sbt plugin interface for lesscss.org 1.3.0 compiler */
/** sbt frontend for lesst less css compiler */
object Plugin extends sbt.Plugin {

object LessKeys {
Expand Down Expand Up @@ -59,22 +59,22 @@ object Plugin extends sbt.Plugin {
.fold({
case ce: lesst.CompilationError => throw ce
case NonFatal(e) => throw new RuntimeException(
"unexpected compilation error: %s" format e.getMessage, e)
"unexpected less css compilation error: %s" format e.getMessage, e)
}, {
case lesst.StyleSheet(css, imports) =>
IO.write(lessFile.cssFile, css)
log.debug("Wrote css to file %s" format lessFile.cssFile)
IO.write(lessFile.importsFile, imports mkString Files.ImportsDelimiter)
log.debug("Wrote imports to file %s" format lessFile.importsFile)
lessFile.cssFile
lessFile.cssFile
})
} catch {
case NonFatal(e) => throw new RuntimeException(
"Error occured while compiling %s:\n%s" format(
lessFile, e.getMessage), e)
}

private def allCompilerTask =
private def allCompileTask =
(streams, sourceDirectory in lesskey,
resourceManaged in lesskey, target in lesskey,
filter in lesskey, excludeFilter in lesskey,
Expand Down Expand Up @@ -144,7 +144,7 @@ object Plugin extends sbt.Plugin {
unmanagedSources in lesskey <<= lessSourcesTask,
clean in lesskey <<= lessCleanTask,
lesskey <<= lessCompileTask,
all in lesskey <<= allCompilerTask,
all in lesskey <<= allCompileTask,
lessCompiler in lesskey <<= lessCompilerTask
)
}
14 changes: 7 additions & 7 deletions src/sbt-test/less-sbt/check-dependencies/test
@@ -1,14 +1,14 @@
# `imports` files should be generated
> less
$ exists target/less-1.3.0/main.less.imports
$ exists target/less-1.3.0/alone.less.imports
$ exists target/less-1.3.0/nested/main.less.imports
> contents target/less-1.3.0/main.less.imports fixtures/main.less.imports
> contents target/less-1.3.0/alone.less.imports fixtures/alone.less.imports
> contents target/less-1.3.0/nested/main.less.imports fixtures/nested-main.less.imports
$ exists target/less-1.4.2/main.less.imports
$ exists target/less-1.4.2/alone.less.imports
$ exists target/less-1.4.2/nested/main.less.imports
> contents target/less-1.4.2/main.less.imports fixtures/main.less.imports
> contents target/less-1.4.2/alone.less.imports fixtures/alone.less.imports
> contents target/less-1.4.2/nested/main.less.imports fixtures/nested-main.less.imports
# changing of sub.less should trigger main.less recompilation
$ touch src/main/less/sub.less
> less
$ newer target/scala-2.9.2/resource_managed/main/css/main.css src/main/less/sub.less
#> less::clean-files
#-$ exists target/less-1.3.0/
#-$ exists target/less-1.4.2/

0 comments on commit f960641

Please sign in to comment.