Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed grizzled dep for eglob.

  • Loading branch information...
commit 11531f28e30f4f6345da0e84c0cf212fe11c12d6 1 parent c3a0b10
@dansimpson authored
View
7 core/buildfile
@@ -5,7 +5,6 @@ Java.classpath << "src/resources"
repositories.remote << "http://repo1.maven.org/maven2/"
repositories.remote << "http://www.asual.com/maven/content/groups/public"
-GRIZZLED = "org.clapper:grizzled-scala_2.8.1:jar:1.0.4"
YUI = "com.yahoo.platform.yui:yuicompressor:jar:2.4.6"
LESSENGINE = "com.asual.lesscss:lesscss-engine:jar:1.0.43"
@@ -15,11 +14,11 @@ define "satchel" do
extend PomGenerator
project.group = "org.ds"
- project.version = 0.1
+ project.version = 0.2
manifest["Copyright"] = "Dan Simpson (C) 2011"
manifest["Implementation-Vendor"] = "Dan Simpson"
- compile.with transitive(GRIZZLED), transitive(YUI), transitive(LESSENGINE)
- run.with transitive(GRIZZLED), transitive(YUI), transitive(LESSENGINE)
+ compile.with transitive(YUI), transitive(LESSENGINE)
+ run.with transitive(YUI), transitive(LESSENGINE)
end
View
11 core/src/main/scala/org/ds/satchel/Satchel.scala
@@ -26,13 +26,15 @@
package org.ds.satchel
+import org.ds.satchel.util.FileUtil
+
import java.io.{ ByteArrayOutputStream, FileInputStream, IOException, File }
import scala.util.control.Breaks._
import scala.xml.Elem
import java.util.concurrent.ConcurrentHashMap
-import grizzled.file.util
-import grizzled.file.GrizzledFile._
+//import grizzled.file.util
+//import grizzled.file.GrizzledFile._
import org.ds.satchel.processors._
object Satchel {
@@ -270,8 +272,11 @@ class Satchel(val name: String,
private def glob(patterns: List[String]): List[String] = {
patterns.map { pattern: String =>
- util.eglob(root + "/" + pattern)
+ FileUtil.eglob(root + "/" + pattern)
+ //util.eglob(root + "/" + pattern)
}.flatten.removeDuplicates
}
+
+
}
View
52 core/src/main/scala/org/ds/satchel/util/FileUtil.scala
@@ -0,0 +1,52 @@
+package org.ds.satchel.util
+
+import java.io.File
+import scala.io.Source
+
+class RichFile(val file: File) {
+
+ def children:Iterable[File] = {
+ if(file.isDirectory) {
+ return file.listFiles
+ }
+ Array[File]()
+ }
+
+ def tree : Iterable[File] = {
+ (Seq(file) ++ children.flatMap(child => new RichFile(child).tree))
+ }
+
+}
+
+
+object FileUtil {
+
+ def eglob(path:String):List[String] = {
+
+ val base = path.replace(seperator * 2, seperator)
+ val root = slap(base.split(seperator))
+
+ val regex = base
+ .replace("**/", """[[\w\d\-\_]+""" + seperator + "]~~~")
+ .replace("*.", """.+\.""")
+ .replace("*", ".+")
+ .replace("~~~", "*").r
+
+ val result = new RichFile(new File(root)).tree.map(_.toString)
+
+ result.filter { p =>
+ val itr = regex.findAllIn(p)
+ itr.size > 0
+ }.toList.reverse
+ }
+
+ private def seperator = "/"
+
+ private def slap(parts:Array[String]) = {
+ val pure = parts.takeWhile { s =>
+ !s.contains("*")
+ }
+ pure.reduceLeft(_ + seperator + _)
+ }
+
+}
View
4 scalatra/buildfile
@@ -1,7 +1,7 @@
require "buildr-dependency-extensions"
require "buildr/scala"
-CORE = "org.ds:satchel:jar:0.1"
+CORE = "org.ds:satchel:jar:0.2"
SCALATRA = "org.scalatra:scalatra_2.8.1:jar:2.0.0.M3"
repositories.remote << "http://repo1.maven.org/maven2/"
@@ -12,7 +12,7 @@ define "satchel-scalatra" do
extend PomGenerator
project.group = "org.ds"
- project.version = 0.1
+ project.version = 0.2
manifest["Copyright"] = "Dan Simpson (C) 2011"
manifest["Implementation-Vendor"] = "Dan Simpson"
Please sign in to comment.
Something went wrong with that request. Please try again.