git.rb revision 78b69b71ee6bb1b213a2af7a2daec9e2e16052ef
require 'git_repository'
included do
end
end
end
git.commits(*args, &block)
end
# replace capistrano-style release with 'current'-symlink
end
end
mark_ontology_as_having_file(filepath, false)
end
end
end
end
end
# we expect that this method is only called, when the ontology is 'present'
ontology.present = true
end
if !ontology
end
end
end
ontology.present = true
end
end
{ commit_oid: commit_oid,
# We can't use the ontology's filepath bacause it might have changed
{ without_protection: true })
end
end
end
end
end
walk_commits(limit: 3)
end
versions = []
commits_count = 0
commits_count += 1
current_file_count += 1
if f.added? || f.modified?
do_not_parse: true)
versions << save_ontology(commit.oid, ontology_version_options)
elsif f.renamed?
ontology_version_options = OntologyVersionOptions.new(
f.path,
options.delete(:user),
fast_parse: has_changed?(f.path, commit.oid),
do_not_parse: true,
previous_filepath: f.delta.old_file[:path])
versions << save_ontology(commit.oid, ontology_version_options)
elsif f.deleted?
mark_ontology_as_having_file(f.path, false)
end
}
highest_change_file_count = [highest_change_file_count,
current_file_count].max
}
priority = applicable_for_priority?(commits_count,
highest_change_file_count)
schedule_batch_parsing(versions, priority_mode: priority)
end
def schedule_batch_parsing(versions, priority_mode: false)
grouped_versions = versions.compact.group_by(&:path)
grouped_versions.each do |k,versions|
optioned_versions = versions.map do |version|
[version.id, { fast_parse: version.fast_parse }]
end
OntologyBatchParseWorker.
perform_async_with_priority(priority_mode, optioned_versions)
end
end
def applicable_for_priority?(commits_count, highest_change_file_count)
(commits_count <= priority_settings.commits) &&
(highest_change_file_count <= priority_settings.changed_files_per_commit)
end
def priority_settings
@priority_settings ||= OpenStruct.new(Settings.git[:push_priority])
end
def mark_ontology_as_having_file(path, has_file)
ontos = ontologies.with_path(path)
if ontos.any?{ |onto| onto.has_file != has_file }
ontos.each do |onto|
onto.has_file = has_file
onto.save
end
end
end
def user_info(user)
{email: user.email, name: user.name}
end
def master_file?(ontology, ontology_version_options)
ontology.path == ontology_version_options.pre_saving_filepath
end
def generate_iri(basepath)
"http://#{Settings.hostname}#{generate_locid(basepath)}"
end
def generate_locid(basepath)
"/#{path}/#{basepath}"
end
end