Skip to content

Instantly share code, notes, and snippets.

@jzajpt
Created September 28, 2010 08:41
Show Gist options
  • Save jzajpt/600628 to your computer and use it in GitHub Desktop.
Save jzajpt/600628 to your computer and use it in GitHub Desktop.
#!/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