Skip to content

omeid/kar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kar GoDoc

Kar is a simple utility that helps you create run [Kargar](https://github.com/omeid/kargar) builds from CLI.

To allow, co-existence of build file and your Go project code and to insure it is properly isolated, kar is guarded with a build build constraint, kar; to properly leverage Go tooling's caching mechanism and avoid any issues with stale cache objects, the task runner, cmd/kar uses it's own pkgdir ($GOPATH/pkg/$GOOS_$GOARCH_kar).

Install

Requires Go 1.5.

go install github.com/omeid/kar/cmd/kar

Example

$ cat demo_kar.go
// +build kar

// Pay attention at the build tag. Kar builds your project with the build tag `kar`
// which allows you the isolation of your _build code_ and as a result, dependencies
// from your main code.


package main

import (
  "github.com/omeid/gonzo/context"
  "github.com/omeid/kargar"
  "github.com/omeid/kargar/kar"
)


// You must put your task definations inside an init.
// Read more about the order of init functions and Package Initialization
// at https://golang.org/ref/spec#Package_initialization
func init() {

  kar.Run(func(build *kargar.Build) error {

    return build.Add(
      kargar.Task{

        Name:  "say-hello",
        Usage: "This tasks is self-documented, it says hello for every second.",

        Action: func(ctx context.Context) error {
          ctx.Info("Hello!")
          return nil
        },
      })
  })
}
$ kar install    # build and  cache the dependencies.
$ kar say-hello #run task say-hello
INFO[0000] [say-hello]                                  
INFO[0000] Hello!                                        task=say-hello

#TODO:

  • Finish this doc.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages