Apr 05, 2010 / yuml ~ ruby
Generate yUML Diagrams in 10 Lines of Ruby

First, install gems...

sudo gem install rio curb

Then the script (tweak as needed)....

require 'rubygems'
require 'curb'                                                                               
require 'rio' 

# POST DSL up to yUML
c = Curl::Easy.new("http://yuml.me/diagram/plain/class/")
c.multipart_form_post = true           
c.http_post(Curl::PostField.content("dsl_text","[A]->[B]"))

# Grab the ID, and then download img and save to disk
img_id = c.body_str  
img = "http://yuml.me/#{img_id}"
rio(img) > rio("img.png")   

You may also like...