Created
February 27, 2013 16:16
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#clean up the existing files | |
rm -rf pkg tmp/cache public/assets | |
bundle exec rake build_package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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