diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm index 82c5b7b5f8..a746b7de9c 100644 --- a/gnu/packages/protobuf.scm +++ b/gnu/packages/protobuf.scm @@ -49,6 +49,7 @@ #:use-module (gnu packages python-check) #:use-module (gnu packages python-xyz) #:use-module (gnu packages rpc) + #:use-module (gnu packages rails) #:use-module (gnu packages ruby) #:use-module (srfi srfi-1)) 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 ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2019, 2021, 2022 Efraim Flashner +;;; Copyright © 2023 Maxim Cournoyer ;;; ;;; 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") diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm index fe93ec53e6..e600e84cfe 100644 --- a/gnu/packages/ruby.scm +++ b/gnu/packages/ruby.scm @@ -6547,39 +6547,6 @@ you about the changes.") documents and fragments. It's built on top of Nokogiri and libxml2.") (license license:expat))) -(define-public ruby-activesupport - (package - (name "ruby-activesupport") - (version "6.1.3") - (source - (origin - (method url-fetch) - (uri (rubygems-uri "activesupport" version)) - (sha256 - (base32 - "00a4db64g8w5yyk6hzak2nqrmdfvyh5zc9cvnm9gglwbi87ss28h")))) - (build-system ruby-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (replace 'check - (lambda _ - ;; There are no tests, instead attempt to load the library. - (invoke "ruby" "-Ilib" "-r" "active_support")))))) - (propagated-inputs - (list ruby-concurrent - ruby-i18n - ruby-minitest - ruby-tzinfo - ruby-tzinfo-data - ruby-zeitwerk)) - (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://www.rubyonrails.org") - (license license:expat))) - (define-public ruby-crass (package (name "ruby-crass")