summary refs log tree commit diff
path: root/gnu/packages/rails.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-02 11:04:35 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-28 22:22:17 -0400
commit365de8cfd2de433b111b2e14e36c07c3c0b4c9f2 (patch)
tree706e648caed9d9786e054c5d2ea2489f3d4cec6f /gnu/packages/rails.scm
parent7d325537ed9c3b6cee5a4dfacd61c4292c566217 (diff)
downloadguix-365de8cfd2de433b111b2e14e36c07c3c0b4c9f2.tar.gz
gnu: ruby-activesupport: Update to 7.0.4.3.
* gnu/packages/ruby.scm (ruby-activesupport): Move to...
* gnu/packages/rails.scm (ruby-activesupport): ... here.
(%ruby-rails-version, ruby-rails-monorepo): New variables.
(ruby-activesupport): Update to 7.0.4.3.
[arguments]: Use gexps.  Add the delete-gemfiles, chdir, check-setup and
delete-problematic-tests phases.  Delete check phase override.
[native-inputs]: New field.
[propagated-inputs]: Remove ruby-zeitwerk.  Replace ruby-minitest with
ruby-minitest-5.15.
[home-page]: Update URL.
Diffstat (limited to 'gnu/packages/rails.scm')
-rw-r--r--gnu/packages/rails.scm84
1 files changed, 84 insertions, 0 deletions
diff --git a/gnu/packages/rails.scm b/gnu/packages/rails.scm
index 8f5bda4638..3af90bc913 100644
--- a/gnu/packages/rails.scm
+++ b/gnu/packages/rails.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,10 +25,93 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix packages)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages databases)
   #:use-module (gnu packages node)
   #:use-module (gnu packages ruby)
   #:use-module (guix build-system ruby))
 
+(define %ruby-rails-version "7.0.4.3")
+
+(define ruby-rails-monorepo
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+          (url "https://github.com/rails/rails")
+          (commit (string-append "v" %ruby-rails-version))))
+    (file-name (git-file-name "ruby-rails" %ruby-rails-version))
+    (sha256
+     (base32
+      "0f5f8r8wdmdmbyl07b0z555arai4ys2j8dj3fy0mq63y9bfhcqqk"))))
+
+(define-public ruby-activesupport
+  (package
+    (name "ruby-activesupport")
+    (version %ruby-rails-version)
+    (source ruby-rails-monorepo)
+    (build-system ruby-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'delete-gemfiles
+            (lambda _
+              (delete-file "Gemfile")
+              (delete-file "Gemfile.lock")))
+          (add-after 'delete-gemfiles 'chdir
+            (lambda _
+              (chdir "activesupport")))
+          (add-before 'check 'check-setup
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              ;; Multiple tests require to set the timezone.
+              (setenv "TZDIR" (search-input-directory (or native-inputs inputs)
+                                                      "share/zoneinfo"))
+              ;; The test suite requires a memcached and a redis server.
+              (invoke "memcached" "-d")
+              (invoke "redis-server" "--daemonize" "yes")))
+          (add-before 'check 'delete-problematic-tests
+            (lambda _
+              ;; These tests fail non-deterministically.
+              (substitute* "test/cache/behaviors.rb"
+                ((".*behaviors/cache_store_behavior.*")
+                 "")
+                ((".*behaviors/encoded_key_cache_behavior.*")
+                 ""))
+              (delete-file "test/evented_file_update_checker_test.rb")
+              ;; These tests require cache_store_behavior, disabled above.
+              (delete-file "test/cache/stores/file_store_test.rb")
+              (delete-file "test/cache/stores/mem_cache_store_test.rb")
+              (delete-file "test/cache/stores/memory_store_test.rb")
+              (delete-file "test/cache/stores/redis_cache_store_test.rb"))))))
+    (native-inputs
+     (list memcached
+           redis
+           ruby-builder
+           ruby-connection-pool
+           ruby-dalli
+           ruby-hiredis
+           ruby-libxml
+           ruby-listen
+           ruby-rack
+           ruby-redis
+           ruby-rexml
+           tzdata-for-tests))
+    (propagated-inputs
+     (list ruby-concurrent
+           ruby-i18n
+           ;; This is sub-optimal, but apparently necessary (see:
+           ;; https://github.com/rails/rails/commit/
+           ;; 9766eb4a833c26c64012230b96dd1157ebb8e8a2).
+           ruby-minitest-5.15
+           ruby-tzinfo
+           ruby-tzinfo-data))
+    (synopsis "Ruby on Rails utility library")
+    (description "ActiveSupport is a toolkit of support libraries and Ruby
+core extensions extracted from the Rails framework.  It includes support for
+multibyte strings, internationalization, time zones, and testing.")
+    (home-page "https://rubyonrails.org/")
+    (license license:expat)))
+
 (define-public ruby-spring
   (package
     (name "ruby-spring")