markmandel / brute

A simple and lightweight Entity Component System library for writing games with Clojure and ClojureScript.
Eclipse Public License 1.0
181 stars 6 forks source link

port of Brute w/ tests to ClojureScript, introducing cljx #4

Closed Janiczek closed 10 years ago

Janiczek commented 10 years ago

With this commit, Brute 0.2.1-SNAPSHOT now

I've had to disable your dev profile REPL customization - it was consistently crashing my attempts to make cljx work. Maybe some fiddling with the vector of paths will make it work again. I didn't know what's your workflow with that, so I didn't test it.

Other thing is that purnam.test is really trimmed compared to midje. Things like (just #{...}) or namespace-state-changes just aren't there, which required me to hack around a few places. But I guess it's still better to have this until some better midje port comes than having, say, clojurescript.test and not being possible to have a shared test codebase.

I didn't test the doc generation, but given what is in project.clj, it should see the clj sources in target/generated/src/clj and tests in target/generated/test/clj.

karma requires you (or at least required me) to install NPM modules

Also, karma doesn't like advanced compilation (probably would need externs file or something so that it doesn't shorten the jasmine variable added to js/window) so we run in whitespace mode. (It is possible to compile Brute without tests in advanced mode, just right now in project.clj there's only dev profile with :optimizations :none, because running lein cljsbuild test karma runs all the builds, which would mean that the advanced compilation would prolong the execution time of the already slow cleantest command by at least 20 seconds. If it's possible to tell cljsbuild to only build one of them -- the test one would be enough -- that would fasten it quite a bit.)

markmandel commented 10 years ago

Nice one. I'll have a review of this in the next few days! Sounds like I need to get on a new release soon.

markmandel commented 10 years ago

Making notes as I test:

I tested this against a game I'm mucking with too, and it all looks good. I've put it a feature branch for now: feature/cljx

Things I want to do before I merge into develop (this is just a series of todos for myself):

But awesome stuff. Nice work mate!

Janiczek commented 10 years ago

Glad I could help a bit :)

I looked into the user namespace thing again, and it seems to work with:

:source-paths ["dev"
               "target/generated/src/clj"]
:repl-options {:init-ns user}

It seems the trouble was caused by my ~/.lein/profiles.clj - I had vinyasa inject refresh into clojure.core and it seemed to clash with your refresh for the system. When I comment out the offending part in ~/.lein/profiles.clj, I get a working REPL with your helpers in it (go etc.).

I'll commit that so you can use it.

markmandel commented 10 years ago

Had to make some changes, because of the chicken and egg scenario with a "dev/user.clj". Works now, but I need to make note in the README.md that if you don't run some version of lein cljx before firing up a REPL, it just falls over.

markmandel commented 10 years ago

Thanks! This has been merged into develop. I'll do a release once I've written up an announcement for the new features. Nice work.

Janiczek commented 10 years ago

About the lein cljx and REPL: I think the

:hooks [cljx.hooks]

thing in project.clj makes cljx run before lein repl, actually. But it will be good to have a warning in the README, for sure :)

About the merge: Glad to help! :)

markmandel commented 10 years ago

Yeah, it's the nature of the user namespace - it gets loaded before the cljx hooks have the ability to fire. It's very chicken and egg.