Permalink
Browse files

Merge pull request #3 from twitter/upgrade-standard-project

Upgrade standard project
  • Loading branch information...
mccv committed Sep 9, 2011
2 parents df78b45 + e0b45a8 commit bd49c0f685ca1b35ba5553506f0676f1c2064210
View
@@ -0,0 +1,5 @@
+0.3.1
+-----
+Released September 8, 2011
+
+- Upgrade standard-project to 0.12.7
View
@@ -1,8 +1,8 @@
#Project properties
-#Wed Jul 14 15:26:15 PDT 2010
+#Wed Jun 01 10:40:20 PDT 2011
project.organization=com.twitter
project.name=streamyj
sbt.version=0.7.4
-project.version=0.2
+project.version=0.3.1-SNAPSHOT
build.scala.versions=2.8.1 2.7.7
project.initialize=false
@@ -1,9 +1,12 @@
import sbt._
import com.twitter.sbt._
-class StreamyJProject(info: ProjectInfo) extends StandardProject(info) with SubversionPublisher
+class StreamyJProject(info: ProjectInfo) extends StandardProject(info)
+with SubversionPublisher
+with PublishSourcesAndJavadocs
+with PublishSite
{
- val jackson = "org.codehaus.jackson" % "jackson-core-asl" % "1.5.2"
+ val jackson = "org.codehaus.jackson" % "jackson-core-asl" % "1.8.1"
val objenesis = "org.objenesis" % "objenesis" % "1.1"
val specs = buildScalaVersion match {
case "2.7.7" => "org.scala-tools.testing" % "specs" % "1.6.2.1" % "test"
@@ -2,5 +2,5 @@ import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
val twitterMaven = "twitter.com" at "http://maven.twttr.com/"
- val defaultProject = "com.twitter" % "standard-project" % "0.7.17"
+ val defaultProject = "com.twitter" % "standard-project" % "0.12.7"
}
@@ -17,26 +17,28 @@ object Streamy {
*/
val factory = new JsonFactory()
- def apply(source: String): Streamy = apply(factory.createJsonParser(source))
- def apply(reader: Reader): Streamy = apply(factory.createJsonParser(reader))
- def apply(file: File): Streamy = apply(factory.createJsonParser(file))
- def apply(parser: JsonParser): Streamy = new Streamy(parser)
+ def apply(source: String): Streamy = apply(factory.createJsonParser(source), source)
+ def apply(reader: Reader): Streamy = apply(factory.createJsonParser(reader), reader.toString)
+ def apply(file: File): Streamy = apply(factory.createJsonParser(file), file.getPath)
+ def apply(parser: JsonParser): Streamy = apply(parser, parser.toString)
+ def apply(parser: JsonParser, src: => String ): Streamy = new Streamy(parser, src)
}
/**
* A helper for the Jackson JSON parser.
*
* Streamy allows you to write streaming parsers in an elegant,
- * Scala-idiomatic manner. A quick example:
- *
+ * Scala-idiomatic manner.
*/
-class Streamy(parser: JsonParser) {
+class Streamy(parser: JsonParser, val source: String) {
import Streamy.ObjectParseFunc
import Streamy.ArrayParseFunc
private var currentToken: StreamyToken = NotAvailable
private var peekedToken: StreamyToken = NotAvailable
+ override def toString = "Streamy(" + source + ")"
+
/**
* Advances the parser and sets the current token.
* @throws JsonParseException if the are no more tokens
@@ -24,7 +24,7 @@ object StreamySpec extends Specification {
s.peek() mustEqual ValueLong(2)
s.next() mustEqual ValueLong(2)
}
-
+
"handle scalar values" in {
val s = Streamy("true false 123456789 3.1415927 \"hello world\"")
s.readBoolean() must beTrue
@@ -129,7 +129,7 @@ object StreamySpec extends Specification {
}
}
s.readArray(fn)
- seen.toList mustEqual Range(0, 4).toList
+ seen.toList mustEqual 0.until(4).toList
}
"foldArray" in {

0 comments on commit bd49c0f

Please sign in to comment.