1 class ActionsController < ApplicationController
3 skip_before_filter :find_object_by_uuid, only: :post
5 def combine_selected_files_into_collection
8 params["selection"].each do |s|
9 m = CollectionsHelper.match(s)
10 if m and m[1] and m[2]
11 lst.append(m[1] + m[2])
16 collections = Collection.where(uuid: lst)
19 collections.each do |c|
26 mt = chash[m[1]+m[2]].manifest_text
28 IO.popen(['arv-normalize', '--extract', m[4][1..-1]], 'w+b') do |io|
31 while buf = io.read(2**20)
36 combined += chash[m[1]+m[2]].manifest_text
41 IO.popen(['arv-normalize'], 'w+b') do |io|
44 while buf = io.read(2**20)
53 newuuid = "#{d.hexdigest}+#{normalized.length}"
58 $arvados_api_client.arvados_v1_base.
59 sub(/\/arvados\/v1/, '').
60 sub(/^https?:\/\//, ''),
61 'ARVADOS_API_TOKEN' => Thread.current[:arvados_api_token],
62 'ARVADOS_API_HOST_INSECURE' =>
63 Rails.configuration.arvados_insecure_https ? 'true' : 'false'
66 IO.popen([env, 'arv-put', '--raw'], 'w+b') do |io|
69 while buf = io.read(2**20)
74 newc = Collection.new({:uuid => newuuid, :manifest_text => normalized})
81 link_class: "provenance",
87 redirect_to controller: 'collections', action: :show, id: newc.uuid
91 if params["combine_selected_files_into_collection"]
92 combine_selected_files_into_collection