diff --git a/build.sbt b/build.sbt index ce788a5..e8424b0 100644 --- a/build.sbt +++ b/build.sbt @@ -37,6 +37,7 @@ "org.apache.tika" % "tika-core" % "1.13", //"com.typesafe.slick" %% "slick" % "3.2.0-M1", "com.github.takezoe" %% "blocking-slick" % "0.0.3-SNAPSHOT", + "joda-time" % "joda-time" % "2.9.6", "com.novell.ldap" % "jldap" % "2009-10-07", "com.h2database" % "h2" % "1.4.192", "mysql" % "mysql-connector-java" % "5.1.39", @@ -46,7 +47,7 @@ "com.typesafe" % "config" % "1.3.0", "com.typesafe.akka" %% "akka-actor" % "2.4.12", "fr.brouillard.oss.security.xhub" % "xhub4j-core" % "1.0.0", - "com.enragedginger" % "akka-quartz-scheduler_2.11" % "1.5.0-akka-2.4.x" exclude("c3p0","c3p0"), // TODO Scala 2.12 + "com.enragedginger" %% "akka-quartz-scheduler" % "1.6.0-akka-2.4.x" exclude("c3p0","c3p0"), "org.eclipse.jetty" % "jetty-webapp" % JettyVersion % "provided", "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided", "junit" % "junit" % "4.12" % "test", @@ -56,7 +57,7 @@ ) // Compiler settings -scalacOptions := Seq("-deprecation", "-language:postfixOps", "-Ybackend:GenBCode", "-Ydelambdafy:method", "-target:jvm-1.8") +scalacOptions := Seq("-deprecation", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-1.8") javacOptions in compile ++= Seq("-target", "8", "-source", "8") javaOptions in Jetty += "-Dlogback.configurationFile=/logback-dev.xml" diff --git a/project/plugins.sbt b/project/plugins.sbt index 21a6329..fb3bace 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature") -addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.1.1") +addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.3.0") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3") addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.1") addSbtPlugin("fi.gekkio.sbtplugins" % "sbt-jrebel-plugin" % "0.10.0") diff --git a/src/main/scala/gitbucket/core/service/AccessTokenService.scala b/src/main/scala/gitbucket/core/service/AccessTokenService.scala index c04fccc..f7daddb 100644 --- a/src/main/scala/gitbucket/core/service/AccessTokenService.scala +++ b/src/main/scala/gitbucket/core/service/AccessTokenService.scala @@ -1,9 +1,8 @@ package gitbucket.core.service import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ - +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.{Account, AccessToken} import gitbucket.core.util.StringUtil @@ -21,7 +20,7 @@ def tokenToHash(token: String): String = StringUtil.sha1(token) /** - * @retuen (TokenId, Token) + * @return (TokenId, Token) */ def generateAccessToken(userName: String, note: String)(implicit s: Session): (Int, String) = { var token: String = null @@ -43,8 +42,8 @@ def getAccountByAccessToken(token: String)(implicit s: Session): Option[Account] = Accounts .join(AccessTokens) - .filter{ case (ac, t) => (ac.userName === t.userName) && (t.tokenHash === tokenToHash(token).bind) && (ac.removed === false.bind) } - .map{ case (ac, t) => ac } + .filter { case (ac, t) => (ac.userName === t.userName) && (t.tokenHash === tokenToHash(token).bind) && (ac.removed === false.bind) } + .map { case (ac, t) => ac } .firstOption def getAccessTokens(userName: String)(implicit s: Session): List[AccessToken] = diff --git a/src/main/scala/gitbucket/core/service/AccountService.scala b/src/main/scala/gitbucket/core/service/AccountService.scala index 5a6c748..941a587 100644 --- a/src/main/scala/gitbucket/core/service/AccountService.scala +++ b/src/main/scala/gitbucket/core/service/AccountService.scala @@ -3,12 +3,12 @@ import org.slf4j.LoggerFactory import gitbucket.core.model.{GroupMember, Account} import gitbucket.core.model.Profile._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ +import gitbucket.core.model.Profile.dateColumnType import gitbucket.core.util.{StringUtil, LDAPUtil} import StringUtil._ import gitbucket.core.service.SystemSettingsService.SystemSettings -import profile._ -import profile.blockingApi._ -import gitbucket.core.model.Profile.dateColumnType trait AccountService { diff --git a/src/main/scala/gitbucket/core/service/ActivityService.scala b/src/main/scala/gitbucket/core/service/ActivityService.scala index a7e61cd..09ebb0b 100644 --- a/src/main/scala/gitbucket/core/service/ActivityService.scala +++ b/src/main/scala/gitbucket/core/service/ActivityService.scala @@ -1,10 +1,10 @@ package gitbucket.core.service import gitbucket.core.model.Activity -import gitbucket.core.model.Profile._ import gitbucket.core.util.JGitUtil -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ trait ActivityService { diff --git a/src/main/scala/gitbucket/core/service/CommitStatusService.scala b/src/main/scala/gitbucket/core/service/CommitStatusService.scala index 07fe47f..9c01e2a 100644 --- a/src/main/scala/gitbucket/core/service/CommitStatusService.scala +++ b/src/main/scala/gitbucket/core/service/CommitStatusService.scala @@ -1,8 +1,8 @@ package gitbucket.core.service import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.dateColumnType import gitbucket.core.model.{CommitState, CommitStatus, Account} @@ -50,4 +50,4 @@ protected def byCommitStatues(userName: String, repositoryName: String, sha: String)(implicit s: Session) = CommitStatuses.filter(t => t.byCommit(userName, repositoryName, sha)).sortBy(_.updatedDate desc) -} \ No newline at end of file +} diff --git a/src/main/scala/gitbucket/core/service/CommitsService.scala b/src/main/scala/gitbucket/core/service/CommitsService.scala index a7a8fc4..b9aaea0 100644 --- a/src/main/scala/gitbucket/core/service/CommitsService.scala +++ b/src/main/scala/gitbucket/core/service/CommitsService.scala @@ -2,8 +2,8 @@ import gitbucket.core.model.CommitComment import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.dateColumnType trait CommitsService { diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index e43f399..69d6f23 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -5,8 +5,8 @@ import gitbucket.core.util.Implicits._ import gitbucket.core.model._ import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.dateColumnType diff --git a/src/main/scala/gitbucket/core/service/LabelsService.scala b/src/main/scala/gitbucket/core/service/LabelsService.scala index 716ae32..8accddc 100644 --- a/src/main/scala/gitbucket/core/service/LabelsService.scala +++ b/src/main/scala/gitbucket/core/service/LabelsService.scala @@ -2,8 +2,8 @@ import gitbucket.core.model.Label import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ trait LabelsService { diff --git a/src/main/scala/gitbucket/core/service/MilestonesService.scala b/src/main/scala/gitbucket/core/service/MilestonesService.scala index b94ca39..879638a 100644 --- a/src/main/scala/gitbucket/core/service/MilestonesService.scala +++ b/src/main/scala/gitbucket/core/service/MilestonesService.scala @@ -2,8 +2,8 @@ import gitbucket.core.model.Milestone import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.dateColumnType trait MilestonesService { diff --git a/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala b/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala index 9cd63b6..3552762 100644 --- a/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala +++ b/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala @@ -1,10 +1,10 @@ package gitbucket.core.service import gitbucket.core.model.{ProtectedBranch, ProtectedBranchContext, CommitState} -import gitbucket.core.model.Profile._ import gitbucket.core.plugin.ReceiveHook -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import org.eclipse.jgit.transport.{ReceivePack, ReceiveCommand} diff --git a/src/main/scala/gitbucket/core/service/PullRequestService.scala b/src/main/scala/gitbucket/core/service/PullRequestService.scala index fbdee92..e5b3e23 100644 --- a/src/main/scala/gitbucket/core/service/PullRequestService.scala +++ b/src/main/scala/gitbucket/core/service/PullRequestService.scala @@ -1,11 +1,10 @@ package gitbucket.core.service -import gitbucket.core.model.{Account, Issue, PullRequest, WebHook, CommitStatus, CommitState} -import gitbucket.core.model.Profile._ +import gitbucket.core.model.{Issue, PullRequest, CommitStatus, CommitState} import gitbucket.core.util.JGitUtil -import profile._ -import profile.blockingApi._ - +import gitbucket.core.model.Profile._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ trait PullRequestService { self: IssuesService => import PullRequestService._ diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 6ecc93a..1b1fcad 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -4,8 +4,8 @@ import gitbucket.core.util.JGitUtil import gitbucket.core.model.{Collaborator, Repository, RepositoryOptions, Account, Permission} import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.dateColumnType trait RepositoryService { self: AccountService => diff --git a/src/main/scala/gitbucket/core/service/SshKeyService.scala b/src/main/scala/gitbucket/core/service/SshKeyService.scala index a0e142c..82a8e93 100644 --- a/src/main/scala/gitbucket/core/service/SshKeyService.scala +++ b/src/main/scala/gitbucket/core/service/SshKeyService.scala @@ -2,8 +2,8 @@ import gitbucket.core.model.SshKey import gitbucket.core.model.Profile._ -import profile._ -import profile.blockingApi._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ trait SshKeyService { diff --git a/src/main/scala/gitbucket/core/service/WebHookService.scala b/src/main/scala/gitbucket/core/service/WebHookService.scala index 9d64779..346c8cc 100644 --- a/src/main/scala/gitbucket/core/service/WebHookService.scala +++ b/src/main/scala/gitbucket/core/service/WebHookService.scala @@ -5,9 +5,9 @@ import gitbucket.core.api._ import gitbucket.core.model.{WebHook, Account, Issue, PullRequest, IssueComment, WebHookEvent, CommitComment} import gitbucket.core.model.Profile._ +import gitbucket.core.model.Profile.profile._ +import gitbucket.core.model.Profile.profile.blockingApi._ import org.apache.http.client.utils.URLEncodedUtils -import profile._ -import profile.blockingApi._ import gitbucket.core.util.JGitUtil.CommitInfo import gitbucket.core.util.RepositoryName import gitbucket.core.service.RepositoryService.RepositoryInfo diff --git a/src/main/scala/gitbucket/core/util/StringUtil.scala b/src/main/scala/gitbucket/core/util/StringUtil.scala index 9710b50..768c407 100644 --- a/src/main/scala/gitbucket/core/util/StringUtil.scala +++ b/src/main/scala/gitbucket/core/util/StringUtil.scala @@ -101,18 +101,18 @@ .findAllIn(message).matchData.map(_.group(1)).toSeq.distinct - /** - * Encode search string for LIKE condition. - * This method has been copied from Slick's SqlUtilsComponent. - */ - def likeEncode(s: String) = { - val b = new StringBuilder - for(c <- s) c match { - case '%' | '_' | '^' => b append '^' append c - case _ => b append c - } - b.toString - } +// /** +// * Encode search string for LIKE condition. +// * This method has been copied from Slick's SqlUtilsComponent. +// */ +// def likeEncode(s: String) = { +// val b = new StringBuilder +// for(c <- s) c match { +// case '%' | '_' | '^' => b append '^' append c +// case _ => b append c +// } +// b.toString +// } }