A common workflow when developing a Clojure project is to leverage one or more libraries written by others. When found, you'll review the main documentation page for a library and learn the information you'll need to add to your project.clj file's
:dependencies vector so Leiningen can find and load that library. These libraries will typically come from Clojars but can also be loaded from Maven Central.
Behind the scenes, when you build your project, you should know that your configured libraries will be installed in your local Maven repository. Look inside of the
.m2 directory off of your home directory.
So far so good. This will be all you need if you are good using these libraries without modification.
The question does arise though when you want to try changing one of these libraries. How can you set things up to allow this is the question.
I have a few old sites that were developed in PHP using the Zend framework. Since moving to Clojure mostly full-time I thought it would be good to do some house cleaning and move these old sites over to Clojure. While doing so I and seeing that there was a basic pattern to the process I thought it might help others if I mocked up an example and put some notes together.
Now, before I go on I'll say that my example is very simple and it covers a basic site. Highlighting the structure of the PHP/Zend site and the Clojure/Compojure site is the main idea I'd like to get across. Those with more complex sites will clearly need to do more. Hopefully, the following will help get them started.
To start visit or clone the following repo. It contains two examples of the same simple site. One in PHP and the other in Clojure. I'll walk through the differences.
Cryogen works by compiling your posts created in Markdown into HTML using the theme and configuration settings you've setup. This is great because I can edit everything in Emacs just as I do for nearly everything else.
Here, I've been using org-mode for nearly all lists, plans and documents for a very long time. With the discovery of Markdown Mode for Emacs) I've found a new balance. With keystrokes for expanding and moving around your Markdown document that are familar to the org-mode user I've found the new mode is making creating these blog posts as comfortable as when I was creating documents in org-mode.
I recently revived my blog by building it with the static site generator Cryogen. Working primarily in Clojure these days made using Cryogen a nice fit.
So I took the early train today. Earlier than I usually do and as a result I was both croggy and rushing. While I was coming down the hill and about to cross through the parking lot at the train a car rushed by with what seemed like little care as to where I was.
Now I titled this post partially with the words nearly hit but to be honest that wasn't the case. What really was the case was that I think the car should have stopped or at least slowed because of where I was. Normally this seems to be the polite behavior of drivers around here and for a moment I was put back as the car rushed around the corner and I continued walking in a fashion to prove how close I was.
I think I muttered something under my breath and it might not have been all that nice. Then, because I was rushing I pushed on and as I reached the stairs I noticed the car pulling into a spot down the way along the track. Ah, I thought they are trying to catch the train. Well, that explains their behavior somewhat.
Now, back to me. Another part of the story is time and one's sense of it. When you commute you get these very fixed goals in your head revolving around the train schedule. You also learn how long it takes for you to walk to the train and as it happens you whittle that walking commute down to the shortest possible amount. So I left by looking at the clock and starting the game of getting to the train in my allotted amount of time. Today was no different than any other and I was cutting it close. Not running close but just the exact amount.