Subject: [bug#62196] [PATCH 028/223] gnu: ruby-thor: Update to 1.2.1.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 20 Mar 2023 13:13:20 -0400

* gnu/packages/ruby.scm (ruby-thor): Update to 1.2.1.
[source]: Update URI.
[arguments]: Use gexps.  Delete trailing #t.
[phases] {fix-readline-tests, disable-network-tests}
{make-files-writable}: Delete phases.
{remove-coveralls-dependency}: Do not remove webmock requires.
{disable-quality-tests}: Rename to...
{disable-problematic-tests}: ... this.  Disable a new failing test.
{check}: Honor TESTS?.
---
 gnu/packages/ruby.scm | 83 ++++++++++++++++---------------------------
 1 file changed, 30 insertions(+), 53 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index ccd446bdd1..cf270a0d34 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -2737,69 +2737,46 @@ (define-public ruby-xml-simple
 (define-public ruby-thor
   (package
     (name "ruby-thor")
-    (version "1.0.1")
+    (version "1.2.1")
     (source (origin
               ;; Pull from git because the gem has no tests.
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/erikhuda/thor")
+                    (url "https://github.com/rails/thor")
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1anrx5vynk57hn5c8ig5pgkmcsbj9q5mvckd5rviw1jid7n89k57"))))
+                "1vjm628ks5kw8q6dskh38dqyz2j8c3n694wsqkj4jb4jrn6rkfzx"))))
     (build-system ruby-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
-                  (add-after 'unpack 'fix-readline-tests
-                    (lambda _
-                      ;; Ensure Readline is initialized before running the
-                      ;; test to avoid a type clash with the mock ::Readline.
-                      ;; See <https://github.com/erikhuda/thor/pull/717>.
-                      (substitute* "spec/line_editor/readline_spec.rb"
-                        (("unless defined\\? ::Readline" all)
-                         (string-append "Thor::LineEditor::Readline.available?\n"
-                                        all)))
-                      #t))
-                  (add-after 'unpack 'remove-coveralls-dependency
-                    (lambda _
-                      ;; Do not hook the test suite into the online
-                      ;; coveralls service.
-                      (substitute* "Gemfile"
-                        ((".*coveralls.*") ""))
-                      (substitute* "spec/helper.rb"
-                        (("require \"coveralls\"") "")
-                        (("Coveralls::SimpleCov::Formatter") "")
-                        ;; Also drop the WebMock dependency which is only
-                        ;; present to allow a coveralls.io connection, and
-                        ;; would otherwise introduce a circular dependency.
-                        (("require \"webmock/rspec\"") "")
-                        (("WebMock\\.disable_net_connect.*") ""))
-                      #t))
-                  (add-after 'unpack 'disable-network-tests
-                    (lambda _
-                      ;; These tests attempt to look up example.com.
-                      (substitute* "spec/actions/file_manipulation_spec.rb"
-                        (("it \"accepts (https?) remote sources" _ proto)
-                         (string-append "xit \"accepts " proto " remote sources")))
-                      #t))
-                  (add-after 'unpack 'disable-quality-tests
-                    (lambda _
-                      ;; These tests attempt to check the git repository for
-                      ;; tabs vs spaces, double vs single quotes, etc, and
-                      ;; depend on the git checkout.
-                      (delete-file "spec/quality_spec.rb")
-                      #t))
-                  (add-before 'check 'make-files-writable
-                    (lambda _
-                      ;; The tests needs rw access to the test suite.
-                      (for-each make-file-writable (find-files "spec"))
-                      #t))
-                  (replace 'check
-                    (lambda _
-                      (invoke "rspec" "spec"))))))
-    (native-inputs
-     (list ruby-rspec ruby-simplecov))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-coveralls-dependency
+            (lambda _
+              ;; Do not hook the test suite into the online coveralls service.
+              (substitute* "Gemfile"
+                ((".*coveralls.*") ""))
+              (substitute* "spec/helper.rb"
+                (("require \"coveralls\"") "")
+                (("Coveralls::SimpleCov::Formatter") ""))))
+          (add-after 'unpack 'disable-problematic-tests
+            (lambda _
+              ;; These tests attempt to check the git repository for
+              ;; tabs vs spaces, double vs single quotes, etc, and
+              ;; depend on the git checkout.
+              (delete-file "spec/quality_spec.rb")
+              (substitute* "spec/parser/options_spec.rb"
+                ;; This test fails for unknown reasons (see:
+                ;; https://github.com/rails/thor/issues/814).
+                (("it \"raises an error for unknown switches" all)
+                 (string-append "x" all)))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "rspec" "spec" )))))))
+    (native-inputs (list ruby-rspec ruby-simplecov ruby-webmock))
     (synopsis "Ruby toolkit for building command-line interfaces")
     (description "Thor is a toolkit for building powerful command-line
 interfaces.")
-- 
2.39.1