Dr Nic's Journey

The small things in my day so I don't clutter the Dr Nic site.

Areas of interest: Ruby, Rails, JavaScript, Editors, and my life in general.

Subscribe:

Dr Nic Blog:

Packaging a rails/ruby app

Want to send a copy of your Rails app to someone? Our old friend Rake comes to the rescue. Stick this in your Rails app’s Rakefile:

require 'rake/packagetask'
require 'rake/clean'

NAME    = File.basename(File.expand_path(File.dirname(File.expand_path(__FILE__)))) unless defined? NAME
VERS = ENV['VERSION'] || begin
  `svn info` =~ /Revision: (\d+)/
  $1
end unless defined? VERS
CLEAN.include('pkg')

Rake::PackageTask.new(NAME, VERS) do |p|
  p.need_tar = true
  p.need_zip = true
  p.package_files.include('**/*')
  p.package_files.exclude(".svn")
  p.package_files.exclude("vendor/rails")
end
Now run rake package and it will generate tar and zip files, without edge rails included (tell them to install it themself).