Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sam Rose
committed
Aug 23, 2011
0 parents
commit 4a9aa49
Showing
200 changed files
with
7,362 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name := "Todo.txt Scala" | ||
|
||
version := "0.1" | ||
|
||
organization := "com.lbak" | ||
|
||
scalaVersion := "2.8.1" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+245 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/actions_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+302 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/api_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+109 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/cache_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+78.5 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/classfile_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+69.8 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/classpath_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+177 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/collections_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+29.4 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/commons-codec-1.2.jar
Binary file not shown.
Binary file added
BIN
+298 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/commons-httpclient-3.1.jar
Binary file not shown.
Binary file added
BIN
+37.1 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/commons-logging-1.0.4.jar
Binary file not shown.
Binary file added
BIN
+114 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/compile_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+134 KB
...tools.sbt/sbt/0.10.1/compiler-interface-bin_2.8.1.final/compiler-interface-bin-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+137 KB
...ala-tools.sbt/sbt/0.10.1/compiler-interface-bin_2.9.0.1/compiler-interface-bin-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+17.2 KB
...1/org.scala-tools.sbt/sbt/0.10.1/compiler-interface-src/compiler-interface-src-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+274 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/completion_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+10.7 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/control_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+21.1 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/discovery_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+145 KB
...ect/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/incremental-compiler_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+243 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/io_2.8.1-0.10.1.jar
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+453 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/ivy_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+85.3 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/jline-0.9.94.jar
Binary file not shown.
Binary file added
BIN
+168 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/jsch-0.1.31.jar
Binary file not shown.
Binary file added
BIN
+5.32 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/launcher-interface_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+68.6 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/logging_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+1.41 MB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/main_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+110 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/persist_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+108 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/process_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+82.6 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/run_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+145 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/sbinary_2.8.1-0.4.0.jar
Binary file not shown.
Binary file added
BIN
+14.3 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/sbt_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+117 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/task-system_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+96.7 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/tasks_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+4.3 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/test-interface-0.5.jar
Binary file not shown.
Binary file added
BIN
+69 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/testing_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+41.7 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/tracking_2.8.1-0.10.1.jar
Binary file not shown.
Binary file added
BIN
+35.4 KB
project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/xsbti/interface-0.10.1.jar
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=0.10.1 |
Binary file added
BIN
+637 Bytes
project/target/config-classes/$023a9dae26dc527bdbe9$$anonfun$$sbtdef$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+632 Bytes
project/target/config-classes/$28d84a9e8f70680f35be$$anonfun$$sbtdef$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+634 Bytes
project/target/config-classes/$42b35fbc4362f45e8454$$anonfun$$sbtdef$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+643 Bytes
project/target/config-classes/$5fba351a47d098327bc6$$anonfun$$sbtdef$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.lbak.todo | ||
|
||
import scala.util.matching.Regex | ||
|
||
class Task(val orig: String) { | ||
private val PriorityRegex = new Regex("""^\(([A-Za-z])\)\s+.*?""") | ||
private val ContextsRegex = new Regex("""(?:\s+|^)@\w+""") | ||
private val ProjectsRegex = new Regex("""(?:\s+|^)\+\w+""") | ||
|
||
lazy val priority = getPriority() | ||
lazy val contexts = getContexts() | ||
lazy val projects = getProjects() | ||
lazy val text = getText() | ||
|
||
private def getPriority(): String = orig match { | ||
case PriorityRegex(priorityMatch) => priorityMatch | ||
case _ => null // Do Nothing | ||
} | ||
|
||
private def getContexts(): List[String] = { | ||
ContextsRegex.findAllIn(orig).toList.map(_.trim) | ||
} | ||
|
||
private def getProjects(): List[String] = { | ||
ProjectsRegex.findAllIn(orig).toList.map(_.trim) | ||
} | ||
|
||
private def getText(): String = { | ||
orig.replaceAll(PriorityRegex.toString, ""). | ||
replaceAll(ContextsRegex.toString, ""). | ||
replaceAll(ProjectsRegex.toString, ""). | ||
replaceAll("""\s+""", " "). | ||
trim | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.lbak.todo | ||
|
||
object TodoApp { | ||
def main(args: Array[String]) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.lbak.todo | ||
|
||
import scala.io.Source | ||
|
||
class TodoList(val path: String) { | ||
/** | ||
* | ||
*/ | ||
val tasks = Source.fromFile(path).getLines.map(new Task(_)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.lbak.todo.test | ||
|
||
import org.specs._ | ||
import com.lbak.todo.Task | ||
|
||
class TaskSpec extends Specification { | ||
val task = new Task("(A) This task has all sorts. @context +project") | ||
val dud = new Task(" (B) Failed@priority and 2+2 is 4!") | ||
|
||
"Task" should { | ||
"recognise priority" >> { | ||
task.priority must_== "A" | ||
} | ||
|
||
"recognise contexts" >> { | ||
task.contexts must contain("@context") | ||
} | ||
|
||
"recognise projects" >> { | ||
task.projects must contain("+project") | ||
} | ||
|
||
"extract text correctly" >> { | ||
task.text must_== "This task has all sorts." | ||
} | ||
} | ||
|
||
"Dud task" should { | ||
"not match priority" >> { | ||
dud.priority must beNull | ||
} | ||
|
||
"not match context" >> { | ||
dud.contexts must beEmpty | ||
} | ||
|
||
"not match projects" >> { | ||
dud.projects must beEmpty | ||
} | ||
|
||
"still match text" >> { | ||
// It has no leading space because the .text gets trimmed. | ||
dud.text must_== "(B) Failed@priority and 2+2 is 4!" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.lbak.todo.test | ||
|
||
import com.lbak.todo.TodoList | ||
import com.lbak.todo.Task | ||
import org.specs._ | ||
import java.io.File | ||
|
||
class TodoListSpec extends Specification { | ||
// Get the test data file. Pretty hacky but it'll do for now. | ||
val path = new File(".").getAbsolutePath().stripSuffix(".") + | ||
"src/test/scala/data/todo.txt" | ||
// Create a TodoList out of the path given. | ||
val list = new TodoList(path) | ||
|
||
"TodoList" should { | ||
"grab a list of Tasks" >> { | ||
var allTasks = true | ||
list.tasks.foreach({ task => | ||
if (!task.isInstanceOf[Task]) { | ||
allTasks = false | ||
} | ||
}) | ||
|
||
allTasks must beTrue | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(A) Crack the Da Vinci Code. | ||
(B) +winning Win. | ||
@context Give it some context. | ||
Just a POD: Plain old task. | ||
(C) +project @context This one has it all! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
run | ||
console | ||
~compile | ||
test | ||
console | ||
~test | ||
build | ||
package | ||
publish | ||
console | ||
test | ||
~test | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | ||
<html> | ||
<head> | ||
<title>com.lbak</title> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | ||
|
||
<link href="../../lib/template.css" rel="stylesheet" type="text/css" media="screen" /> | ||
<script type="text/javascript" src="../../lib/jquery.js"></script> | ||
<script type="text/javascript" src="../../lib/jquery-ui.js"></script> | ||
<script type="text/javascript" src="../../lib/template.js"></script> | ||
<script type="text/javascript" src="../../lib/tools.tooltip.js"></script> | ||
|
||
</head> | ||
<body class="value" onload="windowTitle();"> | ||
|
||
<p id="owner"><a href="../package.html" class="extype" name="com">com</a></p> | ||
|
||
<div id="definition"> | ||
<img src="../../lib/package_big.png" /> | ||
<h1>lbak</h1> | ||
</div> | ||
|
||
<h4 class="signature" id="signature"> | ||
<span class="kind">package</span> | ||
<span class="symbol"> | ||
<span class="name">lbak</span> | ||
|
||
|
||
|
||
</span> | ||
</h4> | ||
<div class="fullcomment" id="comment"></div> | ||
|
||
<div id="template"> | ||
|
||
<div id="mbrsel"> | ||
<div id="textfilter"><span class="pre"></span><span class="input"><input accesskey="/" type="text" /></span><span class="post"></span></div> | ||
|
||
|
||
<div id="visbl"> | ||
<span class="filtertype">Visibility</span> | ||
<ol><li class="public in">Public</li><li class="all out">All</li></ol> | ||
</div> | ||
<div id="impl"> | ||
<span class="filtertype">Impl.</span> | ||
<ol><li class="concrete in">Concrete</li><li class="abstract in">Abstract</li></ol> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
|
||
<div class="values members" id="values"> | ||
<h3>Value Members</h3> | ||
<ol><li visbl="pub" data-isabs="false" name="com.lbak.todo"> | ||
<a id="todo:todo"></a> | ||
<h4 class="signature"><a href="todo/package.html"> | ||
<span class="kind">package</span> | ||
<span class="symbol"> | ||
<span class="name">todo</span> | ||
|
||
|
||
|
||
</span> | ||
</a></h4> | ||
|
||
</li></ol> | ||
</div> | ||
|
||
|
||
|
||
</div> | ||
|
||
<div id="tooltip"></div> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.