Giter Site home page Giter Site logo

Comments (2)

fergusstrange avatar fergusstrange commented on August 28, 2024

Really awesome to see you're building out features based on this library, I'm glad it's been useful.

We're unlikely to bundle such a long list of specific versions as the intended use-case for this library is really for integration testing, and as such we aim to keep the version selections as simple as possible, with the option to provide a custom string if needed.

That said, we've left the door open with the current strategy to put a wrapper around this library with the above and do all of that logic on the outside - which it looks like you may have done already?

We are actively looking at the remote fetch logic and seeing if this could be made into a middleware style function, but it's not something we are close to making a decision on yet.

If there are any other features you're after feel free to open an issue. All the best and good luck with the CLI!

from embedded-postgres.

SamuelMarks avatar SamuelMarks commented on August 28, 2024

Thanks I'll keep you in the loop for where it goes!

In the meantime, here's the Go logic to list supported versions:

import (
	"encoding/xml"
	"errors"
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
	"path"
	"time"

	embeddedpostgres "github.com/fergusstrange/embedded-postgres"
	cli "github.com/urfave/cli/v2"
)

type Metadata struct {
	XMLName    xml.Name `xml:"metadata"`
	Text       string   `xml:",chardata"`
	GroupId    string   `xml:"groupId"`
	ArtifactId string   `xml:"artifactId"`
	Versioning struct {
		Text     string `xml:",chardata"`
		Latest   string `xml:"latest"`
		Release  string `xml:"release"`
		Versions struct {
			Text    string   `xml:",chardata"`
			Version []string `xml:"version"`
		} `xml:"versions"`
		LastUpdated string `xml:"lastUpdated"`
	} `xml:"versioning"`
}

func main() {
	var metadata Metadata
	{
		resp, err := http.Get("https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-bom/maven-metadata.xml")
		if err != nil {
			panic(err)
		}
		defer func(Body io.ReadCloser) {
			err := Body.Close()
			if err != nil {
				panic(err)
			}
		}(resp.Body)
		body, err := io.ReadAll(resp.Body)
		if err := xml.Unmarshal(body, &metadata); err != nil {
			panic(err)
		}
	}
	for _, version := range metadata.Versioning.Versions.Version {
		fmt.Printf("\"%s\",\n", version)
	}
}

from embedded-postgres.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.