Ruby mogilefs-client dev/users discussion/patches/bugs/help/...
 help / color / mirror / code / Atom feed
* [PATCH 0/3] updates for newer Rubies
@ 2019-10-30  9:23 Eric Wong
  2019-10-30  9:23 ` [PATCH 1/3] mogilefs: actually use kwarg for Net::HTTP::Persistent.new Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-30  9:23 UTC (permalink / raw)
  To: mogilefs-client-public

Newer Rubies warn about more things, which is annoying
to users who don't code *sigh*

Eric Wong (3):
  mogilefs: actually use kwarg for Net::HTTP::Persistent.new
  fix more indentation warnings
  test_client: quiet warnings about redefining accessors

 lib/mogilefs/mogilefs.rb          |  7 +++++--
 lib/mogilefs/new_file/stream.rb   |  4 ++--
 test/test_client.rb               |  3 ++-
 test/test_fresh.rb                |  4 ++--
 test/test_http_reader.rb          |  4 ++--
 test/test_mogilefs.rb             | 16 ++++++++--------
 test/test_mogilefs_integration.rb |  4 ++--
 7 files changed, 23 insertions(+), 19 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] mogilefs: actually use kwarg for Net::HTTP::Persistent.new
  2019-10-30  9:23 [PATCH 0/3] updates for newer Rubies Eric Wong
@ 2019-10-30  9:23 ` Eric Wong
  2019-10-30  9:23 ` [PATCH 2/3] fix more indentation warnings Eric Wong
  2019-10-30  9:23 ` [PATCH 3/3] test_client: quiet warnings about redefining accessors Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-30  9:23 UTC (permalink / raw)
  To: mogilefs-client-public

Ruby 2.7.0dev will warn about hashes uses as kwargs *sigh*
---
 lib/mogilefs/mogilefs.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/mogilefs/mogilefs.rb b/lib/mogilefs/mogilefs.rb
index 724dfb6..990ae38 100644
--- a/lib/mogilefs/mogilefs.rb
+++ b/lib/mogilefs/mogilefs.rb
@@ -550,8 +550,11 @@ def file_debug(args)
   end
 
   def nhp_new(name) # :nodoc:
