diff mbox series

[bug#62196,034/223] gnu: Add ruby-dotenv.

Message ID 20230320171635.11184-34-maxim.cournoyer@gmail.com
State New
Headers show
Series None | expand

Commit Message

Maxim Cournoyer March 20, 2023, 5:13 p.m. UTC
* gnu/packages/ruby.scm (ruby-dotenv): New variable.
---
 gnu/packages/ruby.scm | 45 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 51f7d80951..6396f3cd6f 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -9352,6 +9352,51 @@  (define-public ruby-domain-name
     (home-page "https://github.com/knu/ruby-domain_name")
     (license license:bsd-2)))
 
+(define-public ruby-dotenv
+  (package
+    (name "ruby-dotenv")
+    (version "2.8.1")
+    (source (origin
+              (method git-fetch)        ;for the tests
+              (uri (git-reference
+                    (url "https://github.com/bkeepers/dotenv")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0s1a71jxppa20fsm2rd1vym099ib48m039rmhggmz99hc3z1fvvr"))))
+    (build-system ruby-build-system)
+    (arguments
+     (list
+      #:test-target "spec"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'do-not-build-dotenv-rails
+            (lambda _
+              ;; The repository includes the definitions of two packages,
+              ;; 'dotenv' and 'dotenv-rails'.  Since we want to package them
+              ;; separately, remove the dotenv-rails and associated Rake
+              ;; tasks.
+              (delete-file "dotenv-rails.gemspec")
+              (delete-file "spec/dotenv/rails_spec.rb")
+              (substitute* "Rakefile"
+                (("DotenvRailsGemHelper.install_tasks name: \"dotenv-rails\"")
+                 "")
+                ((", \"dotenv-rails:.*\"")
+                 ""))))
+          (replace 'replace-git-ls-files
+            (lambda _
+              (substitute* "dotenv.gemspec"
+                (("`git ls-files README.md LICENSE lib bin \\| grep -v rails`")
+                 "`find README.md LICENSE lib bin -type f | sort | \
+grep -v rails`")))))))
+    (native-inputs (list ruby-standard ruby-rspec))
+    (synopsis "Ruby library for setting environment variables")
+    (description "Dotenv is a Ruby library for setting environment variables
+defined in a @file{.env} file.")
+    (home-page "https://github.com/bkeepers/dotenv")
+    (license license:expat)))
+
 (define-public ruby-http-cookie
   (package
     (name "ruby-http-cookie")