diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-03-30 10:42:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 16:42:47 +0800 |
commit | 1d332342db6d5bd4e1552d8d46720bf1b948c26b (patch) | |
tree | ca0c8931e5da85e71037ed43d7a90826ba708d9d /templates/package/content | |
parent | 2bce1ea9862c70ebb69963e65bb84dcad6ebb31c (diff) | |
download | gitea-1d332342db6d5bd4e1552d8d46720bf1b948c26b.tar.gz gitea-1d332342db6d5bd4e1552d8d46720bf1b948c26b.zip |
Add Package Registry (#16510)
* Added package store settings.
* Added models.
* Added generic package registry.
* Added tests.
* Added NuGet package registry.
* Moved service index to api file.
* Added NPM package registry.
* Added Maven package registry.
* Added PyPI package registry.
* Summary is deprecated.
* Changed npm name.
* Sanitize project url.
* Allow only scoped packages.
* Added user interface.
* Changed method name.
* Added missing migration file.
* Set page info.
* Added documentation.
* Added documentation links.
* Fixed wrong error message.
* Lint template files.
* Fixed merge errors.
* Fixed unit test storage path.
* Switch to json module.
* Added suggestions.
* Added package webhook.
* Add package api.
* Fixed swagger file.
* Fixed enum and comments.
* Fixed NuGet pagination.
* Print test names.
* Added api tests.
* Fixed access level.
* Fix User unmarshal.
* Added RubyGems package registry.
* Fix lint.
* Implemented io.Writer.
* Added support for sha256/sha512 checksum files.
* Improved maven-metadata.xml support.
* Added support for symbol package uploads.
* Added tests.
* Added overview docs.
* Added npm dependencies and keywords.
* Added no-packages information.
* Display file size.
* Display asset count.
* Fixed filter alignment.
* Added package icons.
* Formatted instructions.
* Allow anonymous package downloads.
* Fixed comments.
* Fixed postgres test.
* Moved file.
* Moved models to models/packages.
* Use correct error response format per client.
* Use simpler search form.
* Fixed IsProd.
* Restructured data model.
* Prevent empty filename.
* Fix swagger.
* Implemented user/org registry.
* Implemented UI.
* Use GetUserByIDCtx.
* Use table for dependencies.
* make svg
* Added support for unscoped npm packages.
* Add support for npm dist tags.
* Added tests for npm tags.
* Unlink packages if repository gets deleted.
* Prevent user/org delete if a packages exist.
* Use package unlink in repository service.
* Added support for composer packages.
* Restructured package docs.
* Added missing tests.
* Fixed generic content page.
* Fixed docs.
* Fixed swagger.
* Added missing type.
* Fixed ambiguous column.
* Organize content store by sha256 hash.
* Added admin package management.
* Added support for sorting.
* Add support for multiple identical versions/files.
* Added missing repository unlink.
* Added file properties.
* make fmt
* lint
* Added Conan package registry.
* Updated docs.
* Unify package names.
* Added swagger enum.
* Use longer TEXT column type.
* Removed version composite key.
* Merged package and container registry.
* Removed index.
* Use dedicated package router.
* Moved files to new location.
* Updated docs.
* Fixed JOIN order.
* Fixed GROUP BY statement.
* Fixed GROUP BY #2.
* Added symbol server support.
* Added more tests.
* Set NOT NULL.
* Added setting to disable package registries.
* Moved auth into service.
* refactor
* Use ctx everywhere.
* Added package cleanup task.
* Changed packages path.
* Added container registry.
* Refactoring
* Updated comparison.
* Fix swagger.
* Fixed table order.
* Use token auth for npm routes.
* Enabled ReverseProxy auth.
* Added packages link for orgs.
* Fixed anonymous org access.
* Enable copy button for setup instructions.
* Merge error
* Added suggestions.
* Fixed merge.
* Handle "generic".
* Added link for TODO.
* Added suggestions.
* Changed temporary buffer filename.
* Added suggestions.
* Apply suggestions from code review
Co-authored-by: Thomas Boerger <thomas@webhippie.de>
* Update docs/content/doc/packages/nuget.en-us.md
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Thomas Boerger <thomas@webhippie.de>
Diffstat (limited to 'templates/package/content')
-rw-r--r-- | templates/package/content/composer.tmpl | 50 | ||||
-rw-r--r-- | templates/package/content/composer_dependencies.tmpl | 19 | ||||
-rw-r--r-- | templates/package/content/conan.tmpl | 34 | ||||
-rw-r--r-- | templates/package/content/container.tmpl | 78 | ||||
-rw-r--r-- | templates/package/content/generic.tmpl | 14 | ||||
-rw-r--r-- | templates/package/content/maven.tmpl | 71 | ||||
-rw-r--r-- | templates/package/content/npm.tmpl | 56 | ||||
-rw-r--r-- | templates/package/content/npm_dependencies.tmpl | 19 | ||||
-rw-r--r-- | templates/package/content/nuget.tmpl | 52 | ||||
-rw-r--r-- | templates/package/content/pypi.tmpl | 31 | ||||
-rw-r--r-- | templates/package/content/rubygems.tmpl | 40 | ||||
-rw-r--r-- | templates/package/content/rubygems_dependencies.tmpl | 19 |
12 files changed, 483 insertions, 0 deletions
diff --git a/templates/package/content/composer.tmpl b/templates/package/content/composer.tmpl new file mode 100644 index 0000000000..29162f97b0 --- /dev/null +++ b/templates/package/content/composer.tmpl @@ -0,0 +1,50 @@ +{{if eq .PackageDescriptor.Package.Type "composer"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{.i18n.Tr "packages.composer.registry" | Safe}}</label> + <div class="markup"><pre class="code-block"><code>{ + "repositories": [{ + "type": "composer", + "url": "{{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/composer" + } + ] +}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.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>{{.i18n.Tr "packages.composer.documentation" | Safe}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Require .PackageDescriptor.Metadata.RequireDev}} + <h4 class="ui top attached header">{{.i18n.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" (.i18n.Tr "packages.composer.dependencies")}} + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RequireDev "title" (.i18n.Tr "packages.composer.dependencies.development")}} + </div> + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{.i18n.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 0000000000..1ab644f417 --- /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">{{.root.i18n.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{.root.i18n.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 0000000000..3c1c35c00f --- /dev/null +++ b/templates/package/content/conan.tmpl @@ -0,0 +1,34 @@ +{{if eq .PackageDescriptor.Package.Type "conan"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.conan.registry"}}</label> + <div class="markup"><pre class="code-block"><code>conan remote add gitea {{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/conan</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.conan.install"}}</label> + <div class="markup"><pre class="code-block"><code>conan install --remote=gitea {{.PackageDescriptor.Package.Name}}/{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{.i18n.Tr "packages.conan.documentation" | Safe}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{.i18n.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">{{.i18n.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl new file mode 100644 index 0000000000..14d4a56398 --- /dev/null +++ b/templates/package/content/container.tmpl @@ -0,0 +1,78 @@ +{{if eq .PackageDescriptor.Package.Type "container"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.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>{{.i18n.Tr "packages.container.documentation" | Safe}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.MultiArch}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.container.multi_arch"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + {{range $arch, $digest := .PackageDescriptor.Metadata.MultiArch}} + <div class="field"> + <label>{{svg "octicon-terminal"}} {{$arch}}</label> + {{if eq $.PackageDescriptor.Metadata.Type "oci"}} + <div class="markup"><pre class="code-block"><code>docker pull {{$.RegistryHost}}/{{$.PackageDescriptor.Owner.LowerName}}/{{$.PackageDescriptor.Package.LowerName}}@{{$digest}}</code></pre></div> + {{end}} + </div> + {{end}} + </div> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.ImageLayers}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.container.layers"}}</h4> + <div class="ui attached segment"> + <table id="notice-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">{{.i18n.Tr "packages.container.labels"}}</h4> + <div class="ui attached segment"> + <table id="notice-table" class="ui very basic compact table"> + <thead> + <tr> + <th>{{.i18n.Tr "packages.container.labels.key"}}</th> + <th>{{.i18n.Tr "packages.container.labels.value"}}</th> + </tr> + </thead> + <tbody> + {{range $key, $value := .PackageDescriptor.Metadata.Labels}} + <tr> + <td>{{$key}}</td> + <td>{{$value}}</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 0000000000..05a47b3ef4 --- /dev/null +++ b/templates/package/content/generic.tmpl @@ -0,0 +1,14 @@ +{{if eq .PackageDescriptor.Package.Type "generic"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.generic.download"}}</label> + <div class="markup"><pre class="code-block"><code>curl {{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/generic/{{.PackageDescriptor.Package.Name}}/{{.PackageDescriptor.Version.Version}}/{{(index .PackageDescriptor.Files 0).File.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{.i18n.Tr "packages.generic.documentation" | Safe}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl new file mode 100644 index 0000000000..32b89616cb --- /dev/null +++ b/templates/package/content/maven.tmpl @@ -0,0 +1,71 @@ +{{if eq .PackageDescriptor.Package.Type "maven"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{.i18n.Tr "packages.maven.registry" | Safe}}</label> + <div class="markup"><pre class="code-block"><code><repositories> + <repository> + <id>gitea</id> + <url>{{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/maven</url> + </repository> +</repositories> + +<distributionManagement> + <repository> + <id>gitea</id> + <url>{{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/maven</url> + </repository> + + <snapshotRepository> + <id>gitea</id> + <url>{{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/maven</url> + </snapshotRepository> +</distributionManagement></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{.i18n.Tr "packages.maven.install" | Safe}}</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"}} {{.i18n.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"}} {{.i18n.Tr "packages.maven.download"}}</label> + <div class="markup"><pre class="code-block"><code>mvn dependency:get -DremoteRepositories={{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/maven -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{.i18n.Tr "packages.maven.documentation" | Safe}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{.i18n.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}} diff --git a/templates/package/content/npm.tmpl b/templates/package/content/npm.tmpl new file mode 100644 index 0000000000..16347d1b6e --- /dev/null +++ b/templates/package/content/npm.tmpl @@ -0,0 +1,56 @@ +{{if eq .PackageDescriptor.Package.Type "npm"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{.i18n.Tr "packages.npm.registry" | Safe}}</label> + <div class="markup"><pre class="code-block"><code>{{if .PackageDescriptor.Metadata.Scope}}{{.PackageDescriptor.Metadata.Scope}}:{{end}}registry={{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/npm/</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.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"}} {{.i18n.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>{{.i18n.Tr "packages.npm.documentation" | Safe}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Readme}} + <div class="markup markdown"> + {{RenderMarkdownToHtml .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">{{.i18n.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" (.i18n.Tr "packages.npm.dependencies")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (.i18n.Tr "packages.npm.dependencies.development")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.PeerDependencies "title" (.i18n.Tr "packages.npm.dependencies.peer")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.OptionalDependencies "title" (.i18n.Tr "packages.npm.dependencies.optional")}} + </div> + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{.i18n.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 0000000000..1ab644f417 --- /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">{{.root.i18n.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{.root.i18n.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 0000000000..879d7d0176 --- /dev/null +++ b/templates/package/content/nuget.tmpl @@ -0,0 +1,52 @@ +{{if eq .PackageDescriptor.Package.Type "nuget"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.nuget.registry"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet nuget add source --name Gitea --username your_username --password your_token {{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/nuget/index.json</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.nuget.install"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet add package --source Gitea --version {{.PackageDescriptor.Version.Version}} {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{.i18n.Tr "packages.nuget.documentation" | Safe}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.ReleaseNotes}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + {{if .PackageDescriptor.Metadata.ReleaseNotes}}{{Str2html .PackageDescriptor.Metadata.ReleaseNotes}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{.i18n.Tr "packages.dependency.id"}}</th> + <th class="three wide">{{.i18n.Tr "packages.dependency.version"}}</th> + <th class="three wide">{{.i18n.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/pypi.tmpl b/templates/package/content/pypi.tmpl new file mode 100644 index 0000000000..352f4f617f --- /dev/null +++ b/templates/package/content/pypi.tmpl @@ -0,0 +1,31 @@ +{{if eq .PackageDescriptor.Package.Type "pypi"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.pypi.install"}}</label> + <div class="markup"><pre class="code-block"><code>pip install --extra-index-url {{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/pypi/simple {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{.i18n.Tr "packages.pypi.documentation" | Safe}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + <p>{{if .PackageDescriptor.Metadata.Summary}}{{.PackageDescriptor.Metadata.Summary}}{{end}}</p> + {{if .PackageDescriptor.Metadata.LongDescription}} + {{RenderMarkdownToHtml .PackageDescriptor.Metadata.LongDescription}} + {{else if .PackageDescriptor.Metadata.Description}} + {{RenderMarkdownToHtml .PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.RequiresPython}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{.i18n.Tr "packages.pypi.requires"}}: {{.PackageDescriptor.Metadata.RequiresPython}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rubygems.tmpl b/templates/package/content/rubygems.tmpl new file mode 100644 index 0000000000..6e22d7fbea --- /dev/null +++ b/templates/package/content/rubygems.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "rubygems"}} + <h4 class="ui top attached header">{{.i18n.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{.i18n.Tr "packages.rubygems.install" | Safe}}:</label> + <div class="markup"><pre class="code-block"><code>gem install {{.PackageDescriptor.Package.Name}} --version "{{.PackageDescriptor.Version.Version}}" --source "{{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{.i18n.Tr "packages.rubygems.install2"}}:</label> + <div class="markup"><pre class="code-block"><code>source "{{AppUrl}}api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems" do + gem "{{.PackageDescriptor.Package.Name}}", "{{.PackageDescriptor.Version.Version}}" +end</code></pre></div> + </div> + <div class="field"> + <label>{{.i18n.Tr "packages.rubygems.documentation" | Safe}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{.i18n.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">{{.i18n.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.RequiredRubyVersion}}<p>{{.i18n.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>{{.i18n.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">{{.i18n.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" (.i18n.Tr "packages.rubygems.dependencies.runtime")}} + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (.i18n.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 0000000000..79f66ad3f9 --- /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">{{.root.i18n.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{.root.i18n.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}} |