Skip to content

Instantly share code, notes, and snippets.

@shivabhusal
Created February 8, 2016 06:03
Show Gist options
  • Select an option

  • Save shivabhusal/44e5815dd803f71ea3b5 to your computer and use it in GitHub Desktop.

Select an option

Save shivabhusal/44e5815dd803f71ea3b5 to your computer and use it in GitHub Desktop.
Using capistrano's SSHKit library you can move file from local to server from your Rails console or IRB
require 'sshkit'
require 'sshkit/dsl'
on ['deployer@XX.79.200.XXX'] do
# upload! '/home/john/Downloads/__thepact_com/__thepact_com.crt', '/home/deployer/__thepact_com.crt'
# upload! '/home/john/Downloads/__thepact_com/__thepact_com.p7b', '/home/deployer/__thepact_com.p7b'
upload! '/home/john/Downloads/__thepact_com/__thepact_com.ca-bundle', '/home/deployer/__thepact_com.ca-bundle'
within '/home/deployer/' do
# execute 'sudo', 'mv', '/home/deployer/__thepact_com.crt', '/opt/nginx/ssl/__thepact_com.crt'
# execute 'sudo', 'mv', '/home/deployer/__thepact_com.p7b', '/opt/nginx/ssl/__thepact_com.p7b'
execute 'sudo', 'mv', '/home/deployer/__thepact_com.ca-bundle', '/opt/nginx/ssl/__thepact_com.ca-bundle'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment