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

Commit

Permalink
fixes multi extensions (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates authored Aug 8, 2019
1 parent ba0f902 commit 8b9dce5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
24 changes: 15 additions & 9 deletions buffalo/cmd/fix/plush.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@ func Plush(r *Runner) error {
return err
}

dir := filepath.Dir(p)
base := filepath.Base(p)
sep := strings.Split(base, ".")

ext := filepath.Ext(p)
if !(ext == ".html" || ext == ".js" || ext == ".md") {
if info.IsDir() {
return nil
}

if len(sep) != 2 {
return nil
dir := filepath.Dir(p)
base := filepath.Base(p)

var exts []string
ext := filepath.Ext(base)
for len(ext) != 0 {
if ext == ".plush" || ext == ".fizz" {
return nil
}
exts = append([]string{ext}, exts...)
base = strings.TrimSuffix(base, ext)
ext = filepath.Ext(base)
}
exts = append([]string{".plush"}, exts...)

pn := filepath.Join(dir, sep[0]+".plush."+sep[1])
pn := filepath.Join(dir, base+strings.Join(exts, ""))

fn, err := os.Create(pn)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions buffalo/cmd/fix/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package fix

import (
"fmt"
"os"
"os/exec"

"github.com/gobuffalo/buffalo/runtime"
"github.com/gobuffalo/meta"
Expand Down Expand Up @@ -42,6 +44,13 @@ func Run() error {
}()

for _, c := range checks {
if r.App.WithModules {
cmd := exec.Command("go", "mod", "tidy")
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return err
}
}
if err := c(r); err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/gobuffalo/buffalo
go 1.12

require (
cloud.google.com/go v0.36.0 // indirect
github.com/BurntSushi/toml v0.3.1
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions packrd/packed-packr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8b9dce5

Please sign in to comment.