projects/guix·blob python-team · refs

1655 lines · 68.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Matthew Jordan <[email protected]>
3;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2019, 2021, 2022 Efraim Flashner <[email protected]>
5;;; Copyright © 2019 Christopher Baines <[email protected]>
6;;; Copyright © 2023 Maxim Cournoyer <[email protected]>
7;;; Copyright © 2025 dan <[email protected]>
8;;; Copyright © 2026 gemmaro <[email protected]>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages rails)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix gexp)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix packages)
31 #:use-module (guix utils)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages databases)
35 #:use-module (gnu packages node)
36 #:use-module (gnu packages ruby)
37 #:use-module (gnu packages ruby-check)
38 #:use-module (gnu packages ruby-xyz)
39 #:use-module (gnu packages sqlite)
40 #:use-module (gnu packages version-control)
41 #:use-module (guix build-system ruby)
42 #:use-module ((srfi srfi-1) #:select (alist-delete)))
43
44(define %ruby-rails-version "7.2.3.2")
45
46(define ruby-rails-monorepo
47 (origin
48 (method git-fetch)
49 (uri (git-reference
50 (url "https://github.com/rails/rails")
51 (commit (string-append "v" %ruby-rails-version))))
52 (file-name (git-file-name "ruby-rails" %ruby-rails-version))
53 (sha256
54 (base32
55 "1fdx0m4zmkiap9aglxk47zplw7ixcp6vf552yjbiiqbss81bl98l"))
56 (patches
57 (search-patches "ruby-actionpack-remove-browser-tests.patch"))))
58
59(define-public ruby-activesupport
60 (package
61 (name "ruby-activesupport")
62 (version %ruby-rails-version)
63 (source
64 (origin
65 (inherit ruby-rails-monorepo)))
66 (build-system ruby-build-system)
67 (arguments
68 (list
69 #:phases
70 #~(modify-phases %standard-phases
71 (add-after 'unpack 'delete-gemfiles
72 (lambda _
73 (delete-file "Gemfile")
74 (delete-file "Gemfile.lock")))
75 (add-after 'delete-gemfiles 'chdir
76 (lambda _
77 (chdir "activesupport")))
78 (add-before 'check 'check-setup
79 (lambda* (#:key native-inputs inputs #:allow-other-keys)
80 ;; Multiple tests require to set the timezone.
81 (setenv "TZDIR" (search-input-directory (or native-inputs inputs)
82 "share/zoneinfo"))
83 ;; The test suite requires a memcached and a redis server.
84 (invoke "memcached" "-d")
85 (invoke "redis-server" "--daemonize" "yes")))
86 (add-before 'check 'delete-problematic-tests
87 (lambda _
88 ;; These tests fail non-deterministically.
89 (substitute* "test/cache/behaviors.rb"
90 ((".*behaviors/cache_store_behavior.*")
91 "")
92 ((".*behaviors/encoded_key_cache_behavior.*")
93 ""))
94 (when #$(target-x86-32?)
95 ;; This test fails on i686 (see:
96 ;; https://github.com/rails/rails/issues/47832).
97 (substitute* "test/core_ext/duration_test.rb"
98 (("def test_iso8601_output_and_reparsing.*" all)
99 (string-append all " skip('fails on i686')\n"))))
100 (delete-file "test/evented_file_update_checker_test.rb")
101 ;; These tests require cache_store_behavior, disabled above.
102 (delete-file "test/cache/stores/file_store_test.rb")
103 (delete-file "test/cache/stores/mem_cache_store_test.rb")
104 (delete-file "test/cache/stores/memory_store_test.rb")
105 (delete-file "test/cache/stores/redis_cache_store_test.rb"))))))
106 (native-inputs
107 (list memcached
108 redis
109 ruby-builder
110 ruby-dalli
111 ruby-hiredis
112 ruby-libxml
113 ruby-listen
114 ruby-rack
115 ruby-redis
116 ruby-rexml
117 tzdata-for-tests))
118 (propagated-inputs
119 (list ruby-benchmark
120 ruby-concurrent-ruby
121 ruby-connection-pool
122 ruby-i18n
123 ruby-minitest
124 ruby-msgpack
125 ruby-securerandom
126 ruby-tzinfo
127 ruby-tzinfo-data))
128 (synopsis "Ruby on Rails utility library")
129 (description "ActiveSupport is a toolkit of support libraries and Ruby
130core extensions extracted from the Rails framework. It includes support for
131multibyte strings, internationalization, time zones, and testing.")
132 (home-page "https://rubyonrails.org/")
133 (license license:expat)))
134
135(define-public ruby-globalid
136 (package
137 (name "ruby-globalid")
138 (version "1.1.0")
139 (source
140 (origin
141 (method url-fetch)
142 (uri (rubygems-uri "globalid" version))
143 (sha256
144 (base32
145 "0kqm5ndzaybpnpxqiqkc41k4ksyxl41ln8qqr6kb130cdxsf2dxk"))))
146 (build-system ruby-build-system)
147 (arguments
148 '(#:tests? #f)) ;no included tests
149 (propagated-inputs
150 (list ruby-activesupport))
151 (synopsis "Generate URIs identifying model instances in Ruby")
152 (description
153 "@code{GlobalID} provides a way to generate URIs from a model in Ruby that
154uniquely identify it.")
155 (home-page "https://rubyonrails.org/")
156 (license license:expat)))
157
158(define-public ruby-spring
159 (package
160 (name "ruby-spring")
161 (version "4.2.0")
162 (source
163 (origin
164 (method git-fetch)
165 (uri (git-reference
166 (url "https://github.com/rails/spring")
167 (commit (string-append "v" version))))
168 (file-name (git-file-name name version))
169 (sha256
170 (base32
171 "1n2c6y69asj3z447kbrc13qaqw12dm1qq886rannbpj5av3k5csy"))))
172 (build-system ruby-build-system)
173 (arguments
174 (list #:test-target "test:unit"
175 #:phases
176 #~(modify-phases %standard-phases
177 (add-before 'check 'remove-bump
178 (lambda _
179 (substitute* "spring.gemspec"
180 (("gem.add_development_dependency 'bump'") ""))
181 (substitute* "Gemfile"
182 (("gem \"bump\"") ""))
183 (substitute* "Rakefile"
184 (("require \\\"bump/tasks\\\"") "")))))))
185 (native-inputs (list bundler ruby-activesupport))
186 (synopsis "Ruby on Rails application preloader")
187 (description
188 "Spring is a Ruby on Rails application preloader. It speeds up
189development by keeping your application running in the background so the
190application does need to boot it every time you run a test, rake task or
191migration.")
192 (home-page "https://github.com/rails/spring")
193 (license license:expat)))
194
195(define-public ruby-sass-rails
196 (package
197 (name "ruby-sass-rails")
198 (version "6.0.0")
199 (source
200 (origin
201 (method url-fetch)
202 (uri (rubygems-uri "sass-rails" version))
203 (sha256
204 (base32
205 "1lqhb0fgmls9l9jhgz42ri25w13q5pmsiiwzjbarz4n7l6749dp0"))))
206 (build-system ruby-build-system)
207 (arguments
208 '(#:tests? #f)) ; No included tests
209 (propagated-inputs
210 (list ruby-sassc-rails))
211 (synopsis "Sass adapter for the Rails asset pipeline")
212 (description
213 "This library integrates the SASS stylesheet language into Ruby on
214Rails.")
215 (home-page "https://github.com/rails/sass-rails")
216 (license license:expat)))
217
218(define-public ruby-debug-inspector
219 (package
220 (name "ruby-debug-inspector")
221 (version "1.1.0")
222 (source
223 (origin
224 (method url-fetch)
225 (uri (rubygems-uri "debug_inspector" version))
226 (sha256
227 (base32
228 "01l678ng12rby6660pmwagmyg8nccvjfgs3487xna7ay378a59ga"))))
229 (build-system ruby-build-system)
230 (arguments
231 (list
232 #:phases
233 #~(modify-phases %standard-phases
234 (replace 'check
235 (lambda _
236 (invoke "rake" "compile")
237 (invoke "ruby" "-Ilib" "-e"
238 (string-append
239 "require 'debug_inspector'; RubyVM::DebugInspector."
240 "open{|dc| p dc.backtrace_locations}")))))))
241 (native-inputs
242 (list ruby-rake-compiler))
243 (synopsis "Ruby wrapper for the MRI 2.0 debug_inspector API")
244 (description
245 "This package provides a Ruby wrapper for the MRI 2.0 debug_inspector
246API.")
247 (home-page
248 "https://github.com/banister/debug_inspector")
249 (license license:expat)))
250
251(define-public ruby-autoprefixer-rails
252 (package
253 (name "ruby-autoprefixer-rails")
254 (version "10.4.13.0")
255 (source (origin
256 (method git-fetch) ;for tests
257 (uri (git-reference
258 (url "https://github.com/ai/autoprefixer-rails")
259 (commit version)))
260 (file-name (git-file-name name version))
261 (sha256
262 (base32
263 "1i34apjlav1qz8mdg2fyf0hvs5z32inv1snycdkhmqpkfj2ri2hh"))))
264 (build-system ruby-build-system)
265 (arguments
266 '(#:test-target "spec"
267 #:phases
268 (modify-phases %standard-phases
269 (add-after 'extract-gemspec 'relax-requirements
270 (lambda _
271 (substitute* "Gemfile"
272 ;; Remove overly strict requirement on sprockets
273 ((", '>= 4\\.0\\.0\\.beta1'") "")
274 ;; The mini_racer gem isn't packaged yet, and it's not directly
275 ;; required, as other backends for ruby-execjs can be used.
276 (("gem \"mini_racer\"") "")
277 ;; For some reason, this is required for the tzinfo-data gem to
278 ;; be picked up.
279 (("gemspec") "gemspec\ngem 'tzinfo-data'\n"))
280 (substitute* "autoprefixer-rails.gemspec"
281 ((".*rubocop.*") ""))))))) ;provided by 'standard'
282 (native-inputs
283 (list bundler
284 ruby-rails
285 ruby-rspec-rails
286 ruby-sassc-rails
287 ruby-sprockets
288 ruby-standard
289 ;; This is used at runtime by ruby-execjs.
290 node-lts))
291 (propagated-inputs
292 (list ruby-execjs))
293 (synopsis "Parse CSS and add vendor prefixes to CSS rules")
294 (description
295 "This gem provides Ruby and Ruby on Rails integration with Autoprefixer,
296which can parse CSS and add vendor prefixes to CSS rules using values from the
297Can I Use website.")
298 (home-page "https://github.com/ai/autoprefixer-rails")
299 (license license:expat)))
300
301(define-public ruby-activemodel
302 (package
303 (name "ruby-activemodel")
304 (version %ruby-rails-version)
305 (source ruby-rails-monorepo)
306 (build-system ruby-build-system)
307 (arguments
308 (list
309 #:phases
310 #~(modify-phases %standard-phases
311 (add-after 'extract-gemspec 'chdir
312 (lambda _
313 (chdir "activemodel")))
314 (add-after 'chdir 'delete-problematic-tests
315 (lambda _
316 ;; We do not want to depend on ruby-railties at this stage.
317 (delete-file "test/cases/railtie_test.rb"))))))
318 (native-inputs (list ruby-bcrypt))
319 (propagated-inputs (list ruby-activesupport))
320 (synopsis "Toolkit for building modeling frameworks like Active Record")
321 (description
322 "This package provides a toolkit for building modeling frameworks like
323Active Record. ActiveSupport handles attributes, callbacks, validations,
324serialization, internationalization, and testing.")
325 (home-page "https://rubyonrails.org/")
326 (license license:expat)))
327
328(define-public ruby-activerecord
329 (package
330 (name "ruby-activerecord")
331 (version %ruby-rails-version)
332 (source ruby-rails-monorepo)
333 (build-system ruby-build-system)
334 (arguments
335 (list
336 #:phases
337 #~(modify-phases %standard-phases
338 (add-after 'extract-gemspec 'chdir
339 (lambda _
340 (chdir "activerecord")))
341 (delete 'check)
342 (add-after 'install 'check
343 (lambda* (#:key tests? #:allow-other-keys)
344 (when tests?
345 ;; Avoid running the database tests, which require railties
346 ;; and/or database servers.
347 (setenv "ARCONN" "sqlite3")
348 (invoke "ruby" "-Itest" "test/cases/base_test.rb"))))
349 (add-before 'check 'set-GEM_PATH
350 (lambda _
351 (setenv "GEM_PATH" (string-append
352 (getenv "GEM_PATH") ":"
353 #$output "/lib/ruby/vendor_ruby"))))
354 (add-before 'check 'check-setup
355 (lambda* (#:key native-inputs inputs #:allow-other-keys)
356 ;; A few tests require to set the timezone.
357 (setenv "TZDIR" (search-input-directory (or native-inputs inputs)
358 "share/zoneinfo")))))))
359 (native-inputs
360 (list tzdata-for-tests
361 ruby-mini-portile-2))
362 (propagated-inputs (list ruby-activemodel
363 ruby-activesupport
364 ruby-sqlite3
365 ruby-timeout))
366 (synopsis "Ruby library to connect to relational databases")
367 (description
368 "Active Record connects classes to relational database table to establish
369an almost zero-configuration persistence layer for applications.")
370 (home-page "https://rubyonrails.org")
371 (license license:expat)))
372
373(define-public ruby-rspec-rails
374 (package
375 (name "ruby-rspec-rails")
376 (version "7.1.1")
377 (source (origin
378 (method git-fetch)
379 (uri (git-reference
380 (url "https://github.com/rspec/rspec-rails")
381 (commit (string-append "v" version))))
382 (file-name (git-file-name name version))
383 (sha256
384 (base32 "05irf7nc5zfm0bb6cfz4y6hkxqband8dkf8djjaryifkv7fp3w1k"))))
385 (build-system ruby-build-system)
386 (arguments
387 (list
388 ;; Run the 'spec' instead of the 'default' Rake target to avoid running
389 ;; the acceptance test suite, which doesn't seem to allow being run
390 ;; offline (see: https://github.com/rspec/rspec-rails/issues/2660).
391 #:test-target "spec"
392 #:phases
393 #~(modify-phases %standard-phases
394 (add-after 'extract-gemspec 'relax-requirements
395 (lambda _
396 (substitute* "Gemfile"
397 ;; Remove a few extraneous requirements.
398 ((".*yard.*") "")
399 ((".*github-markup.*") "")
400 ((".*redcarpet.*") "")
401 ((".*relish.*") "")
402 ((".*rubocop.*") ""))
403 (substitute* "Rakefile"
404 (("Bundler\\.setup") ""))
405 (substitute* "Gemfile-rspec-dependencies"
406 ((", :git => \"https://github.com/rspec.*")
407 "\n"))
408 (setenv "RAILS_VERSION" #$%ruby-rails-version)
409 (substitute* '("Gemfile-rails-dependencies"
410 "example_app_generator/generate_app.rb")
411 (("'sqlite3', .*")
412 (string-append
413 "'sqlite3', '~> "
414 #$(package-version
415 (this-package-native-input "ruby-sqlite3")) "'")))
416 (substitute* "rspec-rails.gemspec"
417 (("'aruba', '~> 0.14.12'")
418 "'aruba', '>= 0.14.12'")
419 (("'cucumber', '~> 7.0'")
420 "'cucumber', '>= 7.0'"))))
421 (replace 'replace-git-ls-files
422 (lambda _
423 (substitute* "rspec-rails.gemspec"
424 (("`git ls-files -- lib/\\*`")
425 "`find lib -type f |sort`"))))
426 (add-before 'check 'patch-tests
427 (lambda _
428 ;; Requires chrome or firefox.
429 (delete-file "spec/rspec/rails/example/system_example_group_spec.rb")
430 ;; Requires Bundler.
431 (delete-file "spec/sanity_check_spec.rb")
432 ;; It just checks a Git output.
433 (delete-file "spec/rspec/rails_spec.rb")))
434 (add-before 'check 'set-GEM_PATH
435 (lambda _
436 (setenv "GEM_PATH" (string-append
437 (getenv "GEM_PATH") ":"
438 #$output "/lib/ruby/vendor_ruby"))))
439 (delete 'check) ;moved after install phase
440 (add-after 'install 'check
441 (assoc-ref %standard-phases 'check)))))
442 (native-inputs
443 (list ruby-ammeter-bootstrap
444 ruby-aruba
445 ruby-capybara
446 ruby-cucumber
447 ruby-puma
448 ruby-rails
449 ruby-rspec
450 ruby-selenium-webdriver
451 ruby-sqlite3))
452 (propagated-inputs
453 (list ruby-actionpack
454 ruby-activesupport
455 ruby-railties
456 ruby-rspec-core
457 ruby-rspec-expectations
458 ruby-rspec-mocks
459 ruby-rspec-support))
460 (synopsis "Use RSpec to test Ruby on Rails applications")
461 (description
462 "This package provides support for using RSpec to test Ruby on Rails
463applications, in pace of the default Minitest testing library.")
464 (home-page "https://github.com/rspec/rspec-rails")
465 (license license:expat)))
466
467(define-public ruby-rails-html-sanitizer
468 (package
469 (name "ruby-rails-html-sanitizer")
470 (version "1.6.0")
471 (source
472 (origin
473 (method url-fetch)
474 (uri (rubygems-uri "rails-html-sanitizer" version))
475 (sha256
476 (base32
477 "1pm4z853nyz1bhhqr7fzl44alnx4bjachcr6rh6qjj375sfz3sc6"))))
478 (build-system ruby-build-system)
479 (arguments
480 '(;; No included tests
481 #:tests? #f))
482 (propagated-inputs
483 (list ruby-loofah ruby-nokogiri))
484 (synopsis "HTML sanitization for Rails applications")
485 (description
486 "This gem is used to handle HTML sanitization in Rails applications. If
487you need similar functionality in non Rails apps consider using Loofah
488directly.")
489 (home-page "https://github.com/rails/rails-html-sanitizer")
490 (license license:expat)))
491
492(define-public ruby-rails-dom-testing
493 (package
494 (name "ruby-rails-dom-testing")
495 (version "2.2.0")
496 (source
497 (origin
498 (method git-fetch)
499 (uri (git-reference
500 (url "https://github.com/rails/rails-dom-testing")
501 (commit (string-append "v" version))))
502 (file-name (git-file-name name version))
503 (sha256
504 (base32
505 "0ydzwdmssapp0x9gy19qy11b3f1yp56zc1kc971dajq9x7jl3jfa"))))
506 (build-system ruby-build-system)
507 (arguments
508 (list
509 #:phases
510 #~(modify-phases %standard-phases
511 (add-after 'unpack 'delete-gemfile.lock
512 (lambda _
513 (delete-file "Gemfile.lock"))))))
514 (native-inputs
515 (list bundler))
516 (propagated-inputs
517 (list ruby-activesupport ruby-nokogiri))
518 (synopsis "Compare HTML DOMs and assert certain elements exists")
519 (description
520 "This gem can compare HTML and assert certain elements exists. This is
521useful when writing tests.")
522 (home-page "https://github.com/rails/rails-dom-testing")
523 (license license:expat)))
524
525(define-public ruby-actiontext
526 (package
527 (name "ruby-actiontext")
528 (version %ruby-rails-version)
529 (source ruby-rails-monorepo)
530 (build-system ruby-build-system)
531 (arguments
532 (list
533 #:tests? #f ;avoid a cycle with ruby-rails
534 #:phases
535 #~(modify-phases %standard-phases
536 (add-after 'extract-gemspec 'chdir
537 (lambda _
538 (chdir "actiontext"))))))
539 (propagated-inputs
540 (list ruby-actionpack
541 ruby-activerecord
542 ruby-activestorage
543 ruby-activesupport
544 ruby-nokogiri))
545 (synopsis "Edit and display rich text in Rails applications")
546 (description
547 "ActionText edits and displays rich text in Rails applications.")
548 (home-page "https://rubyonrails.org")
549 (license license:expat)))
550
551(define-public ruby-actionview
552 (package
553 (name "ruby-actionview")
554 (version %ruby-rails-version)
555 (source ruby-rails-monorepo)
556 (build-system ruby-build-system)
557 (arguments
558 (list
559 ;; XXX: This gem appears to load action_controller, provided by
560 ;; ruby-actionpack, but actionpack propagates ruby-actionview,
561 ;; introducing a circular dependency.
562 #:tests? #f
563 #:test-target "test:template"
564 #:phases
565 #~(modify-phases %standard-phases
566 (add-after 'extract-gemspec 'chdir
567 (lambda _
568 (chdir "actionview"))))))
569 (propagated-inputs
570 (list ruby-activesupport
571 ruby-builder
572 ruby-erubi
573 ruby-rails-dom-testing
574 ruby-rails-html-sanitizer))
575 (synopsis "Conventions and helpers for building web pages")
576 (description
577 "ActionView provides conventions and helpers for building web pages in
578Ruby.")
579 (home-page "https://rubyonrails.org/")
580 (license license:expat)))
581
582(define-public ruby-actionpack
583 (package
584 (name "ruby-actionpack")
585 (version %ruby-rails-version)
586 (source ruby-rails-monorepo)
587 (build-system ruby-build-system)
588 (arguments
589 (list
590 #:phases
591 #~(modify-phases %standard-phases
592 (add-after 'extract-gemspec 'chdir
593 (lambda _
594 (chdir "actionpack")))
595 (add-before 'check 'delete-problematic-tests
596 (lambda _
597 (let-syntax ((skip-tests
598 (syntax-rules ()
599 ((_ file test ...)
600 (substitute* file
601 ;; ActiveSupport test case.
602 (((string-append "test \"" test "\".*") all)
603 (string-append
604 all " skip 'fails on guix'\n")) ...
605 ;; MiniTest test case.
606 (((string-append "def " test ".*") all)
607 (string-append
608 all " skip('fails on guix')\n")) ...)))))
609
610 (with-directory-excursion "test"
611 (for-each delete-file
612 ;; These tests depend on rails, which depends on
613 ;; this package.
614 '("dispatch/mount_test.rb"
615 "dispatch/prefix_generation_test.rb"
616 "dispatch/routing_assertions_test.rb"
617 "dispatch/routing/inspector_test.rb"
618 "controller/live_stream_test.rb"
619 "controller/integration_test.rb"
620 "controller/test_case_test.rb"))
621
622 ;; This might be resolved by upgrading to version 8.0 or
623 ;; later (see: https://github.com/rails/rails/issues/55093).
624 (skip-tests "controller/caching_test.rb"
625 "test_preserves_order_when_reading_from_cache_plus_rendering")
626
627 ;; The following test failures have been reported upstream
628 ;; (see: https://github.com/rails/rails/issues/47615).
629 (skip-tests "controller/new_base/render_streaming_test.rb"
630 ;; These tests fail due to white space
631 ;; characters in the compared strings.
632 "rendering with streaming no layout"
633 "rendering with streaming enabled at the \
634class level"
635 "rendering with streaming given to render"
636 "rendering with layout exception"
637 "rendering with template exception"
638 "rendering with streaming do not override \
639explicit cache control given to render")
640
641 (skip-tests "dispatch/system_testing/driver_test.rb"
642 ;; These tests require Firefox.
643 "initializing the driver with a headless firefox"
644 "define extra capabilities using headless_firefox"
645 "define extra capabilities using firefox"
646 ;; These tests require Chrome.
647 "initializing the driver with a browser"
648 "initializing the driver with a headless chrome"
649 "define extra capabilities using headless_chrome"
650 "define extra capabilities using chrome"
651 ;; This test requires geckodriver.
652 "does not define extra capabilities")
653
654 ;; These depends on firefox or chrome.
655 (delete-file "dispatch/system_testing/system_test_case_test.rb")
656 (delete-file "dispatch/system_testing/screenshot_helper_test.rb")
657
658 ;; Small translation errors.
659 (skip-tests "abstract/translation_test.rb" "\
660test_translate_marks_translation_with_missing_nested_html_key_as_safe" "\
661test_translate_marks_translation_with_missing_html_key_as_safe")
662
663 ;; IPSpoofAttackError
664 (skip-tests "dispatch/request_test.rb"
665 "remote ip spoof detection"
666 "remote ip v6 spoof detection")
667
668 (skip-tests "dispatch/session/cache_store_test.rb"
669 ;; This test fails with: "NoMethodError:
670 ;; undefined method `hash_for' for
671 ;; #<Rack::Test::CookieJar:0x0000000003572170>".
672 "test_getting_session_value_after_session_reset"))))))))
673 (native-inputs
674 (list ruby-activemodel
675 ruby-capybara
676 ruby-selenium-webdriver
677 ruby-zeitwerk))
678 (propagated-inputs
679 (list ruby-actionview
680 ruby-activesupport
681 ruby-rack
682 ruby-rack-cache
683 ruby-rack-session
684 ruby-rack-test
685 ruby-rails-dom-testing
686 ruby-rails-html-sanitizer
687 ruby-useragent))
688 (synopsis "Conventions for building and testing MVC web applications")
689 (description
690 "ActionPack provides conventions for building and testing MVC web
691applications. These work with any Rack-compatible server.")
692 (home-page "https://rubyonrails.org/")
693 (license license:expat)))
694
695(define-public ruby-actioncable
696 (package
697 (name "ruby-actioncable")
698 (version %ruby-rails-version)
699 (source ruby-rails-monorepo)
700 (build-system ruby-build-system)
701 (arguments
702 (list
703 #:phases
704 #~(modify-phases %standard-phases
705 (add-after 'extract-gemspec 'chdir
706 (lambda _
707 (chdir "actioncable")))
708 (delete 'check) ;moved after install phase
709 (add-after 'install 'check
710 (assoc-ref %standard-phases 'check))
711 (add-before 'check 'set-GEM_PATH
712 (lambda _
713 (setenv "GEM_PATH" (string-append
714 (getenv "GEM_PATH") ":"
715 #$output "/lib/ruby/vendor_ruby"))))
716 (add-before 'check 'disable-problematic-tests
717 (lambda _
718 ;; There are multiple client test failures (see:
719 ;; https://github.com/rails/rails/issues/47617).
720 (delete-file "test/client_test.rb")
721 ;; This requires yarn.
722 (delete-file "test/javascript_package_test.rb")))
723 (add-before 'check 'start-redis
724 (lambda* (#:key tests? #:allow-other-keys)
725 (when tests?
726 (invoke "redis-server" "--daemonize" "yes")))))))
727 (native-inputs
728 (list redis
729 ruby-activerecord
730 ruby-pg
731 ruby-puma
732 ruby-redis
733 ruby-websocket-client-simple
734 ruby-zeitwerk))
735 (propagated-inputs
736 (list ruby-actionpack
737 ruby-activesupport
738 ruby-nio4r
739 ruby-websocket-driver))
740 (synopsis "Integrate integrates WebSockets with Rails applications")
741 (description
742 "Action Cable integrates WebSockets with Rails applications. Through
743WebSockets it allows for real-time features in web applications.")
744 (home-page "https://rubyonrails.org/")
745 (license license:expat)))
746
747(define-public ruby-activejob
748 (package
749 (name "ruby-activejob")
750 (version %ruby-rails-version)
751 (source ruby-rails-monorepo)
752 (build-system ruby-build-system)
753 (arguments
754 (list
755 #:phases
756 #~(modify-phases %standard-phases
757 (add-after 'extract-gemspec 'chdir
758 (lambda _
759 (chdir "activejob")))
760 (add-after 'chdir 'delete-problematic-tests
761 (lambda _
762 (substitute* "Rakefile"
763 ;; Remove the adapters that aren't yet packaged or would
764 ;; introduce cyclic dependencies.
765 (("backburner ") "")
766 (("resque ") "")
767 (("sidekiq ") "")
768 (("sneakers ") "")
769 (("sucker_punch ") ""))
770 (substitute* "test/cases/exceptions_test.rb"
771 (("ActiveJob::QueueAdapters::SneakersAdapter") "")))))))
772 (native-inputs
773 (list ruby-queue-classic
774 ruby-delayed-job
775 ruby-que
776 ruby-zeitwerk))
777 (propagated-inputs
778 (list ruby-activesupport
779 ruby-globalid))
780 (synopsis "Declare job classes for multiple backends")
781 (description "ActiveJob allows declaring job classes in a common way
782across Rails applications.")
783 (home-page "https://rubyonrails.org/")
784 (license license:expat)))
785
786(define-public ruby-activestorage
787 (package
788 (name "ruby-activestorage")
789 (version %ruby-rails-version)
790 (source ruby-rails-monorepo)
791 (build-system ruby-build-system)
792 (arguments
793 (list
794 ;; The test suite is disabled, because it activestorage requires
795 ;; 'rails', which would introduce a dependency cycle.
796 #:tests? #f
797 #:phases
798 #~(modify-phases %standard-phases
799 (add-after 'extract-gemspec 'chdir
800 (lambda _
801 (chdir "activestorage"))))))
802 (propagated-inputs
803 (list ruby-actionpack
804 ruby-activejob
805 ruby-activerecord
806 ruby-activesupport
807 ruby-marcel
808 ruby-mini-mime))
809 (synopsis "Integrate file storage services in to Rails applications")
810 (description
811 "ActiveStorage integrates file storage services with Rails applications,
812allowing files to be attached to ActiveRecord models.")
813 (home-page "https://rubyonrails.org/")
814 (license license:expat)))
815
816(define-public ruby-actionmailbox
817 (package
818 (name "ruby-actionmailbox")
819 (version %ruby-rails-version)
820 (source ruby-rails-monorepo)
821 (build-system ruby-build-system)
822 (arguments
823 (list
824 #:tests? #f ;avoid a cycle with ruby-rails
825 #:phases
826 #~(modify-phases %standard-phases
827 (add-after 'extract-gemspec 'chdir
828 (lambda _
829 (chdir "actionmailbox"))))))
830 (propagated-inputs
831 (list ruby-actionpack
832 ruby-activejob
833 ruby-activerecord
834 ruby-activestorage
835 ruby-activesupport
836 ruby-mail))
837 (synopsis "Receive and process incoming emails in Rails applications")
838 (description
839 "ActionMailbox receives and processes incoming emails in Rails applications.")
840 (home-page "https://rubyonrails.org")
841 (license license:expat)))
842
843(define-public ruby-actionmailer
844 (package
845 (name "ruby-actionmailer")
846 (version %ruby-rails-version)
847 (source ruby-rails-monorepo)
848 (build-system ruby-build-system)
849 (arguments
850 (list
851 #:tests? #f ;avoid a cycle with ruby-rails
852 #:phases
853 #~(modify-phases %standard-phases
854 (add-after 'extract-gemspec 'chdir
855 (lambda _
856 (chdir "actionmailer"))))))
857 (propagated-inputs
858 (list ruby-actionpack
859 ruby-actionview
860 ruby-activejob
861 ruby-activesupport
862 ruby-mail
863 ruby-rails-dom-testing))
864 (synopsis "Work with emails using the controller/view pattern")
865 (description
866 "Compose, deliver, receive, and test emails using the controller/view
867pattern. Including support for multipart email and attachments.")
868 (home-page "https://rubyonrails.org/")
869 (license license:expat)))
870
871;; A variant where the ruby-rspec-rails dependency purposefully omitted to
872;; avoid a dependency cycle with that same package.
873(define-public ruby-ammeter-bootstrap
874 (package
875 (name "ruby-ammeter-bootstrap")
876 (version "1.1.7")
877 (source (origin
878 (method url-fetch)
879 (uri (rubygems-uri "ammeter" version))
880 (sha256
881 (base32
882 "1y8idnc7v0w82mmri17902ahn56x0wqcny496mmsg4n3vham702r"))))
883 (build-system ruby-build-system)
884 (arguments
885 (list #:tests? #f
886 #:phases
887 #~(modify-phases %standard-phases
888 (add-after 'extract-gemspec 'remove-rails-requirement
889 (lambda _
890 (substitute* "Gemfile"
891 (("gem 'rspec-rails', rspec_version")
892 "")
893 (("gem 'rails', rails_version")
894 "")))))))
895 (propagated-inputs (list ruby-activesupport ruby-railties))
896 (synopsis "Write specs for your Rails 3+ generators")
897 (description "The @code{ammeter} gem makes it easy to write specs for
898Rails generators. An existing user is @code{rspec-rails}, which uses
899@code{ammeter} to spec its own generators.")
900 (home-page "https://github.com/alexrothenberg/ammeter")
901 (properties '((hidden? . #t)))
902 (license license:expat)))
903
904(define-public ruby-ammeter
905 (package/inherit ruby-ammeter-bootstrap
906 (name "ruby-ammeter")
907 ;; TODO: The test suite requires multiple packages which are not packaged
908 ;; yet.
909 (arguments (list #:tests? #f))
910 (propagated-inputs
911 (modify-inputs propagated-inputs
912 (append ruby-rspec-rails)))
913 (properties
914 (alist-delete 'hidden? (package-properties ruby-ammeter-bootstrap)))))
915
916(define-public ruby-bootsnap
917 (package
918 (name "ruby-bootsnap")
919 (version "1.18.6")
920 (source (origin
921 (method git-fetch) ;for tests
922 (uri (git-reference
923 (url "https://github.com/Shopify/bootsnap")
924 (commit (string-append "v" version))))
925 (file-name (git-file-name name version))
926 (sha256
927 (base32
928 "1dd9qffwhfzd4lzv264mcvx3w8zw4inwywgarfjnwa31nfxwb1r2"))))
929 (build-system ruby-build-system)
930 (arguments
931 (list
932 #:test-target "default"
933 #:phases
934 #~(modify-phases %standard-phases
935 (add-after 'extract-gemspec 'relax-requirements
936 (lambda _
937 (substitute* "Gemfile"
938 ;; Rubocop and byebug are not actually needed to run the
939 ;; tests.
940 ((".*rubocop.*") "")
941 ((".*byebug.*") ""))))
942 (replace 'replace-git-ls-files
943 (lambda _
944 (substitute* "bootsnap.gemspec"
945 (("`git ls-files -z ext lib`")
946 "`find ext lib -type f -print0 | sort -z`")))))))
947 (native-inputs (list ruby-mocha ruby-rake-compiler))
948 (propagated-inputs (list ruby-msgpack))
949 (synopsis "Accelerator for large Ruby/Rails application")
950 (description "Bootsnap is a library that plugs into Ruby, with optional
951support for YAML, to optimize and cache expensive computations.")
952 (home-page "https://github.com/Shopify/bootsnap")
953 (license license:expat)))
954
955;;; A private variant used to bootstrap railties.
956(define ruby-importmap-rails-bootstrap
957 (package
958 (name "ruby-importmap-rails-bootstrap")
959 (version "2.1.0")
960 (source (origin
961 (method git-fetch) ;for tests
962 (uri (git-reference
963 (url "https://github.com/rails/importmap-rails")
964 (commit (string-append "v" version))))
965 (file-name (git-file-name name version))
966 (sha256
967 (base32
968 "1mv223davpm0z50i787yiy49fiakd8ay5slmimyrg5cl3cjrvzm9"))))
969 (build-system ruby-build-system)
970 (arguments
971 (list #:tests? #f ;avoid all extra dependencies
972 #:phases
973 #~(modify-phases %standard-phases
974 (add-after 'unpack 'patch-rails-version
975 (lambda _
976 (substitute* (cons* "Appraisals"
977 (find-files "gemfiles" "\\.gemfile$"))
978 (("7\\.1\\.0")
979 #$%ruby-rails-version)))))))
980 ;; Leave out ruby-railties, for bootstrapping purposes.
981 (propagated-inputs (list ruby-actionpack))
982 (synopsis "Tool to manage modern JavaScript in Rails")
983 (description "Import maps can import JavaScript modules using logical
984names that map to versioned/digested files -- directly from the browser. It
985makes it possible to build modern JavaScript applications using JavaScript
986libraries made for ES modules (ESM) without the need for transpiling or
987bundling, which removes the need for Webpack, Yarn, npm, or any other part of
988the JavaScript toolchain. All that is needed is the asset pipeline that is
989already included in Rails.")
990 (home-page "https://github.com/rails/importmap-rails")
991 (license license:expat)))
992
993(define-public ruby-importmap-rails
994 (package/inherit ruby-importmap-rails-bootstrap
995 (name "ruby-importmap-rails")
996 (arguments
997 (list #:phases
998 #~(modify-phases %standard-phases
999 (add-after 'unpack 'patch-rails-version
1000 (lambda _
1001 (substitute* (cons* "Appraisals"
1002 (find-files "gemfiles" "\\.gemfile$"))
1003 (("7\\.1\\.0")
1004 #$%ruby-rails-version))))
1005 (add-after 'extract-gemspec 'relax-requirements
1006 (lambda _
1007 (delete-file "gemfiles/rails_7_1_propshaft.gemfile.lock")
1008 (substitute* "gemfiles/rails_7_1_propshaft.gemfile"
1009 ((".*gem \"byebug\".*") "")
1010 ;; Remove appraisal, and add tzinfo-data, which needs to
1011 ;; be in the Gemfile to become available.
1012 ((".*appraisal.*")
1013 "gem 'tzinfo-data'\n")
1014 ;; This gem is for managing *installation* of
1015 ;; webdrivers... we do not want that.
1016 ((".*gem \"webdrivers\".*") ""))))
1017 (add-before 'check 'set-BUNDLE_GEMFILE
1018 (lambda _
1019 (setenv "BUNDLE_GEMFILE"
1020 "gemfiles/rails_7_1_propshaft.gemfile")))
1021 (add-before 'check 'disable-problematic-tests
1022 (lambda _
1023 ;; All bin/importmap invocation fail.
1024 ;; At least one requires networking.
1025 (delete-file "test/commands_test.rb")
1026 ;; Bundler, probably requires networking
1027 (delete-file "test/installer_test.rb")
1028 ;; The integration tests require networking; disable them.
1029 (delete-file "test/npm_integration_test.rb")
1030 (delete-file "test/packager_integration_test.rb"))))))
1031 (native-inputs
1032 (list git-minimal/pinned
1033 ruby-capybara
1034 ruby-propshaft
1035 ruby-rails
1036 ruby-rexml
1037 ruby-selenium-webdriver
1038 ruby-sqlite3-1.4
1039 ruby-stimulus-rails
1040 ruby-turbo-rails
1041 ruby-tzinfo
1042 ruby-tzinfo-data))
1043 (propagated-inputs
1044 (list ruby-actionpack
1045 ruby-railties))))
1046
1047(define-public ruby-marcel
1048 (package
1049 (name "ruby-marcel")
1050 (version "1.0.4")
1051 (source (origin
1052 (method git-fetch)
1053 (uri (git-reference
1054 (url "https://github.com/rails/marcel")
1055 (commit (string-append "v" version))))
1056 (file-name (git-file-name name version))
1057 (sha256
1058 (base32
1059 "08lfdzv7niy0wyh6lh4zp47li35shg8dyik02m9h9xfldxri5gjw"))))
1060 (build-system ruby-build-system)
1061 (arguments
1062 (list
1063 #:test-target "default"
1064 #:phases
1065 #~(modify-phases %standard-phases
1066 (add-after 'unpack 'patch
1067 (lambda _
1068 ;; Remove byebug dependency
1069 (substitute* "test/test_helper.rb"
1070 (("require 'byebug'") ""))))
1071 (add-before 'check 'disable-problematic-tests
1072 (lambda _
1073 (substitute* "test/mime_type_test.rb"
1074 ;; One test fails because of the newer rack
1075 ;; version used (see:
1076 ;; https://github.com/rails/marcel/issues/91).
1077 (("test \"gets content type.*" all)
1078 (string-append
1079 all " skip('fails on guix')\n"))))))))
1080 (native-inputs (list ruby-nokogiri ruby-rack))
1081 (propagated-inputs (list ruby-mimemagic))
1082 (synopsis "MIME type detection using magic numbers, filenames and extensions")
1083 (description
1084 "@code{marcel} provides @acronym{MIME, Multipurpose Internet Mail
1085Extensions} type detection using magic numbers, filenames, and extensions")
1086 (home-page "https://github.com/rails/marcel")
1087 (license license:expat)))
1088
1089(define-public ruby-propshaft
1090 (package
1091 (name "ruby-propshaft")
1092 (version "0.7.0")
1093 (source (origin
1094 (method url-fetch)
1095 (uri (rubygems-uri "propshaft" version))
1096 (sha256
1097 (base32
1098 "19s5qvfady49b9b6dcvz6nsna1lvckw509ddh3ihmdz0w4qrjy49"))))
1099 (build-system ruby-build-system)
1100 (propagated-inputs (list ruby-actionpack ruby-activesupport ruby-rack
1101 ruby-railties))
1102 (synopsis "Asset pipeline library for Rails")
1103 (description "Propshaft is an asset pipeline library for Rails. It's
1104built for an era where bundling assets to save on HTTP connections is no
1105longer urgent, where JavaScript and CSS are either compiled by dedicated
1106Node.js bundlers or served directly to the browsers, and where increases in
1107bandwidth have made the need for minification less pressing. These factors
1108allow for a dramatically simpler and faster asset pipeline compared to
1109previous options, like Sprockets.")
1110 (home-page "https://github.com/rails/propshaft")
1111 (license license:expat)))
1112
1113;;; Pro-tip: to get a summary of the failures, run
1114;;; 'M-x occur [1-9][0-9]* \(failures\|errors\)' on the build log.
1115(define-public ruby-railties
1116 (package
1117 (name "ruby-railties")
1118 (version %ruby-rails-version)
1119 (source ruby-rails-monorepo)
1120 (build-system ruby-build-system)
1121 (arguments
1122 (list
1123 #:phases
1124 #~(modify-phases %standard-phases
1125 (add-after 'unpack 'delete-gemfiles
1126 (lambda _
1127 ;; Delete Gemfile and Gemfile.lock, as they contains too many
1128 ;; dependencies not actually useful here.
1129 (delete-file "Gemfile")
1130 (delete-file "Gemfile.lock")))
1131 (add-after 'extract-gemspec 'chdir
1132 (lambda _
1133 (chdir "railties")))
1134 (add-after 'chdir 'disable-bundler
1135 (lambda _
1136 (substitute* (append (list "Rakefile")
1137 (find-files "test" "\\.rb$")
1138 (find-files "lib" "\\.tt$"))
1139 ;; Do not use Bundler, which causes errors such as not finding
1140 ;; the gem of this package (railties), or preferring the other
1141 ;; in-source gems.
1142 (("`bundle exec") "`")
1143 ((".*require \"bundler/setup\".*") "")
1144 ((".*Bundler.require.*") ""))
1145 ;; Adjust a runtime substitution that uses a removed
1146 ;; Bundler.require in its pattern; instead of matching
1147 ;; "Bundler.require", it now appends to the 'require
1148 ;; "rails/all"' line in the generated 'application.rb' template
1149 ;; generated from
1150 ;; "lib/rails/generators/rails/app/templates/config/application.rb.tt".
1151 (substitute* "test/isolation/abstract_unit.rb"
1152 (("contents.sub!\\(/\\^Bundler\\\\.require\\.\\*/, \"([^\"]*)"
1153 _ replacement)
1154 (format #f "contents.sub!('require \"rails/all\"', \"\\\\0\\n~a"
1155 replacement)))))
1156 (add-after 'chdir 'do-not-load-other-gems-from-source
1157 (lambda _
1158 ;; The Rakefile adds '-I' Ruby options so that the other Rails
1159 ;; libraries are loaded from source; since they are already
1160 ;; packaged separately, use these instead.
1161 (substitute* "Rakefile"
1162 ((".*\"\\.\\./activesupport/lib\",.*") "")
1163 ((".*\"\\.\\./actionpack/lib\",.*") "")
1164 ((".*\"\\.\\./actionview/lib\",.*") "")
1165 ((".*\"\\.\\./activemodel/lib\".*") ""))))
1166 (add-after 'chdir 'patch-paths
1167 (lambda _
1168 (substitute* "lib/rails/generators/base.rb"
1169 (("/usr/bin/env") (which "env")))))
1170 (delete 'check) ;moved after install phase
1171 (add-after 'install 'check
1172 (assoc-ref %standard-phases 'check))
1173 (add-before 'check 'prepare-for-tests
1174 (lambda _
1175 (define (touch file-name)
1176 (call-with-output-file file-name (const #t)))
1177 ;; Otherwise, the test suite attempts to use yarn to fetch
1178 ;; NodeJS modules.
1179 (mkdir-p "../actionview/lib/assets/compiled")
1180 (touch "../actionview/lib/assets/compiled/rails-ujs.js")
1181 (mkdir-p "test/isolation/assets/node_modules")
1182 ;; Git requires to be able to write to HOME.
1183 (setenv "HOME" "/tmp")))
1184 (add-before 'check 'disable-problematic-tests
1185 (lambda _
1186 (let-syntax ((skip-tests
1187 (syntax-rules ()
1188 ((_ file test ...)
1189 (substitute* file
1190 ;; ActiveSupport test case.
1191 (((string-append "test \"" test "\".*") all)
1192 (string-append
1193 all " skip 'fails on guix'\n")) ...
1194 ;; MiniTest test case.
1195 (((string-append "def " test ".*") all)
1196 (string-append
1197 all " skip('fails on guix')\n")) ...)))))
1198 (with-directory-excursion "test"
1199 ;; This test requires 'rails' and Bundler.
1200 (delete-file "application/server_test.rb")
1201 ;; These depends on firefox or chrome.
1202 (delete-file "application/active_job_adapter_test.rb")
1203 (delete-file "application/system_test_case_test.rb")
1204 ;; These tests requires the assets which we lack.
1205 (delete-file "application/assets_test.rb")
1206 (delete-file "railties/generators_test.rb")
1207 ;; This test requires Bundler.
1208 (skip-tests "generators/api_app_generator_test.rb"
1209 "test_app_update_does_not_generate_public_files")
1210 (skip-tests "generators/shared_generator_tests.rb"
1211 ;; This test checks that bin/rails has /usr/bin/env has a
1212 ;; shebang and fails.
1213 "test_shebang_when_is_the_same_as_default_use_env"
1214 "test_generated_files_have_no_rubocop_warnings")
1215 (skip-tests "generators/app_generator_test.rb"
1216 ;; These tests requires networking.
1217 "test_app_update_create_new_framework_defaults"
1218 "test_app_update_does_not_change_config_target_version"
1219 "test_app_update_does_not_change_app_name_when_app_name_\
1220is_hyphenated_name"
1221 "test_app_update_does_not_create_rack_cors"
1222 "test_app_update_does_not_generate_bootsnap_contents_\
1223when_skip_bootsnap_is_given"
1224 "test_app_update_does_not_remove_rack_cors_if_already_present"
1225 "test_app_update_does_not_generate_manifest_config_\
1226when_propshaft_is_used"
1227 "test_app_update_does_not_generate_action_cable_\
1228contents_when_skip_action_cable_is_given"
1229 "test_app_update_preserves_propshaft"
1230 "test_app_update_preserves_skip_action_mailbox"
1231 "test_app_update_preserves_skip_action_text"
1232 "test_app_update_preserves_skip_system_test"
1233 "test_app_update_preserves_skip_test"
1234 "test_application_name_is_detected_if_it_exists_and_app_folder_renamed"
1235 "test_template_from_url"
1236 ;; These tests require Bundler.
1237 "test_generation_use_original_bundle_environment"
1238 "test_app_update_does_not_generate_assets_initializer_when_sprockets_and_propshaft_are_not_used"
1239 "test_app_update_does_not_generate_active_storage_contents_when_skip_active_record_is_given"
1240 "test_app_update_does_not_generate_active_storage_contents_when_skip_active_storage_is_given"
1241 "test_app_update_preserves_skip_active_job"
1242 ;; This test requires Rubocop.
1243 "test_app_update_preserves_skip_rubocop"
1244 ;; These tests require assets.
1245 "test_css_option_with_cssbundling_gem"
1246 "test_css_option_with_asset_pipeline_sass"
1247 ;; These tests require the rails/command
1248 ;; namespace provided by the 'ruby-rails'
1249 ;; package, which depends on this one.
1250 "test_app_update_generates_public_folders"
1251 "test_app_update_preserves_skip_brakeman"
1252 "test_app_update_supports_pretend"
1253 "test_app_update_supports_skip"
1254 "test_css_option_with_asset_pipeline_tailwind"
1255 "test_hotwire")
1256 ;; These tests require Rubocop.
1257 (skip-tests "application/generators_test.rb"
1258 "generators with apply_rubocop_autocorrect_after_generate!"
1259 "generators with apply_rubocop_autocorrect_after_generate! and pretend")
1260 (skip-tests
1261 "generators/plugin_generator_test.rb"
1262 ;; These tests require assets.
1263 "test_model_with_existent_application_record_in_mountable_engine"
1264 "test_dummy_application_loads_plugin"
1265 "test_generate_application_mailer_when_does_not_exist_in_\
1266mountable_engine"
1267 "test_generate_mailer_layouts_when_does_not_exist_in_mountable_engine"
1268 "test_ensure_that_migration_tasks_work_with_mountable_option"
1269 "test_generating_controller_inside_mountable_engine"
1270 "test_generate_application_job_when_does_not_exist_in_mountable_engine"
1271 "test_run_default"
1272 ;; This test expects a /usr/bin/env shebang.
1273 "test_shebang"
1274 ;; This test requires Bundler.
1275 "test_plugin_passes_generated_test")
1276 ;; The following tests require Gemfile or .bundle in their setup.
1277 (delete-file "generators/plugin_test_runner_test.rb")
1278 (skip-tests
1279 "generators/scaffold_controller_generator_test.rb"
1280 "test_controller_tests_pass_by_default_inside_full_engine"
1281 "test_controller_tests_pass_by_default_inside_mountable_engine")
1282 (skip-tests
1283 "generators/scaffold_generator_test.rb"
1284 "test_scaffold_tests_pass_by_default_inside_mountable_engine"
1285 "test_scaffold_tests_pass_by_default_inside_api_mountable_engine"
1286 "test_scaffold_tests_pass_by_default_inside_api_full_engine"
1287 "test_scaffold_on_invoke_inside_mountable_engine"
1288 "test_scaffold_tests_pass_by_default_inside_full_engine"
1289 "test_scaffold_tests_pass_by_default_inside_namespaced_\
1290mountable_engine")
1291 ;; Tests in this file require Bundler.
1292 (delete-file "generators/test_runner_in_engine_test.rb")
1293 ;; The actions_test tests depend on assets or the rails gem.
1294 (delete-file "generators/actions_test.rb")
1295 (skip-tests "engine/commands_test.rb"
1296 "test_server_command_work_inside_engine"
1297 "test_runner_command_work_inside_engine")
1298 ;; These tests fails because of cleanup code
1299 ;; when the environment lacks a PTY device (see:
1300 ;; https://github.com/rails/rails/issues/47656).
1301 (delete-file "engine/commands_test.rb")
1302 ;; The following tests require the 'rails' gem.
1303 (skip-tests "application/test_runner_test.rb"
1304 "test_run_app_without_rails_loaded"
1305 "test_generated_scaffold_works_with_rails_test"
1306 "test_load_fixtures_when_running_test_suites"
1307 "test_run_in_parallel_with_unmarshable_exception"
1308 "test_run_in_parallel_with_unknown_object"
1309 "test_system_tests_are_run_through_rake_test_when_given_in_TEST"
1310 "test_reset_sessions_before_rollback_on_system_tests"
1311 "test_reset_sessions_on_failed_system_test_screenshot"
1312 "test_parallel_testing_when_schema_is_not_up_to_date"
1313 "test_failed_system_test_screenshot_should_be_\
1314taken_before_other_teardown")
1315 (skip-tests
1316 "application/test_test.rb"
1317 "schema for all the models is loaded when tests are run in eager load context"
1318 "automatically synchronizes test schema after rollback"
1319 "hooks for plugins"
1320 "sql structure migrations when adding column to existing table"
1321 "sql structure migrations"
1322 "ruby schema migrations")
1323 ;; These tests require a PostgreSQL server accepting
1324 ;; connections under /var/run/postgresql.
1325 (skip-tests
1326 "application/rake_test.rb"
1327 "test_not_protected_when_previous_migration_was_not_production")
1328 (delete-file "application/rake/dbs_test.rb")
1329 (delete-file "application/rake/migrations_test.rb")
1330 (delete-file "application/rake/multi_dbs_test.rb")
1331 (skip-tests "isolation/abstract_unit.rb" "use_postgresql")
1332 ;; Requires rails gem.
1333 (delete-file "engine/test_test.rb")
1334 (skip-tests "railties/engine_test.rb"
1335 "active_storage:install task works within engine"
1336 "active_storage:update task works within engine"
1337 "rake environment can be called in the engine"
1338 "mountable engine should copy migrations within engine_path"
1339 ;; This test fails because we do not use the
1340 ;; in-source active/action gems.
1341 "i18n files have lower priority than application ones"
1342 ;; This test fails when not using Bundler.
1343 "setting priority for engines with config.railties_order")
1344 ;; This test requires a database server or networking.
1345 (delete-file "application/bin_setup_test.rb")
1346 (skip-tests "application/initializers/frameworks_test.rb"
1347 ;; These tests are either broken, or rely on
1348 ;; database availability
1349 "expire schema cache dump if the version can't be checked because the database is unhealthy"
1350 "does not expire schema cache dump if check_schema_cache_dump_version is false and the database unhealthy"
1351 "does not expire schema cache dump if check_schema_cache_dump_version is false")
1352 (skip-tests "commands/console_test.rb"
1353 "test_prompt_env_colorization"
1354 "test_reload_command_fires_preparation_and_cleanup_callbacks")
1355 (skip-tests "commands/credentials_test.rb"
1356 "edit command does not display save confirmation message if interrupted")
1357 (skip-tests "commands/encrypted_test.rb"
1358 "edit command does not display save confirmation message if interrupted")
1359 (skip-tests "commands/routes_test.rb"
1360 "rails routes with expanded option")
1361 (skip-tests "commands/server_test.rb"
1362 "test_served_url_when_server_prints_it")))))
1363 (add-before 'check 'set-paths
1364 (lambda _
1365 (setenv "PATH" (string-append (getenv "PATH") ":"
1366 #$output "/bin"))
1367 (setenv "GEM_PATH" (string-append
1368 (getenv "GEM_PATH") ":"
1369 #$output "/lib/ruby/vendor_ruby")))))))
1370 (native-inputs
1371 (list git-minimal/pinned
1372 ruby-actioncable
1373 ruby-actionmailbox
1374 ruby-actionmailer
1375 ruby-actiontext
1376 ruby-actionview
1377 ruby-activejob
1378 ruby-activemodel
1379 ruby-activerecord
1380 ruby-activestorage
1381 ruby-bcrypt
1382 ruby-bootsnap
1383 ruby-capybara
1384 ruby-dalli
1385 ruby-importmap-rails-bootstrap
1386 ruby-listen
1387 ruby-minitest-retry
1388 ruby-mysql2
1389 ruby-pg
1390 ruby-selenium-webdriver
1391 ruby-sprockets-rails
1392 sqlite))
1393 (propagated-inputs
1394 (list ruby-actionpack
1395 ruby-activesupport
1396 ruby-method-source
1397 ruby-rackup-1
1398 ruby-rake
1399 ruby-thor
1400 ruby-webrick
1401 ruby-zeitwerk))
1402 (synopsis "Rails internals, including application bootup and generators")
1403 (description "@code{railties} provides the core Rails internals including
1404handling application bootup, plugins, generators, and Rake tasks.")
1405 (home-page "https://rubyonrails.org")
1406 (license license:expat)))
1407
1408(define-public ruby-sassc-rails
1409 (package
1410 (name "ruby-sassc-rails")
1411 (version "2.1.2")
1412 (source (origin
1413 (method url-fetch)
1414 (uri (rubygems-uri "sassc-rails" version))
1415 (sha256
1416 (base32
1417 "1d9djmwn36a5m8a83bpycs48g8kh1n2xkyvghn7dr6zwh4wdyksz"))))
1418 (build-system ruby-build-system)
1419 ;; The test suite currently fails with multiple "FrozenError: can't modify
1420 ;; frozen Array: []" errors, apparently caused by Rails 7 (see:
1421 ;; https://github.com/sass/sassc-rails/pull/178/files).
1422 (arguments (list #:tests? #f
1423 #:phases #~(modify-phases %standard-phases
1424 (add-after 'extract-gemspec 'relax-requirements
1425 (lambda _
1426 (substitute* "sassc-rails.gemspec"
1427 (("%q<rake>.freeze, \\[\"~> 10.0\"]")
1428 "%q<rake>.freeze, [\">= 10.0\"]")))))))
1429 (native-inputs (list ruby-mocha ruby-pry ruby-tzinfo-data))
1430 (propagated-inputs (list ruby-railties ruby-sassc ruby-sprockets
1431 ruby-sprockets-rails ruby-tilt))
1432 (synopsis "SassC-Ruby integration with Rails")
1433 (description "This Ruby library integrates SassC-Ruby into Rails.")
1434 (home-page "https://github.com/sass/sassc-rails")
1435 (license license:expat)))
1436
1437(define-public ruby-sprockets
1438 (package
1439 (name "ruby-sprockets")
1440 (version "4.2.0")
1441 (source
1442 (origin
1443 (method url-fetch)
1444 (uri (rubygems-uri "sprockets" version))
1445 (sha256
1446 (base32
1447 "0k0236g4h3ax7v6vp9k0l2fa0w6f1wqp7dn060zm4isw4n3k89sw"))))
1448 (build-system ruby-build-system)
1449 (arguments
1450 '(;; No included tests
1451 #:tests? #f))
1452 (propagated-inputs
1453 (list ruby-concurrent-ruby ruby-rack))
1454 (synopsis "Sprockets is a Rack-based asset packaging system")
1455 (description
1456 "Sprockets is a Rack-based asset packaging system that concatenates and
1457serves JavaScript, CoffeeScript, CSS, LESS, Sass, and SCSS.")
1458 (home-page "https://github.com/rails/sprockets")
1459 (license license:expat)))
1460
1461(define-public ruby-sprockets-rails
1462 (package
1463 (name "ruby-sprockets-rails")
1464 (version "3.4.2")
1465 (source
1466 (origin
1467 (method url-fetch)
1468 (uri (rubygems-uri "sprockets-rails" version))
1469 (sha256
1470 (base32
1471 "1b9i14qb27zs56hlcc2hf139l0ghbqnjpmfi0054dxycaxvk5min"))))
1472 (build-system ruby-build-system)
1473 (arguments
1474 '(;; No included tests
1475 #:tests? #f))
1476 (propagated-inputs
1477 (list ruby-actionpack ruby-activesupport ruby-sprockets))
1478 (synopsis "Sprockets Rails integration")
1479 (description
1480 "Provides Sprockets implementation for the Rails Asset Pipeline.")
1481 (home-page
1482 "https://github.com/rails/sprockets-rails")
1483 (license license:expat)))
1484
1485(define-public ruby-stimulus-rails
1486 (package
1487 (name "ruby-stimulus-rails")
1488 (version "1.2.1")
1489 (source (origin
1490 (method url-fetch)
1491 (uri (rubygems-uri "stimulus-rails" version))
1492 (sha256
1493 (base32
1494 "12hfdzh6cwahbd6p4r0r0d14n3laj3cqasx9w18wga9fq70bq6w3"))))
1495 (build-system ruby-build-system)
1496 (propagated-inputs (list ruby-railties))
1497 (synopsis "Modest JavaScript framework for Rails")
1498 (description "This package provides a modest JavaScript framework for the
1499HTML you already have.")
1500 (home-page "https://stimulus.hotwired.dev")
1501 (license license:expat)))
1502
1503(define-public ruby-turbo-rails
1504 (package
1505 (name "ruby-turbo-rails")
1506 (version "1.4.0")
1507 (source (origin
1508 (method url-fetch)
1509 (uri (rubygems-uri "turbo-rails" version))
1510 (sha256
1511 (base32
1512 "0vm3iqgr3kxyyz5i09lhvfszp4pw1gw5j5rhhv1gmasv4kq2p3qh"))))
1513 (build-system ruby-build-system)
1514 ;; The test suite depends on JavaScript modules fetched via 'yarn'.
1515 (arguments (list #:tests? #f))
1516 (propagated-inputs (list ruby-actionpack ruby-activejob ruby-railties))
1517 (synopsis "High performance web application framework")
1518 (description
1519 "Turbo aims to be as fast as single-page web application without having
1520to write any JavaScript. Turbo accelerates links and form submissions without
1521requiring server-side changes to the generated HTML. It allows carving up a
1522page into independent frames, which can be lazy-loaded and operated as
1523independent components. Finally, it helps making partial page updates using
1524just HTML and a set of CRUD-like container tags. These three techniques
1525reduce the amount of custom JavaScript that many web applications need to
1526write by an order of magnitude. And for the few dynamic bits that are left,
1527Stimulus can be used.")
1528 (home-page "https://github.com/hotwired/turbo-rails")
1529 (license license:expat)))
1530
1531(define-public ruby-web-console
1532 (package
1533 (name "ruby-web-console")
1534 (version "4.2.0")
1535 (source
1536 (origin
1537 ;; Download from GitHub as test files are not provided in the gem.
1538 (method git-fetch)
1539 (uri (git-reference
1540 (url "https://github.com/rails/web-console")
1541 (commit (string-append "v" version))))
1542 (file-name (git-file-name name version))
1543 (sha256
1544 (base32
1545 "07mg9nq7h48n01hps1m0g2nk94zknab6mrcxsv8x2vaf2xfgjilg"))))
1546 (build-system ruby-build-system)
1547 (arguments
1548 '(#:phases
1549 (modify-phases %standard-phases
1550 (add-after 'unpack 'patch-Gemfile
1551 (lambda _
1552 (substitute* "Gemfile"
1553 ;; Remove the github bit from the Gemfile, so that the Guix
1554 ;; packages are used.
1555 ((", github: .*") "\n")
1556 ;; The usual methods of not loading this group don't work, so
1557 ;; patch the Gemfile.
1558 (("group :development") "[].each")
1559 ;; tzinfo-data is propagated by ruby-activesupport, but it
1560 ;; needs to be in the Gemfile to become available.
1561 (("group :test do") "group :test do\n gem 'tzinfo-data'")))))))
1562 (propagated-inputs
1563 (list ruby-actionview ruby-activemodel ruby-arel ruby-skiptrace ruby-railties))
1564 (native-inputs
1565 (list bundler ruby-bindex ruby-rails ruby-mocha ruby-simplecov))
1566 (synopsis "Debugging tool for your Ruby on Rails applications")
1567 (description
1568 "This package allows you to create an interactive Ruby session in your
1569browser. Those sessions are launched automatically in case of an error and
1570can also be launched manually in any page.")
1571 (home-page "https://github.com/rails/web-console")
1572 (license license:expat)))
1573
1574(define-public ruby-with-advisory-lock
1575 (package
1576 (name "ruby-with-advisory-lock")
1577 (version "4.0.0")
1578 (source
1579 (origin
1580 (method url-fetch)
1581 (uri (rubygems-uri "with_advisory_lock" version))
1582 (sha256
1583 (base32
1584 "1k37hxgmaqgsd54gplm5xim9nw3ghvqsbzaw7q4q64ha1nbd9a41"))))
1585 (build-system ruby-build-system)
1586 (arguments
1587 '(#:tests? #f)) ; TODO Tests require a running MySQL service
1588 (propagated-inputs
1589 (list ruby-activerecord))
1590 (native-inputs
1591 (list bundler ruby-yard ruby-mysql2))
1592 (synopsis "Advisory locking for ActiveRecord")
1593 (description
1594 "The With advisory lock gem adds advisory locking to ActiveRecord for
1595PostgreSQL and MySQL. SQLite is also supported, but this uses the file system
1596for locks.")
1597 (home-page "https://closuretree.github.io/with_advisory_lock/")
1598 (license license:expat)))
1599
1600;;; This is a meta-package which propagates all the individual Rails
1601;;; components.
1602(define-public ruby-rails
1603 (package
1604 (name "ruby-rails")
1605 (version %ruby-rails-version)
1606 (source ruby-rails-monorepo)
1607 (build-system ruby-build-system)
1608 (arguments
1609 (list
1610 #:phases
1611 #~(modify-phases %standard-phases
1612 (add-after 'unpack 'delete-extraneous-gemspec-files
1613 (lambda _
1614 ;; They would otherwise be picked up instead of rails.gemspec at
1615 ;; the root of the repository.
1616 (for-each (lambda (f)
1617 (unless (string-suffix? "rails.gemspec" f)
1618 (delete-file f)))
1619 (find-files "." "\\.gemspec"))))
1620 ;; This gem acts as glue between the gems that actually make up
1621 ;; Rails. The important thing to check is that the gemspec matches
1622 ;; up with the Guix packages and Rubygems can successfully activate
1623 ;; the Rails gem.
1624 ;;
1625 ;; The following check phase tests this.
1626 (delete 'check)
1627 (add-after 'install 'check
1628 (lambda* (#:key tests? outputs #:allow-other-keys)
1629 (when tests?
1630 (setenv "GEM_PATH"
1631 (string-append (getenv "GEM_PATH") ":" #$output
1632 "/lib/ruby/vendor_ruby"))
1633 (invoke "ruby" "-e" "gem 'rails'")))))))
1634 (propagated-inputs
1635 (list bundler
1636 ruby-actioncable
1637 ruby-actionmailbox
1638 ruby-actionmailer
1639 ruby-actionpack
1640 ruby-actiontext
1641 ruby-actionview
1642 ruby-activejob
1643 ruby-activemodel
1644 ruby-activerecord
1645 ruby-activestorage
1646 ruby-activesupport
1647 ruby-railties
1648 ruby-sprockets-rails))
1649 (synopsis "Full-stack web framework optimized for programmer happiness")
1650 (description
1651 "Ruby on Rails is a full-stack web framework optimized for programmer
1652happiness and sustainable productivity. It encourages beautiful code by
1653favoring convention over configuration.")
1654 (home-page "https://rubyonrails.org/")
1655 (license license:expat)))