Skip to content

Instantly share code, notes, and snippets.

@smsohan
Created February 27, 2013 16:16
Show Gist options
  • Save smsohan/5049141 to your computer and use it in GitHub Desktop.
Save smsohan/5049141 to your computer and use it in GitHub Desktop.
A Rake Task to precompile the assets and then make a tarball of the rails project for deploys.
#clean up the existing files
rm -rf pkg tmp/cache public/assets
bundle exec rake build_package
if Rails.env.development?
require 'rake/packagetask'
desc 'precompiles the assets and builds a tarball of the rails application'
task :build_package => "assets:precompile" do
Rake::PackageTask.new("project-name", :noversion) do |p|
p.need_tar_gz = true
p.package_files.add %w(app/**/* config/**/* db/**/* lib/**/* public/**/* script/**/* vendor/assets/**/* Capfile Gemfile Gemfile.lock REVISION Rakefile config.ru)
p.package_files.exclude 'config/database.yml'
end
Rake::Task['package'].invoke
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment