[bug#34222,10/15] gnu: Add ruby-ast.

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

Checks

Context Check Description
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

Commit Message

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

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

Comments

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

> Required for ruby-parser.
>
> * gnu/packages/ruby.scm (ruby-ast): New variable.
[…]
> +    (native-inputs
> +     `(("bundler" ,bundler)
> +       ("ruby-simplecov" ,ruby-simplecov)
> +       ("ruby-json-pure" ,ruby-json-pure)
> +       ("ruby-mime-times" ,ruby-mime-types)
> +       ("ruby-yard" ,ruby-yard)
> +       ("ruby-kramdown" ,ruby-kramdown)
> +       ("ruby-rest-client" ,ruby-rest-client)
> +       ("ruby-bacon" ,ruby-bacon)
> +       ("ruby-bacon-colored-output" ,ruby-bacon-colored-output)
> +       ("ruby-racc" ,ruby-racc)))

Are really none of these required at run time?
Christopher Baines Jan. 27, 2019, 6:50 p.m. UTC | #2
Ricardo Wurmus <rekado@elephly.net> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> Required for ruby-parser.
>>
>> * gnu/packages/ruby.scm (ruby-ast): New variable.
> […]
>> +    (native-inputs
>> +     `(("bundler" ,bundler)
>> +       ("ruby-simplecov" ,ruby-simplecov)
>> +       ("ruby-json-pure" ,ruby-json-pure)
>> +       ("ruby-mime-times" ,ruby-mime-types)
>> +       ("ruby-yard" ,ruby-yard)
>> +       ("ruby-kramdown" ,ruby-kramdown)
>> +       ("ruby-rest-client" ,ruby-rest-client)
>> +       ("ruby-bacon" ,ruby-bacon)
>> +       ("ruby-bacon-colored-output" ,ruby-bacon-colored-output)
>> +       ("ruby-racc" ,ruby-racc)))
>
> Are really none of these required at run time?

According to the gemspec at least [1].

1: https://github.com/whitequark/ast/blob/master/ast.gemspec#L14-L26

I don't know the library at all, but it seems like a AST data structure,
so I think it's possible that it's very dependency light.

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index e0c09f59ab..2bb9ea1cff 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -699,6 +699,53 @@  AsciiDoc content to HTML5, DocBook 5 (or 4.5), PDF, and other formats.")
   (home-page "https://asciidoctor.org")
   (license license:expat)))
 
+(define-public ruby-ast
+  (package
+    (name "ruby-ast")
+    (version "2.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "ast" version))
+       (sha256
+        (base32
+         "184ssy3w93nkajlz2c70ifm79jp3j737294kbc5fjw69v1w0n9x7"))))
+    (build-system ruby-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'remove-coveralls-requirement
+           (lambda _
+             (substitute* "test/helper.rb"
+               (("require 'coveralls'") "")
+               (("Coveralls::SimpleCov::Formatter") ""))
+             #t))
+         (add-after 'extract-gemspec 'remove-unnecessary-requirements
+           (lambda _
+             (substitute* "ast.gemspec"
+               ((".*coveralls.*") "\n")
+               (("%q<rest-client>.*") "%q<rest-client>.freeze, [\">= 0\"])\n")
+               (("%q<mime-types>.*") "%q<mime-types>.freeze, [\">= 0\"])\n")
+               (("%q<rake>.*") "%q<rake>.freeze, [\">= 0\"])\n"))
+             #t)))))
+    (native-inputs
+     `(("bundler" ,bundler)
+       ("ruby-simplecov" ,ruby-simplecov)
+       ("ruby-json-pure" ,ruby-json-pure)
+       ("ruby-mime-times" ,ruby-mime-types)
+       ("ruby-yard" ,ruby-yard)
+       ("ruby-kramdown" ,ruby-kramdown)
+       ("ruby-rest-client" ,ruby-rest-client)
+       ("ruby-bacon" ,ruby-bacon)
+       ("ruby-bacon-colored-output" ,ruby-bacon-colored-output)
+       ("ruby-racc" ,ruby-racc)))
+    (synopsis "Library for working with Abstract Syntax Trees")
+    (description
+     "@code{ast} is a Ruby library for working with Abstract Syntax Trees.
+It does this through immutable data structures.")
+    (home-page "https://whitequark.github.io/ast/")
+    (license license:expat)))
+
 (define-public ruby-sporkmonger-rack-mount
   ;; Testing the addressable gem requires a newer commit than that released, so
   ;; use an up to date version.