diff options
Diffstat (limited to 'templates/package/content')
25 files changed, 1175 insertions, 0 deletions
diff --git a/templates/package/content/alpine.tmpl b/templates/package/content/alpine.tmpl new file mode 100644 index 0000000..8914006 --- /dev/null +++ b/templates/package/content/alpine.tmpl @@ -0,0 +1,52 @@ +{{if eq .PackageDescriptor.Package.Type "alpine"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.alpine.registry"}}</label> + <div class="markup"><pre class="code-block"><code><origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/alpine"></origin-url>/$branch/$repository</code></pre></div> + <p>{{ctx.Locale.Tr "packages.alpine.registry.info"}}</p> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.alpine.registry.key"}}</label> + <div class="markup"><pre class="code-block"><code>curl -JO <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/alpine/key"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.alpine.install"}}</label> + <div class="markup"> + <pre class="code-block"><code>sudo apk add {{$.PackageDescriptor.Package.Name}}={{$.PackageDescriptor.Version.Version}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Alpine" "https://forgejo.org/docs/latest/user/packages/alpine/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.alpine.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.branches"}}</h5></td> + <td>{{StringUtils.Join .Branches ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.repositories"}}</h5></td> + <td>{{StringUtils.Join .Repositories ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/arch.tmpl b/templates/package/content/arch.tmpl new file mode 100644 index 0000000..6138b1d --- /dev/null +++ b/templates/package/content/arch.tmpl @@ -0,0 +1,143 @@ +{{if eq .PackageDescriptor.Package.Type "arch"}} +<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> +<div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.arch.pacman.helper.gpg"}}</label> + <div class="markup"> + <pre class="code-block"><code>wget -O sign.gpg <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/arch/repository.key"></origin-url> +pacman-key --add sign.gpg +pacman-key --lsign-key '{{$.SignMail}}'</code></pre> + </div> + </div> + <div class="field"> + <label>{{svg "octicon-gear"}} {{ctx.Locale.Tr "packages.arch.pacman.conf"}}</label> + <div class="markup"> + <pre + class="code-block"><code> +{{- if gt (len $.Groups) 1 -}} +# {{ctx.Locale.Tr "packages.arch.pacman.repo.multi" $.PackageDescriptor.Package.LowerName}} + +{{end -}} +{{- $GroupSize := (len .Groups) -}} +{{- range $i,$v := .Groups -}} +{{- if gt $i 0}} +{{end -}}{{- if gt $GroupSize 1 -}} +# {{ctx.Locale.Tr "packages.arch.pacman.repo.multi.item" .}} +{{end -}} +[{{$.PackageDescriptor.Owner.LowerName}}.{{$.RegistryHost}}] +SigLevel = Required +Server = <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/arch/{{.}}/$arch"></origin-url> +{{end -}} +</code></pre> + </div> + </div> + <div class="field"> + <label>{{svg "octicon-sync"}} {{ctx.Locale.Tr "packages.arch.pacman.sync"}}</label> + <div class="markup"> + <pre class="code-block"><code>pacman -Sy {{.PackageDescriptor.Package.LowerName}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Arch" + "https://forgejo.org/docs/latest/user/packages/arch/"}}</label> + </div> + </div> +</div> + +<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.arch.version.properties"}}</h4> +<div class="ui attached segment"> + <table class="ui very basic compact table"> + <tbody> + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.description"}}</h5> + </td> + <td>{{.PackageDescriptor.Metadata.Description}}</td> + </tr> + + {{if .PackageDescriptor.Metadata.Groups}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.groups"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.Groups ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.Provides}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.provides"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.Provides ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.Depends}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.depends"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.Depends ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.OptDepends}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.optdepends"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.OptDepends ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.MakeDepends}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.makedepends"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.MakeDepends ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.CheckDepends}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.checkdepends"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.CheckDepends ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.Conflicts}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.conflicts"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.Conflicts ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.Replaces}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.replaces"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.Replaces ", "}}</td> + </tr> + {{end}} + + {{if .PackageDescriptor.Metadata.Backup}} + <tr> + <td class="collapsing"> + <h5>{{ctx.Locale.Tr "packages.arch.version.backup"}}</h5> + </td> + <td>{{StringUtils.Join $.PackageDescriptor.Metadata.Backup ", "}}</td> + </tr> + {{end}} + </tbody> + </table> +</div> + +{{end}} diff --git a/templates/package/content/cargo.tmpl b/templates/package/content/cargo.tmpl new file mode 100644 index 0000000..2f14945 --- /dev/null +++ b/templates/package/content/cargo.tmpl @@ -0,0 +1,63 @@ +{{if eq .PackageDescriptor.Package.Type "cargo"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.cargo.registry"}}</label> + <div class="markup"><pre class="code-block"><code>[registry] +default = "forgejo" + +[registries.forgejo] +index = "sparse+<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cargo/"></origin-url>" # Sparse index +# index = "<origin-url data-url="{{AppSubUrl}}/{{.PackageDescriptor.Owner.Name}}/_cargo-index.git"></origin-url>" # Git + +[net] +git-fetch-with-cli = true</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.cargo.install"}}</label> + <div class="markup"><pre class="code-block"><code>cargo add {{.PackageDescriptor.Package.Name}}@{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Cargo" "https://forgejo.org/docs/latest/user/packages/cargo/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="six wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{.Req}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/chef.tmpl b/templates/package/content/chef.tmpl new file mode 100644 index 0000000..d39164b --- /dev/null +++ b/templates/package/content/chef.tmpl @@ -0,0 +1,48 @@ +{{if eq .PackageDescriptor.Package.Type "chef"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.chef.registry"}}</label> + <div class="markup"><pre class="code-block"><code>knife[:supermarket_site] = '<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/chef"></origin-url>'</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.chef.install"}}</label> + <div class="markup"><pre class="code-block"><code>knife supermarket install {{.PackageDescriptor.Package.Name}} {{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Chef" "https://forgejo.org/docs/latest/user/packages/chef/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}<p>{{.PackageDescriptor.Metadata.Description}}</p>{{end}} + {{if .PackageDescriptor.Metadata.LongDescription}}{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/composer.tmpl b/templates/package/content/composer.tmpl new file mode 100644 index 0000000..73ab3ac --- /dev/null +++ b/templates/package/content/composer.tmpl @@ -0,0 +1,50 @@ +{{if eq .PackageDescriptor.Package.Type "composer"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.composer.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{ + "repositories": [{ + "type": "composer", + "url": "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/composer"></origin-url>" + } + ] +}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.composer.install"}}</label> + <div class="markup"><pre class="code-block"><code>composer require {{.PackageDescriptor.Package.Name}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Composer" "https://forgejo.org/docs/latest/user/packages/composer/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Comments}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Comments}}<div class="ui attached segment">{{StringUtils.Join .PackageDescriptor.Metadata.Comments " "}}</div>{{end}} + {{end}} + + {{if or .PackageDescriptor.Metadata.Require .PackageDescriptor.Metadata.RequireDev}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.Require "title" (ctx.Locale.Tr "packages.composer.dependencies")}} + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RequireDev "title" (ctx.Locale.Tr "packages.composer.dependencies.development")}} + </div> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/composer_dependencies.tmpl b/templates/package/content/composer_dependencies.tmpl new file mode 100644 index 0000000..dba4575 --- /dev/null +++ b/templates/package/content/composer_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/conan.tmpl b/templates/package/content/conan.tmpl new file mode 100644 index 0000000..8ebc258 --- /dev/null +++ b/templates/package/content/conan.tmpl @@ -0,0 +1,34 @@ +{{if eq .PackageDescriptor.Package.Type "conan"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conan.registry"}}</label> + <div class="markup"><pre class="code-block"><code>conan remote add forgejo <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conan"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conan.install"}}</label> + <div class="markup"><pre class="code-block"><code>conan install --remote=forgejo {{.PackageDescriptor.Package.Name}}/{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Conan" "https://forgejo.org/docs/latest/user/packages/conan/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/conda.tmpl b/templates/package/content/conda.tmpl new file mode 100644 index 0000000..5ff7944 --- /dev/null +++ b/templates/package/content/conda.tmpl @@ -0,0 +1,30 @@ +{{if eq .PackageDescriptor.Package.Type "conda"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.conda.registry"}}</label> + <div class="markup"><pre class="code-block"><code>channel_alias: <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url> +channels: +  - <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url> +default_channels: +  - <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conda.install"}}</label> + {{$channel := .PackageDescriptor.PackageProperties.GetByName "conda.channel"}} + <div class="markup"><pre class="code-block"><code>conda install{{if $channel}} -c {{$channel}}{{end}} {{.PackageDescriptor.PackageProperties.GetByName "conda.name"}}={{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Conda" "https://forgejo.org/docs/latest/user/packages/conda/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{else}}{{.PackageDescriptor.Metadata.Summary}}{{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl new file mode 100644 index 0000000..b5fdcfe --- /dev/null +++ b/templates/package/content/container.tmpl @@ -0,0 +1,90 @@ +{{if eq .PackageDescriptor.Package.Type "container"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.container.pull"}}</label> + {{if eq .PackageDescriptor.Metadata.Type "helm"}} + <div class="markup"><pre class="code-block"><code>helm pull oci://{{.RegistryHost}}/{{.PackageDescriptor.Owner.LowerName}}/{{.PackageDescriptor.Package.LowerName}} --version {{.PackageDescriptor.Version.LowerVersion}}</code></pre></div> + {{else}} + {{$separator := ":"}} + {{if not .PackageDescriptor.Metadata.IsTagged}} + {{$separator = "@"}} + {{end}} + <div class="markup"><pre class="code-block"><code>docker pull {{.RegistryHost}}/{{.PackageDescriptor.Owner.LowerName}}/{{.PackageDescriptor.Package.LowerName}}{{$separator}}{{.PackageDescriptor.Version.LowerVersion}}</code></pre></div> + {{end}} + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.container.digest"}}</label> + <div class="markup"><pre class="code-block"><code>{{range .PackageDescriptor.Files}}{{if eq .File.LowerName "manifest.json"}}{{.Properties.GetByName "container.digest"}}{{end}}{{end}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Container" "https://forgejo.org/docs/latest/user/packages/container/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Manifests}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.multi_arch"}}</h4> + <div class="ui attached segment"> + <table class="ui very basic compact table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "packages.container.digest"}}</th> + <th>{{ctx.Locale.Tr "packages.container.multi_arch"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.size"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Manifests}} + <tr> + <td><a href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{.Digest}}</a></td> + <td>{{.Platform}}</td> + <td>{{ctx.Locale.TrSize .Size}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.ImageLayers}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.layers"}}</h4> + <div class="ui attached segment tw-break-anywhere"> + <table class="ui very basic compact table"> + <tbody> + {{range .PackageDescriptor.Metadata.ImageLayers}} + <tr> + <td>{{.}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.Labels}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.labels"}}</h4> + <div class="ui attached segment"> + <table class="ui very basic compact table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "packages.container.labels.key"}}</th> + <th>{{ctx.Locale.Tr "packages.container.labels.value"}}</th> + </tr> + </thead> + <tbody> + {{range $key, $value := .PackageDescriptor.Metadata.Labels}} + <tr> + <td class="top aligned">{{$key}}</td> + <td class="tw-break-anywhere">{{$value}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/cran.tmpl b/templates/package/content/cran.tmpl new file mode 100644 index 0000000..df7a48c --- /dev/null +++ b/templates/package/content/cran.tmpl @@ -0,0 +1,59 @@ +{{if eq .PackageDescriptor.Package.Type "cran"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.cran.registry"}}</label> + <div class="markup"><pre class="code-block"><code>options("repos" = c(getOption("repos"), c(forgejo="<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cran"></origin-url>")))</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.cran.install"}}</label> + <div class="markup"><pre class="code-block"><code>install.packages("{{.PackageDescriptor.Package.Name}}")</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "CRAN" "https://forgejo.org/docs/latest/user/packages/cran/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Title}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Title}}{{else}}{{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Imports .PackageDescriptor.Metadata.Depends .PackageDescriptor.Metadata.LinkingTo .PackageDescriptor.Metadata.Suggests}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + {{if .PackageDescriptor.Metadata.Imports}} + <tr> + <td>Imports</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Imports ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.Depends}} + <tr> + <td>Depends</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Depends ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.LinkingTo}} + <tr> + <td>LinkingTo</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.LinkingTo ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.Suggests}} + <tr> + <td>Suggests</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Suggests ", "}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/debian.tmpl b/templates/package/content/debian.tmpl new file mode 100644 index 0000000..782ac1c --- /dev/null +++ b/templates/package/content/debian.tmpl @@ -0,0 +1,65 @@ +{{if eq .PackageDescriptor.Package.Type "debian"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.debian.registry"}}</label> + <div class="markup"><pre class="code-block"><code>sudo curl <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/debian/repository.key"></origin-url> -o /etc/apt/keyrings/forgejo-{{$.PackageDescriptor.Owner.Name}}.asc +echo "deb [signed-by=/etc/apt/keyrings/forgejo-{{$.PackageDescriptor.Owner.Name}}.asc] <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/debian"></origin-url> $distribution $component" | sudo tee -a /etc/apt/sources.list.d/forgejo.list +sudo apt update</code></pre></div> + <p>{{ctx.Locale.Tr "packages.debian.registry.info"}}</p> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.debian.install"}}</label> + <div class="markup"> + <pre class="code-block"><code>sudo apt install {{$.PackageDescriptor.Package.Name}}={{$.PackageDescriptor.Version.Version}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Debian" "https://forgejo.org/docs/latest/user/packages/debian/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.debian.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.distributions"}}</h5></td> + <td>{{StringUtils.Join .Distributions ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.components"}}</h5></td> + <td>{{StringUtils.Join .Components ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/generic.tmpl b/templates/package/content/generic.tmpl new file mode 100644 index 0000000..4ebfb91 --- /dev/null +++ b/templates/package/content/generic.tmpl @@ -0,0 +1,18 @@ +{{if eq .PackageDescriptor.Package.Type "generic"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.generic.download"}}</label> + <div class="markup"><pre class="code-block"><code> +{{- range .PackageDescriptor.Files -}} +curl -OJ <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/generic/{{$.PackageDescriptor.Package.Name}}/{{$.PackageDescriptor.Version.Version}}/{{.File.Name}}"></origin-url> +{{end -}} + </code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Generic" "https://forgejo.org/docs/latest/user/packages/generic/"}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/go.tmpl b/templates/package/content/go.tmpl new file mode 100644 index 0000000..5e32ea7 --- /dev/null +++ b/templates/package/content/go.tmpl @@ -0,0 +1,14 @@ +{{if eq .PackageDescriptor.Package.Type "go"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.go.install"}}</label> + <div class="markup"><pre class="code-block"><code>GOPROXY=<origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/go"></origin-url> go install {{$.PackageDescriptor.Package.Name}}@{{$.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Go" "https://forgejo.org/docs/latest/user/packages/go/"}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/helm.tmpl b/templates/package/content/helm.tmpl new file mode 100644 index 0000000..9d85555 --- /dev/null +++ b/templates/package/content/helm.tmpl @@ -0,0 +1,57 @@ +{{if eq .PackageDescriptor.Package.Type "helm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.helm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>helm repo add {{AppDomain}} <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/helm"></origin-url> +helm repo update</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.helm.install"}}</label> + <div class="markup"><pre class="code-block"><code>helm install {{.PackageDescriptor.Package.Name}} {{AppDomain}}/{{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Helm" "https://forgejo.org/docs/latest/user/packages/helm/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="six wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{.Version}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl new file mode 100644 index 0000000..7f7e3fa --- /dev/null +++ b/templates/package/content/maven.tmpl @@ -0,0 +1,75 @@ +{{if eq .PackageDescriptor.Package.Type "maven"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.registry"}}</label> + <div class="markup"><pre class="code-block"><code><repositories> + <repository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </repository> +</repositories> + +<distributionManagement> + <repository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </repository> + + <snapshotRepository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </snapshotRepository> +</distributionManagement></code></pre></div> + </div> + {{if .PackageDescriptor.Metadata}} + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.install"}}</label> + <div class="markup"><pre class="code-block"><code><dependency> + <groupId>{{.PackageDescriptor.Metadata.GroupID}}</groupId> + <artifactId>{{.PackageDescriptor.Metadata.ArtifactID}}</artifactId> + <version>{{.PackageDescriptor.Version.Version}}</version> +</dependency></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.install2"}}</label> + <div class="markup"><pre class="code-block"><code>mvn install</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.download"}}</label> + <div class="markup"><pre class="code-block"><code>mvn dependency:get -DremoteRepositories=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url> -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Maven" "https://forgejo.org/docs/latest/user/packages/maven/"}}</label> + </div> + {{end}} + </div> + </div> + + {{if .PackageDescriptor.Metadata}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{range .PackageDescriptor.Metadata.Dependencies}} + <div class="item"> + <i class="icon">{{svg "octicon-package-dependencies" 16 ""}}</i> + <div class="content"> + <div class="header">{{.GroupID}}:{{.ArtifactID}}</div> + <div class="description text small">{{.Version}}</div> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + {{end}} +{{end}} diff --git a/templates/package/content/npm.tmpl b/templates/package/content/npm.tmpl new file mode 100644 index 0000000..1ffbd19 --- /dev/null +++ b/templates/package/content/npm.tmpl @@ -0,0 +1,65 @@ +{{if eq .PackageDescriptor.Package.Type "npm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.npm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{{if .PackageDescriptor.Metadata.Scope}}{{.PackageDescriptor.Metadata.Scope}}:{{end}}registry=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/npm/"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.npm.install"}}</label> + <div class="markup"><pre class="code-block"><code>npm install {{.PackageDescriptor.Package.Name}}@{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.npm.install2"}}</label> + <div class="markup"><pre class="code-block"><code>"{{.PackageDescriptor.Package.Name}}": "{{.PackageDescriptor.Version.Version}}"</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "npm" "https://forgejo.org/docs/latest/user/packages/npm/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Readme}} + <div class="markup markdown"> + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}} + </div> + {{else if .PackageDescriptor.Metadata.Description}} + {{.PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Dependencies .PackageDescriptor.Metadata.DevelopmentDependencies .PackageDescriptor.Metadata.PeerDependencies .PackageDescriptor.Metadata.OptionalDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.Dependencies "title" (ctx.Locale.Tr "packages.npm.dependencies")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.development")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.PeerDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.peer")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.OptionalDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.optional")}} + </div> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.BundleDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.npm.dependencies.bundle"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.BundleDependencies}} + {{.}} + {{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/npm_dependencies.tmpl b/templates/package/content/npm_dependencies.tmpl new file mode 100644 index 0000000..dba4575 --- /dev/null +++ b/templates/package/content/npm_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/nuget.tmpl b/templates/package/content/nuget.tmpl new file mode 100644 index 0000000..ea665c7 --- /dev/null +++ b/templates/package/content/nuget.tmpl @@ -0,0 +1,51 @@ +{{if eq .PackageDescriptor.Package.Type "nuget"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.nuget.registry"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet nuget add source --name {{.PackageDescriptor.Owner.Name}} --username your_username --password your_token <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/nuget/index.json"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.nuget.install"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet add package --source {{.PackageDescriptor.Owner.Name}} --version {{.PackageDescriptor.Version.Version}} {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "NuGet" "https://forgejo.org/docs/latest/user/packages/nuget/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.ReleaseNotes .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ReleaseNotes}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.ReleaseNotes}}</div>{{end}} + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="three wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + <th class="three wide">{{ctx.Locale.Tr "packages.nuget.dependency.framework"}}</th> + </tr> + </thead> + <tbody> + {{range $framework, $dependencies := .PackageDescriptor.Metadata.Dependencies}} + {{range $dependencies}} + <tr> + <td>{{.ID}}</td> + <td>{{.Version}}</td> + <td>{{$framework}}</td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/pub.tmpl b/templates/package/content/pub.tmpl new file mode 100644 index 0000000..8448b97 --- /dev/null +++ b/templates/package/content/pub.tmpl @@ -0,0 +1,19 @@ +{{if eq .PackageDescriptor.Package.Type "pub"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.pub.install"}}</label> + <div class="markup"><pre class="code-block"><code>dart pub add {{.PackageDescriptor.Package.Name}}:{{.PackageDescriptor.Version.Version}} --hosted-url=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pub/"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Pub" "https://forgejo.org/docs/latest/user/packages/pub/"}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/content/pypi.tmpl b/templates/package/content/pypi.tmpl new file mode 100644 index 0000000..6addac3 --- /dev/null +++ b/templates/package/content/pypi.tmpl @@ -0,0 +1,31 @@ +{{if eq .PackageDescriptor.Package.Type "pypi"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.pypi.install"}}</label> + <div class="markup"><pre class="code-block"><code>pip install --index-url <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pypi/simple/"></origin-url> {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "PyPI" "https://forgejo.org/docs/latest/user/packages/pypi/"}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + <p>{{if .PackageDescriptor.Metadata.Summary}}{{.PackageDescriptor.Metadata.Summary}}{{end}}</p> + {{if .PackageDescriptor.Metadata.LongDescription}} + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}} + {{else if .PackageDescriptor.Metadata.Description}} + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.RequiresPython}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{ctx.Locale.Tr "packages.pypi.requires"}}: {{.PackageDescriptor.Metadata.RequiresPython}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rpm.tmpl b/templates/package/content/rpm.tmpl new file mode 100644 index 0000000..f5d5662 --- /dev/null +++ b/templates/package/content/rpm.tmpl @@ -0,0 +1,56 @@ +{{if eq .PackageDescriptor.Package.Type "rpm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rpm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{{- if gt (len .Groups) 1 -}} +# {{ctx.Locale.Tr "packages.rpm.repository.multiple_groups"}} + +{{end -}} +# {{ctx.Locale.Tr "packages.rpm.distros.redhat"}} +{{- range $group := .Groups}} + {{- if $group}}{{$group = print "/" $group}}{{end}} +dnf config-manager --add-repo <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/rpm{{$group}}.repo"></origin-url> +{{- end}} + +# {{ctx.Locale.Tr "packages.rpm.distros.suse"}} +{{- range $group := .Groups}} + {{- if $group}}{{$group = print "/" $group}}{{end}} +zypper addrepo <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/rpm{{$group}}.repo"></origin-url> +{{- end}}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rpm.install"}}</label> + <div class="markup"> + <pre class="code-block"><code># {{ctx.Locale.Tr "packages.rpm.distros.redhat"}} +dnf install {{$.PackageDescriptor.Package.Name}} + +# {{ctx.Locale.Tr "packages.rpm.distros.suse"}} +zypper install {{$.PackageDescriptor.Package.Name}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "RPM" "https://forgejo.org/docs/latest/user/packages/rpm/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.rpm.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.rpm.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if or .PackageDescriptor.Metadata.Summary .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Summary}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Summary}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/content/rubygems.tmpl b/templates/package/content/rubygems.tmpl new file mode 100644 index 0000000..009fd70 --- /dev/null +++ b/templates/package/content/rubygems.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "rubygems"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rubygems.install"}}:</label> + <div class="markup"><pre class="code-block"><code>gem install {{.PackageDescriptor.Package.Name}} --version "{{.PackageDescriptor.Version.Version}}" --source "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"></origin-url>"</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.rubygems.install2"}}:</label> + <div class="markup"><pre class="code-block"><code>source "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"></origin-url>" do + gem "{{.PackageDescriptor.Package.Name}}", "{{.PackageDescriptor.Version.Version}}" +end</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "RubyGems" "https://forgejo.org/docs/latest/user/packages/rubygems/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div> + {{end}} + {{if or .PackageDescriptor.Metadata.RequiredRubyVersion .PackageDescriptor.Metadata.RequiredRubygemsVersion}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.RequiredRubyVersion}}<p>{{ctx.Locale.Tr "packages.rubygems.required.ruby"}}: {{range $i, $v := .PackageDescriptor.Metadata.RequiredRubyVersion}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</p>{{end}} + {{if .PackageDescriptor.Metadata.RequiredRubygemsVersion}}<p>{{ctx.Locale.Tr "packages.rubygems.required.rubygems"}}: {{range $i, $v := .PackageDescriptor.Metadata.RequiredRubygemsVersion}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</p>{{end}} + </div> + {{end}} + {{if or .PackageDescriptor.Metadata.RuntimeDependencies .PackageDescriptor.Metadata.DevelopmentDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RuntimeDependencies "title" (ctx.Locale.Tr "packages.rubygems.dependencies.runtime")}} + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (ctx.Locale.Tr "packages.rubygems.dependencies.development")}} + </div> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rubygems_dependencies.tmpl b/templates/package/content/rubygems_dependencies.tmpl new file mode 100644 index 0000000..2c42dce --- /dev/null +++ b/templates/package/content/rubygems_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{range $i, $v := .Version}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/swift.tmpl b/templates/package/content/swift.tmpl new file mode 100644 index 0000000..68db444 --- /dev/null +++ b/templates/package/content/swift.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "swift"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.swift.registry"}}</label> + <div class="markup"><pre class="code-block"><code>swift package-registry set <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/swift"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.swift.install"}}</label> + <div class="markup"><pre class="code-block"><code>dependencies: [ + .package(id: "{{.PackageDescriptor.Package.Name}}", from:"{{.PackageDescriptor.Version.Version}}") +]</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.swift.install2"}}</label> + <div class="markup"><pre class="code-block"><code>swift package resolve</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Swift" "https://forgejo.org/docs/latest/user/packages/swift/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/vagrant.tmpl b/templates/package/content/vagrant.tmpl new file mode 100644 index 0000000..4dc3e62 --- /dev/null +++ b/templates/package/content/vagrant.tmpl @@ -0,0 +1,18 @@ +{{if eq .PackageDescriptor.Package.Type "vagrant"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.vagrant.install"}}</label> + <div class="markup"><pre class="code-block"><code>vagrant box add --box-version {{.PackageDescriptor.Version.Version}} "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/vagrant/{{.PackageDescriptor.Package.Name}}"></origin-url>"</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Vagrant" "https://forgejo.org/docs/latest/user/packages/vagrant/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div> + {{end}} +{{end}} |