1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
3 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages rails)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix download)
24 #:use-module (guix git-download)
25 #:use-module (guix packages)
26 #:use-module (gnu packages node)
27 #:use-module (gnu packages ruby)
28 #:use-module (guix build-system ruby))
30 (define-public ruby-spring
38 (url "https://github.com/rails/spring")
39 (commit (string-append "v" version))))
40 (file-name (git-file-name name version))
43 "0smwrndjmnr7g7jjskw05zin3gh6kx5db6yrkiqi6i9wl5mrn9n5"))))
44 (build-system ruby-build-system)
46 `(#:test-target "test:unit"
48 (modify-phases %standard-phases
49 (add-before 'check 'remove-bump
51 (substitute* "spring.gemspec"
52 (("gem.add_development_dependency 'bump'") "")
53 (("gem.add_development_dependency 'activesupport'.*")
54 "gem.add_development_dependency 'activesupport'\n"))
55 (substitute* "Rakefile"
56 (("require \\\"bump/tasks\\\"") ""))
59 `(("bundler" ,bundler)
60 ("ruby-activesupport" ,ruby-activesupport)))
61 (synopsis "Ruby on Rails application preloader")
63 "Spring is a Ruby on Rails application preloader. It speeds up
64 development by keeping your application running in the background so the
65 application does need to boot it every time you run a test, rake task or
67 (home-page "https://github.com/rails/spring")
68 (license license:expat)))
70 (define-public ruby-sass-rails
72 (name "ruby-sass-rails")
77 (uri (rubygems-uri "sass-rails" version))
80 "1wa63sbsimrsf7nfm8h0m1wbsllkfxvd7naph5d1j6pbc555ma7s"))))
81 (build-system ruby-build-system)
83 '(#:tests? #f)) ; No included tests
85 `(("ruby-railties" ,ruby-railties)
86 ("ruby-sass" ,ruby-sass)
87 ("ruby-sprockets" ,ruby-sprockets)
88 ("ruby-sprockets-rails" ,ruby-sprockets-rails)
89 ("ruby-tilt" ,ruby-tilt)))
90 (synopsis "Sass adapter for the Rails asset pipeline")
92 "This library integrates the SASS stylesheet language into Ruby on
94 (home-page "https://github.com/rails/sass-rails")
95 (license license:expat)))
97 (define-public ruby-debug-inspector
99 (name "ruby-debug-inspector")
104 (uri (rubygems-uri "debug_inspector" version))
107 "0vxr0xa1mfbkfcrn71n7c4f2dj7la5hvphn904vh20j3x4j5lrx0"))))
108 (build-system ruby-build-system)
111 (modify-phases %standard-phases
114 (invoke "rake" "compile")
115 (invoke "ruby" "-Ilib" "-e"
117 "require 'debug_inspector'; RubyVM::DebugInspector."
118 "open{|dc| p dc.backtrace_locations}")))))))
119 (synopsis "Ruby wrapper for the MRI 2.0 debug_inspector API")
121 "This package provides a Ruby wrapper for the MRI 2.0 debug_inspector
124 "https://github.com/banister/debug_inspector")
125 (license license:expat)))
127 (define-public ruby-autoprefixer-rails
129 (name "ruby-autoprefixer-rails")
134 (uri (rubygems-uri "autoprefixer-rails" version))
137 "0fxbfl3xrrjj84n98x24yzxbz4nvm6c492dxj41kkrl9z97ga13i"))))
138 (build-system ruby-build-system)
140 '(#:test-target "spec"
142 (modify-phases %standard-phases
143 (add-after 'extract-gemspec 'remove-unnecessary-dependencies
145 ;; Remove the testing of compass, as it's use is deprecated, and
146 ;; it's unpackaged for Guix
147 (substitute* "autoprefixer-rails.gemspec"
148 ((".*%q<compass>.*") "\n")
149 (("\"spec/compass_spec\\.rb\"\\.freeze, ") ""))
150 (delete-file "spec/compass_spec.rb")
152 (substitute* "Gemfile"
153 ;; Remove overly strict requirement on sprockets
154 ((", '>= 4\\.0\\.0\\.beta1'") "")
155 ;; The mini_racer gem isn't packaged yet, and it's not directly
156 ;; required, as other backends for ruby-execjs can be used.
157 (("gem 'mini_racer'") "")
158 ;; For some reason, this is required for the gems to be picked
160 (("gemspec") "gemspec\ngem 'tzinfo-data'\ngem 'sass'"))
163 `(("bundler" ,bundler)
164 ("ruby-rails" ,ruby-rails)
165 ("ruby-rspec-rails" ,ruby-rspec-rails)
166 ;; This is needed for a test, but I'm unsure why
167 ("ruby-sass" ,ruby-sass)
168 ;; This is used as the ruby-execjs runtime
171 `(("ruby-execjs" ,ruby-execjs)))
172 (synopsis "Parse CSS and add vendor prefixes to CSS rules")
174 "This gem provides Ruby and Ruby on Rails integration with Autoprefixer,
175 which can parse CSS and add vendor prefixes to CSS rules using values from the
177 (home-page "https://github.com/ai/autoprefixer-rails")
178 (license license:expat)))
180 (define-public ruby-activemodel
182 (name "ruby-activemodel")
187 (uri (rubygems-uri "activemodel" version))
190 "07m85r00cd1dzxg65zr9wjrdqppw51b5ka9c5mrz92vnw18kfb70"))))
191 (build-system ruby-build-system)
193 '(;; No included tests
196 `(("ruby-activesupport" ,ruby-activesupport)))
197 (synopsis "Toolkit for building modeling frameworks like Active Record")
199 "This package provides a toolkit for building modeling frameworks like
200 Active Record. ActiveSupport handles attributes, callbacks, validations,
201 serialization, internationalization, and testing.")
202 (home-page "https://rubyonrails.org/")
203 (license license:expat)))
205 (define-public ruby-activerecord
207 (name "ruby-activerecord")
212 (uri (rubygems-uri "activerecord" version))
215 "03kr6vslwd9iw89jidjpjlp7prr2rf7kpsfa4fz03g9by0kliivs"))))
216 (build-system ruby-build-system)
218 '(;; No included tests
221 `(("ruby-activemodel" ,ruby-activemodel)
222 ("ruby-activesupport" ,ruby-activesupport)
223 ("ruby-arel" ,ruby-arel)))
224 (synopsis "Ruby library to connect to relational databases")
226 "Active Record connects classes to relational database table to establish
227 an almost zero-configuration persistence layer for applications.")
228 (home-page "https://rubyonrails.org")
229 (license license:expat)))
231 (define-public ruby-rspec-rails
233 (name "ruby-rspec-rails")
238 (uri (rubygems-uri "rspec-rails" version))
241 "1pf6n9l4sw1arlax1bdbm1znsvl8cgna2n6k6yk1bi8vz2n73ls1"))))
242 (build-system ruby-build-system)
244 '(#:tests? #f)) ; No included tests
246 `(("ruby-actionpack" ,ruby-actionpack)
247 ("ruby-activesupport" ,ruby-activesupport)
248 ("ruby-railties" ,ruby-railties)
249 ("ruby-rspec-core" ,ruby-rspec-core)
250 ("ruby-rspec-expectations" ,ruby-rspec-expectations)
251 ("ruby-rspec-mocks" ,ruby-rspec-mocks)
252 ("ruby-rspec-support" ,ruby-rspec-support)))
253 (synopsis "Use RSpec to test Ruby on Rails applications")
255 "This package provides support for using RSpec to test Ruby on Rails
256 applications, in pace of the default Minitest testing library.")
257 (home-page "https://github.com/rspec/rspec-rails")
258 (license license:expat)))
260 (define-public ruby-rails-html-sanitizer
262 (name "ruby-rails-html-sanitizer")
267 (uri (rubygems-uri "rails-html-sanitizer" version))
270 "1icpqmxbppl4ynzmn6dx7wdil5hhq6fz707m9ya6d86c7ys8sd4f"))))
271 (build-system ruby-build-system)
273 '(;; No included tests
276 `(("ruby-loofah" ,ruby-loofah)))
277 (synopsis "HTML sanitization for Rails applications")
279 "This gem is used to handle HTML sanitization in Rails applications. If
280 you need similar functionality in non Rails apps consider using Loofah
282 (home-page "https://github.com/rails/rails-html-sanitizer")
283 (license license:expat)))
285 (define-public ruby-rails-dom-testing
287 (name "ruby-rails-dom-testing")
293 (url "https://github.com/rails/rails-dom-testing")
294 (commit (string-append "v" version))))
295 (file-name (git-file-name name version))
298 "17vdh273cmmfpzy5m546dd13zqmimv54jjx0f7sl0zi5lwz0gnck"))))
299 (build-system ruby-build-system)
301 `(("bundler" ,bundler)))
303 `(("ruby-activesupport" ,ruby-activesupport)
304 ("ruby-nokogiri" ,ruby-nokogiri)))
305 (synopsis "Compare HTML DOMs and assert certain elements exists")
307 "This gem can compare HTML and assert certain elements exists. This is
308 useful when writing tests.")
309 (home-page "https://github.com/rails/rails-dom-testing")
310 (license license:expat)))
312 (define-public ruby-actiontext
314 (name "ruby-actiontext")
319 (uri (rubygems-uri "actiontext" version))
322 "04k4z4xj40sbzbgx0x9m6i8k0nc22jb6dkrlslj16p2z2dfnwhqg"))))
323 (build-system ruby-build-system)
325 '(;; No included tests
328 `(("ruby-actionpack" ,ruby-actionpack)
329 ("ruby-activerecord" ,ruby-activerecord)
330 ("ruby-activestorage" ,ruby-activestorage)
331 ("ruby-activesupport" ,ruby-activesupport)
332 ("ruby-nokogiri" ,ruby-nokogiri)))
333 (synopsis "Edit and display rich text in Rails applications")
335 "ActionText edits and displays rich text in Rails applications.")
336 (home-page "https://rubyonrails.org")
337 (license license:expat)))
339 (define-public ruby-actionview
341 (name "ruby-actionview")
346 (uri (rubygems-uri "actionview" version))
349 "1s5kc1abi7id1g54lz1npgc42zl7pbz172wp8pi7j3s7qljafzw5"))))
350 (build-system ruby-build-system)
352 '(;; No included tests
355 `(("ruby-activesupport" ,ruby-activesupport)
356 ("ruby-builder" ,ruby-builder)
357 ("ruby-erubi" ,ruby-erubi)
358 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)
359 ("ruby-rails-html-sanitizer" ,ruby-rails-html-sanitizer)))
360 (synopsis "Conventions and helpers for building web pages")
362 "ActionView provides conventions and helpers for building web pages in
364 (home-page "https://rubyonrails.org/")
365 (license license:expat)))
367 (define-public ruby-actionpack
369 (name "ruby-actionpack")
374 (uri (rubygems-uri "actionpack" version))
377 "030yyaskzlic5cp4d9zbwwr3rhf4k6hsls44a7ihsfd6r8mlivq5"))))
378 (build-system ruby-build-system)
380 '(;; No included tests
383 `(("ruby-actionview" ,ruby-actionview)
384 ("ruby-activesupport" ,ruby-activesupport)
385 ("ruby-rack" ,ruby-rack)
386 ("ruby-rack-test" ,ruby-rack-test)
387 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)
388 ("ruby-rails-html-sanitizer" ,ruby-rails-html-sanitizer)))
389 (synopsis "Conventions for building and testing MVC web applications")
391 "ActionPack provides conventions for building and testing MVC web
392 applications. These work with any Rack-compatible server.")
393 (home-page "https://rubyonrails.org/")
394 (license license:expat)))
396 (define-public ruby-actioncable
398 (name "ruby-actioncable")
403 (uri (rubygems-uri "actioncable" version))
406 "1cgb1l0gml1vklxka2djpi5q5b4bgzgm5pahzfjvvgm5vzvrvi9v"))))
407 (build-system ruby-build-system)
409 '(;; No included tests
412 `(("ruby-actionpack" ,ruby-actionpack)
413 ("ruby-activesupport" ,ruby-activesupport)
414 ("ruby-nio4r" ,ruby-nio4r)
415 ("ruby-websocket-driver" ,ruby-websocket-driver)))
416 (synopsis "Integrate integrates WebSockets with Rails applications")
418 "Action Cable integrates WebSockets with Rails applications. Through
419 WebSockets it allows for real-time features in web applications.")
420 (home-page "https://rubyonrails.org/")
421 (license license:expat)))
423 (define-public ruby-activejob
425 (name "ruby-activejob")
430 (uri (rubygems-uri "activejob" version))
433 "175d8q0achdlsxjsvq0w9znvfqfkgbj75kbmdrvg4fb277wwplmf"))))
434 (build-system ruby-build-system)
436 '(;; No included tests
439 `(("ruby-activesupport" ,ruby-activesupport)
440 ("ruby-globalid" ,ruby-globalid)))
441 (synopsis "Declare job classes for multiple backends")
443 "ActiveJob allows declaring job classes in a common way across Rails
445 (home-page "https://rubyonrails.org/")
446 (license license:expat)))
448 (define-public ruby-activestorage
450 (name "ruby-activestorage")
455 (uri (rubygems-uri "activestorage" version))
458 "0gkxvbi5w8zmdxpiyz3b10kzz8cxqqh9bj81sjl3fp8wa3v2ld4i"))))
459 (build-system ruby-build-system)
461 '(;; No included tests
464 `(("ruby-actionpack" ,ruby-actionpack)
465 ("ruby-activejob" ,ruby-activejob)
466 ("ruby-activerecord" ,ruby-activerecord)
467 ("ruby-activesupport" ,ruby-activesupport)
468 ("ruby-marcel" ,ruby-marcel)
469 ("ruby-mimemagic" ,ruby-mimemagic)))
470 (synopsis "Integrate file storage services in to Rails applications")
472 "ActiveStorage integrates file storage services with Rails applications,
473 allowing files to be attached to ActiveRecord models.")
474 (home-page "https://rubyonrails.org/")
475 (license license:expat)))
477 (define-public ruby-actionmailbox
479 (name "ruby-actionmailbox")
484 (uri (rubygems-uri "actionmailbox" version))
487 "0wv2p24xn4f0kj8kiyagkn934hzrcp98vzjqxwd4r75qq0cijadp"))))
488 (build-system ruby-build-system)
490 '(;; No included tests
493 `(("ruby-actionpack" ,ruby-actionpack)
494 ("ruby-activejob" ,ruby-activejob)
495 ("ruby-activerecord" ,ruby-activerecord)
496 ("ruby-activestorage" ,ruby-activestorage)
497 ("ruby-activesupport" ,ruby-activesupport)
498 ("ruby-mail" ,ruby-mail)))
499 (synopsis "Receive and process incoming emails in Rails applications")
501 "ActionMailbox receives and processes incoming emails in Rails applications.")
502 (home-page "https://rubyonrails.org")
503 (license license:expat)))
505 (define-public ruby-actionmailer
507 (name "ruby-actionmailer")
512 (uri (rubygems-uri "actionmailer" version))
515 "0lic4mc6wqi3p9ipdqljl64vd9ndabm0k8hww0m07sfdhwsl5ba9"))))
516 (build-system ruby-build-system)
518 '(;; No included tests
521 `(("ruby-actionpack" ,ruby-actionpack)
522 ("ruby-actionview" ,ruby-actionview)
523 ("ruby-activejob" ,ruby-activejob)
524 ("ruby-activesupport" ,ruby-activesupport)
525 ("ruby-mail" ,ruby-mail)
526 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)))
527 (synopsis "Work with emails using the controller/view pattern")
529 "Compose, deliver, receive, and test emails using the controller/view
530 pattern. Including support for multipart email and attachments.")
531 (home-page "https://rubyonrails.org/")
532 (license license:expat)))
534 (define-public ruby-railties
536 (name "ruby-railties")
541 (uri (rubygems-uri "railties" version))
544 "1685y5dcfgcq0b38j13vrpkhiiblmrl64wa9w065669bkgmkw4ra"))))
545 (build-system ruby-build-system)
547 '(;; No included tests
550 `(("ruby-actionpack" ,ruby-actionpack)
551 ("ruby-activesupport" ,ruby-activesupport)
552 ("ruby-method-source" ,ruby-method-source)
553 ("ruby-rake" ,ruby-rake)
554 ("ruby-thor" ,ruby-thor)))
555 (synopsis "Rails internals, including application bootup and generators")
557 "@code{railties} provides the core Rails internals including handling
558 application bootup, plugins, generators, and Rake tasks.")
559 (home-page "https://rubyonrails.org/")
560 (license license:expat)))
562 (define-public ruby-sprockets-rails
564 (name "ruby-sprockets-rails")
569 (uri (rubygems-uri "sprockets-rails" version))
572 "0ab42pm8p5zxpv3sfraq45b9lj39cz9mrpdirm30vywzrwwkm5p1"))))
573 (build-system ruby-build-system)
575 '(;; No included tests
578 `(("ruby-actionpack" ,ruby-actionpack)
579 ("ruby-activesupport" ,ruby-activesupport)
580 ("ruby-sprockets" ,ruby-sprockets)))
581 (synopsis "Sprockets Rails integration")
583 "Provides Sprockets implementation for the Rails Asset Pipeline.")
585 "https://github.com/rails/sprockets-rails")
586 (license license:expat)))
588 (define-public ruby-web-console
590 (name "ruby-web-console")
594 ;; Download from GitHub as test files are not provided in the gem.
597 (url "https://github.com/rails/web-console")
598 (commit (string-append "v" version))))
599 (file-name (git-file-name name version))
602 "0azk8nmimnjbh74vxgwcj9jr588rj7kb5rrlclcjfjsw9jqjzckc"))))
603 (build-system ruby-build-system)
606 (modify-phases %standard-phases
607 (add-after 'unpack 'patch-Gemfile
609 (substitute* "Gemfile"
610 ;; Remove the github bit from the Gemfile, so that the Guix
611 ;; packages are used.
612 ((", github: .*") "\n")
613 ;; The usual methods of not loading this group don't work, so
614 ;; patch the Gemfile.
615 (("group :development") "[].each")
616 ;; tzinfo-data is propagated by ruby-activesupport, but it
617 ;; needs to be in the Gemfile to become available.
618 (("group :test do") "group :test do\n gem 'tzinfo-data'"))
621 `(("ruby-actionview" ,ruby-actionview)
622 ("ruby-activemodel" ,ruby-activemodel)
623 ("ruby-bindex" ,ruby-bindex)
624 ("ruby-railties" ,ruby-railties)))
626 `(("bundler" ,bundler)
627 ("ruby-rails" ,ruby-rails)
628 ("ruby-mocha" ,ruby-mocha)
629 ("ruby-simplecov" ,ruby-simplecov)))
630 (synopsis "Debugging tool for your Ruby on Rails applications")
632 "This package allows you to create an interactive Ruby session in your
633 browser. Those sessions are launched automatically in case of an error and
634 can also be launched manually in any page.")
635 (home-page "https://github.com/rails/web-console")
636 (license license:expat)))
638 (define-public ruby-with-advisory-lock
640 (name "ruby-with-advisory-lock")
645 (uri (rubygems-uri "with_advisory_lock" version))
648 "1k37hxgmaqgsd54gplm5xim9nw3ghvqsbzaw7q4q64ha1nbd9a41"))))
649 (build-system ruby-build-system)
651 '(#:tests? #f)) ; TODO Tests require a running MySQL service
653 `(("ruby-activerecord" ,ruby-activerecord)))
655 `(("bundler" ,bundler)
656 ("ruby-yard" ,ruby-yard)
657 ("ruby-mysql2" ,ruby-mysql2)))
658 (synopsis "Advisory locking for ActiveRecord")
660 "The With advisory lock gem adds advisory locking to ActiveRecord for
661 PostgreSQL and MySQL. SQLite is also supported, but this uses the file system
663 (home-page "https://closuretree.github.io/with_advisory_lock/")
664 (license license:expat)))
666 (define-public ruby-rails
673 (uri (rubygems-uri "rails" version))
676 "0hdancysa617lzyy5gmrcmnpgyb1mz1lawy0l34ycz2wary7y2bz"))))
677 (build-system ruby-build-system)
680 (modify-phases %standard-phases
681 ;; This gem acts as glue between the gems that actually make up
682 ;; Rails. The important thing to check is that the gemspec matches up
683 ;; with the Guix packages and Rubygems can successfully activate the
686 ;; The following check phase tests this.
688 (add-after 'install 'check
689 (lambda* (#:key tests? outputs #:allow-other-keys)
694 (assoc-ref outputs "out") "/lib/ruby/vendor_ruby"))
696 (invoke "ruby" "-e" "gem 'rails'"))
699 `(("ruby-actioncable" ,ruby-actioncable)
700 ("ruby-actionmailbox" ,ruby-actionmailbox)
701 ("ruby-actionmailer" ,ruby-actionmailer)
702 ("ruby-actionpack" ,ruby-actionpack)
703 ("ruby-actiontext" ,ruby-actiontext)
704 ("ruby-actionview" ,ruby-actionview)
705 ("ruby-activejob" ,ruby-activejob)
706 ("ruby-activemodel" ,ruby-activemodel)
707 ("ruby-activerecord" ,ruby-activerecord)
708 ("ruby-activestorage" ,ruby-activestorage)
709 ("ruby-activesupport" ,ruby-activesupport)
711 ("ruby-railties" ,ruby-railties)
712 ("ruby-sprockets-rails" ,ruby-sprockets-rails)))
713 (synopsis "Full-stack web framework optimized for programmer happiness")
715 "Ruby on Rails is a full-stack web framework optimized for programmer
716 happiness and sustainable productivity. It encourages beautiful code by
717 favoring convention over configuration.")
718 (home-page "https://rubyonrails.org/")
719 (license license:expat)))