Skip to content

Commit a16baa5

Browse files
committed
compatibility with gitbucket 4.0, fixes #10
1 parent 9d43488 commit a16baa5

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

README.MD

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ On success, you will receive a `HTTP 200` answer with a body containing the word
4141

4242
Plugin version | GitBucket version
4343
:--------------|:-----------------
44+
1.2.x | 4.x.y
4445
1.1.x | 3.11.x
4546
1.0.x | 3.6.x, 3.7.x, 3.8.x,, 3.9.x, 3.10.x
4647

@@ -57,6 +58,10 @@ sbt clean package
5758

5859
## Release Notes
5960

61+
### 1.2.0
62+
63+
- binary compatibility with gitbucket 4.x
64+
6065
### 1.1
6166

6267
- recompilation to ensure binary compatibility with gitbucket 3.11

project/build.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object MyBuild extends Build {
77

88
val Organization = "fr.brouillard.gitbucket"
99
val Name = "gitbucket-h2-backup-plugin"
10-
val Version = "1.1"
10+
val Version = "1.2.0"
1111
val ScalaVersion = "2.11.6"
1212

1313
lazy val project = Project (
@@ -25,7 +25,8 @@ object MyBuild extends Build {
2525
"amateras-repo" at "http://amateras.sourceforge.jp/mvn/"
2626
),
2727
libraryDependencies ++= Seq(
28-
"gitbucket" % "gitbucket-assembly" % "3.11.0" % "provided",
28+
"gitbucket" % "gitbucket-assembly" % "4.0.0" % "provided",
29+
"io.github.gitbucket" % "solidbase" % "1.0.0" % "provided",
2930
"com.typesafe.play" %% "twirl-compiler" % "1.0.4" % "provided",
3031
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
3132
),

src/main/scala/Plugin.scala

+9-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import javax.servlet.ServletContext
2-
31
import fr.brouillard.gitbucket.h2.controller.H2BackupController
4-
import gitbucket.core.plugin.PluginRegistry
5-
import gitbucket.core.service.SystemSettingsService.SystemSettings
6-
import gitbucket.core.util.Version
2+
import io.github.gitbucket.solidbase.model.Version
3+
import gitbucket.core.controller.Context
4+
import gitbucket.core.plugin.Link
5+
76

87
class Plugin extends gitbucket.core.plugin.Plugin {
98
override val pluginId: String = "h2-backup"
@@ -13,25 +12,13 @@ class Plugin extends gitbucket.core.plugin.Plugin {
1312
override val description: String = "Allows to export h2 database of gitbucket"
1413

1514
override val versions: List[Version] = List(
16-
Version(1, 0)
15+
new Version("1.2.0"),
16+
new Version("1.0.0")
1717
)
1818

19-
override def javaScripts(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, String)] = {
20-
// Add Snippet link to the header
21-
val path = settings.baseUrl.getOrElse(context.getContextPath)
22-
Seq(
23-
".*/admin/h2backup" -> s"""
24-
|$$('#system-admin-menu-container>li:last').after(
25-
| $$('<li class="active"><a href="${path}/admin/h2backup">H2 Backup</a></li>')
26-
|);
27-
""".stripMargin,
28-
".*/admin/(?!h2backup).*" -> s"""
29-
|$$('#system-admin-menu-container>li:last').after(
30-
| $$('<li><a href="${path}/admin/h2backup">H2 Backup</a></li>')
31-
|);
32-
""".stripMargin
33-
)
34-
}
19+
override val systemSettingMenus: Seq[(Context) => Option[Link]] = Seq(
20+
(ctx: Context) => Some(Link("h2-backup", "H2 Backup", "admin/h2backup"))
21+
)
3522

3623
override val controllers = Seq(
3724
"/admin/h2backup" -> new H2BackupController()

src/main/twirl/fr/brouillard/gitbucket/h2/export.scala.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
@menu("h2backup"){
1010
@information(info)
1111
<form action="@path/database/backup" method="POST">
12-
<div class="box">
13-
<div class="box-header">Database backup</div>
14-
<div class="box-content">
12+
<div class="panel panel-default">
13+
<div class="panel-heading strong">Database backup</div>
14+
<div class="panel-body">
1515
<fieldset>
1616
<label><span class="strong">Database backup file:</span></label>
1717
<p class="muted">
1818
Allows to export/backup the database content. The same action can be achieved via an HTTP GET call to @path/database/backup
1919
</p>
2020
<input type="text" name="dest" value="@dest" style="width: 400px" />
2121
</fieldset>
22-
2322
</div>
2423
</div>
2524
<div class="align-right" style="margin-top: 20px;">

0 commit comments

Comments
 (0)