Skip to content
Snippets Groups Projects
Commit 6ca954d3 authored by Arnaud Levy's avatar Arnaud Levy
Browse files
parent 68b4b67d
No related branches found
No related tags found
No related merge requests found
......@@ -13,12 +13,24 @@ module WithDependencies
[]
end
def recursive_dependencies(array = [])
# Method is often overriden
def syncable?
if respond_to? :published_now?
published_now?
elsif respond_to? :published
published
else
true
end
end
def recursive_dependencies(array: [], syncable_only: false)
return array if syncable_only && !syncable?
dependencies.each do |dependency|
next if dependency.in?(array)
array << dependency
next unless dependency.respond_to?(:recursive_dependencies)
array = dependency.recursive_dependencies(array)
array = dependency.recursive_dependencies(array: array, syncable_only: syncable_only)
end
array
end
......
......@@ -33,12 +33,14 @@ module WithGit
def sync_with_git
return unless website.git_repository.valid?
Communication::Website::GitFile.sync website, self
recursive_dependencies.each do |object|
Communication::Website::GitFile.sync website, object
end
references.each do |object|
Communication::Website::GitFile.sync website, object
if syncable?
Communication::Website::GitFile.sync website, self
recursive_dependencies(syncable_only: true).each do |object|
Communication::Website::GitFile.sync website, object
end
references.each do |object|
Communication::Website::GitFile.sync website, object
end
end
website.git_repository.sync!
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment