Tag Archives: ruby

awesome rspec hints and tips

Read “Pure Rspec”, a great slideshow by Jon “Lark” Larkowski.
It contains some really cool rspec tips and hints, how to write your tests more readable and compact.

creating a new gem

I found a few articles that describe easier ways to create a gem. From the entire list of available tools, i want to highlight two: jeweler and (Mr.) bones.
Mr. bones seems a very configurable route to take: it allows you to define your own skeletons (application templates) or use those of others, e.g. bort. On [...]

installing ubuntu for ruby development

I have made the complete switch. My home development machine is no longer Windows XP, no longer dual booting Ubuntu but a full-fledged Ubuntu. After installing the dual-boot, and my machine at work this is the third time to install an ubuntu machine, and getting everything ready for ruby development.
I just want to archive my [...]

use %q to create strings

In my gemspec created by jeweler I saw string creating using %Q. What?

gem.summary = %Q{TODO: one-line summary of your gem}
gem.description = %Q{TODO: longer description of your gem}

I found a page describing ruby string creation, and it seems %Q is the equivalent of double quote delimited strings and [...]

script/plugin install from git fails

I am using ruby 1.8.7 on windows (mingw32), and all of a sudden i cannot run

c:\> ruby script/plugin install git://github.com/daphonz/dirty_associations.git
Plugin not found: ["git://github.com/daphonz/dirty_associations.git"]

the suggested variations also don’t work, e.g.

ruby script/plugin install http://github.com/daphonz/dirty_associations.git
ruby script/plugin install http://github.com/daphonz/dirty_associations.git/

all give the same error.
But, apparently, it has something to do with the mingw32 platform.
In C:\Ruby\lib\ruby\gems\1.8\gems\activesupport-2.3.5\lib\active_support\core_ext\kernel\reporting.rb the following line can [...]

Arrrrcamp

Went to arrrrcamp last friday (Arrrr as in Ruby, Rails, Radiant and, of course, Rhum!). It was the third edition of this unique ruby-on-rails event, and the third time i visited it ;) So i am a regular :)
The first year i was just starting ruby and my then-collegue and me learned a lot. [...]

setting word bookmarks from ruby

The easy solution to set a bookmark inside a Word-document:

require ‘win32ole’
word = WIN32OLE.new(’Word.Application’)
doc = word.Documents.Add("#{path to your template here}")
doc.Bookmarks("bookmark-name").Range.Text = "new content here"

This will work, and will replace the bookmark with the text you wanted to insert.
Recently i had to convert a document that was first built using mail-merge. I am not very familiar with [...]

ruby-oci8 on x64: not a valid win32 executable

working on Windows Server 2008R2 64-bit, installing ruby 1.8.7, ruby-oci8 ran into the following error, after requiring ‘oci8′ : LoadError 193: %1 is not a valid Win32 application
On this machine a 64bit version of Oracle was installed. So the OCI.dll was a 64-bit version. The fix seemed easy: copy a 32-bit version of the [...]

refactoring ruby code

Most of my ruby/rails development is against a legacy Oracle database. One of the things we needed to fix, was a user-table with not enough fields. Because the user table was shared with another application, we were not able to alter the table.
So we added another table, user_params, containing possibly extra parameters for each user.
Now [...]

multiple ruby versions on windows

I started developing ruby more than a year ago, on windows, which might not be the ideal platform :)
But i started out with the standard one-click installer, ruby version 1.8.6, which up until recently served me fine and is an easy way to start. But when i felt the need to install metric_fu, i found [...]