Skip to content
Permalink
Browse files

compatibility with gitbucket 4.0, fixes #10

  • Loading branch information...
McFoggy committed May 10, 2016
1 parent 9d43488 commit a16baa5faa82f45df762e3bd1fc8706d9fb232c7
Showing with 20 additions and 28 deletions.
  1. +5 −0 README.MD
  2. +3 −2 project/build.scala
  3. +9 −22 src/main/scala/Plugin.scala
  4. +3 −4 src/main/twirl/fr/brouillard/gitbucket/h2/export.scala.html
@@ -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

@@ -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
@@ -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 (
@@ -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"
),
@@ -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"
@@ -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()
@@ -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;">

0 comments on commit a16baa5

Please sign in to comment.
You can’t perform that action at this time.