Skip to content

Instantly share code, notes, and snippets.

@sintaxi
Created December 5, 2008 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sintaxi/32194 to your computer and use it in GitHub Desktop.
Save sintaxi/32194 to your computer and use it in GitHub Desktop.
undefined
set :application, "phonegap"
set :deploy_to, "/var/www/phonegap.com"
set :tmp, "#{application}_update"
set :app_root, "/"
set :user, "root"
set :use_sudo, true
role :web, "phonegap.com"
namespace :deploy do
task :phonegap do
# Copy
system("cp -r #{application} #{tmp}")
# Config
File.open("#{tmp}/config/settings.php", "w") { |file| file.puts "<?php $APP_ROOT = \"#{app_root}\"; ?>" }
# Tar
system("tar -C #{tmp} -czf #{tmp}.tar.gz . && rm -r #{tmp}")
# Upload
put(File.read("#{tmp}.tar.gz"), "#{tmp}.tar.gz")
# Untar
run "tar -xzf #{tmp}.tar.gz -C #{deploy_to}"
# Cleanup
system("rm -rf #{tmp}.tar.gz")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment