Skip to content

Commit

Permalink
Merge branch 'release/0.3-gibbon'
Browse files Browse the repository at this point in the history
  • Loading branch information
wspringer committed Apr 18, 2013
2 parents a2881fb + 6a4c203 commit ec3ccaf
Show file tree
Hide file tree
Showing 46 changed files with 698 additions and 172 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ Download the monkeyman jar from the Downloads section. Start it with

## Changes

0.3 Gibbon

*Breaking changes:*

* The general pattern now is to move *.html.scaml into *.html files, *.js.coffee files into *.js files, and so on. In line with Middleman's approach.

*Other changes:*

* 2012-03-13: Genuine YAML support (decent YAML parser used now).
* 2012-03-13: Added summary and subtitle for every resource.
* 2012-12-21: Add switch to switch directory browsing on/off.
* 2012-12-21: Fix for allResources not getting updated when new files appear.
* 2013-04-18: Added coffeescript transpiler support.
* 2013-04-18: Added image resizing support.

0.2

* 2012-02-20: Default site template (no need to start creating a layout)
Expand Down
23 changes: 14 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@ import AssemblyKeys._

name := "monkeyman"

version := "0.2"
version := "0.3"

scalaVersion := "2.8.1"
scalaVersion := "2.9.2"

libraryDependencies ++= Seq(
"org.pegdown" % "pegdown" % "1.1.0",
"org.fusesource.scalamd" % "scalamd" % "1.5",
"joda-time" % "joda-time" % "2.0",
"eu.medsea.mimeutil" % "mime-util" % "2.1.3" intransitive,
"commons-io" % "commons-io" % "2.1",
"commons-io" % "commons-io" % "2.4",
"org.joda" % "joda-convert" % "1.2",
"org.fusesource.scalate" % "scalate-core" % "1.5.2-scala_2.8.1",
"org.clapper" %% "argot" % "0.3.3",
"org.fusesource.scalate" % "scalate-core" % "1.5.3",
"org.clapper" %% "argot" % "0.4",
"com.ibm.icu" % "icu4j" % "4.8.1.1",
"ch.qos.logback" % "logback-core" % "1.0.0",
"ch.qos.logback" % "logback-classic" % "1.0.0",
"com.asual.lesscss" % "lesscss-engine" % "1.1.5"
"com.asual.lesscss" % "lesscss-engine" % "1.1.5",
"org.yaml" % "snakeyaml" % "1.10",
"org.jsoup" % "jsoup" % "1.6.3"
// "org.imgscalr" % "imgscalr-lib" % "4.2"
)

