git_repositories.rb revision edb0262a62074951f0d4997a783ce03eebc7c63e
require 'git_repository'
included do
end
end
end
# replace capistrano-style release with 'current'-symlink
end
end
end
end
message ||= "delete file #{filepath}"
end
end
end
end
end
# we expect that this method is only called, when the ontology is 'present'
if o
o.present = true
# update existing ontology
fast_parse: fast_parse },
{ without_protection: true })
end
else
# create new ontology
clazz = Ontology::file_extensions_distributed.include?(File.extname(filepath)) ? DistributedOntology : SingleOntology
o = clazz.new
o.iri = iri || "http://#{Settings.hostname}/#{path}/#{basepath}"
o.present = true
fast_parse: fast_parse },
{ without_protection: true })
end
end
path ||= '/'
end
end
path ||= '/'
if git.empty?
end
if path_exists?(path, commit_oid)
if file
{
type: :file,
}
else
entries.each do |name, es|
es.each do |e|
end
es.sort_by! { |e| -e[:ontologies].size }
end
{
type: :dir,
}
end
else
case
when entries.size == 1
{
type: :file_base,
}
else
{
type: :file_base_ambiguous,
}
end
end
end
end
# given a commit oid or a branch name, commit_id returns a hash of oid and branch name if existent
branch_names = git.branches.select { |b| b[:oid] == oid }
{ oid: oid, branch_name: nil }
else
{ oid: oid, branch_name: branch_names[0][:name] }
end
else
else
end
end
end
end
end
end
commits(limit: 3)
end
# recognized options: :start_oid (first commit to show)
# :stop_oid (first commit to hide)
# :path (file to show changes for)
# :limit (max number of commits)
# :offset (number of commits to skip)
# :walk_order (Rugged-Walkorder)
end
versions = []
versions << save_ontology(commit_oid, f.path, options.delete(:user), fast_parse: has_changed?(f.path, commit_oid), do_not_parse: true)
end
}
}
schedule_batch_parsing(versions)
end
def schedule_batch_parsing(versions)
grouped_versions = versions.compact.group_by { |v| v.ontology.path }
grouped_versions.each do |k,versions|
optioned_versions = versions.map do |version|
[version.id, { fast_parse: version.fast_parse }]
end
OntologyBatchParseWorker.perform_async(optioned_versions)
end
end
# saves all ontologies at the current state in the database
def save_current_ontologies(user=nil)
git.files do |entry|
save_ontology entry.last_change[:oid], entry.path, user, fast_parse: true
end
end
def user_info(user)
{email: user.email, name: user.name}
end
end