[personal profile] horrorcheck
So I joined The Learning Collective and one of the things we do is a weekly check-in. I've already done a couple, but I just thought, this could be something for my own blog too! And this thing has been inactive for waaaay too long.

I missed last week's check-in because I was a little confused about what was going on.

Last week:

I spent a lot of time on my KiSS doll viewer. KiSS dolls are a format that was invented in Japan in 1991 to display pixel-based drag-and-drop dress-up dolls. KiSS sets have their own special scripting language and image format. The challenge I gave myself was to find a way to convert these sets to something that can be viewed in the browser. I used C to convert the image format, Haskell to parse the configuration file into JSON, and vanilla JavaScript for user interaction.

I did manage to convert a single doll, "Aurora" by Punky, to a browser-based set. You can play with it here.

Once I got to that point, I was very excited, but the project is barely started. I still need to implement a lot more of the earliest KiSS spec, let alone the many later upgrades.

Before I got any deeper into the project, though, I needed to add a test suite to make it easier to test the parser. This is where I ran into trouble.


The main problem is that Smooch does a lot of reading of files + I'm using hspec and automated test discovery for unit testing.

When I run hspec in the test suite using "runhaskell Spec.hs", it works. If I try running "runhaskell tests/Spec.hs", it doesn't work because it automatically looks in the current directory for tests and won't find them.

I also want to be able to use "stack test" or "cabal test", which have to be run in the same directory as the smooch.cabal file.

All this was not a problem until I started reading test files while testing, because now this test:
describe "transColor" $
  it "gets the transparent color from a palette" $
    transColor "tests/samples/color.kcf" `shouldReturn` "rgb:ff/f7/ff"

is looking in a different directory depending on where the test is run. So either "cabal test" or "runhaskell Spec.hs" is going to fail depending on whether I keep "tests/" in the relative filepath.

I searched StackOverflow and only found this suggesting C++ macros!!

For now I'm just going to use a hard-coded absolute filepath, but I know that's not correct, since if anyone else wants to someday work on this (I can dream!!) it's not like they'll be installing to "/home/libby/".

Sorry this is not a very interesting question (it's just a little implementation detail I guess) but it's been very sticky for me!!

Next week my question is sure to be more interesting, because....

This week

I just started moving the whole project to one of Haskell's web frameworks (Snap)!! Previously I was just manually running a command to generate the HTML and JavaScript. Now I want the server to do that. The user will type in the URL of a KiSS set, and the server will decompress the archive, convert all the image files inside, generate JSON and HTML to display the set, and the serve it up to the user, all automatically. That's the eventually goal anyway.

I've already got the templates working the way I want, which was the easy part. The Snap templating language, Heist, is very nice. This week will be all about figuring out how Snaplets (little composable web applications) work. Exciting!!
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
Account name:
If you don't have an account you can create one now.
HTML doesn't work in the subject.


Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.



August 2015


Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 23rd, 2017 04:22 am
Powered by Dreamwidth Studios