File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1- sbt.version =0.13.9
1+ sbt.version =0.13.11
Original file line number Diff line number Diff line change @@ -4,12 +4,30 @@ import gitbucket.plugin.pages.PagesController
44import io .github .gitbucket .solidbase .model .Version
55
66class Plugin extends gitbucket.core.plugin.Plugin {
7+ import gitbucket .plugin .pages .util .Version
78 override val pluginId = " pages"
89 override val pluginName = " Pages Plugin"
9- override val description = " Provides Pages feature on GitBucket "
10- override val versions = List (new Version (" 0.0.0 " ))
10+ override val description = " Project pages for gitbucket "
11+ override val versions = List (new Version (Version .version.getOrElse( " unknown " ) ))
1112
1213 override val controllers : Seq [(String , ControllerBase )] = Seq (
1314 " /*" -> new PagesController
1415 )
15- }
16+ }
17+
18+ package gitbucket .plugin .pages .util {
19+ import scala .collection .JavaConverters ._
20+ import scala .util .Try
21+ import java .util .jar .{ Manifest => JarManifest }
22+
23+ object Version {
24+ val version = Try (getVersionFromManifests()).toOption.flatten
25+ def getVersionFromManifests () = {
26+ val resources = getClass.getClassLoader.getResources(" META-INF/MANIFEST.MF" ).asScala.toList
27+ resources
28+ .flatMap(res => Try (new JarManifest (res.openStream())).toOption.toList)
29+ .find(manifest => Option (manifest.getMainAttributes.getValue(" Implementation-Title" )).contains(" pages-plugin" ))
30+ .flatMap(manifest => Option (manifest.getMainAttributes.getValue(" Implementation-Version" )))
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments