Subject: [bug#44880] [PATCH] gnu: ruby-rubocop: Update to 1.4.2.

From: Tomás Ortín Fernández <[email-masked]>
Date: Fri, 27 Nov 2020 20:05:06 +0100

I'm finding it very difficult to package the updated rubocop from git, so here is a patch with rubocop 1.4.2 packaged from the gem. It was packaged from git because the gem doesn't include tests, but I can't figure out how to make the tests work. I have already asked for help at help-guix, and I'm sending this patch in the meanwhile because the current rubocop version is too outdated to be useful at all. As soon as I have the tests figured out, I will send a patch enabling the tests.

Tomás

* gnu/packages/ruby.scm (ruby-rubocop): Update to 1.4.2, fetch from gem, disable tests
---
gnu/packages/ruby.scm | 51 +++++----------------------------------------------
1 file changed, 5 insertions(+), 46 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 2753403834..eeabedf3d1 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -7052,58 +7052,17 @@ run.")
 (define-public ruby-rubocop
   (package
     (name "ruby-rubocop")
-    (version "0.88.0")
+    (version "1.4.2")
     (source
      (origin
-       (method git-fetch)               ;no tests in distributed gem
-       (uri (git-reference
-             (url "https://github.com/rubocop-hq/rubocop")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
+       (method url-fetch)
+       (uri (rubygems-uri "rubocop" version))
        (sha256
         (base32
-         "1d06893jp8pd85fvgp5d16vqcf31bafi430v4f4y746ihyvhzz5r"))
-       (patches (search-patches "ruby-rubocop-break-dependency-cycle.patch"))))
+         "1kvzhzhzcdd5bqwjilb0fpp51sqjniww2b0g713n0cvhnlgchn2y"))))
     (build-system ruby-build-system)
     (arguments
-     '(#:test-target "default"
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'remove-problematic-tests
-           ;; These tests depend on Rubocop extensions, which cannot be
-           ;; included as they cause a dependency cycle with Rubocop itself.
-           (lambda _
-             (delete-file "spec/rubocop/config_loader_spec.rb")
-             (substitute* "Gemfile"
-               ((".*'rubocop-performance'.*") "")
-               ((".*'rubocop-rspec'.*") ""))
-             ;; Prevent "Unnecessary disabling of RSpec/* (unknown cop)"
-             ;; errors.
-             (substitute* (find-files "spec/rubocop/cop/" "_spec\\.rb$")
-               (("# (rubocop:(enable|disable) RSpec.*)" _ what)
-                (string-append "# Disabled: " what)))
-             #t))
-         (add-after 'unpack 'disable-bundler
-           (lambda _
-             (substitute* "Rakefile"
-               (("Bundler\\.setup.*") "nil\n"))
-             #t))
-         (replace 'replace-git-ls-files
-           (lambda _
-             (substitute* "rubocop.gemspec"
-               (("`git ls-files(.*)`" _ files)
-                (format #f "`find ~a -type f| sort`" files)))
-             #t))
-         (add-before 'check 'set-home
-           (lambda _
-             (setenv "HOME" (getcwd))
-             #t))
-         (add-before 'check 'make-adoc-files-writable
-           (lambda _
-             (let ((adoc-files (find-files "docs/modules/ROOT/pages"
-                                           "\\.adoc$")))
-               (for-each make-file-writable adoc-files))
-             #t)))))
+     '(#:tests? #f))  ;no tests in distributed gem
     (native-inputs
      `(("ruby-bump" ,ruby-bump)
        ("ruby-pry" ,ruby-pry)