Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade dependencies scala-2.10, jline-2.9.

  • Loading branch information...
commit 527bf9330b9db11d5e6503d99584948178f24662 1 parent 450ab2d
@zhongl zhongl authored
View
15 build.sbt
@@ -2,18 +2,21 @@ name := "yascli"
organization := "com.github.zhongl"
-version := "0.1.0"
+version := "0.2.0"
-scalaVersion := "2.9.2"
+scalaVersion := "2.10.0-RC5"
-crossScalaVersions := Seq("2.9.0","2.9.1","2.9.2")
+scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
+
+javacOptions += "-Xlint:unchecked"
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
libraryDependencies := Seq(
- "jline" % "jline" % "2.7" ,
- "org.mockito" % "mockito-all" % "1.9.0" % "test",
- "org.scalatest" %% "scalatest" % "1.7.2" % "test"
+ "jline" % "jline" % "2.9" ,
+ "org.scala-lang" % "scala-library" % "2.10.0-RC5",
+ "org.mockito" % "mockito-all" % "1.9.0" % "test",
+ "org.scalatest" % "scalatest_2.10.0-RC5" % "1.8-B1" % "test"
)
publishMavenStyle := true
View
4 project/plugins.sbt
@@ -1,3 +1,3 @@
-resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
-addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")
+addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.7")
View
9 src/main/scala/com/github/zhongl/yascli/Application.scala
@@ -17,9 +17,10 @@
package com.github.zhongl.yascli
/**
- * @author <a href="mailto:zhong.lunfu@gmail.com">zhongl<a>
- */
-trait Application {self: Command =>
+ * @author <a href="mailto:zhong.lunfu@gmail.com">zhongl<a>
+ */
+trait Application {
+ self: Command =>
private val printHelp = flag("-h" :: "--help" :: Nil, "show help infomation of this command.")
@@ -28,7 +29,7 @@ trait Application {self: Command =>
parse(arguments)
if (printHelp()) println(help) else run()
} catch {
- case t => println(t)
+ case t: Throwable => println(t)
}
}
}
View
7 src/main/scala/com/github/zhongl/yascli/Command.scala
@@ -17,6 +17,7 @@
package com.github.zhongl.yascli
import collection.mutable.{ListBuffer, Map}
+import language.reflectiveCalls
import annotation.tailrec
/**
@@ -114,12 +115,12 @@ abstract class Command(val name: String, val description: String, val out: Print
override def toString = {
val isNotFlag = !isFlag
- "\t" + names.mkString(", ") + isNotFlag ? ("=[" + manifest[T].erasure.getSimpleName.toUpperCase + "]") +
+ "\t" + names.mkString(", ") + isNotFlag ? ("=[" + manifest[T].runtimeClass.getSimpleName.toUpperCase + "]") +
"\n\t\t" + description +
isNotFlag ? ("\n\t\tdefault: " + defaultValue)
}
- def isFlag = manifest[T].erasure == classOf[Boolean]
+ def isFlag = manifest[T].runtimeClass == classOf[Boolean]
}
private case class Parameter[T: Manifest](name: String, description: String, optional: Boolean) {
@@ -127,7 +128,7 @@ abstract class Command(val name: String, val description: String, val out: Print
def repr = { val s = isVarLength ?(name + "...", name); optional ?("[" + s + "]", s) }
- def isVarLength = manifest[T].erasure.isArray
+ def isVarLength = manifest[T].runtimeClass.isArray
}
}
View
8 src/main/scala/com/github/zhongl/yascli/JavaConvertions.java
@@ -19,7 +19,7 @@
import scala.*;
import scala.collection.immutable.List;
import scala.reflect.Manifest;
-import scala.reflect.Manifest$;
+import scala.reflect.ManifestFactory$;
import scala.runtime.AbstractFunction1;
import java.lang.Boolean;
@@ -27,7 +27,7 @@
/**
* @author <a href="mailto:zhong.lunfu@gmail.com">zhongl<a>
*/
-public class JavaConvertions {
+public final class JavaConvertions {
private static final AbstractFunction1<String, String> TO_STRING = new AbstractFunction1<String, String>() {
@Override
public String apply(String value) {
@@ -36,7 +36,7 @@ public String apply(String value) {
};
public static <T> Manifest<T> manifest(Class<T> klass) {
- return Manifest$.MODULE$.classType(klass);
+ return ManifestFactory$.MODULE$.classType(klass);
}
public static <T> Option<T> none(Class<T> klass) {
@@ -44,7 +44,7 @@ public String apply(String value) {
}
public static <T> Option<T> some(T value) {
- return (Option<T>) Some$.MODULE$.apply(value);
+ return Some$.MODULE$.apply(value);
}
public static Function1<String, String> defaultConverter() {
View
4 src/main/scala/com/github/zhongl/yascli/Shell.scala
@@ -50,7 +50,7 @@ abstract class Shell(
if (!array.head.isEmpty) run(array.head, array.tail) { name => println("Unknown command: " + name) }
} catch {
case e: QuitException => return
- case t => error(t)
+ case t: Throwable => error(t)
}
parse(reader.readLine())
}
@@ -97,7 +97,7 @@ abstract class Shell(
protected def argumentComplete(name: String, prefix: String, cursor: Int, candidates: List[CharSequence]) =
completerOfCommand(name).complete(prefix, cursor, candidates)
- private def completerOfCommand(name: String): Completer = commands find {_.name == name} match {
+ private def completerOfCommand(name: String): Completer = commands find { _.name == name } match {
case Some(c) if c.isInstanceOf[Completer] => c.asInstanceOf[Completer]
case Some(c) if c == helpCommand => HelpCompleter
case _ => NullCompleter.INSTANCE
View
1  src/main/scala/com/github/zhongl/yascli/SuiteAppcation.scala
@@ -16,6 +16,7 @@
package com.github.zhongl.yascli
+import language.reflectiveCalls
import Converters._
/**
View
1  src/test/scala/com/github/zhongl/yascli/CommandSpec.scala
@@ -16,6 +16,7 @@
package com.github.zhongl.yascli
+import language.reflectiveCalls
import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers
import java.io.File
Please sign in to comment.
Something went wrong with that request. Please try again.