Skip to content

Commit

Permalink
Merge pull request #31 from tcnksm/add-ignore
Browse files Browse the repository at this point in the history
Enable to generate .gitignore
  • Loading branch information
tcnksm committed Oct 8, 2015
2 parents f07294e + 232da79 commit 5121867
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions skeleton/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Framework struct {
var CommonTemplates = []Template{
{"resource/tmpl/common/CHANGELOG.md.tmpl", "CHANGELOG.md"},
{"resource/tmpl/common/README.md.tmpl", "README.md"},
{"resource/tmpl/common/gitignore.tmpl", ".gitignore"},
}

// Frameworks is collection of Framework.
Expand Down
1 change: 1 addition & 0 deletions skeleton/resource/tmpl/common/gitignore.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.test
12 changes: 12 additions & 0 deletions tests/command_framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"testing"
"time"

"github.com/tcnksm/gcli/skeleton"
)

func TestNew_command_frameworks(t *testing.T) {
Expand Down Expand Up @@ -63,6 +66,15 @@ func TestNew_command_frameworks(t *testing.T) {
t.Fatalf("[%s] expect %q to contain %q", tt.framework, output, expect)
}

// Check common files are generated
for _, tmpl := range skeleton.CommonTemplates {
// NOTE: OutputPathTmpl of common template is same as final output name
// and not changed by templating
if _, err := os.Stat(filepath.Join(artifactBin, tmpl.OutputPathTmpl)); os.IsNotExist(err) {
t.Fatalf("file is not exist: %s", tmpl.OutputPathTmpl)
}
}

if err := goTests(artifactBin); err != nil {
t.Fatal(err)
}
Expand Down
12 changes: 12 additions & 0 deletions tests/design_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"time"

"github.com/tcnksm/gcli/skeleton"
)

func TestDesignFlow(t *testing.T) {
Expand Down Expand Up @@ -71,6 +74,15 @@ func TestDesignFlow(t *testing.T) {
t.Fatalf("Expect %q to contain %q", output, expect)
}

// Check common files are generated
for _, tmpl := range skeleton.CommonTemplates {
// NOTE: OutputPathTmpl of common template is same as final output name
// and not changed by templating
if _, err := os.Stat(filepath.Join(artifactBin, tmpl.OutputPathTmpl)); os.IsNotExist(err) {
t.Fatalf("file is not exist: %s", tmpl.OutputPathTmpl)
}
}

if err := goTests(artifactBin); err != nil {
t.Fatalf("Failed to run go tests in %s: %s", artifactBin, err)
}
Expand Down
12 changes: 12 additions & 0 deletions tests/flag_framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"testing"
"time"

"github.com/tcnksm/gcli/skeleton"
)

func TestNew_flag_frameworks(t *testing.T) {
Expand Down Expand Up @@ -52,6 +55,15 @@ func TestNew_flag_frameworks(t *testing.T) {
t.Fatalf("[%s] expect %q to contain %q", tt.framework, output, expect)
}

// Check common files are generated
for _, tmpl := range skeleton.CommonTemplates {
// NOTE: OutputPathTmpl of common template is same as final output name
// and not changed by templating
if _, err := os.Stat(filepath.Join(artifactBin, tmpl.OutputPathTmpl)); os.IsNotExist(err) {
t.Fatalf("file is not exist: %s", tmpl.OutputPathTmpl)
}
}

if err := goTests(artifactBin); err != nil {
t.Fatal(err)
}
Expand Down
5 changes: 5 additions & 0 deletions tests/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func runGcli(args []string) (string, error) {

}

func checkFile(files []string) error {

return nil
}

func goTests(output string) error {
// Change directory to artifact directory root
if err := os.Chdir(output); err != nil {
Expand Down

0 comments on commit 5121867

Please sign in to comment.