qrush / litanyagainstfear

coding with spice

This URL has Read+Write access

litanyagainstfear / Rakefile
100644 29 lines (25 sloc) 0.672 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
desc "deploy site to litanyagainstfear.com"
task :deploy do
  require 'rubygems'
  require 'highline/import'
  require 'net/ssh'
 
  branch = "master"
 
  username = ask("Username: ") { |q| q.echo = true }
  password = ask("Password: ") { |q| q.echo = "*" }
 
  Net::SSH.start('litanyagainstfear.com', username, :port => 1337, :password => password) do |ssh|
    commands = <<EOF
cd ~/litanyagainstfear/cached-copy
git checkout #{branch}
git pull origin #{branch}
git checkout -f
rm -rf _site
jekyll --no-auto
mv _site ../_#{branch}
mv ../#{branch} _old
mv ../_#{branch} ../#{branch}
rm -rf _old
EOF
    commands = commands.gsub(/\n/, "; ")
    ssh.exec commands
  end
end