Skip to content

Commit

Permalink
compatibility with gitbucket 4.0, fixes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
McFoggy committed May 10, 2016
1 parent 9d43488 commit a16baa5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
5 changes: 5 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ On success, you will receive a `HTTP 200` answer with a body containing the word

Plugin version | GitBucket version
:--------------|:-----------------
1.2.x | 4.x.y
1.1.x | 3.11.x
1.0.x | 3.6.x, 3.7.x, 3.8.x,, 3.9.x, 3.10.x

Expand All @@ -57,6 +58,10 @@ sbt clean package

## Release Notes

### 1.2.0

- binary compatibility with gitbucket 4.x

### 1.1

- recompilation to ensure binary compatibility with gitbucket 3.11
Expand Down
5 changes: 3 additions & 2 deletions project/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object MyBuild extends Build {

val Organization = "fr.brouillard.gitbucket"
val Name = "gitbucket-h2-backup-plugin"
val Version = "1.1"
val Version = "1.2.0"
val ScalaVersion = "2.11.6"

lazy val project = Project (
Expand All @@ -25,7 +25,8 @@ object MyBuild extends Build {
"amateras-repo" at "http://amateras.sourceforge.jp/mvn/"
),
libraryDependencies ++= Seq(
"gitbucket" % "gitbucket-assembly" % "3.11.0" % "provided",
"gitbucket" % "gitbucket-assembly" % "4.0.0" % "provided",
"io.github.gitbucket" % "solidbase" % "1.0.0" % "provided",
"com.typesafe.play" %% "twirl-compiler" % "1.0.4" % "provided",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
),
Expand Down
31 changes: 9 additions & 22 deletions src/main/scala/Plugin.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import javax.servlet.ServletContext

import fr.brouillard.gitbucket.h2.controller.H2BackupController
import gitbucket.core.plugin.PluginRegistry
import gitbucket.core.service.SystemSettingsService.SystemSettings
import gitbucket.core.util.Version
import io.github.gitbucket.solidbase.model.Version
import gitbucket.core.controller.Context
import gitbucket.core.plugin.Link


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

override val versions: List[Version] = List(
Version(1, 0)
new Version("1.2.0"),
new Version("1.0.0")
)

override def javaScripts(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, String)] = {
// Add Snippet link to the header
val path = settings.baseUrl.getOrElse(context.getContextPath)
Seq(
".*/admin/h2backup" -> s"""
|$$('#system-admin-menu-container>li:last').after(
| $$('<li class="active"><a href="${path}/admin/h2backup">H2 Backup</a></li>')
|);
""".stripMargin,
".*/admin/(?!h2backup).*" -> s"""
|$$('#system-admin-menu-container>li:last').after(
| $$('<li><a href="${path}/admin/h2backup">H2 Backup</a></li>')
|);
""".stripMargin
)
}
override val systemSettingMenus: Seq[(Context) => Option[Link]] = Seq(
(ctx: Context) => Some(Link("h2-backup", "H2 Backup", "admin/h2backup"))
)

override val controllers = Seq(
"/admin/h2backup" -> new H2BackupController()
Expand Down
7 changes: 3 additions & 4 deletions src/main/twirl/fr/brouillard/gitbucket/h2/export.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
@menu("h2backup"){
@information(info)
<form action="@path/database/backup" method="POST">
<div class="box">
<div class="box-header">Database backup</div>
<div class="box-content">
<div class="panel panel-default">
<div class="panel-heading strong">Database backup</div>
<div class="panel-body">
<fieldset>
<label><span class="strong">Database backup file:</span></label>
<p class="muted">
Allows to export/backup the database content. The same action can be achieved via an HTTP GET call to @path/database/backup
</p>
<input type="text" name="dest" value="@dest" style="width: 400px" />
</fieldset>

</div>
</div>
<div class="align-right" style="margin-top: 20px;">
Expand Down

0 comments on commit a16baa5

Please sign in to comment.