Bash script to install Gems
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
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
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 101: Naming Conventions.
- Zero to Riding the Rails in Four Months.
- Default Order Plugin – order_by :fields => ['last_name', 'first_name'], :mode => :desc
Ruby
- Mailtrap – dummy SMTP server for testing your emails.
- New netbeans update from Oct 12th.
Web Development
it_only: running a single example in RSpec
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
Another cup of fresh Rails and not so Rails brew. If you’d like to send in a link, please use this page.