-    Net::HTTP::Persistent::VERSION.to_f >= 3.0 and name = { :name => name }
-    MogileFS::NHP.new(name)
+    if Net::HTTP::Persistent::VERSION.to_f >= 3.0
+      MogileFS::NHP.new(:name => name)
+    else
+      MogileFS::NHP.new(name)
+    end
   rescue NameError
     MogileFS::NHP.new(name)
   end

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] fix more indentation warnings
  2019-10-30  9:23 [PATCH 0/3] updates for newer Rubies Eric Wong
  2019-10-30  9:23 ` [PATCH 1/3] mogilefs: actually use kwarg for Net::HTTP::Persistent.new Eric Wong
@ 2019-10-30  9:23 ` Eric Wong
  2019-10-30  9:23 ` [PATCH 3/3] test_client: quiet warnings about redefining accessors Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-30  9:23 UTC (permalink / raw)
  To: mogilefs-client-public

Not sure how or why I missed these with commit 4e0f8155a62711ae
("fix indentation warnings with ruby trunk"), but this cleans
them up.
---
 lib/mogilefs/new_file/stream.rb   |  4 ++--
 test/test_fresh.rb                |  4 ++--
 test/test_http_reader.rb          |  4 ++--
 test/test_mogilefs.rb             | 16 ++++++++--------
 test/test_mogilefs_integration.rb |  4 ++--
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/mogilefs/new_file/stream.rb b/lib/mogilefs/new_file/stream.rb
index 2207a13..4396b8b 100644
--- a/lib/mogilefs/new_file/stream.rb
+++ b/lib/mogilefs/new_file/stream.rb
@@ -58,8 +58,8 @@ def commit
     end
     read_response(@to_io) # raises on errors
     create_close(@devid, @uri, @bytes_uploaded)
-    ensure
-      @to_io.close if @to_io && ! @to_io.closed?
+  ensure
+    @to_io.close if @to_io && ! @to_io.closed?
   end
 
   def start_sock(sock, uri)
diff --git a/test/test_fresh.rb b/test/test_fresh.rb
index ff7bae6..b8ae292 100644
--- a/test/test_fresh.rb
+++ b/test/test_fresh.rb
@@ -247,8 +247,8 @@ def test_create_update_delete_class
     assert_equal 1, tmp["mindevcount"]
     assert_equal "MultipleHosts(1)", tmp["replpolicy"]
     @admin.update_class(domain, "klassy", 2)
-    ensure
-      @admin.delete_class(domain, "klassy") rescue nil
+  ensure
+    @admin.delete_class(domain, "klassy") rescue nil
   end
 
   def test_device_file_add
diff --git a/test/test_http_reader.rb b/test/test_http_reader.rb
index f6f0055..e2d8842 100644
--- a/test/test_http_reader.rb
+++ b/test/test_http_reader.rb
@@ -16,8 +16,8 @@ def rsock
     assert_nil th.value
     assert_kind_of IO, r
     r
-    ensure
-      s.close
+  ensure
+    s.close
   end
 
   def test_short_to_s
diff --git a/test/test_mogilefs.rb b/test/test_mogilefs.rb
index 186e88a..45d4452 100644
--- a/test/test_mogilefs.rb
+++ b/test/test_mogilefs.rb
@@ -590,8 +590,8 @@ def assert_get_paths_args(expect, *args)
     assert_equal "foo", tmp.delete("domain")
     assert_equal expect, tmp
     c.backend.shutdown
-    ensure
-      sock.close
+  ensure
+    sock.close
   end
 
   def test_get_paths_args
@@ -762,8 +762,8 @@ def test_list_keys_verbose_ordering # implementation detail
     th.join
     received.map! { |(key,_,_)| key }
     assert_equal %w(a b c d e), received
-    ensure
-      sock.close
+  ensure
+    sock.close
   end
 
   def test_list_keys_verbose_retry_eof # implementation detail
@@ -806,8 +806,8 @@ def test_list_keys_verbose_retry_eof # implementation detail
     th.join
     received.map! { |(key,_,_)| key }
     assert_equal %w(a b c d e), received
-    ensure
-      sock.close
+  ensure
+    sock.close
   end
 
   def test_list_keys_verbose_retry_truncated # implementation detail
@@ -851,8 +851,8 @@ def test_list_keys_verbose_retry_truncated # implementation detail
     th.join
     received.map! { |(key,_,_)| key }
     assert_equal %w(a b c d e), received
-    ensure
-      sock.close
+  ensure
+    sock.close
   end
 
   def test_sleep
diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb
index 6d16cd7..13ae3f1 100644
--- a/test/test_mogilefs_integration.rb
+++ b/test/test_mogilefs_integration.rb
@@ -242,8 +242,8 @@ def test_new_file_content_md5
     assert_raises(MogileFS::Backend::UnregClassError) {
       @client.new_file("a", :class => "non-existent")
     }
-    ensure
-      r.close if r
+  ensure
+    r.close if r
   end
 
   def test_store_content_opts

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] test_client: quiet warnings about redefining accessors
  2019-10-30  9:23 [PATCH 0/3] updates for newer Rubies Eric Wong
  2019-10-30  9:23 ` [PATCH 1/3] mogilefs: actually use kwarg for Net::HTTP::Persistent.new Eric Wong
  2019-10-30  9:23 ` [PATCH 2/3] fix more indentation warnings Eric Wong
@ 2019-10-30  9:23 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-10-30  9:23 UTC (permalink / raw)
  To: mogilefs-client-public

lasterr and lasterrstr are already readers, so we only need
to expose them as writers, not as both.
---
 test/test_client.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/test_client.rb b/test/test_client.rb
index a6e6c1f..cbf298a 100644
--- a/test/test_client.rb
+++ b/test/test_client.rb
@@ -3,7 +3,8 @@
 require 'mogilefs'
 
 class MogileFS::Backend
-  attr_accessor :timeout, :lasterr, :lasterrstr, :hosts
+  attr_accessor :timeout, :hosts
+  attr_writer :lasterr, :lasterrstr
 end
 
 class MogileFS::Client

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-30  9:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30  9:23 [PATCH 0/3] updates for newer Rubies Eric Wong
2019-10-30  9:23 ` [PATCH 1/3] mogilefs: actually use kwarg for Net::HTTP::Persistent.new Eric Wong
2019-10-30  9:23 ` [PATCH 2/3] fix more indentation warnings Eric Wong
2019-10-30  9:23 ` [PATCH 3/3] test_client: quiet warnings about redefining accessors Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/mogilefs-client.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).