[bug#34650,7/7] gnu: Add mailcatcher.

Message ID 20190228174435.14499-7-mail@ambrevar.xyz
State Accepted
Headers show
Series [bug#34650,1/7] gnu: ruby-rack-protection: Update to 2.0.5. | 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

Commit Message

Pierre Neidhardt Feb. 28, 2019, 5:44 p.m. UTC
* gnu/packages/ruby.scm (mailcatcher): New variable.
---
 gnu/packages/ruby.scm | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Comments

Christopher Baines March 4, 2019, 9:50 p.m. UTC | #1
Pierre Neidhardt <mail@ambrevar.xyz> writes:

> * gnu/packages/ruby.scm (mailcatcher): New variable.
> ---
>  gnu/packages/ruby.scm | 49 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>
> diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
> index 8cb170e17..854b4669b 100644
> --- a/gnu/packages/ruby.scm
> +++ b/gnu/packages/ruby.scm
> @@ -7814,3 +7814,52 @@ minimal effort.")
>      (description "Simple, upgradable WebSockets for Ruby Thin.")
>      (home-page "https://github.com/sj26/skinny")
>      (license license:expat)))
> +
> +(define-public mailcatcher
> +  (package
> +    (name "mailcatcher")
> +    (version "0.6.5")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (rubygems-uri "mailcatcher" version))
> +       (sha256
> +        (base32
> +         "0h6gk8n18i5f651f244al1hscjzl27fpma4vqw0qhszqqpd5p3bx"))))
> +    (build-system ruby-build-system)
> +    (arguments
> +     ;; TODO: Grab from GitHub to get tests?
> +     `(#:tests? #f

As with ruby-skinny, if there are no tests, I'd put:

  '(#:tests? #f ; No included tests

> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'build 'patch-gemspec
> +           (lambda _
> +             (substitute* ".gemspec"
> +               (("<eventmachine>.freeze, \\[\\\"= 1.0.9.1") "<eventmachine>, [\">= 1.0.9.1")
> +               (("<rack>.freeze, \\[\\\"~> 1.5") "<rack>, [\">= 1.5")
> +               (("<thin>.freeze, \\[\\\"~> 1.5.0") "<thin>, [\">= 1.5.0")
> +               (("<sinatra>.freeze, \\[\\\"~> 1.2") "<sinatra>, [\">= 1.2")
> +               )))
> +         (add-before 'build 'loosen-dependency-contraint
> +             (lambda _
> +               (substitute* "lib/mail_catcher.rb"
> +                 (("\"eventmachine\", \"1.0.9.1\"") "\"eventmachine\", \">= 1.0.9.1\"")
> +                 (("\"rack\", \"~> 1.5\"") "\"rack\", \">= 1.5\"")
> +                 (("\"thin\", \"~> 1.5.0\"") "\"thin\", \">= 1.5.0\"")
> +                 (("\"sinatra\", \"~> 1.2\"") "\"sinatra\", \">= 1.2\"")))))))

I'd add an explicit #t at the end of these phases.

Also, using wildcards in place of the versions in the mailcatcher gem
would probably make it easier to update this package if new versions are
released.

> +    (inputs
> +     `(("ruby-eventmachine" ,ruby-eventmachine)
> +       ("ruby-mail" ,ruby-mail)
> +       ("ruby-rack" ,ruby-rack)
> +       ("ruby-sinatra" ,ruby-sinatra)
> +       ("ruby-skinny" ,ruby-skinny)
> +       ("ruby-sqlite3" ,ruby-sqlite3)
> +       ("ruby-thin" ,ruby-thin)))
> +    (synopsis "Run an SMTP server which catches any message sent to it to display in a browser")
> +    (description
> +     "MailCatcher runs a super simple SMTP server which catches any message
> +sent to it to display in a web interface.  Run mailcatcher, set your favourite
> +app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server,
> +then check out http://127.0.0.1:1080 to see the mail.")
> +    (home-page "https://mailcatcher.me")
> +    (license license:expat)))
Pierre Neidhardt March 5, 2019, 9:09 a.m. UTC | #2
Thanks for the review!

> I'd recommend trying to avoid inserting packages at the end of modules,
> or generally in the same place. This can make rebases difficult, and
> increase the chances of conflicts when going to apply patches. I
> generally try to fit patches in to modules somewhat alphabetically.

You are very true here, but currently ruby.scm seems to follow no order
whatsoever.  Not sure where to insert the new packages then.
Pierre Neidhardt March 5, 2019, 10:27 a.m. UTC | #3
I've taken all your comments into accounts (hopefully).
I did not manage to run the test suite for mailcatcher.  I've added a
comment explaining what's going on, but I don't know enough Ruby to fix
it properly.

I've pushed to master.

Thanks again for your review!
Christopher Baines March 5, 2019, 6:51 p.m. UTC | #4
Pierre Neidhardt <pierre@atlas.engineer> writes:

> Thanks for the review!
>
>> I'd recommend trying to avoid inserting packages at the end of modules,
>> or generally in the same place. This can make rebases difficult, and
>> increase the chances of conflicts when going to apply patches. I
>> generally try to fit patches in to modules somewhat alphabetically.
>
> You are very true here, but currently ruby.scm seems to follow no order
> whatsoever.  Not sure where to insert the new packages then.

Well, it's in no strict order. One approach I normally use is to start
at the top and work my way down, and fit packages in just below the
first thing that's before them in the alphabet.

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 8cb170e17..854b4669b 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -7814,3 +7814,52 @@  minimal effort.")
     (description "Simple, upgradable WebSockets for Ruby Thin.")
     (home-page "https://github.com/sj26/skinny")
     (license license:expat)))
+
+(define-public mailcatcher
+  (package
+    (name "mailcatcher")
+    (version "0.6.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "mailcatcher" version))
+       (sha256
+        (base32
+         "0h6gk8n18i5f651f244al1hscjzl27fpma4vqw0qhszqqpd5p3bx"))))
+    (build-system ruby-build-system)
+    (arguments
+     ;; TODO: Grab from GitHub to get tests?
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-gemspec
+           (lambda _
+             (substitute* ".gemspec"
+               (("<eventmachine>.freeze, \\[\\\"= 1.0.9.1") "<eventmachine>, [\">= 1.0.9.1")
+               (("<rack>.freeze, \\[\\\"~> 1.5") "<rack>, [\">= 1.5")
+               (("<thin>.freeze, \\[\\\"~> 1.5.0") "<thin>, [\">= 1.5.0")
+               (("<sinatra>.freeze, \\[\\\"~> 1.2") "<sinatra>, [\">= 1.2")
+               )))
+         (add-before 'build 'loosen-dependency-contraint
+             (lambda _
+               (substitute* "lib/mail_catcher.rb"
+                 (("\"eventmachine\", \"1.0.9.1\"") "\"eventmachine\", \">= 1.0.9.1\"")
+                 (("\"rack\", \"~> 1.5\"") "\"rack\", \">= 1.5\"")
+                 (("\"thin\", \"~> 1.5.0\"") "\"thin\", \">= 1.5.0\"")
+                 (("\"sinatra\", \"~> 1.2\"") "\"sinatra\", \">= 1.2\"")))))))
+    (inputs
+     `(("ruby-eventmachine" ,ruby-eventmachine)
+       ("ruby-mail" ,ruby-mail)
+       ("ruby-rack" ,ruby-rack)
+       ("ruby-sinatra" ,ruby-sinatra)
+       ("ruby-skinny" ,ruby-skinny)
+       ("ruby-sqlite3" ,ruby-sqlite3)
+       ("ruby-thin" ,ruby-thin)))
+    (synopsis "Run an SMTP server which catches any message sent to it to display in a browser")
+    (description
+     "MailCatcher runs a super simple SMTP server which catches any message
+sent to it to display in a web interface.  Run mailcatcher, set your favourite
+app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server,
+then check out http://127.0.0.1:1080 to see the mail.")
+    (home-page "https://mailcatcher.me")
+    (license license:expat)))