mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 02:56:08 +01:00
Rename ProjectService to RepositoryService.
This commit is contained in:
@@ -9,12 +9,12 @@ import org.apache.commons.io._
|
|||||||
import jp.sf.amateras.scalatra.forms._
|
import jp.sf.amateras.scalatra.forms._
|
||||||
|
|
||||||
class CreateRepositoryController extends CreateRepositoryControllerBase
|
class CreateRepositoryController extends CreateRepositoryControllerBase
|
||||||
with ProjectService with AccountService with WikiService
|
with RepositoryService with AccountService with WikiService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new repository.
|
* Creates new repository.
|
||||||
*/
|
*/
|
||||||
trait CreateRepositoryControllerBase extends ControllerBase { self: ProjectService with WikiService =>
|
trait CreateRepositoryControllerBase extends ControllerBase { self: RepositoryService with WikiService =>
|
||||||
|
|
||||||
case class RepositoryCreationForm(name: String, description: String) // TODO Option
|
case class RepositoryCreationForm(name: String, description: String) // TODO Option
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ trait CreateRepositoryControllerBase extends ControllerBase { self: ProjectServi
|
|||||||
val loginUserName = context.loginAccount.get.userName
|
val loginUserName = context.loginAccount.get.userName
|
||||||
|
|
||||||
// Insert to the database at first
|
// Insert to the database at first
|
||||||
createProject(form.name, loginUserName, Some(form.description))
|
createRepository(form.name, loginUserName, Some(form.description))
|
||||||
|
|
||||||
// Create the actual repository
|
// Create the actual repository
|
||||||
val gitdir = getRepositoryDir(loginUserName, form.name)
|
val gitdir = getRepositoryDir(loginUserName, form.name)
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package app
|
|||||||
|
|
||||||
import service._
|
import service._
|
||||||
|
|
||||||
class IndexController extends IndexControllerBase with ProjectService with AccountService
|
class IndexController extends IndexControllerBase with RepositoryService with AccountService
|
||||||
|
|
||||||
trait IndexControllerBase extends ControllerBase { self: ProjectService =>
|
trait IndexControllerBase extends ControllerBase { self: RepositoryService =>
|
||||||
|
|
||||||
get("/"){
|
get("/"){
|
||||||
html.index(getAccessibleRepositories(context.loginAccount, servletContext))
|
html.index(getAccessibleRepositories(context.loginAccount, servletContext))
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ import org.eclipse.jgit.lib._
|
|||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import org.eclipse.jgit.treewalk._
|
import org.eclipse.jgit.treewalk._
|
||||||
|
|
||||||
class RepositoryViewerController extends RepositoryViewerControllerBase with ProjectService with AccountService
|
class RepositoryViewerController extends RepositoryViewerControllerBase
|
||||||
|
with RepositoryService with AccountService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository viewer.
|
* The repository viewer.
|
||||||
*/
|
*/
|
||||||
trait RepositoryViewerControllerBase extends ControllerBase { self: ProjectService with AccountService =>
|
trait RepositoryViewerControllerBase extends ControllerBase {
|
||||||
|
self: RepositoryService with AccountService =>
|
||||||
|
|
||||||
// TODO separate to AccountController?
|
// TODO separate to AccountController?
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package app
|
|||||||
|
|
||||||
import service._
|
import service._
|
||||||
|
|
||||||
class SettingsController extends SettingsControllerBase with ProjectService with AccountService
|
class SettingsController extends SettingsControllerBase with RepositoryService with AccountService
|
||||||
|
|
||||||
|
|
||||||
trait SettingsControllerBase extends ControllerBase { self: ProjectService =>
|
trait SettingsControllerBase extends ControllerBase { self: RepositoryService =>
|
||||||
|
|
||||||
get("/:owner/:repository/settings") {
|
get("/:owner/:repository/settings") {
|
||||||
val owner = params("owner")
|
val owner = params("owner")
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import util.JGitUtil
|
|||||||
import util.Directory._
|
import util.Directory._
|
||||||
import jp.sf.amateras.scalatra.forms._
|
import jp.sf.amateras.scalatra.forms._
|
||||||
|
|
||||||
class WikiController extends WikiControllerBase with WikiService with ProjectService with AccountService
|
class WikiController extends WikiControllerBase
|
||||||
|
with WikiService with RepositoryService with AccountService
|
||||||
|
|
||||||
trait WikiControllerBase extends ControllerBase { self: WikiService with ProjectService =>
|
trait WikiControllerBase extends ControllerBase { self: WikiService with RepositoryService =>
|
||||||
|
|
||||||
case class WikiPageEditForm(pageName: String, content: String, message: Option[String], currentPageName: String)
|
case class WikiPageEditForm(pageName: String, content: String, message: Option[String], currentPageName: String)
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import Database.threadLocalSession
|
|||||||
import util.JGitUtil
|
import util.JGitUtil
|
||||||
import javax.servlet.ServletContext
|
import javax.servlet.ServletContext
|
||||||
|
|
||||||
trait ProjectService { self: AccountService =>
|
trait RepositoryService { self: AccountService =>
|
||||||
import ProjectService._
|
import RepositoryService._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new project.
|
* Creates a new repository.
|
||||||
*
|
*
|
||||||
* The project is created as public repository at first. Users can modify the project type at the repository settings
|
* The project is created as public repository at first. Users can modify the project type at the repository settings
|
||||||
* page after the project creation to configure the project as the private repository.
|
* page after the project creation to configure the project as the private repository.
|
||||||
@@ -20,7 +20,7 @@ trait ProjectService { self: AccountService =>
|
|||||||
* @param description the project description
|
* @param description the project description
|
||||||
* @return the created project id
|
* @return the created project id
|
||||||
*/
|
*/
|
||||||
def createProject(repositoryName: String, userName: String, description: Option[String]): Long = {
|
def createRepository(repositoryName: String, userName: String, description: Option[String]): Long = {
|
||||||
// TODO create a git repository also here?
|
// TODO create a git repository also here?
|
||||||
|
|
||||||
// TODO insert default labels.
|
// TODO insert default labels.
|
||||||
@@ -103,7 +103,7 @@ trait ProjectService { self: AccountService =>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object ProjectService {
|
object RepositoryService {
|
||||||
|
|
||||||
val Public = 0
|
val Public = 0
|
||||||
val Private = 1
|
val Private = 1
|
||||||
@@ -25,7 +25,7 @@ object helpers {
|
|||||||
/**
|
/**
|
||||||
* Converts the issue number and the commit id to the link.
|
* Converts the issue number and the commit id to the link.
|
||||||
*/
|
*/
|
||||||
private def markdownFilter(value: String, repository: service.ProjectService.RepositoryInfo)(implicit context: app.Context): String = {
|
private def markdownFilter(value: String, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context): String = {
|
||||||
value
|
value
|
||||||
.replaceAll("#([0-9]+)", "[$0](%s/%s/%s/issue/$1)".format(context.path, repository.owner, repository.name))
|
.replaceAll("#([0-9]+)", "[$0](%s/%s/%s/issue/$1)".format(context.path, repository.owner, repository.name))
|
||||||
.replaceAll("[0-9a-f]{40}", "[$0](%s/%s/%s/commit/$0)".format(context.path, repository.owner, repository.name))
|
.replaceAll("[0-9a-f]{40}", "[$0](%s/%s/%s/commit/$0)".format(context.path, repository.owner, repository.name))
|
||||||
@@ -34,7 +34,7 @@ object helpers {
|
|||||||
/**
|
/**
|
||||||
* Converts Markdown of Wiki pages to HTML.
|
* Converts Markdown of Wiki pages to HTML.
|
||||||
*/
|
*/
|
||||||
def markdown(value: String, repository: service.ProjectService.RepositoryInfo, wikiLink: Boolean)(implicit context: app.Context): twirl.api.Html = {
|
def markdown(value: String, repository: service.RepositoryService.RepositoryInfo, wikiLink: Boolean)(implicit context: app.Context): twirl.api.Html = {
|
||||||
import org.pegdown._
|
import org.pegdown._
|
||||||
val html = new PegDownProcessor(Extensions.AUTOLINKS|Extensions.WIKILINKS|Extensions.FENCED_CODE_BLOCKS)
|
val html = new PegDownProcessor(Extensions.AUTOLINKS|Extensions.WIKILINKS|Extensions.FENCED_CODE_BLOCKS)
|
||||||
.markdownToHtml(markdownFilter(value, repository), new LinkRenderer(){
|
.markdownToHtml(markdownFilter(value, repository), new LinkRenderer(){
|
||||||
|
|||||||
Reference in New Issue
Block a user