这是indexloc提供的服务,不要输入任何密码
Skip to content

pina-golada is a simple asset tool for go, which generates interface implementations that provide files/folders in the final build, without rendering them in the source code themselve

License

Notifications You must be signed in to change notification settings

u5surf/pina-golada

 
 

Repository files navigation

Pina-Golada /pi:nɑ:-goʊlɑ:dɑ:/

License Go Report Card Build Status GoDoc

Introducing the pina-golada

Pina-Golada is a tool to automatically generate asset providers that implement custom interfaces. The tool's main propose is to hide ugly and blown up asset provider behind interfaces.

This project is work in progress.

Contributing

We are happy to have other people contributing to the project. If you decide to do that, here's how to:

  • get a Go development environment with version 1.11 or greater
  • fork the project
  • create a new branch
  • make your changes
  • open a PR.

Git commit messages should be meaningful and follow the rules nicely written down by Chris Beams:

The seven rules of a great Git commit message

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how

Installation

To install pina-golada on macOS systems, you can use the homeport Homebrew tap:

brew install homeport/tap/pina-golada

Running test cases and binaries generation

There are multiple make targets, but running all does everything you want in one call.

make all

Test it with Linux on your macOS system

Have the project that is in need of asset management depend on Pina-Golada. Define your setup as following:

package test

import (
	"github.com/homeport/pina-golada/pkg/files"
)

// TestInjectionPoint the variable in which the compiled interface implementation will be injected
var TestInjectionPoint TestInterface

// TestInterface is a testing interface for Pina-Golada. This interface will be implemented by Pina-Golada.
// The injector is the name of an exported variable of the type of this interface.
// The instance of the compiled struct, implementing this interface, will stored in the variable provided in the
// annotation below.
//
// @pgl(injector=TestInjectionPoint)
type TestInterface interface {
	
	// GetAssetFile is the method that returns a virtual asset stored in the directory instance.
	// The asset path passed to the annotation is relative to the location the tool will be called in.
	// The compressor defines what type of compression will be used to store the asset found as binary.
	// @pgl(asset=/assets/default-config.yaml&compressor=tar)
	GetAssetFile() (dir files.Directory , e error)
	
}

Now run pina-golada generate prior to your build. This will generate all needed files. After you build your go application, use pina-golada cleanup to clean your project from the asset provider files.

License

Licensed under MIT License

About

pina-golada is a simple asset tool for go, which generates interface implementations that provide files/folders in the final build, without rendering them in the source code themselve

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 88.4%
  • Shell 10.3%
  • Makefile 1.3%