[Rubygems-developers] Proper way to include non-C code extensions / QtRuby designer UI files to a Gem

Robert J. Berger rberger at ibd.com
Wed Jan 31 17:53:54 EST 2007

I have a project that utilizes qtruby and output of the QT Designer  

The output of the QT Designer tool are XML files (*.ui) that are then  
converted into Ruby files using a qtruby tool rbuic.

There are also some image files (*.png or *.jpg) that need to be  
converted to a single ruby file also using rbuic.

I would like to include these source files in the gem and have the  
gem install process run the rbuic commands (ideally based on  
dependencies and thus using Make or Rake). And then put the files in  
the proper place so they will be part of the require heirarchy for  
the rest of the Ruby code in the project's lib directory.

So what would be the "Best Practices" to do this?

Would they go in the ext directory and I create a extconf.rb that  
builds them or builds a make or rake file to build them? If so, do  
they go right into the target install library directory or first into  
the local lib directory?

Or should I create its own ui directory and have the main rakefile  
that is installing the gem run the rbuic process as a set  of tasks?

Or is there another way that is most proper?

Before trying to make it into a gem, I had the ui files in the same  
directory as the rest of my ruby files and had a makefile that ran  
the rbuic process:


RBUICIMPLS=main_form.rb \
         gps_options_form.rb \
         ping_options_form.rb \
         iperf_options_form.rb \
         sniff_radio_options_form.rb \
         data_radio_options_form.rb \
         not_implemented_form.rb \
         error_form.rb \
         dhclient_form.rb \


main_form.rb: main_form.ui
         $(RBUIC) -x $< -o $@

%.rb: %.ui
         $(RBUIC) $< -o $@

         $(RBUIC) -embed skydriver \
         images/editcopy.png \
         images/editcut.png \
         images/editpaste.png \
         images/filenew.png \
         images/fileopen.png \
         images/filesave.png \
         images/exit.png \
         images/print.png \
         images/redo.png \
         images/searchfind.png \
         images/tabwidget.png \
         images/undo.png \
         images/connected_32x32.png \
         images/disconnected_32x32.png \
         images/disconnected_64x64.png \
         images/connected_64x64.png \
         images/negative.png \
         images/positive.png \
     -o qmake_image_collection.rb

         rm -f $(RBUICIMPLS)


Robert J. Berger - Internet Bandwidth Development, LLC.
Voice: 408-882-4755 eFax: +1-408-490-2868
"Until Windows  is outlawed, Bots will own Windows."

More information about the Rubygems-developers mailing list