SameShirtEveryDay.com

Personal blog of the one called Alex Gorbatchev, from Toronto, Canada.
follow me on Twitter

Bash script to install Gems

Posted on October 24th, 2007 by Alex Gorbatchev. In Misc, Ruby. No comments yet...

I looked all over and couldn’t find a bash script which could check and if missing install a list of gems. I had to hack my own up:

GEMS=( `cat gems.txt` ) # gems.txt has one gem name per line

for gem in "${GEMS[@]}"; do
  found=`gem list $gem | grep -i $gem`
  if [ "$found" != "" ]; then
    parts=( $found )
    echo "Found ${parts[0]} ${parts[1]}"
    continue
  fi

  echo "---------------------------"
  echo "Installing $gem"
  sudo gem install $gem -y
  echo "---------------------------"
done

Morning Brew #84

Posted on October 24th, 2007 by Alex Gorbatchev. In Morning Brew. No comments yet...

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

GUI edition

  • Shoes – a lightweight Ruby interface to Windows, Linux and OSX applications. Best for small utilities. (into one, two and three by Juxie)
  • Cheri::Swing – a full blow JRuby builder style interface to Java’s Swing.
  • Ruby-GNOME2 – bindings for the GNOME 2.0 development environment.
  • WxRuby – allows writing native-looking desktop applications for Windows, OS X, Linux GTK and other platforms. Probably the most complete GUI package.
  • FXRuby – provides an interface to the FOX GUI library.
  • RubyCocoa – OSX bindings for Ruby.
  • VisualuRuby – Windows bindings for Ruby.
  • Linux GUI Programming with Ruby – a short video demonstrating Glade based Linux GUI with Ruby.

Morning Brew #83

Posted on October 18th, 2007 by Alex Gorbatchev. In Morning Brew. No comments yet...

Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.

Rails

Ruby

Web Development

it_only: running a single example in RSpec

Posted on October 15th, 2007 by Alex Gorbatchev. In Ruby. 4 comments!

Sometimes you want to focus on just one example in your RSpec file. I had to do this quite often in the last 3 days and I got tired of commenting out stuff back and forth. So, I give you “it_only” example.

module Spec
  module DSL
    module BehaviourEval
      module ModuleMethods
        def it(description = :__generate_description, opts = {}, &block)
          return if @it_only_found
          examples << Example.new(description, opts, &block)
        end

        # Same as +it+ only blocks all other examples making this the
        # only example that would run.
        def it_only(description = :__generate_description, opts = {}, &block)
          @it_only_found = true
          @examples = [Example.new(description, opts, &block)]
        end
      end
    end
  end
end

Drop this into your spec_helper.rb and now if you want to focus on a single example, just make it “it_only” instead of “it“.

Morning Brew #82

Posted on October 14th, 2007 by Alex Gorbatchev. In Morning Brew. 1 comment so far...
home
Subscribe to this blog Follow me on Twitter My bookmarks on Delicious My photography on Flickr