[ARVADOS] updated: 915308ee58ef34d1fc86103b2d485212a72b5b98

Git user git at public.curoverse.com
Wed Apr 13 10:57:25 EDT 2016


Summary of changes:
 sdk/ruby/lib/arvados/collection.rb  | 12 ++++++------
 sdk/ruby/lib/arvados/keep.rb        |  8 ++++----
 sdk/ruby/test/test_keep_manifest.rb | 15 +++++++++++++++
 3 files changed, 25 insertions(+), 10 deletions(-)

       via  915308ee58ef34d1fc86103b2d485212a72b5b98 (commit)
       via  301e4bdcb238b64bb71826520b0664706bbbfb70 (commit)
      from  58367f9175cfa06ede312275969ca9ec76e2c0d1 (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 915308ee58ef34d1fc86103b2d485212a72b5b98
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Apr 13 10:57:09 2016 -0400

    8697: Fix Locator.parse() (was failing on locators with hints).

diff --git a/sdk/ruby/lib/arvados/keep.rb b/sdk/ruby/lib/arvados/keep.rb
index 3c6b26b..489eeee 100644
--- a/sdk/ruby/lib/arvados/keep.rb
+++ b/sdk/ruby/lib/arvados/keep.rb
@@ -47,19 +47,19 @@ module Keep
         raise ArgumentError.new "locator is nil or empty"
       end
 
-      m = LOCATOR_REGEXP.match(tok.strip)
+      m = LOCATOR_REGEXP.match(tok)
       unless m
         raise ArgumentError.new "not a valid locator #{tok}"
       end
 
-      tokhash, _, toksize, _, trailer = m[1..5]
+      tokhash, _, toksize, _, _, trailer = m[1..6]
       tokhints = []
       if trailer
         trailer.split('+').each do |hint|
-          if hint =~ /^[[:upper:]][[:alnum:]@_-]+$/
+          if hint =~ /^[[:upper:]][[:alnum:]@_-]*$/
             tokhints.push(hint)
           else
-            raise ArgumentError.new "unknown hint #{hint}"
+            raise ArgumentError.new "invalid hint #{hint}"
           end
         end
       end
diff --git a/sdk/ruby/test/test_keep_manifest.rb b/sdk/ruby/test/test_keep_manifest.rb
index 5ed9cfc..fa1dc3f 100644
--- a/sdk/ruby/test/test_keep_manifest.rb
+++ b/sdk/ruby/test/test_keep_manifest.rb
@@ -266,6 +266,8 @@ class ManifestTest < Minitest::Test
    [true, 'd41d8cd98f00b204e9800998ecf8427e+0', '+0','0',nil],
    [true, 'd41d8cd98f00b204e9800998ecf8427e+0+Fizz+Buzz','+0','0','+Fizz+Buzz'],
    [true, 'd41d8cd98f00b204e9800998ecf8427e+Fizz+Buzz', nil,nil,'+Fizz+Buzz'],
+   [true, 'd41d8cd98f00b204e9800998ecf8427e+0+Ad41d8cd98f00b204e9800998ecf8427e00000000+Foo', '+0','0','+Ad41d8cd98f00b204e9800998ecf8427e00000000+Foo'],
+   [true, 'd41d8cd98f00b204e9800998ecf8427e+Ad41d8cd98f00b204e9800998ecf8427e00000000+Foo', nil,nil,'+Ad41d8cd98f00b204e9800998ecf8427e00000000+Foo'],
    [true, 'd41d8cd98f00b204e9800998ecf8427e+0+Z', '+0','0','+Z'],
    [true, 'd41d8cd98f00b204e9800998ecf8427e+Z', nil,nil,'+Z'],
   ].each do |ok, locator, match2, match3, match4|
@@ -278,6 +280,18 @@ class ManifestTest < Minitest::Test
         assert_equal match4, match[4]
       end
     end
+    define_method "test_parse_method_on_#{locator.inspect}" do
+      loc = Keep::Locator.parse locator
+      if !ok
+        assert_nil loc
+      else
+        refute_nil loc
+        assert loc.is_a?(Keep::Locator)
+        #assert loc.hash
+        #assert loc.size
+        #assert loc.hints.is_a?(Array)
+      end
+    end
   end
 
   [
@@ -301,6 +315,7 @@ class ManifestTest < Minitest::Test
     [true, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:\\040\n"],
     [true, ". 00000000000000000000000000000000+0 0:0:0\n"],
     [true, ". 00000000000000000000000000000000+0 0:0:d41d8cd98f00b204e9800998ecf8427e+0+Ad41d8cd98f00b204e9800998ecf8427e00000000 at ffffffff\n"],
+    [true, ". d41d8cd98f00b204e9800998ecf8427e+0+Ad41d8cd98f00b204e9800998ecf8427e00000000 at ffffffff 0:0:empty.txt\n"],
     [false, '. d41d8cd98f00b204e9800998ecf8427e 0:0:abc.txt',
       "Invalid manifest: does not end with newline"],
     [false, "abc d41d8cd98f00b204e9800998ecf8427e 0:0:abc.txt\n",

commit 301e4bdcb238b64bb71826520b0664706bbbfb70
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Apr 13 10:24:14 2016 -0400

    8697: ruby 1.8.7 compatibility in arvados/collection.

diff --git a/sdk/ruby/lib/arvados/collection.rb b/sdk/ruby/lib/arvados/collection.rb
index 07b7519..474241d 100644
--- a/sdk/ruby/lib/arvados/collection.rb
+++ b/sdk/ruby/lib/arvados/collection.rb
@@ -44,7 +44,7 @@ module Arv
     end
 
     def cp_r(source, target, source_collection=nil)
-      opts = {descend_target: !source.end_with?("/")}
+      opts = {:descend_target => !source.end_with?("/")}
       copy(:merge, source.chomp("/"), target, source_collection, opts)
     end
 
@@ -70,7 +70,7 @@ module Arv
     end
 
     def rm_r(source)
-      remove(source, recursive: true)
+      remove(source, :recursive => true)
     end
 
     protected
@@ -155,7 +155,7 @@ module Arv
       modified
     end
 
-    LocatorSegment = Struct.new(:locators, :start_pos, :length)
+    Struct.new("LocatorSegment", :locators, :start_pos, :length)
 
     class LocatorRange < Range
       attr_reader :locator
@@ -187,9 +187,9 @@ module Arv
           end_index = search_for_byte(start_pos + length - 1, start_index)
         end
         seg_ranges = @ranges[start_index..end_index]
-        LocatorSegment.new(seg_ranges.map(&:locator),
-                           start_pos - seg_ranges.first.begin,
-                           length)
+        Struct::LocatorSegment.new(seg_ranges.map(&:locator),
+                                   start_pos - seg_ranges.first.begin,
+                                   length)
       end
 
       private

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list