Subject: [bug#28583] [PATCH 1/7] gnu: Add ruby-httpclient.

From: Christopher Baines <[email-masked]>
Date: Sat, 30 Sep 2017 09:21:10 +0100

On Wed, 27 Sep 2017 21:56:04 +1000
Ben Woodcroft <[email-masked]> wrote:

> Hi,
> 
> Thanks for the patches.
> 
> 
> On 25/09/17 03:17, Christopher Baines wrote:
> > * gnu/packages/ruby.scm (ruby-httpclient): New variable.
> > ---
> >   gnu/packages/ruby.scm | 51
> > +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed,
> > 51 insertions(+)
> >
> > diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
> > index 80d3bffd8..ff6be875f 100644
> > --- a/gnu/packages/ruby.scm
> > +++ b/gnu/packages/ruby.scm
> > @@ -3579,6 +3579,57 @@ It has built-in support for the legacy
> > @code{cookies.txt} and (home-page
> > "https://github.com/sparklemotion/http-cookie") (license
> > license:expat))) 
> > +(define-public ruby-httpclient
> > +  (package
> > +    (name "ruby-httpclient")
> > +    (version "2.8.3")
> > +    (source
> > +     (origin
> > +       (method url-fetch)
> > +       (uri (rubygems-uri "httpclient" version))
> > +       (sha256
> > +        (base32
> > +         "19mxmvghp7ki3klsxwrlwr431li7hm1lczhhj8z4qihl2acy8l99"))))
> > +    (build-system ruby-build-system)
> > +    (arguments
> > +     '(;; TODO: Some tests currently fail
> > +       ;; ------
> > +       ;; 211 tests, 729 assertions, 13 failures, 4 errors, 0
> > pendings,
> > +       ;; 2 omissions, 0 notifications
> > +       ;; 91.866% passed
> > +       ;; ------
> > +       ;; 6.49 tests/s, 22.41 assertions/s
> > +       #:tests? #f
> > +       #:phases
> > +       (modify-phases %standard-phases
> > +         (replace 'check
> > +           (lambda* (#:key tests? #:allow-other-keys)
> > +             (if tests?
> > +                 (zero?
> > +                  (system* "ruby"
> > +                           "-Ilib"
> > +                           "test/runner.rb"))
> > +                 #t)))  
> Since tests? is #f, this is effectively dead code. But it could be 
> useful to someone continuing the tests, I'm not fussed.

I'm keen to keep it, as the #:tests? #f has a TODO comment, maybe the
tests can be made to pass in the future.

> > +         (add-after 'install 'wrap-bin-httpclient
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (wrap-program (string-append (assoc-ref outputs "out")
> > +                                          "/bin/httpclient")
> > +               `("GEM_HOME" ":" prefix (,(getenv "GEM_HOME"))))
> > +             #t)))))  
> It would be preferable to move this to be part of the
> ruby-build-system as is done in e.g. python-build-system, but OK.

Agreed, I'll try and make some time to look at this.