aead985e48027c9df1ef553b17df29dd378757aaJulian Kornberger # virtual attribute for upload
7097237ffbd7227b30272b307b6e48c78b22ecb1Julian Kornberger before_create :commit_raw_file, unless: :commit_oid?
658151642f71e0593b7d55f124fd42ebe2cfcf9aEugen Kuksa self.path = @raw_file.original_filename if self.path.nil?
24a4fef0ec5817f68ff5dd8bc59c1ce947187fabEugen Kuksa # otherwise the file upload is broken (no implicit conversion of ActionDispatch::Http::UploadedFile into String):
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase tmp_file = if @raw_file.class == ActionDispatch::Http::UploadedFile
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa repository.save_file(tmp_file, path, 'message', pusher)
045a68332e7be1078224de3911d214939e470b66Julian Kornberger Ontohub::Application.config.commits_path.join(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 # 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