我有同樣的服務器上的開發和生產的文件夾,並在他們身後1個回購推向取決於推分支這兩個文件夾。我想開發文件夾被部署在發展推到回購,當主推生產的文件夾。我有一個編輯紅寶石後收到的文件我在不同的網站上發現,但我是新來的Ruby和似乎無法找出它爲什麼不推到任何文件夾。GIT後收到多個分支部署
#!/usr/bin/env ruby
# post-receive
from, to, branch = ARGF.read.split " "
if (branch =~ /^master/)
puts "Received branch #{branch}, deploying to production."
deploy_to_dir = File.expand_path('/var/www/html/production')
`GIT_WORK_TREE="#{deploy_to_dir}" git checkout -f master`
puts "DEPLOY: master(#{to}) copied to '#{deploy_to_dir}'"
exit
∂
elsif (branch =~ /^develop/)
puts "Received branch #{branch}, deploying to development."
deploy_to_dir = File.expand_path('/var/www/html/development')
`GIT_WORK_TREE="#{deploy_to_dir}" git checkout -f develop`
puts "DEPLOY: develop(#{to}) copied to '#{deploy_to_dir}'"
exit
end
任何幫助這個post-receive或更換將不勝感激。
是第一個根據該swiggle'exit'應該在那裏?對不起,對Ruby也不太瞭解! –