[bug#34222,06/15] gnu: Add ruby-crack.

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

Checks

Context Check Description
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed

Commit Message

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

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

Comments

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

> Required for ruby-webmock.
>
> * gnu/packages/ruby.scm (ruby-crack): New variable.
[…]
> +         (replace 'check
> +           (lambda _
> +             (for-each (lambda (file)
> +                         (display file)(display "\n")
> +                         (invoke "ruby" file))
> +                       (find-files "spec" ".*rb$"))
> +             #t)))))

I don’t see a “spec” directory in the git repository.  Do the Gem
contents differ from the repo?
Christopher Baines Jan. 27, 2019, 6:55 p.m. UTC | #2
Ricardo Wurmus <rekado@elephly.net> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> Required for ruby-webmock.
>>
>> * gnu/packages/ruby.scm (ruby-crack): New variable.
> […]
>> +         (replace 'check
>> +           (lambda _
>> +             (for-each (lambda (file)
>> +                         (display file)(display "\n")
>> +                         (invoke "ruby" file))
>> +                       (find-files "spec" ".*rb$"))
>> +             #t)))))
>
> I don’t see a “spec” directory in the git repository.  Do the Gem
> contents differ from the repo?

Good spot. There isn't a "spec" directory, it's instead called
"test". So no tests were actually being run. I've fixed this now.

+         (replace 'check
+           (lambda _
+             (for-each (lambda (file)
+                         (display file)(display "\n")
+                         (invoke "ruby" "-Ilib" "-Itest" file))
+                       (find-files "test" ".*rb$"))
+             #t)))))

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 3d1dfee47f..e11900b835 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -791,6 +791,37 @@  value is found.")
     (home-page "https://github.com/egonSchiele/contracts.ruby")
     (license license:bsd-2)))
 
+(define-public ruby-crack
+  (package
+    (name "ruby-crack")
+    (version "0.4.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "crack" version))
+       (sha256
+        (base32
+         "0abb0fvgw00akyik1zxnq7yv391va148151qxdghnzngv66bl62k"))))
+    (build-system ruby-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (for-each (lambda (file)
+                         (display file)(display "\n")
+                         (invoke "ruby" file))
+                       (find-files "spec" ".*rb$"))
+             #t)))))
+    (propagated-inputs
+     `(("ruby-safe-yaml" ,ruby-safe-yaml)))
+    (synopsis "Simple JSON and XML parsing for Ruby")
+    (description
+     "@code{crack} provides really simple JSON and XML parsing, extracted from
+code in Merb and Rails.")
+    (home-page "https://github.com/jnunemaker/crack")
+    (license license:expat)))
+
 (define-public ruby-czmq-ffi-gen
   (package
     (name "ruby-czmq-ffi-gen")