Theo this recent thread, capistrano sẽ có thể init và cập nhật các môđun con của bạn:
set :git_enable_submodules,1
trong config/deploy.rb nên là đủ, nếu .gitmodules
mục của bạn được cập nhật.
Bạn có thể cần to patch Capistrano (lib/capistano/recipes/deploy/scm/git.rb
) để đảm bảo các mô-đun con của bạn được bao gồm.
def checkout(revision, destination)
git = command
branch = head
fail "No branch specified, use for example 'set :branch, \"origin/master\"' in your deploy.rb" unless branch
if depth = configuration[:git_shallow_clone]
execute = "#{git} clone --depth #{depth} #{configuration[:repository]} #{destination} && "
else
execute = "#{git} clone #{configuration[:repository]} #{destination} && "
end
execute += "cd #{destination} && #{git} checkout -b deploy #{branch}"
if submodules = configuration[:git_enable_submodules]
execute += " && git-submodule init &&"
execute += "git-submodule update"
end
execute
end
Nếu bạn có nested submodules, bạn cần:
gem sources -a http://gems.github.com
$ sudo gem install morhekil-capistrano-deepmodules
Chỉ cần yêu cầu nó ở cấu hình triển khai của bạn:
require 'capistrano/deepmodules'
Đá quý sẽ tự động xử lý mọi phần còn lại.
Bạn có thể xóa :git_enable_submodules
khỏi cấu hình của mình, đá quý không chú ý đến nó - nếu bạn đang yêu cầu, bạn đã nói rằng bạn muốn bật mô-đun phụ.
Và một chi tiết khác cần chú ý - hiện tại chỉ có chiến lược bộ nhớ cache từ xa mới được hỗ trợ bởi đá quý. Nó có nghĩa là bạn PHẢI thêm vào config
bạn dòng sau:
set :deploy_via, :remote_cache
Nó cho phép bộ nhớ cache từ xa và nó thực sự là điều bạn muốn làm anyway - triển khai codebases lớn với rất nhiều submodules và khác công cụ thực sự là một trải nghiệm phiền hà nếu bạn không có bộ nhớ cache phía máy chủ của nó.