git_repositories.rb revision 184bb45b6cb62422583b634cc27d04fc2ba0e0f6
require 'git_repository'
included do
end
end
end
end
end
end
end
end
end
if o
# update existing ontology
version = o.versions.build({ :commit_oid => commit_oid, :user => user }, { 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}"
version = o.versions.build({ :commit_oid => commit_oid, :user => user }, { 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|
e[:ontologies] = o
end
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)
end
end
}
}
end
# saves all ontologies at the current state in the database
end
end
end