#!/usr/bin/env ruby require 'optparse' RUBY_VERSIONS = %W[1.8.7 1.9.2] RAILS_VERSIONS = %W[2.3 3.0 3.1] options = {} OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options]" opts.on("--install", "Install gem dependencies") do |v| options[:install] = v end end.parse! cmds = if options [:install] ['bundle update'] else ['bundle update --local rails | grep rails', 'rake spec'] end n = 1 total = RUBY_VERSIONS.size * RAILS_VERSIONS.size RUBY_VERSIONS.each do |ruby| RAILS_VERSIONS.each do |rails| puts "\n\n*** ruby version #{ruby} - rails version #{rails} [#{n} of #{total}]\n\n" n += 1 allcmds = [] allcmds << "rvm use #{ruby}" allcmds << "export SCHEMA_VALIDATIONS_RAILS_VERSION=#{rails}" allcmds += cmds allcmds << 'exit' system %Q{echo '#{allcmds.join(' \n ')}' | bash -i} or abort "aborting #{$0}" end end