[bug#34650] ruby-mailcatcher: Draft

Message ID 20190225151705.17655-1-mail@ambrevar.xyz
State Accepted
Headers show
Series [bug#34650] ruby-mailcatcher: Draft | expand

Checks

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

Commit Message

Pierre Neidhardt Feb. 25, 2019, 3:17 p.m. UTC
---
 gnu/packages/ruby.scm | 185 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 185 insertions(+)

Comments

Pierre Neidhardt Feb. 25, 2019, 3:21 p.m. UTC | #1
I've never touched Ruby before, so I've got a bunch of questions:

- Almost none of the tests pass.  Anyone knows what's going on?

- ruby-sinatra 'install phase hangs forever (i.e. several minutes at
  least).  I suspect an infinite loop, and it's quite weird this is
  happening at the 'install phase.

- Should mailcatcher be packaged as "ruby-mailcatcher" or "mailcatcher"?

- Mailcatcher seems to depend on older version of some packages,
  e.g. version 1.0.9.1 of ruby-eventmachine.  What's the commended
  procedure then?

--
Pierre Neidhardt
https://ambrevar.xyz/
Christopher Baines Feb. 25, 2019, 7:10 p.m. UTC | #2
Hey,

Thanks for these patches Pierre, I haven't looked at them in detail, but
one I did spot was ruby-tilt. I've already sent a patch for that here
[1]. In fact, maybe have a look through the patches in that bug, as that
will at least give you an idea of how I've been packaging some Ruby gems
recently.

1: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34514#68


Pierre Neidhardt <mail@ambrevar.xyz> writes:

> I've never touched Ruby before, so I've got a bunch of questions:
>
> - Almost none of the tests pass.  Anyone knows what's going on?

I haven't checked the patch, but often the test suites are omitted from
the archives published to rubygems.org. This avoids users who use the
rubygems package manager from downloading the tests unnecessarily (as I
don't believe rubygems provides a way to run the tests), but obviously
doesn't suit packaging for Guix.

Fetching from the version control repository is a good way of getting
all the tests, but obviously that isn't what the gem importer generates.

> - ruby-sinatra 'install phase hangs forever (i.e. several minutes at
>   least).  I suspect an infinite loop, and it's quite weird this is
>   happening at the 'install phase.

I think theres a commit on the staging branch to pass the --verbose flag
to gem install, which may be revealing.

> - Should mailcatcher be packaged as "ruby-mailcatcher" or "mailcatcher"?

In my opinion, if you think someone might use it as a Ruby library,
stick with the ruby- prefix for consistency. Otherwise, call it what you
think makes most sense.

> - Mailcatcher seems to depend on older version of some packages,
>   e.g. version 1.0.9.1 of ruby-eventmachine.  What's the commended
>   procedure then?

If you're confident that the more recent versions of the dependencies
work, then I'd recommend patching the source to loosen the dependency
constraints.
Pierre Neidhardt Feb. 26, 2019, 10:59 a.m. UTC | #3
Hi Christopher,

Thanks for all the details, that will help tremendously for sure.

> ruby-tilt

I tried applying your patch but I get the following error:

--8<---------------cut here---------------start------------->8---
starting phase `check'
rake aborted!
Bundler::VersionConflict: Bundler could not find compatible versions for gem "ffi":
  In Gemfile:
    sassc was resolved to 2.0.0, which depends on
      ffi (~> 1.9.6)

Could not find gem 'ffi (~> 1.9.6)', which is required by gem 'sassc', in any of the sources.
--8<---------------cut here---------------end--------------->8---

I suppose that ruby-ffi was updated recently and that the version number needs patching?

> I think theres a commit on the staging branch to pass the --verbose flag
> to gem install, which may be revealing.

I'll look into it, thanks for the tip.

> In my opinion, if you think someone might use it as a Ruby library,
> stick with the ruby- prefix for consistency. Otherwise, call it what you
> think makes most sense.

I'll call if mailcatcher then.

> If you're confident that the more recent versions of the dependencies
> work, then I'd recommend patching the source to loosen the dependency
> constraints.

I see that's what you are doing in your patch.  It's quite cumbersome though :p
At this point I wonder: if the developer explicitly say
"A should be version X or above, while B should be exactly version Y", shouldn't
we respect the upstream wish?
Pierre Neidhardt Feb. 28, 2019, 5:47 p.m. UTC | #4
I've eventually figured that many of the dep requirements in the Ruby community
follow poor practices, so I've lifter all of them to ">=" and Mailcatcher seems
to work smoothly still (it starts at least).

I've cleanup up the packages, only the tests are missing.  The rest should be
ready for merge.

Christopher, feel free to merge.  Only ruby-tilt conflicts with your patch.
Christopher Baines March 4, 2019, 9:06 p.m. UTC | #5
Pierre Neidhardt <mail@ambrevar.xyz> writes:

> I've eventually figured that many of the dep requirements in the Ruby community
> follow poor practices, so I've lifter all of them to ">=" and Mailcatcher seems
> to work smoothly still (it starts at least).
>
> I've cleanup up the packages, only the tests are missing.  The rest should be
> ready for merge.
>
> Christopher, feel free to merge.  Only ruby-tilt conflicts with your patch.

I've now merged some of the Ruby patches that I was working on,
including ruby-tilt. It would be good if you could rebase your patches
on top of master, and check if they still work.

I also ran guix lint on the packages and got the following warnings:

gnu/packages/ruby.scm:8431:2: ruby-thin@1.7.2: line 8453 is way too long (91 characters)
gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: can be upgraded to 0.7.1
gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8510 is way too long (92 characters)
gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8514: parentheses feel lonely, move to the previous or next line
gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8530 is way too long (96 characters)

I'll have a look at the individual patches as well.
Pierre Neidhardt March 5, 2019, 9:18 a.m. UTC | #6
> gnu/packages/ruby.scm:8431:2: ruby-thin@1.7.2: line 8453 is way too long (91 characters)
> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: can be upgraded to 0.7.1
> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8510 is way too long (92 characters)
> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8514: parentheses feel lonely, move to the previous or next line
> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8530 is way too long (96 characters)

Funny, I did lint the packages and I don't get the long line warnings.  Any clue
what's going on?
Christopher Baines March 5, 2019, 6:51 p.m. UTC | #7
Pierre Neidhardt <pierre@atlas.engineer> writes:

>> gnu/packages/ruby.scm:8431:2: ruby-thin@1.7.2: line 8453 is way too long (91 characters)
>> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: can be upgraded to 0.7.1
>> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8510 is way too long (92 characters)
>> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8514: parentheses feel lonely, move to the previous or next line
>> gnu/packages/ruby.scm:8491:2: mailcatcher@0.6.5: line 8530 is way too long (96 characters)
>
> Funny, I did lint the packages and I don't get the long line warnings.  Any clue
> what's going on?

No, I'm unsure why those warnings wouldn't appear.

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 6da7109d1..21a00c3ea 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -7683,3 +7683,188 @@  uniquely identify it.")
 serves JavaScript, CoffeeScript, CSS, LESS, Sass, and SCSS.")
     (home-page "https://github.com/rails/sprockets")
     (license license:expat)))
+
+(define-public ruby-eventmachine-mailcatcher
+  (package
+    (inherit ruby-eventmachine)
+    (version "1.0.9.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "eventmachine" version))
+       (sha256
+        (base32
+         "17jr1caa3ggg696dd02g2zqzdjqj9x9q2nl7va82l36f7c5v6k4z"))))
+    (synopsis "ruby-eventmachine for mailcatcher")))
+
+(define-public ruby-rack-mailcatcher
+  (package
+    (inherit ruby-rack)
+    (name "ruby-rack")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url
+              "https://github.com/rack/rack/")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "09k24li8hp65ybpwmvvyy7ipxrbh62zd3n1qv1jh9kcrrhaihpya"))))
+    (arguments
+     ;; TODO: Fix tests.
+     `(#:tests? #f))))
+
+(define-public ruby-tilt
+  (package
+    (name "ruby-tilt")
+    (version "2.0.9")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "tilt" version))
+       (sha256
+        (base32
+         "0ca4k0clwf0rkvy7726x4nxpjxkpv67w043i39saxgldxd97zmwz"))))
+    (build-system ruby-build-system)
+    (arguments
+     ;; TODO: Fix tests.
+     `(#:tests? #f))
+    (synopsis
+     "Generic interface to multiple Ruby template engines")
+    (description
+     "Generic interface to multiple Ruby template engines")
+    (home-page "http://github.com/rtomayko/tilt/")
+    (license license:expat)))
+
+(define-public ruby-mustermann
+  (package
+    (name "ruby-mustermann")
+    (version "1.0.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "mustermann" version))
+       (sha256
+        (base32
+         "0lycgkmnyy0bf29nnd2zql5a6pcf8sp69g9v4xw0gcfcxgpwp7i1"))))
+    (build-system ruby-build-system)
+    (arguments
+     ;; TODO: Fix tests.
+     `(#:tests? #f))
+    (synopsis
+     "A library implementing patterns that behave like regular expressions.")
+    (description
+     "This package provides a library implementing patterns that behave like regular expressions.")
+    (home-page
+     "https://github.com/sinatra/mustermann")
+    (license license:expat)))
+
+(define-public ruby-sinatra
+  (package
+    (name "ruby-sinatra")
+    (version "2.0.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "sinatra" version))
+       (sha256
+        (base32
+         "1gasgn5f15myv08k10i16p326pchxjsy37pgqfw0xm66kcc5d7ry"))))
+    (build-system ruby-build-system)
+    (propagated-inputs
+     `(("ruby-mustermann" ,ruby-mustermann)
+       ("ruby-rack" ,ruby-rack)
+       ("ruby-rack-protection" ,ruby-rack-protection)
+       ("ruby-tilt" ,ruby-tilt)))
+    (synopsis "DSL for quick web applications creation in Ruby")
+    (description
+     "Sinatra is a DSL for quickly creating web applications in Ruby with
+minimal effort.")
+    (home-page "http://sinatrarb.com/")
+    (license license:expat)))
+
+(define-public ruby-thin
+  (package
+    (name "ruby-thin")
+    (version "1.7.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "thin" version))
+       (sha256
+        (base32
+         "0nagbf9pwy1vg09k6j4xqhbjjzrg5dwzvkn4ffvlj76fsn6vv61f"))))
+    (build-system ruby-build-system)
+    (arguments
+     ;; TODO: Fix tests.
+     `(#:tests? #f))
+    (propagated-inputs
+     `(("ruby-daemons" ,ruby-daemons)
+       ("ruby-eventmachine" ,ruby-eventmachine)
+       ("ruby-rack" ,ruby-rack)))
+    (synopsis "A thin and fast web server")
+    (description
+     "This package provides a thin and fast web server")
+    (home-page "http://code.macournoyer.com/thin/")
+    ;; TODO: License?
+    (license (list #f #f))))
+
+(define-public ruby-skinny
+  (package
+    (name "ruby-skinny")
+    (version "0.2.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "skinny" version))
+       (sha256
+        (base32
+         "1y3yvx88ylgz4d2s1wskjk5rkmrcr15q3ibzp1q88qwzr5y493a9"))))
+    (build-system ruby-build-system)
+    (arguments
+     ;; TODO: Fix tests.
+     `(#:tests? #f))
+    (propagated-inputs
+     `(("ruby-eventmachine" ,ruby-eventmachine)
+       ("ruby-thin" ,ruby-thin)))
+    (synopsis
+     "Simple, upgradable WebSockets for Thin.")
+    (description
+     "Simple, upgradable WebSockets for Thin.")
+    (home-page "http://github.com/sj26/skinny")
+    (license license:expat)))
+
+(define-public ruby-mailcatcher
+  (package
+    (name "ruby-mailcatcher")
+    (version "0.6.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "mailcatcher" version))
+       (sha256
+        (base32
+         "0h6gk8n18i5f651f244al1hscjzl27fpma4vqw0qhszqqpd5p3bx"))))
+    (build-system ruby-build-system)
+    (propagated-inputs
+     `(("ruby-eventmachine" ,ruby-eventmachine)
+       ;; ("ruby-eventmachine" ,ruby-eventmachine-mailcatcher)
+       ("ruby-mail" ,ruby-mail)
+       ("ruby-rack" ,ruby-rack)
+       ;; ("ruby-rack" ,ruby-rack-mailcatcher)
+       ("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 "http://mailcatcher.me")
+    (license license:expat)))