Skip to content

Commit

Permalink
feat: move default tools dir under .mage
Browse files Browse the repository at this point in the history
Makes sense to put everything under the .mage dir by default.
  • Loading branch information
odsod committed Jan 6, 2022
1 parent dbdda2c commit 7bf09ad
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

.idea/
.mage/gen/
.tools/
.mage/tools/
3 changes: 2 additions & 1 deletion .mage/tools.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mage_folder := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
mage_generated_path := $(mage_folder)/gen
mage_tools_path := $(mage_folder)/tools
mage_targets_file := $(mage_generated_path)/targets.mk
mage := $(mage_generated_path)/local-mage
mgmake := $(mage_folder)/mgmake_gen.go
Expand Down Expand Up @@ -28,4 +29,4 @@ $(mage_targets_file): $(mage_folder)/go.mod $(shell find $(mage_folder)/.. -type

.PHONY: mage-clean
mage-clean:
@git clean -fdx $(mage_generated_path) ./.tools
@git clean -fdx $(mage_generated_path) $(mage_tools_path)
3 changes: 2 additions & 1 deletion example/.mage/tools.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mage_folder := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
mage_generated_path := $(mage_folder)/gen
mage_tools_path := $(mage_folder)/tools
mage_targets_file := $(mage_generated_path)/targets.mk
mage := $(mage_generated_path)/local-mage
mgmake := $(mage_folder)/mgmake_gen.go
Expand Down Expand Up @@ -28,4 +29,4 @@ $(mage_targets_file): $(mage_folder)/go.mod $(mage_folder)/*.go

.PHONY: mage-clean
mage-clean:
@git clean -fdx $(mage_generated_path) ./.tools
@git clean -fdx $(mage_generated_path) $(mage_tools_path)
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func initMageTools() {
panic(err)
}
defer gitIgnore.Close()
if _, err := gitIgnore.WriteString(".mage/gen/\n.tools/"); err != nil {
if _, err := gitIgnore.WriteString(".mage/gen/\n.mage/tools/"); err != nil {
panic(err)
}
// TODO: Output some documentation, next steps after init, and useful links.
Expand Down
2 changes: 1 addition & 1 deletion mgtool/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
// Path This should only be used to set a custom value.
// Targets should use path() instead which performs
// validation on whether a path is set.
var mgToolPath = GetGitRootPath(".tools")
var mgToolPath = GetGitRootPath(".mage/tools")

func GetCWDPath(path string) string {
cwd, err := os.Getwd()
Expand Down
8 changes: 4 additions & 4 deletions targets/mgprettier/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ func FormatMarkdown(ctx context.Context) error {
mg.CtxDeps(ctx, mg.F(prepare, prettierrc))
args := []string{
"--config",
"./.tools/prettier/.prettierrc.js",
prettierrc,
"--write",
"**/*.md",
"!.tools",
"!.mage",
}
logger.Info("formatting Markdown files...")
return sh.RunV(executable, args...)
Expand All @@ -48,10 +48,10 @@ func FormatYAML(ctx context.Context) error {
mg.CtxDeps(ctx, mg.F(prepare, prettierrc))
args := []string{
"--config",
"./.tools/prettier/.prettierrc.js",
prettierrc,
"--write",
"**/*.y*ml",
"!.tools",
"!.mage",
}
logger.Info("formatting YAML files...")
return sh.RunV(executable, args...)
Expand Down

0 comments on commit 7bf09ad

Please sign in to comment.