Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file should have the extension .json #39

Closed
kytrinyx opened this issue Dec 22, 2013 · 8 comments
Closed

Config file should have the extension .json #39

kytrinyx opened this issue Dec 22, 2013 · 8 comments

Comments

@kytrinyx
Copy link
Member

The file is a .json file, not a .go file.

To fix this we'll need a workaround that moves an .exercism.go file before any command that requires it for the lifetime of the 1.x version of the library.

Originally reported in tandem with another issue in #24

@TrevorBramble
Copy link
Contributor

Started noodling on this last night. Did you have any particular approach you wanted to see?

@kytrinyx
Copy link
Member Author

kytrinyx commented Jan 3, 2014

Nope :) Did you have any specific thoughts about how to approach it?

@TrevorBramble
Copy link
Contributor

I was just going to put a layer of indirection in-between the identification and reading of an existing config file that migrates the file first. After looking through the source though it looked like implementation would be a lot simpler (would require least rework) if it was just a method that was called outside of (ahead of) that workflow that doesn't even care that it's a config file. Just, "if we have this file, move it".

@kytrinyx
Copy link
Member Author

kytrinyx commented Jan 6, 2014

Yeah, that second approach sounds way easier.

@lcowell
Copy link
Contributor

lcowell commented Aug 8, 2014

I was thinking about what we need to consider when it comes to renaming the file.

  • if the suffix is json, leave the file alone
  • if the suffix is go
    • check if a corresponding json file exists
      • if no: rename
      • if yes: panic // or noop ?

I was also thinking about a use supplied configuration file. If the user passes in a file like exercism --config my_other_config.go, should we be renaming that file ? I think as a user that would be surprising to me, so I think we should only rename a file if it's using the default location.

@kytrinyx
Copy link
Member Author

kytrinyx commented Aug 9, 2014

yeah, this would need to apply only to the default config, not the user-passed config.

I was thinking of always doing a check before any operation that reads from the config: normalizeConfig(), this would rename it to .json if it is .go, and just ignore if it's all ok.

Once the API and functionality has settled, then we can remove deprecated functionality.

@lcowell
Copy link
Contributor

lcowell commented Aug 14, 2014

I think it's safe to close this now.

@kytrinyx
Copy link
Member Author

Good catch. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants