~ruther/guix-local

7b02860b016d483750ebae3899064281e7b7422a — gemmaro 6 months ago bd2a782
gnu: ruby-ethon: Enable tests.

* gnu/packages/ruby-xyz.scm (ruby-ethon): Enable tests.
[source]: Switch to use the Git repository, which includes test files.
[arguments]<#:tests?>: Remove it to enable tests by default.
<#:phases>: Add a phase to relax the mime-types gem version constraint.
Add a phase to remove Bundler setup, and replace the check phase to directly
run RSpec, in order to avoid perf dependencies.
Because of this, #:test-target is not needed to be "spec".
[native-inputs]: Add test dependencies.

Change-Id: Ib2685217e7e975b8fa38f120b29f88655ec2fc5a
Signed-off-by: Andreas Enge <andreas@enge.fr>
1 files changed, 26 insertions(+), 5 deletions(-)

M gnu/packages/ruby-xyz.scm
M gnu/packages/ruby-xyz.scm => gnu/packages/ruby-xyz.scm +26 -5
@@ 2685,22 2685,43 @@ support.")
    (version "0.17.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ethon" version))
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/typhoeus/ethon")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1d73yry0y96db22ks0bacjjjhwnbnajslipima3ayhq2cavpsiia"))))
         "06rjq0r3bbybycqp6n2xqpcqmz5x8lymnk6fj5wsq59s8gf843r9"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:tests? #f  ; no included tests
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'libcurl-use-absolute-reference
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "lib/ethon/curls/settings.rb"
                (("libcurl', 'libcurl\\.so\\.4")
                 (search-input-file inputs "/lib/libcurl.so"))))))))
                 (search-input-file inputs "/lib/libcurl.so")))))
          (add-after 'extract-gemspec 'remove-MIME-types-version-constraint
            (lambda _
              (substitute* "Gemfile"
                (("(gem \"mime-types\").*" _ gem)
                 gem))))
          ;; Tell Bundler not to request perf dependencies
          (add-after 'extract-gemspec 'remove-Bundler-setup
            (lambda _
              (substitute* "spec/spec_helper.rb"
                (("Bundler.setup")
                 ""))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (for-each (lambda (file)
                            (invoke "ruby" "-Ispec" file))
                          (find-files "spec" "_spec\\.rb$"))))))))
    (native-inputs (list ruby-rspec ruby-sinatra ruby-mustermann
                         ruby-mime-types ruby-webrick))
    (inputs
     (list curl))
    (propagated-inputs