mirror of
https://github.com/moparisthebest/www.moparscape.org
synced 2024-12-25 08:58:49 -05:00
updated rakefile to support github pages deployments
This commit is contained in:
parent
e021b70d79
commit
54766a0c3b
26
Rakefile
26
Rakefile
@ -10,6 +10,14 @@ port = "4000" # preview project port eg. http://localhost:4000
|
|||||||
site = "site" # compiled site directory
|
site = "site" # compiled site directory
|
||||||
source = "source" # source file directory
|
source = "source" # source file directory
|
||||||
|
|
||||||
|
# Github pages deploy config
|
||||||
|
# For github user pages, use "master"
|
||||||
|
# For github project pages use "gh-pages"
|
||||||
|
# If you're not using this, you can remove it
|
||||||
|
# Read http://pages.github.com for guidance
|
||||||
|
|
||||||
|
github_pages_branch = "gh-pages"
|
||||||
|
|
||||||
def ok_failed(condition)
|
def ok_failed(condition)
|
||||||
if (condition)
|
if (condition)
|
||||||
puts "OK"
|
puts "OK"
|
||||||
@ -86,11 +94,27 @@ task :watch do
|
|||||||
end
|
end
|
||||||
|
|
||||||
desc "generate and deploy website"
|
desc "generate and deploy website"
|
||||||
multitask :deploy => [:default, :clean_debug] do
|
multitask :deploy_rsync => [:default, :clean_debug] do
|
||||||
print ">>> Deploying website <<<"
|
print ">>> Deploying website <<<"
|
||||||
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
|
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "generate and deploy website to github user pages"
|
||||||
|
multitask :github_user_deploy => [:default, :clean_debug] do
|
||||||
|
require 'git'
|
||||||
|
repo = Git.open('.')
|
||||||
|
repo.branch("#{github_pages_branch}").checkout
|
||||||
|
(Dir["*"] - ["#{site}/*"]).each { |f| rm_rf(f) }
|
||||||
|
Dir["#{site}/*"].each {|f| mv(f, ".")}
|
||||||
|
rm_rf("#{site}/*")
|
||||||
|
Dir["**/*"].each {|f| repo.add(f) }
|
||||||
|
repo.status.deleted.each {|f, s| repo.remove(f)}
|
||||||
|
message = ENV["MESSAGE"] || "Site updated at #{Time.now.utc}"
|
||||||
|
repo.commit(message)
|
||||||
|
repo.push
|
||||||
|
repo.branch("source").checkout
|
||||||
|
end
|
||||||
|
|
||||||
desc "start up an instance of serve on the output files"
|
desc "start up an instance of serve on the output files"
|
||||||
task :start_serve => :stop_serve do
|
task :start_serve => :stop_serve do
|
||||||
cd "#{site}" do
|
cd "#{site}" do
|
||||||
|
Loading…
Reference in New Issue
Block a user