files.rb revision ac24fe7991ded663db092bd5480ef9c52c14a86f
aead985e48027c9df1ef553b17df29dd378757aaJulian Kornberger # virtual attribute for upload
7097237ffbd7227b30272b307b6e48c78b22ecb1Julian Kornberger before_create :commit_raw_file, unless: :commit_oid?
24a4fef0ec5817f68ff5dd8bc59c1ce947187fabEugen Kuksa ontology.path = @raw_file.original_filename if ontology.path.nil?
24a4fef0ec5817f68ff5dd8bc59c1ce947187fabEugen Kuksa # otherwise the file upload is broken (no implicit conversion of ActionDispatch::Http::UploadedFile into String):
24a4fef0ec5817f68ff5dd8bc59c1ce947187fabEugen Kuksa tmp_file = if @raw_file.class == ActionDispatch::Http::UploadedFile
24a4fef0ec5817f68ff5dd8bc59c1ce947187fabEugen Kuksa repository.save_file(tmp_file, ontology.path, "message", user)
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger Rails.root.join("tmp","commits",commit_oid)
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger # path to the raw file
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger # path to the raw file, checks out the raw file if is missing
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger # path to xml file (hets output)
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger # checks out the raw file
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger File.open(raw_path, "w"){|f| f.write raw_data }
ac2169141f0b549fc8917a4b1d778f4ba3cab0bfJulian Kornberger # returns the raw data directly from the repository