Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created June 9, 2009 20:42
Show Gist options
  • Save leehambley/126768 to your computer and use it in GitHub Desktop.
Save leehambley/126768 to your computer and use it in GitHub Desktop.
desc <<-DESC
Copy files to the currently deployed version. This is useful for updating \
files piecemeal, such as when you need to quickly deploy only a single \
file. Some files, such as updated templates, images, or stylesheets, \
might not require a full deploy, and especially in emergency situations \
it can be handy to just push the updates to production, quickly.
To use this task, specify the files and directories you want to copy as a \
comma-delimited list in the FILES environment variable. All directories \
will be processed recursively, with all files being pushed to the \
deployment servers.
$ cap deploy:upload FILES=templates,controller.rb
Dir globs are also supported:
$ cap deploy:upload FILES='config/apache/*.conf'
DESC
task :upload, :except => { :no_release => true } do
files = (ENV["FILES"] || "").split(",").map { |f| Dir[f.strip] }.flatten
abort "Please specify at least one file or directory to update (via the FILES environment variable)" if files.empty?
files.each { |file| top.upload(file, File.join(current_path, file)) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment