Skip to content

Commit d5ddc70

Browse files
committed
reformat code
1 parent d0513ad commit d5ddc70

File tree

7 files changed

+39
-38
lines changed

7 files changed

+39
-38
lines changed

build.sbt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ name := "gitbucket-pages-plugin"
33
scalaVersion := "2.12.4"
44
version := "1.7.0"
55
gitbucketVersion := "4.23.0"
6-
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-feature")
7-
6+
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-feature")

src/main/scala/Plugin.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import gitbucket.core.controller.Context
22
import gitbucket.core.controller.ControllerBase
33
import gitbucket.core.plugin.Link
44
import gitbucket.core.service.RepositoryService.RepositoryInfo
5-
import gitbucket.plugin.pages.{ PagesController, PagesHook }
6-
import io.github.gitbucket.solidbase.migration.{ SqlMigration, LiquibaseMigration }
5+
import gitbucket.plugin.pages.{PagesController, PagesHook}
6+
import io.github.gitbucket.solidbase.migration.{SqlMigration, LiquibaseMigration}
77
import io.github.gitbucket.solidbase.model.Version
88

99
class Plugin extends gitbucket.core.plugin.Plugin {
@@ -24,21 +24,21 @@ class Plugin extends gitbucket.core.plugin.Plugin {
2424
new Version(
2525
"1.1",
2626
new LiquibaseMigration("update/gitbucket-page_1.1.xml"),
27-
new SqlMigration("update/gitbucket-page_1.1.sql")),
27+
new SqlMigration("update/gitbucket-page_1.1.sql")
28+
),
2829
new Version("1.2"),
2930
new Version("1.3"),
3031
new Version("1.4.0"),
3132
new Version("1.5.0"),
3233
new Version("1.6.0"),
33-
new Version("1.7.0"))
34+
new Version("1.7.0")
35+
)
3436

35-
override val controllers: Seq[(String, ControllerBase)] = Seq(
36-
"/*" -> new PagesController)
37+
override val controllers: Seq[(String, ControllerBase)] = Seq("/*" -> new PagesController)
3738

3839
override val repositorySettingTabs = Seq(
39-
(repository: RepositoryInfo, context: Context) => Some(Link("pages", "Pages", s"settings/pages")))
40+
(repository: RepositoryInfo, context: Context) => Some(Link("pages", "Pages", s"settings/pages"))
41+
)
4042

41-
override val repositoryHooks = Seq(
42-
new PagesHook)
43+
override val repositoryHooks = Seq(new PagesHook)
4344
}
44-

src/main/scala/gitbucket/plugin/model/PageProfile.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ package gitbucket.plugin.model
22

33
import gitbucket.core.model._
44

5-
object Profile extends CoreProfile
6-
with PagesComponent
5+
object Profile extends CoreProfile with PagesComponent