resolvers ++= Seq(
Expand All @@ -34,9 +37,9 @@ mainClass in (Compile, run) := Some("nl.flotsam.monkeyman.Monkeyman")

mainClass in (Compile, packageBin) := Some("nl.flotsam.monkeyman.Monkeyman")

seq(ProguardPlugin.proguardSettings :_*)

proguardOptions ++= List(keepMain("nl.flotsam.monkeyman.Monkeyman"), "-keepclasseswithmembers class org.pegdown.**", "-keepclasseswithmembers class org.parboiled.**")
//seq(ProguardPlugin.proguardSettings :_*)
//
//proguardOptions ++= List(keepMain("nl.flotsam.monkeyman.Monkeyman"), "-keepclasseswithmembers class org.pegdown.**", "-keepclasseswithmembers class org.parboiled.**")

seq(assemblySettings: _*)

Expand All @@ -47,3 +50,5 @@ jarName in assembly := "monkeyman.jar"
fork in run := true

connectInput in run := true

compileOrder := CompileOrder.JavaThenScala
Binary file added lib/imgscalr-lib-4.3-SNAPSHOT.jar
Binary file not shown.
9 changes: 6 additions & 3 deletions project/plugins/build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-proguard-plugin" % (v+"-0.1.1"))
//libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-proguard-plugin" % (v+"-0.1.1"))

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.7.3")
resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

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

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.4")

resolvers += Resolver.url("sbt-plugin-releases",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.eed3si9n" % "sbt-inspectr" % "0.0.2")
1 change: 1 addition & 0 deletions src/main/resources/mime-types.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rss=application/rss+xml
20 changes: 12 additions & 8 deletions src/main/scala/nl/flotsam/monkeyman/ClasspathResource.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -27,20 +27,24 @@ case class ClasspathResource(path: String) extends Resource {

val url = getClass.getResource("/" + path)

def title = None
val title = None

def pubDateTime = LocalDateTime.now()
def subtitle = None

def contentType = MimeUtil.getMimeTypes(url).asInstanceOf[java.util.Set[MimeType]].head.toString
def summary = None

def open = url.openStream()
val pubDateTime = LocalDateTime.now()

val contentType = MimeUtil.getMimeTypes(url).asInstanceOf[java.util.Set[MimeType]].head.toString

val open = url.openStream()

def tags = Set.empty

def published = true
val published = true

def asHtmlFragment = None
val asHtmlFragment = None

def id = path
val id = path

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -19,11 +19,6 @@

package nl.flotsam.monkeyman

import org.joda.time.LocalDateTime
import collection.JavaConversions._
import eu.medsea.mimeutil.detector.ExtensionMimeDetector
import eu.medsea.mimeutil.{MimeType, MimeUtil}


class ClasspathResourceLoader(paths: Seq[String], loader: ResourceLoader) extends ResourceLoader {

Expand All @@ -39,8 +34,10 @@ class ClasspathResourceLoader(paths: Seq[String], loader: ResourceLoader) extend
loader.register(new ResourceListener {
def deleted(id: String) {
resources.find(_.id == id) match {
case Some(resource) => listener.modified(resource)
case None => listener.deleted(id)
case Some(resource) =>
listener.modified(resource)
case None =>
listener.deleted(id)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -19,7 +19,7 @@

package nl.flotsam.monkeyman

class DecoratingResourceLoader(loader: ResourceLoader, decorators: ResourceDecorator*) extends ResourceLoader {
class DecoratingResourceLoader(loader: ResourceLoader, decorators: List[ResourceDecorator]) extends ResourceLoader {

def load = loader.load.map(decorate)

Expand Down
8 changes: 7 additions & 1 deletion src/main/scala/nl/flotsam/monkeyman/FileSystemResource.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -33,6 +33,10 @@ case class FileSystemResource(baseDir: File, path: String) extends Resource {

lazy val title = None

val subtitle = None

val summary = None

lazy val pubDateTime = new LocalDateTime(file.lastModified())

lazy val contentType = MimeUtil.getMimeTypes(file).asInstanceOf[java.util.Set[MimeType]].head.toString
Expand All @@ -47,4 +51,6 @@ case class FileSystemResource(baseDir: File, path: String) extends Resource {

def id = path

override def supportsPathRewrite = !file.isDirectory

}
37 changes: 23 additions & 14 deletions src/main/scala/nl/flotsam/monkeyman/FileSystemResourceLoader.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -19,17 +19,18 @@

package nl.flotsam.monkeyman

import org.apache.commons.io.FileUtils
import nl.flotsam.monkeyman.ext.ResourceUtils
import org.apache.commons.io.filefilter._
import org.apache.commons.io.FileUtils
import collection.mutable.Buffer
import name.pachler.nio.file.StandardWatchEventKind._
import java.io.{FileFilter, File}
import collection.JavaConversions
import JavaConversions._
import util.Logging
import name.pachler.nio.file._
import java.util.concurrent.{ExecutorService, Executors}
import java.util.concurrent.Executors
import org.apache.commons.io.filefilter._
import scala.Some

class FileSystemResourceLoader(baseDir: File)
extends ResourceLoader with Logging {
Expand Down Expand Up @@ -63,33 +64,37 @@ class FileSystemResourceLoader(baseDir: File)
keys.get(watchKey) match {
case Some(dir) =>
val events = watchKey.pollEvents().toList
watchKey.reset()
for (event <- events) {
if (event.kind() == ENTRY_CREATE) {
val kind = event.kind()
if (kind == ENTRY_CREATE) {
val created = dir.resolve(event.context().asInstanceOf[Path])
if ((new File(created.toString)).isDirectory) {
debug("Added directory {}", created)
keys += created.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) -> created
listeners.map(_.added(new FileSystemResource(baseDir, relative(created))))
} else {
debug("Added file {}", created)
listeners.map(_.added(new FileSystemResource(baseDir, relative(created))))
}
}
else if (event.kind() == ENTRY_DELETE) {
val deleted = dir.resolve(event.context().asInstanceOf[Path])
else if (kind == ENTRY_DELETE) {
val path = event.context().asInstanceOf[Path]
val deleted = dir.resolve(path)
debug("Deleted {}", deleted)
listeners.map(_.deleted(relative(deleted)))
}
else if (event.kind() == ENTRY_MODIFY) {
else if (kind == ENTRY_MODIFY) {
val modified = dir.resolve(event.context().asInstanceOf[Path])
if (!(new File(modified.toString)).isDirectory) {
debug("Modified {}", modified)
listeners.map(_.modified(new FileSystemResource(baseDir, relative(modified))))
}
}
} else warn("Got unexpected type " + kind)
}
case _ =>
warn("Illegal state, time to restart")
}
watchKey.reset()
}
}
})
Expand All @@ -103,17 +108,21 @@ class FileSystemResourceLoader(baseDir: File)
}

def load(file: File) = {
new FileSystemResource(baseDir, ResourceUtils.getRelativePath(file.getAbsolutePath, baseDir.getAbsolutePath,
File.separator))
val relative =
if (file == baseDir) ""
else ResourceUtils.getRelativePath(file.getAbsolutePath, baseDir.getAbsolutePath, File.separator)
new FileSystemResource(baseDir, relative)
}

def load = {
FileUtils.listFiles(baseDir,
FileUtils.listFilesAndDirs(baseDir,
new NotFileFilter(
new OrFileFilter(
List(
new PrefixFileFilter(".#"),
new SuffixFileFilter("~")
new SuffixFileFilter("~"),
new PrefixFileFilter("."),
new RegexFileFilter("^#[^#]*#$")
)
)
), TrueFileFilter.INSTANCE).map(load).toSeq
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/nl/flotsam/monkeyman/LayoutResolver.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/nl/flotsam/monkeyman/Monkeyman.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Monkeyman static web site generator
* Copyright (C) 2012 Wilfred Springer
* Copyright (C) 2013 Wilfred Springer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down
Loading

0 comments on commit ec3ccaf

Please sign in to comment.