Friday, 30 January 2009

Developing New Library for Icon Artists

Since I-don't-remember-when I have been making a complete rewrite of echo-aritst scrpits which are intended to ease the life of echo-icon artist - they create new icons from template, are able to add icons/symlinks to echo icon theme and add manage their local git repository. So they abstract most of the non-artist stuff away from the artist. During the rewrite I noticed several things.
  • It would be usefull to split my efforts to backend (i.e. ruby library) and frontend. This would make it easier for me to change the frontend interface while keeping the functionality intact or improving the functionality without keeping the user interface intact. Also it makes the future possibility of writing a gui frontend much more viable.
  • Also I realised, I could totally abstract echo specific stuff out of the library into the scripts and thus possibly make the library useful for non-echo icon artists as well.

I also decided to make a logical split of the originaly single methods into
  • Icon related stuff - icon creation, icon rendering, icon checking if it has all requisities needed to successfully render it, handling icon symlinks
  • Theme related stuff - generating completely new index.theme, automatic addition of new directories to already existant one
  • Build System related stuff - creating symlinks when doing the things the old way, adding icons and additional symlinks to build sys when using autotools and icon-naming-utils, add symlinks when building completely from source (the buildsystem itself is done in a way that icons are added automagically), or creating a brand new buildsystem (supports only the one where we build from source ATM).
  • SCM system stuff - currently it means handling git without the need for the user to know how to use git sans git push origin.

You can see the result of this split at the icon-artist documentation page and our git repo. Since it's my first time writing a ruby library and also my first time using rdoc I welcome any suggestions that would lead to making the library interface and documentation better ;-)

Now, back to the scripts. I believe ideal icon artist workflow would be like this:
  • Create icon from template (echo-icon-create --context CONTEXT --template CUSTOM-TEMPLATE icon-name)
  • Actually draw the icon in inkscape and label the scalable icon (in order for the scripts to know, which part of the one-cavas SVG is supposed to be the scalable SVG icon used in the actual theme)
  • Add the icon to local git repo (echo-icon-add --symlink SYMLINK1 --symlink SYMLINK1 --branch BRANCH1 --branch BRANCH2 --component COMPONENT icon-file)

In addition to that you need to initialize your local repo at first (echo-git-setup), and at the current state of things you also need to update the repo before adding the icon (echo-git-update) and push your changes to fedorahosted (cd git-repo-dir && git push origin). So in order to achieve the above I need to add git update and git push to echo-icon-add script... Update should be OK and it haven't done it simply because I haven't actually though about it, the push is more tricky since unless I am sure it won't break things I don't want to autopush changes to fedorahosted. So it's possible I rather create a simple echo-git-publish script for that purpose for the time being...

What do you think of it?

On a related note, are there any ruby-fluent readers who could tell me if I am doing things right in this install script?

No comments: