[bug#34222,08/15] gnu: Add ruby-rest-client.

Message ID 20190127170820.28937-8-mail@cbaines.net
State Accepted
Headers show
Series Add ruby-rubocop and dependencies. | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

Christopher Baines Jan. 27, 2019, 5:08 p.m. UTC
Required for ruby-ast.

* gnu/packages/ruby.scm (ruby-rest-client): New variable.
---
 gnu/packages/ruby.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

Comments

Ricardo Wurmus Jan. 27, 2019, 5:34 p.m. UTC | #1
Christopher Baines <mail@cbaines.net> writes:

> Required for ruby-ast.
>
> * gnu/packages/ruby.scm (ruby-rest-client): New variable.

[…]

> +       (modify-phases %standard-phases
> +         (add-before 'check 'fix-dependencies
> +           (lambda _
> +             (substitute* "rest-client.gemspec"
> +               ((".*rubocop.*") "\n")
> +               ((".*pry.*") "\n"))
> +             #t))

Could you please add a comment here why this is necessary?

> +    (description
> +     "@code{rest-client} provides a simple HTTP and REST client for Ruby,
> +inspired by the Sinatra microframework style of specifying actions: get, put,
> +post, delete.")

I would wrap “get”, “put”, “post”, and “delete” in @code{…}.
Christopher Baines Jan. 27, 2019, 6:51 p.m. UTC | #2
Ricardo Wurmus <rekado@elephly.net> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> Required for ruby-ast.
>>
>> * gnu/packages/ruby.scm (ruby-rest-client): New variable.
>
> […]
>
>> +       (modify-phases %standard-phases
>> +         (add-before 'check 'fix-dependencies
>> +           (lambda _
>> +             (substitute* "rest-client.gemspec"
>> +               ((".*rubocop.*") "\n")
>> +               ((".*pry.*") "\n"))
>> +             #t))
>
> Could you please add a comment here why this is necessary?

I've updated the patch to say:

+         (add-before 'check 'remove-unnecessary-development-dependencies
+           (lambda _
+             (substitute* "rest-client.gemspec"
+               ;; Remove rubocop as it's unused. Rubocop also indirectly
+               ;; depends on this package through ruby-parser and ruby-ast so
+               ;; this avoids a dependency loop.
+               ((".*rubocop.*") "\n")
+               ;; Remove pry as it's unused, it's a debugging tool
+               ((".*pry.*") "\n"))

Hopefully that is a bit clearer.

>> +    (description
>> +     "@code{rest-client} provides a simple HTTP and REST client for Ruby,
>> +inspired by the Sinatra microframework style of specifying actions: get, put,
>> +post, delete.")
>
> I would wrap “get”, “put”, “post”, and “delete” in @code{…}.

Ok, I've updated the patch to do this now.

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 5eb08d9929..f013d84299 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -3888,6 +3888,48 @@  wrapping them in ANSI escape codes.")
     (home-page "https://github.com/sickill/rainbow")
     (license license:expat)))
 
+(define-public ruby-rest-client
+  (package
+    (name "ruby-rest-client")
+    (version "2.0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "rest-client" version))
+       (sha256
+        (base32
+         "1hzcs2r7b5bjkf2x2z3n8z6082maz0j8vqjiciwgg3hzb63f958j"))))
+    (build-system ruby-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'fix-dependencies
+           (lambda _
+             (substitute* "rest-client.gemspec"
+               ((".*rubocop.*") "\n")
+               ((".*pry.*") "\n"))
+             #t))
+         (add-before 'check 'delete-network-tests
+           (lambda _
+             (delete-file "spec/integration/request_spec.rb")
+             (delete-file "spec/integration/httpbin_spec.rb")
+             #t)))))
+    (propagated-inputs
+     `(("ruby-http-cookie" ,ruby-http-cookie)
+       ("ruby-mime-types" ,ruby-mime-types)
+       ("ruby-netrc" ,ruby-netrc)))
+    (native-inputs
+     `(("bundler" ,bundler)
+       ("ruby-webmock", ruby-webmock)
+       ("ruby-rspec", ruby-rspec)))
+    (synopsis "Simple HTTP and REST client for Ruby")
+    (description
+     "@code{rest-client} provides a simple HTTP and REST client for Ruby,
+inspired by the Sinatra microframework style of specifying actions: get, put,
+post, delete.")
+    (home-page "https://github.com/rest-client/rest-client")
+    (license license:expat)))
+
 (define-public ruby-contest
   (package
     (name "ruby-contest")