(refs #769) Output go-import meta tag in all repositories for go get

This commit is contained in:
Naoki Takezoe
2016-08-11 14:40:06 +09:00
parent f0a8b3bb17
commit d62adbf649
3 changed files with 16 additions and 6 deletions

View File

@@ -117,9 +117,14 @@ trait RepositoryViewerControllerBase extends ControllerBase {
/**
* Displays the file list of the repository root and the default branch.
*/
get("/:owner/:repository")(referrersOnly {
fileList(_)
})
get("/:owner/:repository") {
params.get("go-get") match {
case Some("1") => defining(request.paths){ paths =>
getRepository(paths(0), paths(1)).map(gitbucket.core.html.goget(_))getOrElse NotFound()
}
case _ => referrersOnly(fileList(_))
}
}
/**
* Displays the file list of the specified path and branch.

View File

@@ -0,0 +1,7 @@
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
<!DOCTYPE html>
<html>
<head>
<meta name="go-import" content="@context.baseUrl.replaceFirst("^https?://", "")/@repository.owner/@repository.name git @repository.httpUrl" />
</head>
</html>

View File

@@ -34,9 +34,7 @@
<script src="@helpers.assets/vendors/jquery-hotkeys/jquery.hotkeys.js"></script>
<script src="@helpers.assets/vendors/jquery-textcomplete-1.6.2/jquery.textcomplete.js"></script>
@repository.map { repository =>
@if(!repository.repository.isPrivate){
<meta name="go-import" content="@context.baseUrl.replaceFirst("^https?://", "")/@repository.owner/@repository.name git @repository.httpUrl" />
}
<meta name="go-import" content="@context.baseUrl.replaceFirst("^https?://", "")/@repository.owner/@repository.name git @repository.httpUrl" />
}
<script src="@helpers.assets/vendors/AdminLTE-2.2.3/js/app.js" type="text/javascript"></script>
</head>