Hi Guix,
I've attached a patch for a simple rubygem. This one was slightly nasty
because the gem for version 1.0.1 includes the .gem file for version
1.0.0, which means that 1.0.0 gets silently installed instead of the
built and tested 1.0.1 .gem file - it is unlucky that
"pkg/ruby-engine-1.0.0.gem" is lexicographically before
"ruby-engine-1.0.1.gem".
While I managed to install 1.0.1, I wasn't sure how best to remove the
bundled 1.0.0 .gem file. The issue is that when the source is a .gem
file (ie most of the time), the gemspec is taken from the downloaded
.gem file directly, and in the same phase the .gem file is built. So as
a packager there is no way to make changes to the gemspec without
replacing the entire build phase. There's a number of rubygems that are
contaminated with junk so it would be great for there to be a simple way
to modify the gemspec before "gem build" is run.
Would someone with more experience like to suggest a way of doing this?
A new "gemspec" phase before "build" that takes the gemspec out of the
.gem so the packager can manipulate it perhaps?
It would also be good to check that there is only one .gem file.
Thanks,
ben
>From aeaf8255414669e5452647d800bf571b50699f29 Mon Sep 17 00:00:00 2001
From: Ben Woodcroft <donttrust...@gmail.com>
Date: Wed, 30 Dec 2015 16:51:18 +1000
Subject: [PATCH] gnu: Add ruby-ruby-engine.
* gnu/packages/ruby.scm (ruby-ruby-engine): New variable.
---
gnu/packages/ruby.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index a3eafb1..b81eef4 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -2884,3 +2884,46 @@ programs to concentrate on the implementation of network protocols. It can be
used to create both network servers and clients.")
(home-page "http://rubyeventmachine.com")
(license (list license:ruby license:gpl3)))) ; GPLv3 only AFAICT
+
+(define-public ruby-ruby-engine
+ (package
+ (name "ruby-ruby-engine")
+ (version "1.0.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (rubygems-uri "ruby_engine" version))
+ (sha256
+ (base32
+ "1d0sd4q50zkcqhr395wj1wpn2ql52r0fpwhzjfvi1bljml7k546v"))))
+ (build-system ruby-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'clean-up
+ (lambda _
+ (delete-file "Gemfile.lock")
+ (substitute* "ruby_engine.gemspec"
+ ;; Remove unnecessary imports that would entail further
+ ;; dependencies.
+ ((".*<rdoc.*") "")
+ ((".*<rubygems-tasks.*") "")
+ ;; Remove extraneous .gem file
+ (("\\\"pkg/ruby_engine-1.0.0.gem\\\",") ""))
+ (substitute* "Rakefile"
+ (("require 'rubygems/tasks'") "")
+ (("Gem::Tasks.new") ""))
+ ;; Remove extraneous .gem file that otherwise gets installed.
+ (delete-file "pkg/ruby_engine-1.0.0.gem")
+ #t)))))
+ (native-inputs
+ `(("bundler" ,bundler)
+ ("ruby-rspec" ,ruby-rspec-2)))
+ (synopsis "Simplifies checking for Ruby implementation")
+ (description
+ "@code{ruby_engine} provides an RubyEngine class that can be used to check
+which implementation of Ruby is in use. It can provide the interpreter name and
+provides query methods such as @{RubyEngine.mri?}.")
+ (home-page
+ "https://github.com/janlelis/ruby_engine")
+ (license license:expat)))
--
2.6.3