Category: Ruby
Secret pictures (SPIC)
A couple of weeks ago, ruby-play was imminent and in such a case one should always try some new things. Heroku is hot, so it had to be something I could deploy on Heroku. Sinatra 1.0 was released, so it had to be something using Sinatra.
What else? S3 is always fun and with that in mind I found the CarrierWave gem.
More? Sure. To experiment with something else then ActiveRecord I used Sequel.
Does it blend? Sure!
A new example app was born: SPIC. Spic (secret pictures) allows you to upload files to S3 for your sharing pleasure.
Heroku really is fun to use. One can setup Spic in only a matter of seconds.
git clone git://github.com/atog/spic.git
cd spic
heroku create
git push heroku master
heroku config:add S3_KEY=your_s3_key S3_SECRET=your_amazon_secret S3_BUCKET=your_bucket SECRET=your_own_personal_jesus
heroku open
It was fun. It was short. It is good.
Capfire, post deploy notifications to Campfire
We use github for all our projects, and we use Campfire as our office backchannel. So when we saw this post we (or maybe it was just me, I’m a sucker for this kind of stuff) knew we had to have a way to easily use this on all our projects; so here it is: Capfire
What it does
Besides being a kickass gem name, it sends a message to Campfire each time you deploy an application. In this message is a link to Github’s compare-view, so you can easily scan just what has changed since your previous deployment. Since it’s being sent to Campfire everyone can take a peek. Great !
Installation
First install the gem:
gem install capfire
First run
script/generate capfire -k campfiretoken -a campfireaccount -r campfireroom
This will add a snippet to your config/deploy.rb to include the capfire capistrano script and will create a file in your home folder named .campfire containing your token, account, room and a configurable message (the parts between ##’s are substituted).
Like this (be careful with your spaces):
campfire: account: 10to1 token: thishastobeyourtoken room: General message: "I (#deployer#) deployed #application# with `cap #args#` (#compare_url#)"
If you’re not sure about this automagically thing, you can do it by hand as well, create the ~/.campfire file and add the following to your config/deploy.rb:
begin require 'capfire/capistrano' rescue Object # Don't force other users to install Capfire. end
Subsequent runs
Since a ~/.campfire file already exists you can just run script/generate capfire to add the snippet to your deploy script in each app. You can run this as much you want it will only add the snippet once. No worries.
If someone else on your team doesn’t have capfire installed, he won’t notice a thing (but be sure to mock him).
I hope you, dear reader, like it as much as we do :)
Create UML diagrams from the command line
Maybe you know it, maybe you don’t but yUML is awesome!
Create and share simple UML diagrams in your blogs, wikis, forums, bug-trackers and emails.
Yesterday I was creating a new class diagram using yUML and besides it’s a great product it was a bit cumbersome working in a small textarea and pressing ‘Generate!’ (all the time). I fired up textmate and created a diagram using the yUML syntax. A couple of minutes later I had ruby script which generated the diagram using yUML by taking a text file as input.
Thanks to Jeweler it’s dead easy to create gems and release them to Gemcutter so a yumlcmd gem was born.
Installation
sudo gem install yumlcmd
Usage
yumlme -f your-diagram.txt
Example your-diagram.txt
[Customer]+1->*[Order][Order]++1-items >*[LineItem][Order]-0..1>[PaymentMethod]
Syntax overview: http://yuml.me/diagram/scruffy/class/draw
Output
yuml-output.png
I hope you like it as much as I do :)
