Skip to content

Commit

Permalink
fixes release to use proper root dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Oct 17, 2018
1 parent b438044 commit 9f43d19
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 25 deletions.
3 changes: 3 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"os"

"github.com/gobuffalo/genny"
"github.com/gobuffalo/release/genny/initgen"
Expand All @@ -27,6 +28,8 @@ var initCmd = &cobra.Command{
}

opts := initOptions.Options
pwd, _ := os.Getwd()
opts.Root = pwd

gg, err := initgen.New(opts)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions genny/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
g.Root = opts.Root

g.Command(exec.Command("git", "init"))
if err := opts.Validate(); err != nil {
Expand Down
6 changes: 2 additions & 4 deletions genny/git/options.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package git

type Options struct {
// add your stuff here
Root string
}


// Validate that options are usuable
func (opts *Options) Validate() error {
return nil
return nil
}

1 change: 1 addition & 0 deletions genny/goreleaser/goreleaser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func Test_New(t *testing.T) {

g, err := New(&Options{
MainFile: "main.go",
Root: ".",
})
r.NoError(err)

Expand Down
5 changes: 5 additions & 0 deletions genny/goreleaser/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Options struct {
MainFile string
BrewOwner string
BrewTap string
Root string
}

// Validate that options are usuable
Expand All @@ -23,6 +24,10 @@ func (opts *Options) Validate() error {
opts.BrewTap = "homebrew-tap"
}

if len(opts.Root) == 0 {
return errors.New("root can not be empty")
}

if len(opts.BrewOwner) == 0 {
user, err := user.Current()
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions genny/initgen/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ func New(opts *Options) (*genny.Group, error) {
if err := opts.Validate(); err != nil {
return gg, errors.WithStack(err)
}

g := genny.New()
g.Box(packr.NewBox("../initgen/templates"))
g.Transformer(genny.Dot())
gg.Add(g)

// set up git
g, err := git.New(&git.Options{})
g, err := git.New(&git.Options{
Root: opts.Root,
})
if err != nil {
return gg, errors.WithStack(err)
}
Expand Down Expand Up @@ -59,6 +60,7 @@ func New(opts *Options) (*genny.Group, error) {
Force: opts.Force,
VersionFile: opts.VersionFile,
MainFile: opts.MainFile,
Root: opts.Root,
})
if err != nil {
return gg, errors.WithStack(err)
Expand All @@ -70,6 +72,7 @@ func New(opts *Options) (*genny.Group, error) {
g, err = goreleaser.New(&goreleaser.Options{
Force: opts.Force,
MainFile: opts.MainFile,
Root: opts.Root,
})
if err != nil {
return gg, errors.WithStack(err)
Expand Down
1 change: 1 addition & 0 deletions genny/initgen/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func Test_New(t *testing.T) {
gg, err := New(&Options{
VersionFile: "foo/bar/version.go",
MainFile: "./main.go",
Root: ".",
})
r.NoError(err)

Expand Down
3 changes: 3 additions & 0 deletions genny/initgen/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ func (opts *Options) Validate() error {
return errors.Errorf("%s is not a .go file", opts.MainFile)
}
}
if len(opts.Root) == 0 {
return errors.New("root can not be empty")
}
return nil
}
1 change: 1 addition & 0 deletions genny/makefile/makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
g.Root = opts.Root

if err := opts.Validate(); err != nil {
return g, errors.WithStack(err)
Expand Down
9 changes: 5 additions & 4 deletions genny/makefile/makefile_test.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package makefile

import (
"context"
"strings"
"testing"

"github.com/gobuffalo/genny"
"github.com/gobuffalo/genny/gentest"
"github.com/stretchr/testify/require"
)

func Test_New(t *testing.T) {
r := require.New(t)

g, err := New(&Options{})
g, err := New(&Options{
Root: ".",
})
r.NoError(err)

run := genny.DryRunner(context.Background())
run := gentest.NewRunner()
run.With(g)

r.NoError(run.Run())
Expand Down
4 changes: 4 additions & 0 deletions genny/makefile/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Options struct {
MainFile string
BuildPath string
VersionFile string
Root string
}

// Validate that options are usuable
Expand All @@ -30,5 +31,8 @@ func (opts *Options) Validate() error {
opts.BuildPath = "./" + opts.BuildPath
}
}
if len(opts.Root) == 0 {
return errors.New("root can not be empty")
}
return nil
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module github.com/gobuffalo/release

require (
github.com/Masterminds/semver v1.4.2
github.com/gobuffalo/envy v1.6.4
github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc
github.com/gobuffalo/envy v1.6.5
github.com/gobuffalo/genny v0.0.0-20181017142616-0ee1b753300e
github.com/gobuffalo/packr v1.13.7
github.com/gobuffalo/plush v3.7.16+incompatible
github.com/gobuffalo/plush v3.7.20+incompatible
github.com/gobuffalo/shoulders v1.0.1
github.com/pkg/errors v0.8.0
github.com/spf13/cobra v0.0.3
Expand Down
32 changes: 20 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ github.com/fatih/structs v1.0.0 h1:BrX964Rv5uQ3wwS+KRUAJCBBw5PQmgJfJ6v4yly5QwU=
github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gobuffalo/envy v1.6.4 h1:kxamN+VYjPMzEdjc2mn4CIKiuYXGxc8VIwXJNixFlNY=
github.com/gobuffalo/envy v1.6.4/go.mod h1:Abh+Jfw475/NWtYMEt+hnJWRiC8INKWibIMyNt1w2Mc=
github.com/gobuffalo/envy v1.6.5 h1:X3is06x7v0nW2xiy2yFbbIjwHz57CD6z6MkvqULTCm8=
github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ=
github.com/gobuffalo/flect v0.0.0-20181002182613-4571df4b1daf/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA=
github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc h1:educQ9aAnsrKD9g3s8dQogCoVbFeEjaQUkKo4yDUvyk=
github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM=
github.com/gobuffalo/genny v0.0.0-20181017142616-0ee1b753300e h1:WjBJKSGXndtuzGTzcob3ipiEZPkk+EeJI1r5ko0Ykn4=
github.com/gobuffalo/genny v0.0.0-20181017142616-0ee1b753300e/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA=
github.com/gobuffalo/github_flavored_markdown v1.0.5 h1:YvGVf7yj1akgsb+qc64Q0WX8uhpuZSibChbqOMRSAqE=
github.com/gobuffalo/github_flavored_markdown v1.0.5/go.mod h1:U0643QShPF+OF2tJvYNiYDLDGDuQmJZXsf/bHOJPsMY=
github.com/gobuffalo/packr v1.13.7 h1:2uZgLd6b/W4yRBZV/ScaORxZLNGMHO0VCvqQNkKukNA=
github.com/gobuffalo/packr v1.13.7/go.mod h1:KkinLIn/n6+3tVXMwg6KkNvWwVsrRAz4ph+jgpk3Z24=
github.com/gobuffalo/plush v3.7.16+incompatible h1:nonpy24axg04np13bYi0zNu3gr812cXKJDNLSkKcEwk=
github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI=
github.com/gobuffalo/plush v3.7.20+incompatible h1:FgLKw/zwd8IY8lAqfSuVNuHopR7jKVSs6yjJKeBajzU=
github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI=
github.com/gobuffalo/shoulders v1.0.1 h1:BqVJBUXlBWAf+WLhXijVk3SCpp75LXrVBiIkOCzZbNc=
github.com/gobuffalo/shoulders v1.0.1/go.mod h1:V33CcVmaQ4gRUmHKwq1fiTXuf8Gp/qjQBUL5tHPmvbA=
github.com/gobuffalo/tags v2.0.11+incompatible h1:zLkaontB8lWefU+DX38mzPLRKFGTJL8FKb9JnKMt0Z0=
Expand All @@ -31,10 +33,12 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/joho/godotenv v1.2.0 h1:vGTvz69FzUFp+X4/bAkb0j5BoLC+9bpqTWY8mjhA9pc=
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand Down Expand Up @@ -80,24 +84,28 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 h1:Vk3wNqEZwyGyei9yq5ekj7frek2u7HUfffJ1/opblzc=
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f h1:QM2QVxvDoW9PFSPp/zy9FgxJLfaWTZlS61KEPtBwacM=
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58 h1:otZG8yDCO4LVps5+9bxOeNiCvgmOyt96J3roHTYs7oE=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=
golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20181003024731-2f84ea8ef872 h1:sNGw2eV2rbpD791+BR7mIgTvvDf+pS18dKJqIoyyYME=
golang.org/x/tools v0.0.0-20181003024731-2f84ea8ef872/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181006002542-f60d9635b16a h1:2clmXmw4YommCu+v1MdCr87N191PLYU6hJ0m74ZFiCo=
golang.org/x/tools v0.0.0-20181006002542-f60d9635b16a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down

0 comments on commit 9f43d19

Please sign in to comment.