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).