Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ require (
github.com/mholt/archiver v3.1.1+incompatible
github.com/otiai10/copy v1.9.0
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/tcnksm/go-gitconfig v0.1.2
github.com/theckman/yacspin v0.13.12
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be
)
Expand All @@ -51,7 +50,6 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/nwaples/rardecode v1.1.2 // indirect
github.com/onsi/gomega v1.24.1 // indirect
github.com/peterhellberg/link v1.1.0 // indirect
github.com/pierrec/lz4/v4 v4.1.8 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ github.com/nicksnyder/go-i18n v1.10.1/go.mod h1:e4Di5xjP9oTVrC6y3C7C0HoSYXjSbhh/
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/nwaples/rardecode v1.1.2 h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M=
github.com/nwaples/rardecode v1.1.2/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM=
github.com/otiai10/copy v1.9.0 h1:7KFNiCgZ91Ru4qW4CWPf/7jqtxLagGRmIxWldPP9VY4=
github.com/otiai10/copy v1.9.0/go.mod h1:hsfX19wcn0UWIHUQ3/4fHuehhk2UyArQ9dVFAn3FczI=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
Expand Down Expand Up @@ -119,8 +117,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE=
github.com/theckman/yacspin v0.13.12 h1:CdZ57+n0U6JMuh2xqjnjRq5Haj6v1ner2djtLQRzJr4=
github.com/theckman/yacspin v0.13.12/go.mod h1:Rd2+oG2LmQi5f3zC3yeZAOl245z8QOvrH4OPOJNZxLg=
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y=
Expand Down
30 changes: 8 additions & 22 deletions pkg/commands/compute/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/fatih/color"
"github.com/fsnotify/fsnotify"
ignore "github.com/sabhiram/go-gitignore"
"github.com/tcnksm/go-gitconfig"
)

// ServeCommand produces and runs an artifact from files on the local disk.
Expand Down Expand Up @@ -496,7 +495,7 @@ func local(bin, file, addr, env string, debug, watch bool, watchDir cmd.Optional
// watchFiles watches the language source directory and restarts the viceroy
// executable when changes are detected.
func watchFiles(watchDir cmd.OptionalString, verbose bool, s *fstexec.Streaming, out io.Writer, restart chan<- bool) {
gi := gitIgnore(watchDir)
gi := ignoreFiles(watchDir)

watcher, err := fsnotify.NewWatcher()
if err != nil {
Expand Down Expand Up @@ -605,29 +604,16 @@ func watchFiles(watchDir cmd.OptionalString, verbose bool, s *fstexec.Streaming,
log.Fatal(err)
}

text.Info(out, "Watching files for changes (using --watch-dir=%s). To see what files are being watched, pass the --verbose flag. To ignore certain files, configure either .ignore, .gitignore or the global git ignore (uses .ignore and .gitignore from --watch-dir).", root)
text.Info(out, "Watching files for changes (using --watch-dir=%s). To see what files are being watched, pass the --verbose flag. To ignore certain files, define patterns within a .fastlyignore config file (uses .fastlyignore from --watch-dir).", root)
text.Break(out)
<-done
}

// gitIgnore returns the specific ignore rules being respected.
//
// NOTE: ignore files will be inherited in the following order:
//
// - .ignore (local)
// - .gitignore (local)
// - core.excludesfile (global)
// ignoreFiles returns the specific ignore rules being respected.
//
// NOTE: We also ignore the .git directory.
func gitIgnore(watchDir cmd.OptionalString) *ignore.GitIgnore {
var (
globalIgnore string
patterns []string
)

if f, err := gitconfig.Global("core.excludesfile"); err == nil {
globalIgnore = filesystem.ResolveAbs(f)
}
func ignoreFiles(watchDir cmd.OptionalString) *ignore.GitIgnore {
var patterns []string

root := ""
if watchDir.WasSet {
Expand All @@ -637,10 +623,10 @@ func gitIgnore(watchDir cmd.OptionalString) *ignore.GitIgnore {
}
}

localIgnore := root + ".ignore"
localGitIgnore := root + ".gitignore"
fastlyIgnore := root + ".fastlyignore"

for _, file := range []string{localIgnore, localGitIgnore, globalIgnore} {
// NOTE: Using a loop to allow for future ignore files to be respected.
for _, file := range []string{fastlyIgnore} {
patterns = append(patterns, readIgnoreFile(file)...)
}

Expand Down