├── project ├── build.properties └── plugins.sbt ├── .github ├── dependabot.yml └── workflows │ └── build.yml ├── src └── main │ └── scala │ ├── io │ └── github │ │ └── gitbucket │ │ └── helloworld │ │ └── controller │ │ └── HelloWorldController.scala │ └── Plugin.scala ├── .gitignore └── README.md /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version = 1.11.7 2 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("io.github.gitbucket" % "sbt-gitbucket-plugin" % "1.6.0") -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /src/main/scala/io/github/gitbucket/helloworld/controller/HelloWorldController.scala: -------------------------------------------------------------------------------- 1 | package io.github.gitbucket.helloworld.controller 2 | 3 | import gitbucket.core.controller.ControllerBase 4 | 5 | class HelloWorldController extends ControllerBase { 6 | 7 | get("/helloworld"){ 8 | "Hello World!" 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.log 3 | 4 | # sbt specific 5 | dist/* 6 | target/ 7 | lib_managed/ 8 | src_managed/ 9 | project/boot/ 10 | project/plugins/project/ 11 | 12 | # Scala-IDE specific 13 | .scala_dependencies 14 | .classpath 15 | .project 16 | .cache 17 | .settings 18 | 19 | # IntelliJ specific 20 | .idea/ 21 | .idea_modules/ 22 | 23 | # Ensime 24 | .ensime 25 | .ensime_cache/ 26 | 27 | # Metals 28 | .vscode 29 | .metals 30 | .bloop 31 | **/metals.sbt 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | gitbucket-plugin-template 2 | ======== 3 | Template project for GitBucket plugin 4 | 5 | Run `sbt assembly` and copy generated `/target/scala-2.13/gitbucket-helloworld-plugin-assembly-1.0.0.jar` to `~/.gitbucket/plugins/` (If the directory does not exist, create it by hand before copying the jar), or just run `sbt install`. 6 | 7 | Then start GitBucket and access to http://localhost:8080/helloworld in your web browser, you will see `Hello World!` response. 8 | -------------------------------------------------------------------------------- /src/main/scala/Plugin.scala: -------------------------------------------------------------------------------- 1 | import gitbucket.core.controller.ControllerBase 2 | import io.github.gitbucket.helloworld.controller.HelloWorldController 3 | import io.github.gitbucket.solidbase.model.Version 4 | 5 | class Plugin extends gitbucket.core.plugin.Plugin { 6 | override val pluginId: String = "helloworld" 7 | override val pluginName: String = "HelloWorld Plugin" 8 | override val description: String = "First example of GitBucket plug-in" 9 | override val versions: List[Version] = List(new Version("1.0.0")) 10 | 11 | override val controllers: Seq[(String, ControllerBase)] = Seq( 12 | "/*" -> new HelloWorldController() 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v6 14 | - name: Cache 15 | uses: actions/cache@v4 16 | env: 17 | cache-name: cache-sbt-libs 18 | with: 19 | path: | 20 | ~/.ivy2/cache 21 | ~/.sbt 22 | ~/.coursier 23 | key: build-${{ env.cache-name }}-${{ hashFiles('build.sbt') }} 24 | - name: Set up JDK 25 | uses: actions/setup-java@v5 26 | with: 27 | distribution: temurin 28 | java-version: 17 29 | - uses: sbt/setup-sbt@v1 30 | - name: Run tests 31 | run: sbt test 32 | --------------------------------------------------------------------------------