summary refs log tree commit diff
diff options
context:
space:
mode:
authorgemmaro <gemmaro.dev@gmail.com>2023-06-08 08:54:50 +0900
committerChristopher Baines <mail@cbaines.net>2023-06-26 09:47:16 +0100
commit93a5378b00ce1f97b0968f9be3899475d9f3ddca (patch)
treed5a99f82b573c4dff13c499e62ac0069799df0a8
parent54e083cef10a022371fa64eb93f2e3626987e4c5 (diff)
downloadguix-93a5378b00ce1f97b0968f9be3899475d9f3ddca.tar.gz
gnu: ruby-atoulme-saikuro: Enable tests.
* gnu/packages/ruby.scm (ruby-atoulme-saikuro)
[propagated-inputs]: Add ruby-irb-1.1.1 and ruby-e2mmap.
[arguments]: Enable tests.

Signed-off-by: Christopher Baines <mail@cbaines.net>
-rw-r--r--gnu/packages/ruby.scm24
1 files changed, 21 insertions, 3 deletions
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 1320467127..60f26bcb05 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -1306,9 +1306,27 @@ script.")
                (base32
                 "0kvd2nsxffbza61d3q4j94wrbnbv50r1zy3a7q26f6k706fw1f19"))))
     (build-system ruby-build-system)
-    ;; FIXME: There are no unit tests.  The tests are demonstrations of the
-    ;; "saikuro" tool.
-    (arguments `(#:tests? #f))
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-module-resolution
+            (lambda _
+              (substitute* "lib/saikuro.rb"
+                ;; irb 1.2.0 or later doesn't have RubyToken
+                (("require 'irb/ruby-lex'")
+                 "require 'rubygems'\ngem 'irb', '=1.1.1'\nrequire 'irb/ruby-lex'"))))
+          (delete 'check)
+          (add-after 'install 'check
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (saikuro (string-append out "/bin/saikuro")))
+                (setenv "GEM_PATH" (string-append
+                                    (getenv "GEM_PATH") ":"
+                                    #$output "/lib/ruby/vendor_ruby"))
+                (invoke saikuro "--cyclo" "--token" "--input_directory" "tests")))))))
+    (propagated-inputs (list ruby-irb-1.1.1
+                             ruby-e2mmap)) ;required by rubygems
     (synopsis "Cyclomatic complexity analyzer")
     (description "Saikuro is a Ruby cyclomatic complexity analyzer.  When
 given Ruby source code Saikuro will generate a report listing the cyclomatic