[bug#34217,11/11] gnu: Add ruby-cucumber and ruby-aruba.

Message ID 20190127114956.26570-11-mail@cbaines.net
State Accepted
Headers show
Series Add ruby-cucumber along with dependencies and a couple of updates. | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed
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 fail Apply failed

Commit Message

Christopher Baines Jan. 27, 2019, 11:49 a.m. UTC
These packages are mutually dependant, so I've put them in one commit.

* gnu/packages/ruby.scm (ruby-aruba, ruby-cucumber): New variables.
---
 gnu/packages/ruby.scm | 136 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

Comments

Björn Höfling Feb. 3, 2019, 10:18 p.m. UTC | #1
On Sun, 27 Jan 2019 11:49:56 +0000
Christopher Baines <mail@cbaines.net> wrote:

> These packages are mutually dependant, so I've put them in one commit.
> 
> * gnu/packages/ruby.scm (ruby-aruba, ruby-cucumber): New variables.

You missed to add the "...-without-tests" variables here.

[...]

> +(define-public ruby-aruba
> +  (package
> +    (name "ruby-aruba")
> +    (version "0.14.7")

There is another update since yesterday:
0.14.8 - February 02, 2019 (169 KB) 

[..]

> +;; A version of ruby-aruba without tests run so that circular
> dependencies can +;; be avoided.
> +(define ruby-aruba-without-tests
> +  (package
> +    (inherit ruby-aruba)
> +    (arguments '(#:tests? #f))
> +    (propagated-inputs
> +     (map (lambda (input)
> +            (if (string=? (car input) "ruby-cucumber")
> +                `("ruby-cucumber" ,ruby-cucumber-without-tests)
> +                input))
> +          (package-propagated-inputs ruby-aruba)))

This is really nit-picking, I haven't tried it out myself and I haven't
used it much myself, but I think this could be written more elegant with
match-lambda [syntax errors might be included]:

 (map (match-lambda
       (("ruby-cucumber" . pkg)
          `("ruby-cucumber" ,ruby-cucumber-without-tests))
	(input input)
...)



Björn
Ricardo Wurmus Feb. 3, 2019, 11:26 p.m. UTC | #2
Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:

>> +    (propagated-inputs
>> +     (map (lambda (input)
>> +            (if (string=? (car input) "ruby-cucumber")
>> +                `("ruby-cucumber" ,ruby-cucumber-without-tests)
>> +                input))
>> +          (package-propagated-inputs ruby-aruba)))
>
> This is really nit-picking, I haven't tried it out myself and I haven't
> used it much myself, but I think this could be written more elegant with
> match-lambda [syntax errors might be included]:
>
>  (map (match-lambda
>        (("ruby-cucumber" . pkg)
>           `("ruby-cucumber" ,ruby-cucumber-without-tests))
> 	(input input)
> ...)

Or like this

    `(("ruby-cucumber" ,ruby-cucumber-without-tests)
      ,@(alist-delete "ruby-cucumber"
                      (package-propagated-inputs ruby-aruba)))
Christopher Baines Feb. 8, 2019, 5:19 p.m. UTC | #3
Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:

> On Sun, 27 Jan 2019 11:49:56 +0000
> Christopher Baines <mail@cbaines.net> wrote:
>
>> These packages are mutually dependant, so I've put them in one commit.
>>
>> * gnu/packages/ruby.scm (ruby-aruba, ruby-cucumber): New variables.
>
> You missed to add the "...-without-tests" variables here.

I wasn't quite sure whether to put only public things in the changelog,
or everything. I've included them in the changelog now.

>> +(define-public ruby-aruba
>> +  (package
>> +    (name "ruby-aruba")
>> +    (version "0.14.7")
>
> There is another update since yesterday:
> 0.14.8 - February 02, 2019 (169 KB)

Cool, I've updated to this new version.

>> +;; A version of ruby-aruba without tests run so that circular
>> dependencies can +;; be avoided.
>> +(define ruby-aruba-without-tests
>> +  (package
>> +    (inherit ruby-aruba)
>> +    (arguments '(#:tests? #f))
>> +    (propagated-inputs
>> +     (map (lambda (input)
>> +            (if (string=? (car input) "ruby-cucumber")
>> +                `("ruby-cucumber" ,ruby-cucumber-without-tests)
>> +                input))
>> +          (package-propagated-inputs ruby-aruba)))
>
> This is really nit-picking, I haven't tried it out myself and I haven't
> used it much myself, but I think this could be written more elegant with
> match-lambda [syntax errors might be included]:
>
>  (map (match-lambda
>        (("ruby-cucumber" . pkg)
>           `("ruby-cucumber" ,ruby-cucumber-without-tests))
> 	(input input)
> ...)

I've changed this to use alist-delete which Ricardo suggested as I think
that's the most straight forward.

Thanks for the your comments,

Chris
Christopher Baines Feb. 8, 2019, 5:19 p.m. UTC | #4
Ricardo Wurmus <rekado@elephly.net> writes:

> Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:
>
>>> +    (propagated-inputs
>>> +     (map (lambda (input)
>>> +            (if (string=? (car input) "ruby-cucumber")
>>> +                `("ruby-cucumber" ,ruby-cucumber-without-tests)
>>> +                input))
>>> +          (package-propagated-inputs ruby-aruba)))
>>
>> This is really nit-picking, I haven't tried it out myself and I haven't
>> used it much myself, but I think this could be written more elegant with
>> match-lambda [syntax errors might be included]:
>>
>>  (map (match-lambda
>>        (("ruby-cucumber" . pkg)
>>           `("ruby-cucumber" ,ruby-cucumber-without-tests))
>> 	(input input)
>> ...)
>
> Or like this
>
>     `(("ruby-cucumber" ,ruby-cucumber-without-tests)
>       ,@(alist-delete "ruby-cucumber"
>                       (package-propagated-inputs ruby-aruba)))

Yep, that looks good to me, thanks :)
Björn Höfling Feb. 8, 2019, 7:02 p.m. UTC | #5
On Fri, 08 Feb 2019 17:19:26 +0000
Christopher Baines <mail@cbaines.net> wrote:

> Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:

> >> * gnu/packages/ruby.scm (ruby-aruba, ruby-cucumber): New
> >> variables.  
> >
> > You missed to add the "...-without-tests" variables here.  
> 
> I wasn't quite sure whether to put only public things in the
> changelog, or everything. I've included them in the changelog now.

Uh, I haven't seen that they are private, which of cause makes sense.

In that case I'm unsure what to do, but adding them doesn't hurt.

Björn

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index e507c816c8..59895240f8 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -32,6 +32,7 @@ 
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages dbm)
@@ -3795,6 +3796,141 @@  It is intended be used by all Cucumber implementations to parse
     (home-page "https://github.com/cucumber-attic/gherkin")
     (license license:expat)))
 
+(define-public ruby-aruba
+  (package
+    (name "ruby-aruba")
+    (version "0.14.7")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "aruba" version))
+       (sha256
+        (base32
+         "0x27352n15dsyf5ak246znfawbrm502q15r4msjw3cis17jlcy1l"))))
+    (build-system ruby-build-system)
+    (arguments
+     '(;; TODO: There are a few test failures
+       ;; 357 examples, 7 failures
+       #:tests? #f
+       #:test-target "spec"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'remove-unnecessary-dependencies
+           (lambda _
+             (substitute* "Gemfile"
+               ((".*byebug.*") "\n")
+               ((".*pry.*") "\n")
+               ((".*yaml.*") "\n")
+               ((".*bcat.*") "\n")
+               ((".*kramdown.*") "\n")
+               ((".*rubocop.*") "\n")
+               ((".*cucumber-pro.*") "\n")
+               ((".*cucumber.*") "\n")
+               ((".*license_finder.*") "\n")
+               ((".*rake.*") "gem 'rake'\n")
+               ((".*simplecov.*") "\n")
+               ((".*relish.*") "\n"))
+             (substitute* "spec/spec_helper.rb"
+               ((".*simplecov.*") "")
+               (("^SimpleCov.*") ""))
+             (substitute* "aruba.gemspec"
+               (("spec\\.add\\_runtime\\_dependency 'cucumber'.*")
+                "spec.add_runtime_dependency 'cucumber'"))
+             #t))
+         (add-before 'check 'set-home
+           (lambda _ (setenv "HOME" "/tmp") #t)))))
+    (native-inputs
+     `(("bundler" ,bundler)
+       ("ruby-rspec" ,ruby-rspec)
+       ("ruby-fuubar" ,ruby-fuubar)))
+    (propagated-inputs
+     `(("ruby-childprocess" ,ruby-childprocess)
+       ("ruby-contracts" ,ruby-contracts)
+       ("ruby-cucumber" ,ruby-cucumber)
+       ("ruby-ffi" ,ruby-ffi)
+       ("ruby-rspec-expectations" ,ruby-rspec-expectations)
+       ("ruby-thor" ,ruby-thor)))
+    (synopsis "Test command-line applications with Cucumber, RSpec or Minitest")
+    (description
+     "Aruba is an extension for Cucumber, RSpec and Minitest for testing
+command-line applications.  It supports applications written in any
+language.")
+    (home-page "https://github.com/cucumber/aruba")
+    (license license:expat)))
+
+;; A version of ruby-aruba without tests run so that circular dependencies can
+;; be avoided.
+(define ruby-aruba-without-tests
+  (package
+    (inherit ruby-aruba)
+    (arguments '(#:tests? #f))
+    (propagated-inputs
+     (map (lambda (input)
+            (if (string=? (car input) "ruby-cucumber")
+                `("ruby-cucumber" ,ruby-cucumber-without-tests)
+                input))
+          (package-propagated-inputs ruby-aruba)))
+    (native-inputs '())))
+
+(define-public ruby-cucumber
+  (package
+    (name "ruby-cucumber")
+    (version "3.1.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/cucumber/cucumber-ruby.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0764wp2cjg60qa3l69q1dxda5g06a01n5w92szqbf89d2hgl47n3"))))
+    (build-system ruby-build-system)
+    (arguments
+     '(#:test-target "spec"
+       #:phases
+       (modify-phases %standard-phases
+         ;; Don't run or require rubocop, the code linting tool, as this is a
+         ;; bit unnecessary.
+         (add-after 'unpack 'dont-run-rubocop
+           (lambda _
+             (substitute* "Rakefile"
+               ((".*rubocop/rake\\_task.*") "")
+               ((".*RuboCop.*") ""))
+             #t)))))
+    (propagated-inputs
+     `(("ruby-builder" ,ruby-builder)
+       ("ruby-cucumber-core" ,ruby-cucumber-core)
+       ("ruby-cucumber-wire" ,ruby-cucumber-wire)
+       ("ruby-cucumber-expressions" ,ruby-cucumber-expressions)
+       ("ruby-diff-lcs" ,ruby-diff-lcs)
+       ("ruby-gherkin" ,ruby-gherkin)
+       ("ruby-multi-json" ,ruby-multi-json)
+       ("ruby-multi-test" ,ruby-multi-test)))
+    (native-inputs
+     `(("bundler" ,bundler)
+       ;; Use a untested version of aruba, to avoid a circular dependency, as
+       ;; ruby-aruba depends on ruby-cucumber.
+       ("ruby-aruba", ruby-aruba-without-tests)
+       ("ruby-rspec" ,ruby-rspec)
+       ("ruby-pry" ,ruby-pry)
+       ("ruby-nokogiri" ,ruby-nokogiri)))
+    (synopsis "Describe automated tests in plain language")
+    (description
+     "Cucumber is a tool for running automated tests written in plain
+language.  It's designed to support a Behaviour Driven Development (BDD)
+software development workflow.")
+    (home-page "https://cucumber.io/")
+    (license license:expat)))
+
+(define ruby-cucumber-without-tests
+  (package (inherit ruby-cucumber)
+    (arguments
+     '(#:tests? #f))
+    (native-inputs
+     '())))
+
 (define-public ruby-cucumber-core
   (package
     (name "ruby-cucumber-core")