github.com/pojntfx/hydrapp/hydrapp@v0.0.0-20240516002902-d08759d6ca9f/pkg/renderers/docs/installation.go (about)

     1  package docs
     2  
     3  import (
     4  	_ "embed"
     5  
     6  	"github.com/pojntfx/hydrapp/hydrapp/pkg/renderers"
     7  )
     8  
     9  //go:embed INSTALLATION.md.tpl
    10  var installationTemplate string
    11  
    12  type installationData struct {
    13  	AppID           string
    14  	AppName         string
    15  	AndroidRepoURL  string
    16  	MacOSBinaryURL  string
    17  	MacOSBinaryName string
    18  	BinariesURL     string
    19  	Flatpaks        []Artifact
    20  	MSIs            []Artifact
    21  	RPMs            []DistroArtifact
    22  	DEBs            []DistroArtifact
    23  	RenderDMG       bool
    24  	RenderAPK       bool
    25  	RenderBinaries  bool
    26  }
    27  
    28  type Artifact struct {
    29  	Architecture string
    30  	URL          string
    31  }
    32  
    33  type DistroArtifact struct {
    34  	Artifact
    35  	DistroName    string
    36  	DistroVersion string
    37  }
    38  
    39  func NewInstallationRenderer(
    40  	appID,
    41  	appName,
    42  	androidRepoURL,
    43  	macOSBinaryURL,
    44  	macOSBinaryName,
    45  	binariesURL string,
    46  	flatpaks,
    47  	msis []Artifact,
    48  	rpms,
    49  	debs []DistroArtifact,
    50  	renderDMG,
    51  	renderAPK,
    52  	renderBinaries bool,
    53  ) renderers.Renderer {
    54  	return renderers.NewRenderer(
    55  		"INSTALLATION.md",
    56  		installationTemplate,
    57  		installationData{
    58  			appID,
    59  			appName,
    60  			androidRepoURL,
    61  			macOSBinaryURL,
    62  			macOSBinaryName,
    63  			binariesURL,
    64  			flatpaks,
    65  			msis,
    66  			rpms,
    67  			debs,
    68  			renderDMG,
    69  			renderAPK,
    70  			renderBinaries,
    71  		},
    72  	)
    73  }