Go to content Go to menu

I’ve recently discovered that Vagrant, a piece of software I always disregarded because I mistakenly thought was a “cloud thing” is actually amazingly useful for developers, as a tool to share working environments. One of the main reasons I even keep this blog around is to share such things as “how I set this up” success stories. How great is it that I can actually just share a single file, and any other developer can recreate the exact same stack of tools? Anyway, enough jabbering, here are the new toys I’m playing with:

Vagrant

Vagrant + DSpace

Vagrant + Oracle

My dream goal with all of this is to produce a Vagrantfile which will allow you to Vagrant Up a working Oracle-based DSpace development environment. Because that would be a beautiful thing indeed.


So, my goal with this work is to be able to have a set of DSpace themes in their own repositories on GitHub, so I can then include them in my own DSpace repository as submodules .

Credit where credit is due, I used the suggestions on these pages for inspiration:
stackoverflow:extract-part-of-a-git-repository
airbladesoftware:moving-a-subdirectory-into-a-seperate-git-repository

However, this page is the one I finally selected as my guide:
stackoverflow:detach-subdirectory-into-seperate-git-repository

Here is the process I followed, in order to extract this recent version of the Mirage theme (Note, the following will extract just the Master/HEAD history for the Mirage theme, and will drop all branches and tags… the resulting repository will be useful as an include/subrepository for a project which is following Master, but won’t be useful for an older code base).


git clone git@github.com:hardyoyo/DSpace.git mirage
cd mirage
git remote rm origin #let's avoid inadvertant pushes back to origin, shall we?
git tag -l | xargs git tag -d
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter dspace-xmlui/src/main/webapp/themes/Mirage HEAD
git reset --hard
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now

This same tactic should work for pulling out any theme from any repository… now just to figure out how to use it. First, let’s put it up somewhere:

  1. create a bare repo on GitHub (in this example, I’ve called it “mirage”
  2. enter the following at the root of the extracted repository created in the steps outlined above:

git remote add origin git@github.com:your-github-user-name/mirage.git
git push -u origin master

If you’re curious about how you might make use of this extracted theme, read Git Tools – Submodules (apologies for the odd formatting above, I’m still not quite used to Textile, and I can’t figure out how to get two blocks of code into the same article… argh!)