Merge pull request #872 from harshavardhana/pr_out_remove_minio_cli_dependency_for_make_go

Remove minio/cli dependency for make.go
This commit is contained in:
Harshavardhana
2015-07-13 18:46:57 +00:00
2 changed files with 17 additions and 43 deletions
+3 -3
View File
@@ -43,13 +43,13 @@ pre-build:
gomake-all: getdeps verifiers
@echo "Installing mc:"
@go run make.go install
@go run make.go -install
@mkdir -p $(HOME)/.mc
release: getdeps verifiers
@echo "Installing mc:"
@go run make.go release
@go run make.go install
@go run make.go -release
@go run make.go -install
@mkdir -p $(HOME)/.mc
godepupdate:
+14 -40
View File
@@ -20,19 +20,16 @@ package main
import (
"bytes"
"flag"
"fmt"
"os"
"os/exec"
"strconv"
"text/template"
"time"
"github.com/minio/cli"
)
type Version struct {
Date string
Tag string
}
func writeVersion(version Version) error {
@@ -49,14 +46,6 @@ import (
// Version autogenerated
var Version = {{if .Date}}"{{.Date}}"{{else}}""{{end}}
// Tag is of following format
//
// [STRING]-[EPOCH]
//
// STRING is release string of your choice.
// EPOCH is unix seconds since Jan 1, 1970 UTC.
var Tag = {{if .Tag}}"{{.Tag}}"{{else}}""{{end}}
// getVersion -
func getVersion() string {
t, _ := time.Parse(time.RFC3339Nano, Version)
@@ -96,10 +85,7 @@ func (c command) String() string {
return message
}
func runMcInstall(ctx *cli.Context) {
if ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, "install", 1) // last argument is exit code
}
func runMcInstall() {
mcBuild := command{exec.Command("godep", "go", "build", "-a", "./..."), &bytes.Buffer{}, &bytes.Buffer{}}
mcTest := command{exec.Command("godep", "go", "test", "-race", "./..."), &bytes.Buffer{}, &bytes.Buffer{}}
mcInstall := command{exec.Command("godep", "go", "install", "-a", "github.com/minio/mc"), &bytes.Buffer{}, &bytes.Buffer{}}
@@ -123,19 +109,10 @@ func runMcInstall(ctx *cli.Context) {
fmt.Print(mcInstall)
}
func runMcRelease(ctx *cli.Context) {
if ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, "release", 1) // last argument is exit code
}
func runMcRelease() {
t := time.Now().UTC()
date := t.Format(time.RFC3339Nano)
// [STRING]-[EPOCH]
//
// STRING is release string of your choice.
// EPOCH is unix seconds since Jan 1, 1970 UTC.
tag := "release" + "-" + strconv.FormatInt(t.Unix(), 10)
version := Version{Date: date, Tag: tag}
version := Version{Date: date}
err := writeVersion(version)
if err != nil {
fmt.Print(err)
@@ -144,18 +121,15 @@ func runMcRelease(ctx *cli.Context) {
}
func main() {
app := cli.NewApp()
app.Usage = "Minio Client for object storage and filesystems"
app.Commands = []cli.Command{
{
Name: "release",
Action: runMcRelease,
},
{
Name: "install",
Action: runMcInstall,
},
releaseFlag := flag.Bool("release", false, "make a release")
installFlag := flag.Bool("install", false, "install mc")
flag.Parse()
if *releaseFlag {
runMcRelease()
}
if *installFlag {
runMcInstall()
}
app.Author = "Minio.io"
app.RunAndExitOnError()
}