Skip to content

Instantly share code, notes, and snippets.

View nelseric's full-sized avatar

Eric Nelson nelseric

  • Grand Rapids, MI
View GitHub Profile
@mklnz
mklnz / capistrano_sudo_helpers.rb
Created April 17, 2012 18:12
Sudo put and template methods for Capistrano
# I got tired of uploading to /tmp then moving to the correct location, so these two convenience methods will save you a lot of time in the long run.
# Helper method to upload to /tmp then use sudo to move to correct location.
def put_sudo(data, to)
filename = File.basename(to)
to_directory = File.dirname(to)
put data, "/tmp/#{filename}"
run "#{sudo} mv /tmp/#{filename} #{to_directory}"
end