-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow for alternate restyled config locations #101
Allow for alternate restyled config locations #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
For testing, I think you should start here https://github.com/restyled-io/restyler/blob/master/test/Restyler/ConfigSpec.hs#L20. Apologies for not test-compiling anything I'm about to write, but I'd imagine you could do something like: spec = do
it "whatever" $ do
app <- liftIO $ testApp "/" [("/a", "Some YAML"), ("/b", "Other YAML")]
x <- runRIO app
$ tryTo showConfigError
$ loadConfigFrom ["/c", "/b"]
$ const
$ pure testRestylers
-- assert you loaded /b, since /c didn't exit
y <- runRIO app $ do
writeFileUnreadable "/x" -- if /x is read, you will explode
tryTo showConfigError
$ loadConfigFrom ["/a", "/x"]
$ const
$ pure testRestylers
-- assert you loaded /a and did not look at /x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM!
Did you want me to wait for tests before merging, or add them myself after?
It took me a bit to figure out how I actually make this work. Let me know what you think of these. One other trivial test (if you think it is necessary) would be to add two configs to the test filesystem and make sure it reads the "first" one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks great! I'm going to pull it into another branch and do some minor tweaks before merging.
It looks like it wasn't too much extra work to clean this up, thanks! See #103. I guess this can be closed. |
This PR allows for alternate
restyled.yaml
configuration files closing #98I formatted the code with
brittany
using your configuration file.I tried to write the most general
findJust
function possible. I tried two versions shown here: https://gist.github.com/chiroptical/2a921faa08976f6a176557fe57bb6021.I would like to add a test to make sure it is working correctly.