summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-11-25 15:36:24 +0100
committerRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-12-14 14:06:29 +0100
commit763624f56616eae6c974e8d6c1acc257020154dd (patch)
tree208d13145d651ae745c54efec77131af9f797d6b /gnu/packages
parent53239b5f9649b5b27945eafd550c6b296b4140d1 (diff)
downloadguix-763624f56616eae6c974e8d6c1acc257020154dd.tar.gz
gnu: Add ruby-json-pure.
* gnu/packages/ruby.scm (ruby-json-pure): New variable.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/ruby.scm48
1 files changed, 48 insertions, 0 deletions
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 2f3e9f3a09..eb6abbf3d2 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -30,6 +30,7 @@
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages java)
   #:use-module (gnu packages libffi)
+  #:use-module (gnu packages ragel)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (guix packages)
@@ -2089,6 +2090,53 @@ a native C extension.")
     (home-page "http://json-jruby.rubyforge.org/")
     (license (list license:ruby license:gpl2)))) ; GPL2 only
 
+(define-public ruby-json-pure
+  (package
+    (name "ruby-json-pure")
+    (version "1.8.3")
+    (source (origin
+              (method url-fetch)
+              (uri (rubygems-uri "json_pure" version))
+              (sha256
+               (base32
+                "025aykr360x6dr1jmg8pmsrx7gr30pws4p1q686vnb48zyw1sc94"))))
+    (build-system ruby-build-system)
+    (arguments
+     `(#:modules ((srfi srfi-1)
+                  (ice-9 regex)
+                  (rnrs io ports)
+                  (guix build ruby-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'replace-git-ls-files
+           (lambda _
+             ;; The existing gemspec file already contains a nice list of
+             ;; files that belong to the gem.  We extract the list from the
+             ;; gemspec file and then replace the file list in the Rakefile to
+             ;; get rid of the call to "git ls-files".
+             (let* ((contents (call-with-input-file "json.gemspec" get-string-all))
+                    ;; Guile is unhappy about the #\nul characters in comments.
+                    (filtered (string-filter (lambda (char)
+                                               (not (equal? #\nul char)))
+                                             contents))
+                    (files (match:substring
+                            (string-match "  s\\.files = ([^]]+\\])" filtered) 1)))
+               (substitute* "Rakefile"
+                 (("FileList\\[`git ls-files`\\.split\\(/\\\\n/\\)\\]")
+                  (string-append "FileList" files))))
+             #t)))))
+    (native-inputs
+     `(("ruby-permutation" ,ruby-permutation)
+       ("ruby-utils" ,ruby-utils)
+       ("ragel" ,ragel)
+       ("bundler" ,bundler)))
+    (synopsis "JSON implementation in pure Ruby")
+    (description
+     "This package provides a JSON implementation written in pure Ruby.")
+    (home-page "http://flori.github.com/json")
+    (license license:ruby)))
+
 (define-public ruby-listen
   (package
     (name "ruby-listen")