Skip to content

Instantly share code, notes, and snippets.

@seth
Created February 16, 2010 17:39
Show Gist options
  • Save seth/305721 to your computer and use it in GitHub Desktop.
Save seth/305721 to your computer and use it in GitHub Desktop.
desc "deploy it call with [true/false] to actually deploy"
task :deploy, [:doit] do |t, args|
args.with_defaults(:doit => false)
site_config = YAML.load_file("./config.yaml")
output_dir = site_config["output_dir"].sub(/\/$/, "")
config = YAML.load_file("./deploy.yaml")
user = config["user"]
host = config["host"]
root = config["root"]
dry = args.doit ? "" : "--dry-run"
cmd = "rsync -av #{dry} #{output_dir}/ #{user}@#{host}:#{root}"
system "#{cmd}"
msg = args.doit ? "sync complete" : "DRY RUN finished, rerun with doit=true"
puts msg
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment