gnu: ruby-yard: Refactor package and some dependencies.

Replace ruby-yard and ruby-yard-with-tests with ruby-yard and
ruby-yard/minimal.  This introduced some cycles, so add some additional
minimal variants to avoid this.

* gnu/packages/ruby.scm (ruby-asciidoctor/minimal, ruby-test-unit/minimal,
ruby-yard/minimal): New variables.
(ruby-rubygems-tasks)[native-inputs]: Remove unnecessary ruby-spec and
ruby-yard.
(ruby-locale, ruby-gettext, ruby-tdiff, ruby-nokogiri-diff,
ruby-public-suffix, ruby-addressable)[native-inputs]:
Switch to ruby-yard/minimal.
(ruby-metaclass)[native-inputs]: Switch to ruby-test-unit/minimal.
(ruby-yard): Update to 0.9.34.
[arguments]: Update style, don't disable tests, specify #:test-target, and
patch spec/cli/diff_spec.rb.
[native-inputs]: Add from ruby-yard-with-tests.
(ruby-yard-with-tests): Remove variable.
This commit is contained in:
Christopher Baines 2023-07-03 10:41:59 +01:00
parent a6e0ecfa77
commit 97a934d45f
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -1597,6 +1597,16 @@ (define-public ruby-asciidoctor
(home-page "https://asciidoctor.org")
(license license:expat)))
(define-public ruby-asciidoctor/minimal
(hidden-package
(package
(inherit ruby-asciidoctor)
(arguments
(ensure-keyword-arguments
(package-arguments ruby-asciidoctor)
(list #:tests? #f)))
(native-inputs '()))))
(define-public ruby-asciidoctor-multipage
(package
(name "ruby-asciidoctor-multipage")
@ -3812,8 +3822,6 @@ (define-public ruby-rubygems-tasks
(build-system ruby-build-system)
;; Tests need Internet access.
(arguments `(#:tests? #f))
(native-inputs
(list ruby-rspec ruby-yard))
(synopsis "Rake tasks for managing and releasing Ruby Gems")
(description "Rubygems-task provides Rake tasks for managing and releasing
Ruby Gems.")
@ -4552,7 +4560,7 @@ (define-public ruby-locale
;; dependency cycle we disable tests.
(arguments `(#:tests? #f))
(native-inputs
(list bundler ruby-yard))
(list bundler ruby-yard/minimal))
(synopsis "Ruby library providing basic localization APIs")
(description
"Ruby-Locale is the pure ruby library which provides basic APIs for
@ -4634,7 +4642,7 @@ (define-public ruby-gettext
(propagated-inputs
(list ruby-locale ruby-text ruby-erubi))
(native-inputs
(list bundler ruby-yard))
(list bundler ruby-yard/minimal))
(synopsis "GNU gettext-like program for Ruby")
(description
"Gettext is a GNU gettext-like program for Ruby. The catalog
@ -4714,6 +4722,16 @@ (define-public ruby-test-unit
(home-page "https://test-unit.github.io/")
(license (list license:psfl license:ruby))))
(define-public ruby-test-unit/minimal
(hidden-package
(package
(inherit ruby-test-unit)
(arguments
(ensure-keyword-arguments
(package-arguments ruby-test-unit)
(list #:tests? #f)))
(native-inputs '()))))
(define-public ruby-mapping
(package
(name "ruby-mapping")
@ -4847,7 +4865,7 @@ (define-public ruby-metaclass
"/lib\""))))
#t)))))
(native-inputs
(list bundler ruby-test-unit))
(list bundler ruby-test-unit/minimal))
(synopsis "Ruby library adding metaclass method to all objects")
(description
"Metaclass is a Ruby library adding a @code{metaclass} method to all Ruby
@ -8275,7 +8293,7 @@ (define-public ruby-tdiff
"0n3gq8rx49f7ln6zqlshqfg2mgqyy30rsdjlnki5mv307ykc7ad4"))))
(build-system ruby-build-system)
(native-inputs
(list ruby-rspec ruby-yard ruby-rubygems-tasks))
(list ruby-rspec ruby-yard/minimal ruby-rubygems-tasks))
(synopsis "Calculate the differences between two tree-like structures")
(description
"This library provides functions to calculate the differences between two
@ -8303,7 +8321,7 @@ (define-public ruby-nokogiri-diff
(list ruby-tdiff
ruby-nokogiri))
(native-inputs
(list ruby-rspec ruby-yard ruby-rubygems-tasks))
(list ruby-rspec ruby-yard/minimal ruby-rubygems-tasks))
(synopsis "Calculate the differences between two XML/HTML documents")
(description
"@code{Nokogiri::Diff} adds the ability to calculate the
@ -10196,7 +10214,7 @@ (define-public ruby-yajl-ruby
(define-public ruby-yard
(package
(name "ruby-yard")
(version "0.9.25")
(version "0.9.34")
(source
(origin
(method git-fetch)
@ -10207,20 +10225,42 @@ (define-public ruby-yard
(file-name (git-file-name name version))
(sha256
(base32
"1x7y4s557hrnq439lih7nqg1y7ximardw75jx9i92x3yzpviqqwa"))))
"10jq0hyzyy0d6l63jxld32g36fhrclkb3rwnyp47igcik73kbagb"))))
(build-system ruby-build-system)
(arguments
;; Note: Tests are willfully disabled to alleviate dependency cycle
;; problems.
`(#:tests? #f
#:phases (modify-phases %standard-phases
(add-after 'unpack 'do-not-set-date-in-gemspec
;; Fix a reproducibility issue (see:
;; https://github.com/lsegal/yard/issues/1343).
(lambda _
(substitute* "yard.gemspec"
((".*s\\.date.*") ""))
#t)))))
(list
#:test-target "default"
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'do-not-set-date-in-gemspec
;; Fix a reproducibility issue (see:
;; https://github.com/lsegal/yard/issues/1343).
(lambda _
(substitute* "yard.gemspec"
((".*s\\.date.*") ""))))
(add-before 'check 'prepare-for-tests
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(substitute* "Rakefile"
((".*[Ss]amus.*") ""))
;; Delete the Gemfile to avoid errors relating to it.
(delete-file "Gemfile")
;; $HOME needs to be set to somewhere writeable for tests to
;; run.
(setenv "HOME" "/tmp")
;; This test fails
;; #<File (class)> received :open with unexpected arguments
;; expected: ("gem1.gem", "rb")
;; got: ("/gnu/store/.../lib/ruby/vendor_ruby/specifications/asciidoctor-2.0.18.gemspec", "r:UTF-8:-")
(substitute* "spec/cli/diff_spec.rb"
(("it \"searches for .gem file")
"xit \"searches for .gem file"))))))))
(native-inputs
(list ruby-rspec
ruby-rack
ruby-redcloth
ruby-webrick
ruby-asciidoctor/minimal))
(synopsis "Documentation generation tool for Ruby")
(description "YARD is a documentation generation tool for the Ruby
programming language. It enables the user to generate consistent, usable
@ -10230,27 +10270,15 @@ (define-public ruby-yard
(home-page "https://yardoc.org")
(license license:expat)))
(define-public ruby-yard-with-tests
(package
(inherit ruby-yard)
(name "ruby-yard-with-tests")
(arguments
(substitute-keyword-arguments
(strip-keyword-arguments '(#:tests?) (package-arguments ruby-yard))
((#:test-target _ "default") "default")
((#:phases phases '%standard-phases)
`(modify-phases ,phases
(add-before 'check 'prepare-for-tests
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(substitute* "Rakefile"
((".*[Ss]amus.*") ""))
;; Delete the Gemfile to avoid errors relating to it.
(delete-file "Gemfile")
;; $HOME needs to be set to somewhere writeable for tests to
;; run.
(setenv "HOME" "/tmp"))))))))
(native-inputs (list ruby-rspec ruby-rack ruby-redcloth ruby-asciidoctor))))
(define-public ruby-yard/minimal
(hidden-package
(package
(inherit ruby-yard)
(arguments
(ensure-keyword-arguments
(package-arguments ruby-yard)
(list #:tests? #f)))
(native-inputs '()))))
(define-public ruby-spectroscope
(package
@ -12622,7 +12650,7 @@ (define-public ruby-public-suffix
(("RuboCop::RakeTask\\.new") ""))
#t)))))
(native-inputs
(list bundler ruby-yard ruby-mocha ruby-minitest-reporters))
(list bundler ruby-yard/minimal ruby-mocha ruby-minitest-reporters))
(home-page "https://simonecarletti.com/code/publicsuffix-ruby/")
(synopsis "Domain name parser")
(description "The gem @code{public_suffix} is a domain name parser,
@ -12669,7 +12697,7 @@ (define-public ruby-addressable
ruby-rspec-its-minimal
ruby-simplecov
ruby-sporkmonger-rack-mount
ruby-yard))
ruby-yard/minimal))
(propagated-inputs
(list ruby-public-suffix))
(home-page "https://github.com/sporkmonger/addressable")