-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
36 lines (31 loc) · 900 Bytes
/
Rakefile
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
30
31
32
33
34
35
desc 'deploy site to specified environment, ie rake deploy[staging] or rake deploy[production].'
task :deploy, :environment do |t, args|
require 'rubygems'
require 'highline/import'
require 'net/ssh'
subdomain = args[:environment] || 'staging'
branch = args[:branch] || 'develop'
if subdomain == 'production'
subdomain = 'www'
branch = 'master'
end
site = "#{subdomain}.entryway.net"
username = ask('Username: ') { |q| q.echo = true }
password = ask('Password: ') { |q| q.echo = "*" }
Net::SSH.start('another.entryway.net', username, :password => password) do |ssh|
commands = <<EOF
cd /var/www/#{site}/cached-copy
git checkout #{branch}
git pull origin #{branch}
git checkout -f
rm -rf _site
jekyll --no-auto
mv _site ../_public
mv ../public _old
mv ../_public ../public
rm -rf _old
EOF
commands = commands.gsub(/\n/, "; ")
ssh.exec commands
end
end