From: Martin Ankerl Date: 2005-03-28T22:39:47+09:00 Subject: Re: Fox vs Fox12 > I'm writing a very simple FxRuby application. When I run it on a newer > version of FxRuby I need to require 'fox12'. When I run it on an older > version, it needs require 'fox'. It seems to work fine on both > environments except that that I need to change the require. I want to > make the application generic so that it runs on both environments by > doing something like: I use the following code in XDCC-Fetch. It works with Fox 1.0, Fox 1.2, and Fox installed via rubygems. In Fox 1.0 several classes have different names than in 1.2, so I create aliases. Sometimes the arguments of method calls are also different, for this I set the FOXVERSION which I use to switch between different code. # Load FXRuby: try gem, then Fox 1.2, then Fox 1.0 begin # try fxruby gem require 'rubygems' require_gem 'fxruby', '>= 1.1.0' require 'fox12' require 'fox12/colors' FOXVERSION="1.2" include Fox rescue LoadError # no gem? try fox12 direct. begin require "fox12" require "fox12/colors" FOXVERSION="1.2" include Fox rescue LoadError # no gem, no fox12? try fox 1.0 require "fox" require "fox/colors" # grep for FOXVERSION to find all code that depends on this FOXVERSION="1.0" include Fox FXMenuBar = FXMenubar FXToolTip = FXTooltip FXStatusBar = FXStatusbar end end