jaceklaskowski / librarian-clojure

Book manager in Clojure
http://librarian-clojure.herokuapp.com/
22 stars 4 forks source link

Convert from javascript to clojurescript #47

Closed zoldar closed 11 years ago

zoldar commented 11 years ago

Because the project is focused on using clojure, I think it would be more in line with it's goal to utilize the same language in process of developing the client-side part of the application. I've prepared a basic framework in the codebase to allow for relatively smooth development. It's available in my branch:

https://github.com/zoldar/librarian-clojure/tree/js-to-cljs

I assume a following workflow.

Startup

  1. In one console, run the app as usual, using "lein run-local"
  2. In another console, run the automatic compiler using "lein cljsbuild auto dev test" and leave it open as well
  3. Open up the browser on "http://localhost:8080/tests/index.html
  4. Open up /src-cljs/librarian_clojure/frontend.clj and /test-cljs/librarian_clojure/test/frontend.clj in your favourite editor (you may use clojure syntax highlighting for .cljs files). You may also want to open /resources/public/js/librarian.js to see the original code for conversion.

Work

  1. Write a test in librarian-clojure.test.frontend
  2. Refresh the browser. See the test fail
  3. Write the code in librarian-clojure.frontend making the test pass
  4. Refresh the browser. See the test pass!
  5. Repeat.

The compiled version of the code is also attached to the app in resources/public/index.html. So far, it doesn't do anything yet there.

Some simple tool/plugin doing page refresh every n seconds may come handy.

zoldar commented 11 years ago

Update! Change in tests does not require touching the code in librarian-clojure.frontend anymore. I think that, as it stands, this could be pulled into upstream. A README update should follow.

zoldar commented 11 years ago

48 got pulled in. Now some actual work can be done!

zoldar commented 11 years ago

Done with #56