Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable to generate .gitignore #31

Merged
merged 2 commits into from
Oct 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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