[ARVADOS] updated: 2606f4df5861ff34ca9e42389a1509e77c102c5a

git at public.curoverse.com git at public.curoverse.com
Fri Mar 20 14:32:26 EDT 2015


Summary of changes:
 apps/workbench/app/helpers/collections_helper.rb |  3 +-
 apps/workbench/config/application.default.yml    |  6 +--
 apps/workbench/config/initializers/mime_types.rb | 34 ++++-----------
 apps/workbench/test/unit/collection_test.rb      |  1 +
 sdk/cli/bin/arv-run-pipeline-instance            | 53 ++++--------------------
 sdk/cli/bin/crunch-job                           | 30 ++++++++++----
 services/api/test/fixtures/collections.yml       |  8 ++--
 7 files changed, 46 insertions(+), 89 deletions(-)

       via  2606f4df5861ff34ca9e42389a1509e77c102c5a (commit)
       via  03e8ba641e0161f15d96351e2432805977fd9d57 (commit)
       via  4925686f6aa7214568ebd60be3acaa49dbf9dd1a (commit)
       via  a578a055456693d66ccf4d65a09822380d2cc7a8 (commit)
       via  1ed0df4d4b2221a06e37effce42ab5b2e23b29c8 (commit)
       via  a239e2db534cc36aa8c3e08077383d84bf6ba8e8 (commit)
       via  3365d47ab4f504a1e849852691313cddd89d0f15 (commit)
      from  a9c8f2dd15af7843ac4d86e5820ab0771cc5fd78 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 2606f4df5861ff34ca9e42389a1509e77c102c5a
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Fri Mar 20 14:30:35 2015 -0400

    5375: improved mime_types initializer. enhance collections_helper to use mime_type sub_type instead of relying on suffix.
    update config param name, value, and comment. add .seq, which is another supported extension of fasta to test.

diff --git a/apps/workbench/app/helpers/collections_helper.rb b/apps/workbench/app/helpers/collections_helper.rb
index 0564ec9..25f2cb5 100644
--- a/apps/workbench/app/helpers/collections_helper.rb
+++ b/apps/workbench/app/helpers/collections_helper.rb
@@ -59,13 +59,12 @@ module CollectionsHelper
   #
   def preview_allowed_for file_name
     file_type = MIME::Types.type_for(file_name).first
-
     if file_type.nil?
       false
     elsif (file_type.raw_media_type == "text") || (file_type.raw_media_type == "image")
       true
     elsif (file_type.raw_media_type == "application") &&
-          (Rails.configuration.filename_suffixes_with_view_icon.include? ((file_name.split('.')[-1]).downcase))
+          (Rails.configuration.application_mimetypes_with_view_icon.include? (file_type.sub_type))
       true
     else
       false
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index c613453..d87ca9b 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -188,11 +188,11 @@ common:
   # generic issue email from
   email_from: arvados at example.com
 
-  # Filename suffixes of applications for which the
-  # view icon would be shown in collection show page.
+  # Mimetypes of applications for which the view icon
+  # would be shown in collection show page.
   # It is sufficient to list only applications here.
   # No need to list text and image types.
-  filename_suffixes_with_view_icon: [fa, fasta, go, json, pdf, py, r, sam, sh, xml, xsl]
+  application_mimetypes_with_view_icon: [fasta, go, json, pdf, python, r, sam, sh, xml, xsl]
 
   # the maximum number of bytes to load in the log viewer
   log_viewer_max_bytes: 1000000
diff --git a/apps/workbench/config/initializers/mime_types.rb b/apps/workbench/config/initializers/mime_types.rb
index 848b3dc..6dd0eae 100644
--- a/apps/workbench/config/initializers/mime_types.rb
+++ b/apps/workbench/config/initializers/mime_types.rb
@@ -8,29 +8,13 @@
 
 require 'mime/types'
 include MIME
