Created
September 28, 2010 08:41
-
-
Save jzajpt/600628 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'net/scp' | |
require 'net/ssh' | |
app = 'his' | |
lang = 'en' | |
host = 'zoidberg.blueberry.cz' | |
port = 30001 | |
user = 'his_webapps_cz' | |
puts "Building #{app}..." | |
system "sc-build #{app} -r -c" | |
build_id = Dir.entries("tmp/build/static/#{app}/#{lang}/").last | |
puts "Deploying build #{build_id}" | |
Net::SCP.start(host, user, :port => port) do |scp| | |
# synchronous (blocking) upload; call blocks until upload completes | |
scp.upload! "tmp/build/static", "current/public", :recursive => true | |
end | |
Net::SSH.start(host, user, :port => port) do |ssh| | |
result = ssh.exec!("cd current/public; ln -sf static/#{app}/#{lang}/#{build_id}/index.html .") | |
puts result | |
end | |
puts "deployed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment