Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Fix Bazaar behavior #923

Merged
merged 1 commit into from
Feb 15, 2018
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: 0 additions & 1 deletion buffalo/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var app = newapp.Generator{
CIProvider: "none",
AsWeb: true,
Docker: "multi",
VCS: "git",
Bootstrap: 3,
}

Expand Down
1 change: 0 additions & 1 deletion generators/newapp/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type Generator struct {
AsWeb bool `json:"as_web"`
AsAPI bool `json:"as_api"`
Docker string `json:"docker"`
VCS string `json:"vcs"`
SkipPop bool `json:"skip_pop"`
SkipWebpack bool `json:"skip_webpack"`
SkipYarn bool `json:"skip_yarn"`
Expand Down
28 changes: 26 additions & 2 deletions generators/newapp/new.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package newapp

import (
"fmt"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -97,9 +98,16 @@ func (a Generator) setupVCS(g *makr.Generator) {
return
}

// Create .gitignore or .bzrignore
g.Add(makr.NewFile(fmt.Sprintf(".%signore", a.VCS), nVCSIgnore))
g.Add(makr.NewCommand(exec.Command(a.VCS, "init")))
g.Add(makr.NewCommand(exec.Command(a.VCS, "add", ".")))
g.Add(makr.NewCommand(exec.Command(a.VCS, "commit", "-m", "Initial Commit")))
args := []string{"add", "."}
if a.VCS == "bzr" {
// Ensure Bazaar is as quiet as Git
args = append(args, "-q")
}
g.Add(makr.NewCommand(exec.Command(a.VCS, args...)))
g.Add(makr.NewCommand(exec.Command(a.VCS, "commit", "-q", "-m", "Initial Commit")))
}

func (a Generator) setupDocker(root string, data makr.Data) error {
Expand Down Expand Up @@ -332,3 +340,19 @@ test:1.8:
script:
- buffalo test
`

const nVCSIgnore = `vendor/
**/*.log
**/*.sqlite
.idea/
bin/
tmp/
node_modules/
.sass-cache/
*-packr.go
public/assets/
{{ .opts.Name.File }}
.vscode/
.grifter/
.env
`
14 changes: 0 additions & 14 deletions generators/newapp/templates/dot-gitignore.tmpl

This file was deleted.

6 changes: 6 additions & 0 deletions meta/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type App struct {
ActionsPkg string `json:"actions_path"`
ModelsPkg string `json:"models_path"`
GriftsPkg string `json:"grifts_path"`
VCS string `json:"vcs"`
WithPop bool `json:"with_pop"`
WithDep bool `json:"with_dep"`
WithWebpack bool `json:"with_webpack"`
Expand Down Expand Up @@ -77,6 +78,11 @@ func New(root string) App {
if _, err := os.Stat(filepath.Join(root, "grifts")); err == nil {
app.WithGrifts = true
}
if _, err := os.Stat(filepath.Join(root, ".git")); err == nil {
app.VCS = "git"
} else if _, err := os.Stat(filepath.Join(root, ".bzr")); err == nil {
app.VCS = "bzr"
}

return app
}
Expand Down