src/main/scala/gitbucket/plugin/model/Pages.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ package gitbucket.plugin.model
33
trait PagesComponent { self: gitbucket.core.model.Profile =>
44
import profile.api._
55

6-
implicit val psColumnType = MappedColumnType.base[PageSourceType, String](ps => ps.code, code => PageSourceType.valueOf(code))
6+
implicit val psColumnType =
7+
MappedColumnType.base[PageSourceType, String](ps => ps.code, code => PageSourceType.valueOf(code))
78

89
lazy val Pages = TableQuery[Pages]
910

@@ -33,7 +34,4 @@ object PageSourceType {
3334
def valueOpt(code: String): Option[PageSourceType] = map.get(code)
3435
}
3536

36-
case class Page(
37-
userName: String,
38-
repositoryName: String,
39-
source: PageSourceType)
37+
case class Page(userName: String, repositoryName: String, source: PageSourceType)

src/main/scala/gitbucket/plugin/pages/PagesHook.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import gitbucket.plugin.model.PageSourceType
55
import gitbucket.plugin.model.Profile.profile.blockingApi._
66
import gitbucket.plugin.service.PagesService
77

8-
class PagesHook
9-
extends PagesHookBase
10-
with PagesService
8+
class PagesHook extends PagesHookBase with PagesService
119

1210
trait PagesHookBase extends RepositoryHook {
1311
self: PagesService =>

src/main/scala/gitbucket/plugin/pages/pages.scala

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package gitbucket.plugin.pages
22

33
import gitbucket.core.controller.ControllerBase
44
import gitbucket.core.service.RepositoryService.RepositoryInfo
5-
import gitbucket.core.service.{ AccountService, RepositoryService }
5+
import gitbucket.core.service.{AccountService, RepositoryService}
66
import gitbucket.core.util.Implicits._
77
import gitbucket.core.util.SyntaxSugars._
8-
import gitbucket.core.util.{ Directory, JGitUtil, OwnerAuthenticator, ReferrerAuthenticator }
8+
import gitbucket.core.util.{Directory, JGitUtil, OwnerAuthenticator, ReferrerAuthenticator}
99
import gitbucket.pages.html
1010
import gitbucket.plugin.model.PageSourceType
1111
import gitbucket.plugin.service.PagesService
@@ -19,20 +19,20 @@ import scala.annotation.tailrec
1919
import scala.language.implicitConversions
2020

2121
class PagesController
22-
extends PagesControllerBase
23-
with AccountService
24-
with OwnerAuthenticator
25-
with PagesService
26-
with RepositoryService
27-
with ReferrerAuthenticator
22+
extends PagesControllerBase
23+
with AccountService
24+
with OwnerAuthenticator
25+
with PagesService
26+
with RepositoryService
27+
with ReferrerAuthenticator
2828

2929
trait PagesControllerBase extends ControllerBase {
3030
self: AccountService with RepositoryService with PagesService with ReferrerAuthenticator with OwnerAuthenticator =>
3131
import PagesControllerBase._
3232

33-
val optionsForm = mapping(
34-
"source" -> trim(label("Pages Source", text(required, pagesOption))))(
35-
(source) => OptionsForm(PageSourceType.valueOf(source)))
33+
val optionsForm = mapping("source" -> trim(label("Pages Source", text(required, pagesOption))))(
34+
(source) => OptionsForm(PageSourceType.valueOf(source))
35+
)
3636

3737
val PAGES_BRANCHES = List("gb-pages", "gh-pages")
3838

@@ -78,7 +78,12 @@ trait PagesControllerBase extends ControllerBase {
7878
}
7979
}
8080

81-
def renderFromBranch(repository: RepositoryService.RepositoryInfo, git: Git, path: String, branchObject: Option[ObjectId]): Any = {
81+
def renderFromBranch(
82+
repository: RepositoryService.RepositoryInfo,
83+
git: Git,
84+
path: String,
85+
branchObject: Option[ObjectId]
86+
): Any = {
8287
val pagePair = branchObject
8388
.map(JGitUtil.getRevCommitFromId(git, _))
8489
.flatMap(getPageObjectId(git, path, _))
@@ -135,7 +140,7 @@ object PagesControllerBase {
135140
case head :: tail =>
136141
f(head) match {
137142
case Some(x) => Some(x)
138-
case None => tail.collectFirstOpt(f)
143+
case None => tail.collectFirstOpt(f)
139144
}
140145
case Nil => None
141146
}
@@ -146,7 +151,7 @@ object PagesControllerBase {
146151
override def validate(name: String, value: String, messages: Messages): Option[String] =
147152
PageSourceType.valueOpt(value) match {
148153
case Some(_) => None
149-
case None => Some("Pages source is invalid.")
154+
case None => Some("Pages source is invalid.")
150155
}
151156
}
152157
}

src/main/scala/gitbucket/plugin/service/PagesService.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package gitbucket.plugin.service
22

3-
import gitbucket.plugin.model.{ Page, PageSourceType }
3+
import gitbucket.plugin.model.{Page, PageSourceType}
44
import gitbucket.plugin.model.Profile._
55
import gitbucket.plugin.model.Profile.profile.blockingApi._
66

@@ -21,7 +21,9 @@ trait PagesService {
2121
.map(t => t.source)
2222
.update(source)
2323

24-
def renameRepository(userName: String, oldRepositoryName: String, newRepositoryName: String)(implicit s: Session): Unit =
24+
def renameRepository(userName: String, oldRepositoryName: String, newRepositoryName: String)(
25+
implicit s: Session
26+
): Unit =
2527
Pages
2628
.filter(t => (t.userName === userName.bind) && (t.repositoryName === oldRepositoryName.bind))
2729
.map(t => t.repositoryName)

0 commit comments

Comments
 (0)