preload
Python Connectivity Check Script Daemonizing Python Clustat XML Server
Feb 11

When I want to distribute a Ruby script to a customer, sometimes its just easier to use something like Ocra to package up all the files needed into one nice .exe file that I can send over. Since I use Rake a lot, I wanted to figure out a way to automate the process. Here’s a simple example:

...
desc "List available Tasks"
task :default do
   sh %{ rake -T }
end

desc "Make BI_Competition_Status_Report.exe file"
task :exe do
   sh %{ cd lib && rake exe }
   sh %{ move lib\\BI_Competition_Status_Report.exe .}
end
...

This is in your main project Rakefile. Since I’m using NetBeans, it places my Ruby files in a ./lib directory. The first sh command simply CD’s down to lib, and runs a second Rakefile located there:

desc "Make BI_Competition_Status_Report.exe file"
task :exe do
   sh %{ ocra --windows --icon C:/Server12/Dev/Ruby/Exonets.ico BI_Competition_Status_Report.rb}
end

This is the actual Ocra command that packages up the Ruby app into a single .exe file. When this rake command ends, the last command in the previous Rakefile moves the completed .exe file up to the current directory.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Leave a Reply