Skip to content

Commit

Permalink
Fix fragment references.
Browse files Browse the repository at this point in the history
embed.FS paths are case-sensitive. For whatever reason, git committed
the upper-case fragment files as lower-case, causing the fragment
references to fail to resolve. Because my local copy is still
upper-case, the fragment references still work here. This, in addition
to having no test, managed to slip under my radar.

This commit changes the fragment references to match the file names as
committed. I've no interest in trying to commit the original upper-case
files, or dealing with the consequences, so fragment file paths will
now just be lower-case from now on.
  • Loading branch information
Anaminus committed May 23, 2021
1 parent b4e7805 commit a6db9a9
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ This document describes changes between versions of rbxmk. The `imperative`
branch is the latest unreleased version.

## imperative
**Fixes:**
- Fix fragments failing to resolve due to case-sensitivity.

See a [comparison with the previous version][cmp-imperative] for a thorough list of changes.

The [Documentation page][doc-imperative] provides a complete reference for this version of rbxmk.
Expand Down
6 changes: 3 additions & 3 deletions rbxmk/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
func DocumentCommands() {
for _, def := range Program.List() {
Program.SetDoc(def.Name, snek.Doc{
Summary: Doc("Commands/" + def.Name + ":Summary"),
Arguments: Doc("Commands/" + def.Name + ":Arguments"),
Description: Doc("Commands/" + def.Name + ":Description"),
Summary: Doc("commands/" + def.Name + ":Summary"),
Arguments: Doc("commands/" + def.Name + ":Arguments"),
Description: Doc("commands/" + def.Name + ":Description"),
})
if def, ok := def.New().(snek.FlagSetter); ok {
def.SetFlags(flag.NewFlagSet("", 0))
Expand Down
6 changes: 3 additions & 3 deletions rbxmk/cmd_download-asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ type DownloadAssetCommand struct {

func (c *DownloadAssetCommand) SetFlags(flags snek.FlagSet) {
SetCookieFlags(&c.Cookies, flags)
flags.Int64Var(&c.ID, "id", 0, Doc("Commands/download-asset:Flags/id"))
flags.StringVar(&c.AssetFormat, "format", "bin", Doc("Commands/download-asset:Flags/format"))
flags.StringVar(&c.FileFormat, "file-format", "", Doc("Commands/download-asset:Flags/file-format"))
flags.Int64Var(&c.ID, "id", 0, Doc("commands/download-asset:Flags/id"))
flags.StringVar(&c.AssetFormat, "format", "bin", Doc("commands/download-asset:Flags/format"))
flags.StringVar(&c.FileFormat, "file-format", "", Doc("commands/download-asset:Flags/file-format"))
}

func (c *DownloadAssetCommand) Run(opt snek.Options) error {
Expand Down
6 changes: 3 additions & 3 deletions rbxmk/cmd_upload-asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ type UploadAssetCommand struct {

func (c *UploadAssetCommand) SetFlags(flags snek.FlagSet) {
SetCookieFlags(&c.Cookies, flags)
flags.Int64Var(&c.ID, "id", 0, Doc("Commands/upload-asset:Flags/id"))
flags.StringVar(&c.AssetFormat, "format", "bin", Doc("Commands/upload-asset:Flags/format"))
flags.StringVar(&c.FileFormat, "file-format", "", Doc("Commands/upload-asset:Flags/file-format"))
flags.Int64Var(&c.ID, "id", 0, Doc("commands/upload-asset:Flags/id"))
flags.StringVar(&c.AssetFormat, "format", "bin", Doc("commands/upload-asset:Flags/format"))
flags.StringVar(&c.FileFormat, "file-format", "", Doc("commands/upload-asset:Flags/file-format"))
}

func (c *UploadAssetCommand) Run(opt snek.Options) error {
Expand Down
6 changes: 3 additions & 3 deletions rbxmk/cookies.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
)

func SetCookieFlags(c *rtypes.Cookies, flags snek.FlagSet) {
flags.Func("cookies-from", Doc("Flags/cookies:cookies-from"), func(v string) error {
flags.Func("cookies-from", Doc("flags/cookies:cookies-from"), func(v string) error {
cookies, err := rbxmk.CookiesFrom(v)
if err != nil {
return err
}
*c = append(*c, cookies...)
return nil
})
flags.Func("cookies-file", Doc("Flags/cookies:cookies-file"), func(v string) error {
flags.Func("cookies-file", Doc("flags/cookies:cookies-file"), func(v string) error {
f, err := os.Open(v)
if err != nil {
return err
Expand All @@ -31,7 +31,7 @@ func SetCookieFlags(c *rtypes.Cookies, flags snek.FlagSet) {
*c = append(*c, cookies...)
return nil
})
flags.Func("cookie-var", Doc("Flags/cookies:cookie-var"), func(v string) error {
flags.Func("cookie-var", Doc("flags/cookies:cookie-var"), func(v string) error {
content := os.Getenv(v)
cookies, err := rbxmk.DecodeCookies(strings.NewReader(content))
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions rbxmk/desc.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ func (d DescFlags) Resolve(client *rbxmk.Client) (desc *rtypes.RootDesc, err err
}

func (d *DescFlags) SetFlags(flags snek.FlagSet) {
flags.BoolVar(&d.Latest, "desc-latest", false, Doc("Flags/desc:desc-latest"))
flags.Func("desc-file", Doc("Flags/desc:desc-file"), func(v string) error {
flags.BoolVar(&d.Latest, "desc-latest", false, Doc("flags/desc:desc-latest"))
flags.Func("desc-file", Doc("flags/desc:desc-file"), func(v string) error {
d.Files = append(d.Files, v)
return nil
})
flags.Func("desc-patch", Doc("Flags/desc:desc-patch"), func(v string) error {
flags.Func("desc-patch", Doc("flags/desc:desc-patch"), func(v string) error {
d.Patches = append(d.Patches, v)
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion rbxmk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/anaminus/snek"
)

var Program = snek.NewProgram("rbxmk", os.Args).Usage(Doc("Commands/main"))
var Program = snek.NewProgram("rbxmk", os.Args).Usage(Doc("commands/main"))

func main() {
DocumentCommands()
Expand Down
8 changes: 4 additions & 4 deletions rbxmk/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ type WorldFlags struct {
}

func (f *WorldFlags) SetFlags(flags snek.FlagSet) {
flags.Var((*repeatedString)(&f.IncludedRoots), "include-root", Doc("Flags/world:include-root"))
flags.Var((*repeatedString)(&f.Libraries), "libraries", Doc("Flags/world:libraries"))
flags.BoolVar(&f.InsecurePaths, "allow-insecure-paths", false, Doc("Flags/world:allow-insecure-paths"))
flags.BoolVar(&f.Debug, "debug", false, Doc("Flags/world:debug"))
flags.Var((*repeatedString)(&f.IncludedRoots), "include-root", Doc("flags/world:include-root"))
flags.Var((*repeatedString)(&f.Libraries), "libraries", Doc("flags/world:libraries"))
flags.BoolVar(&f.InsecurePaths, "allow-insecure-paths", false, Doc("flags/world:allow-insecure-paths"))
flags.BoolVar(&f.Debug, "debug", false, Doc("flags/world:debug"))
}

// WorldOpt are options to InitWorld.
Expand Down

0 comments on commit a6db9a9

Please sign in to comment.