Borkware Miniblog

September 7, 2009

VoodooPad and Subversion

Filed under: programming, Random, VoodooPad — Mark Dalrymple @ 2:55 pm

Yeah, Git and Hg are the new hotness, but for some projects I’m still using subversion.

A also like keeping my project documentation in VoodooPad. By keeping a narrative of development in an ever-growing VP, I can go back and figure out where certain “design” “decisions” came from that are currently causing me problems. Not that it ever happens to me. *cough*.

Anyway, I’m moving into a new 13″ MacBookPro (sweet sweet little machine), and I’m taking the nuke-from-orbit approach: only installing software and data files on-demand. So now I need to be able to commit VoodooPad doc changes. This is complicated by VP docs being a bundle with files coming and going as the file is edited.

VooDooPad has nice Script Plugin support, including some sample LUA scripts. Oooh! “Commit changes to subversion”. Perfect!

Getting it set up correctly isn’t 100% obvious – here’s how I do it:

  1. Snarf the “Commit changes to subversion” code” and paste it into a new file living at.
    ~/Library/Application Support/VoodooPad/Script PlugIns/Svn Commit.lua
  2. Subversion now lives in /usr/bin, so edit the /usr/local/bin references accordingly. Here’s my version:
    --[[
    VPLanguage = lua
    VPScriptMenuTitle = Subversion Commit
    VPEndConfig
    ]]
    -- we assume subversion is located in /usr/bin/svn
     
    posix.chdir(document:fileName())
     
    -- add new files
    os.execute("/usr/bin/svn st | " ..
    	       "/usr/bin/grep '^\?' | " ..
    	       "/usr/bin/sed -e 's/\?[ ]*//g' | " ..
    	       "/usr/bin/xargs /usr/bin/svn add")
     
    -- clean up deleted pages
    os.execute("/usr/bin/svn st | " ..
    	       "/usr/bin/grep '^\!' | " ..
    	       "/usr/bin/sed -e 's/\![ ]*//g' | " ..
    	       "/usr/bin/xargs /usr/bin/svn rm")
     
    os.execute("/usr/bin/svn ci -m'auto commit'")
    os.execute("/usr/bin/svn st")
    vpconsole("Commit complete.")
    

  3. Set up your favorite form of passwordless access. I’ve been using ssh’s authorized keys: passwordless access quickie.
  4. Restart VoodooPad to get the new menu item.
  5. Make changes, and no longer fear commitment.

Blog at WordPress.com.