magex

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 0 Imported by: 0

README

Magefile Extensions

test

This library provides helper methods to use with mage.

Below is a sample of the type of helpers available. Full examples and documentation is on godoc.

// +build mage

package main

import (
	"github.com/carolynvs/magex"
	"github.com/carolynvs/magex/shx"
)

// Install packr2 v2.8.0 if it's not available, and ensure it's in PATH.
func Packr2() error {
    if magex.IsCommandAvailable("packr2") {
        err := magex.EnsurePackage("github.com/gobuffalo/packr/v2/packr2", "v2.8.0", "version")
        if err != nil {
            log.Fatal("could not install packr2")
        }
    }
}

// Install mage if it's not available, and ensure it's in PATH. We don't care which version
func Mage() error {
    return magex.EnsureMage("")
}

// Run a docker registry in a container. Do not print stdout and only print
// stderr when the command fails even when -v is set.
//
// Useful for commands that you only care about when it fails, keeping unhelpful
// output out of your logs.
func StartRegistry() error {
    return shx.RunE("docker", "run", "-d", "-p", "5000:5000", "--name", "registry", "registry:2")
}

Documentation

Overview

Package provides helper methods for working with Magefiles (https://magefile.org)

Directories

Path Synopsis
Helper methods for installing Go packages on any platform.
Helper methods for installing Go packages on any platform.
Extend the github.com/magefile/mage/sh package with helper functions to run commands in a magefile.
Extend the github.com/magefile/mage/sh package with helper functions to run commands in a magefile.
Helper methods for supporting cross-platform shells.
Helper methods for supporting cross-platform shells.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL