Skip to content

Commit

Permalink
[nexus-cli] replacet html/template by text/template
Browse files Browse the repository at this point in the history
  • Loading branch information
sjeandeaux committed Sep 19, 2017
1 parent cbf1b89 commit 4e618c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions repositorymanager/repositorymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"encoding/hex"
"fmt"
"hash"
"html/template"
"io"
"net/http"
"os"
"path/filepath"
"strings"
"text/template"

"net/url"

Expand Down Expand Up @@ -248,7 +248,7 @@ func (artifact *Artifact) extension() string {
// writePom write a wonderful pom
func (artifact *Artifact) writePom() ([]byte, error) {
const templateName = "pom"
const templateValue = `<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>{{.GroupID}}</groupId><artifactId>{{.ArtifactID}}</artifactId><version>{{.Version}}</version></project>`
const templateValue = `<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>{{.GroupID}}</groupId><artifactId>{{.ArtifactID}}</artifactId><version>{{.Version}}</version></project>`

pomTemplate, err := template.New(templateName).Parse(templateValue)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions repositorymanager/repositorymanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func init() {
}

const (
expectedPom = `<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.jeandeaux</groupId><artifactId>elyne</artifactId><version>0.1.0-SNAPSHOT</version></project>`
expectedPom = `<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.jeandeaux</groupId><artifactId>elyne</artifactId><version>0.1.0-SNAPSHOT</version></project>`
groupID = "com.jeandeaux"
artifactID = "elyne"
version = "0.1.0-SNAPSHOT"
Expand Down Expand Up @@ -52,8 +52,8 @@ func TestRepository_UploadArtifact(t *testing.T) {
calledSha1: false,
calledMd5: false,
expected: expectedPom,
expectedSha1: "1f396c7604363c787362e5916005a0cad72701c0",
expectedMd5: "649de9004a8b0e95a7ed1592bcf1ba8c",
expectedSha1: "1a8b00bc4bbeaf8096b6639668cb14861d2514db",
expectedMd5: "a3f28e1e4d5aab8c008e5eb07ebe764e",
}

forFile := call{
Expand Down

0 comments on commit 4e618c6

Please sign in to comment.