-
-# register and add new MIME types to MIME::Types gem
-if (MIME::Types.type_for('file.fa').first.nil?)
-  Mime::Type.register "application/fa", :fa
-  MIME::Types.add(MIME::Type.new(["application/fa", %(fa)]))
-end
-
-if (MIME::Types.type_for('file.fasta').first.nil?)
-  Mime::Type.register "application/fasta", :fasta
-  MIME::Types.add(MIME::Type.new(["application/fasta", %(fasta)]))
-end
-
-if (MIME::Types.type_for('file.go').first.nil?)
-  Mime::Type.register "application/go", :go
-  MIME::Types.add(MIME::Type.new(["application/go", %(go)]))
-end
-
-if (MIME::Types.type_for('file.r').first.nil?)
-  Mime::Type.register "application/r", :r
-  MIME::Types.add(MIME::Type.new(["application/r", %(r)]))
-end
-
-if (MIME::Types.type_for('file.sam').first.nil?)
-  Mime::Type.register "application/sam", :sam
-  MIME::Types.add(MIME::Type.new(["application/sam", %(sam)]))
+[
+  %w(fasta fa fas fsa seq),
+  %w(go),
+  %w(r),
+  %w(sam),
+].each do |suffixes|
+  if (MIME::Types.type_for(suffixes[0]).first.nil?)
+    MIME::Types.add(MIME::Type.new(["application/#{suffixes[0]}", suffixes]))
+  end
 end
diff --git a/apps/workbench/test/unit/collection_test.rb b/apps/workbench/test/unit/collection_test.rb
index 4185909..e7afa69 100644
--- a/apps/workbench/test/unit/collection_test.rb
+++ b/apps/workbench/test/unit/collection_test.rb
@@ -78,6 +78,7 @@ class CollectionTest < ActiveSupport::TestCase
     ["filename.csv", true],
     ["filename.fa", true],
     ["filename.fasta", true],
+    ["filename.seq", true],   # another fasta extension
     ["filename.go", true],
     ["filename.htm", true],
     ["filename.html", true],
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index d3e6beb..4be154a 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -522,26 +522,26 @@ multi_level_to_combine:
 # collection with several file types to test view icon enabled state in collection show page
 collection_with_several_supported_file_types:
   uuid: zzzzz-4zz18-supportedtypes1
-  portable_data_hash: 7a6ef4c162a5c6413070a8bd0bffc818+150
+  portable_data_hash: f7bb16c306b97974afd310749a9848d6+0
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2014-02-03T17:22:54Z
   modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
   modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
   modified_at: 2014-02-03T17:22:54Z
   updated_at: 2014-02-03T17:22:54Z
-  manifest_text: ". 85877ca2d7e05498dd3d109baf2df106+95 0:0:file.csv 0:0:file.fa 0:0:file.fasta 0:0:file.gif 0:0:file.json 0:0:file.md 0:0:file.pdf 0:0:file.py 0:0:file.R 0:0:file.sam 0:0:file.sh 0:0:file.tiff 0:0:file.tsv 0:0:file.txt 0:0:file.vcf 0:0:file.xml 0:0:file.xsl 0:0:file.yml\n"
+  manifest_text: ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:file.csv 0:0:file.fa 0:0:file.fasta 0:0:file.gif 0:0:file.json 0:0:file.md 0:0:file.pdf 0:0:file.py 0:0:file.R 0:0:file.sam 0:0:file.sh 0:0:file.tiff 0:0:file.tsv 0:0:file.txt 0:0:file.vcf 0:0:file.xml 0:0:file.xsl 0:0:file.yml\n"
   name: collection_with_several_supported_file_types
 
 collection_with_several_unsupported_file_types:
   uuid: zzzzz-4zz18-supportedtypes2
-  portable_data_hash: 7a6ef4c162a5c6413070a8bd0bffc818+150
+  portable_data_hash: 97620c05fbb3041a19471bc1e06f3f78+0
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2014-02-03T17:22:54Z
   modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
   modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
   modified_at: 2014-02-03T17:22:54Z
   updated_at: 2014-02-03T17:22:54Z
-  manifest_text: ". 85877ca2d7e05498dd3d109baf2df106+95 0:0:file 0:0:file.bam\n"
+  manifest_text: ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:file 0:0:file.bam\n"
   name: collection_with_several_unsupported_file_types
 
 # Test Helper trims the rest of the file

commit 03e8ba641e0161f15d96351e2432805977fd9d57
Merge: a9c8f2d 4925686
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Fri Mar 20 11:30:59 2015 -0400

    Merge branch 'master' into 5375-preview-collection-text-files


-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list