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, 2022 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 gexp)
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix packages)
27 #:use-module (gnu packages node)
28 #:use-module (gnu packages ruby)
29 #:use-module (guix build-system ruby))
31 (define-public ruby-spring
39 (url "https://github.com/rails/spring")
40 (commit (string-append "v" version))))
41 (file-name (git-file-name name version))
44 "0smwrndjmnr7g7jjskw05zin3gh6kx5db6yrkiqi6i9wl5mrn9n5"))))
45 (build-system ruby-build-system)
47 `(#:test-target "test:unit"
49 (modify-phases %standard-phases
50 (add-before 'check 'remove-bump
52 (substitute* "spring.gemspec"
53 (("gem.add_development_dependency 'bump'") "")
54 (("gem.add_development_dependency 'activesupport'.*")
55 "gem.add_development_dependency 'activesupport'\n"))
56 (substitute* "Rakefile"
57 (("require \\\"bump/tasks\\\"") ""))
60 (list bundler 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 (list ruby-railties ruby-sass ruby-sprockets ruby-sprockets-rails
87 (synopsis "Sass adapter for the Rails asset pipeline")
89 "This library integrates the SASS stylesheet language into Ruby on
91 (home-page "https://github.com/rails/sass-rails")
92 (license license:expat)))
94 (define-public ruby-debug-inspector
96 (name "ruby-debug-inspector")
101 (uri (rubygems-uri "debug_inspector" version))
104 "0vxr0xa1mfbkfcrn71n7c4f2dj7la5hvphn904vh20j3x4j5lrx0"))))
105 (build-system ruby-build-system)
108 (modify-phases %standard-phases
111 (invoke "rake" "compile")
112 (invoke "ruby" "-Ilib" "-e"
114 "require 'debug_inspector'; RubyVM::DebugInspector."
115 "open{|dc| p dc.backtrace_locations}")))))))
116 (synopsis "Ruby wrapper for the MRI 2.0 debug_inspector API")
118 "This package provides a Ruby wrapper for the MRI 2.0 debug_inspector
121 "https://github.com/banister/debug_inspector")
122 (license license:expat)))
124 (define-public ruby-autoprefixer-rails
126 (name "ruby-autoprefixer-rails")
131 (uri (rubygems-uri "autoprefixer-rails" version))
134 "0fxbfl3xrrjj84n98x24yzxbz4nvm6c492dxj41kkrl9z97ga13i"))))
135 (build-system ruby-build-system)
137 '(#:test-target "spec"
139 (modify-phases %standard-phases
140 (add-after 'extract-gemspec 'remove-unnecessary-dependencies
142 ;; Remove the testing of compass, as its use is deprecated, and
143 ;; it's unpackaged for Guix.
144 (substitute* "autoprefixer-rails.gemspec"
145 ((".*%q<compass>.*") "\n")
146 (("\"spec/compass_spec\\.rb\"\\.freeze, ") ""))
147 (delete-file "spec/compass_spec.rb")
149 (substitute* "Gemfile"
150 ;; Remove overly strict requirement on sprockets
151 ((", '>= 4\\.0\\.0\\.beta1'") "")
152 ;; The mini_racer gem isn't packaged yet, and it's not directly
153 ;; required, as other backends for ruby-execjs can be used.
154 (("gem 'mini_racer'") "")
155 ;; For some reason, this is required for the gems to be picked
157 (("gemspec") "gemspec\ngem 'tzinfo-data'\ngem 'sass'"))
163 ;; This is needed for a test, but I'm unsure why
165 ;; This is used as the ruby-execjs runtime
169 (synopsis "Parse CSS and add vendor prefixes to CSS rules")
171 "This gem provides Ruby and Ruby on Rails integration with Autoprefixer,
172 which can parse CSS and add vendor prefixes to CSS rules using values from the
174 (home-page "https://github.com/ai/autoprefixer-rails")
175 (license license:expat)))
177 (define-public ruby-activemodel
179 (name "ruby-activemodel")
184 (uri (rubygems-uri "activemodel" version))
187 "07m85r00cd1dzxg65zr9wjrdqppw51b5ka9c5mrz92vnw18kfb70"))))
188 (build-system ruby-build-system)
190 '(;; No included tests
193 (list ruby-activesupport))
194 (synopsis "Toolkit for building modeling frameworks like Active Record")
196 "This package provides a toolkit for building modeling frameworks like
197 Active Record. ActiveSupport handles attributes, callbacks, validations,
198 serialization, internationalization, and testing.")
199 (home-page "https://rubyonrails.org/")
200 (license license:expat)))
202 (define-public ruby-activerecord
204 (name "ruby-activerecord")
209 (uri (rubygems-uri "activerecord" version))
212 "03kr6vslwd9iw89jidjpjlp7prr2rf7kpsfa4fz03g9by0kliivs"))))
213 (build-system ruby-build-system)
215 '(;; No included tests
218 (list ruby-activemodel ruby-activesupport ruby-arel))
219 (synopsis "Ruby library to connect to relational databases")
221 "Active Record connects classes to relational database table to establish
222 an almost zero-configuration persistence layer for applications.")
223 (home-page "https://rubyonrails.org")
224 (license license:expat)))
226 (define-public ruby-rspec-rails
228 (name "ruby-rspec-rails")
233 (uri (rubygems-uri "rspec-rails" version))
236 "1pf6n9l4sw1arlax1bdbm1znsvl8cgna2n6k6yk1bi8vz2n73ls1"))))
237 (build-system ruby-build-system)
239 '(#:tests? #f)) ; No included tests
241 (list ruby-actionpack
245 ruby-rspec-expectations
248 (synopsis "Use RSpec to test Ruby on Rails applications")
250 "This package provides support for using RSpec to test Ruby on Rails
251 applications, in pace of the default Minitest testing library.")
252 (home-page "https://github.com/rspec/rspec-rails")
253 (license license:expat)))
255 (define-public ruby-rails-html-sanitizer
257 (name "ruby-rails-html-sanitizer")
262 (uri (rubygems-uri "rails-html-sanitizer" version))
265 "1icpqmxbppl4ynzmn6dx7wdil5hhq6fz707m9ya6d86c7ys8sd4f"))))
266 (build-system ruby-build-system)
268 '(;; No included tests
272 (synopsis "HTML sanitization for Rails applications")
274 "This gem is used to handle HTML sanitization in Rails applications. If
275 you need similar functionality in non Rails apps consider using Loofah
277 (home-page "https://github.com/rails/rails-html-sanitizer")
278 (license license:expat)))
280 (define-public ruby-rails-dom-testing
282 (name "ruby-rails-dom-testing")
288 (url "https://github.com/rails/rails-dom-testing")
289 (commit (string-append "v" version))))
290 (file-name (git-file-name name version))
293 "17vdh273cmmfpzy5m546dd13zqmimv54jjx0f7sl0zi5lwz0gnck"))))
294 (build-system ruby-build-system)
298 #~(modify-phases %standard-phases
299 (add-after 'unpack 'delete-gemfile.lock
301 (delete-file "Gemfile.lock"))))))
305 (list ruby-activesupport ruby-nokogiri))
306 (synopsis "Compare HTML DOMs and assert certain elements exists")
308 "This gem can compare HTML and assert certain elements exists. This is
309 useful when writing tests.")
310 (home-page "https://github.com/rails/rails-dom-testing")
311 (license license:expat)))
313 (define-public ruby-actiontext
315 (name "ruby-actiontext")
320 (uri (rubygems-uri "actiontext" version))
323 "04k4z4xj40sbzbgx0x9m6i8k0nc22jb6dkrlslj16p2z2dfnwhqg"))))
324 (build-system ruby-build-system)
326 '(;; No included tests
329 (list ruby-actionpack ruby-activerecord ruby-activestorage
330 ruby-activesupport ruby-nokogiri))
331 (synopsis "Edit and display rich text in Rails applications")
333 "ActionText edits and displays rich text in Rails applications.")
334 (home-page "https://rubyonrails.org")
335 (license license:expat)))
337 (define-public ruby-actionview
339 (name "ruby-actionview")
344 (uri (rubygems-uri "actionview" version))
347 "1s5kc1abi7id1g54lz1npgc42zl7pbz172wp8pi7j3s7qljafzw5"))))
348 (build-system ruby-build-system)
350 '(;; No included tests
353 (list ruby-activesupport ruby-builder ruby-erubi
354 ruby-rails-dom-testing ruby-rails-html-sanitizer))
355 (synopsis "Conventions and helpers for building web pages")
357 "ActionView provides conventions and helpers for building web pages in
359 (home-page "https://rubyonrails.org/")
360 (license license:expat)))
362 (define-public ruby-actionpack
364 (name "ruby-actionpack")
369 (uri (rubygems-uri "actionpack" version))
372 "030yyaskzlic5cp4d9zbwwr3rhf4k6hsls44a7ihsfd6r8mlivq5"))))
373 (build-system ruby-build-system)
375 '(;; No included tests
378 (list ruby-actionview
382 ruby-rails-dom-testing
383 ruby-rails-html-sanitizer))
384 (synopsis "Conventions for building and testing MVC web applications")
386 "ActionPack provides conventions for building and testing MVC web
387 applications. These work with any Rack-compatible server.")
388 (home-page "https://rubyonrails.org/")
389 (license license:expat)))
391 (define-public ruby-actioncable
393 (name "ruby-actioncable")
398 (uri (rubygems-uri "actioncable" version))
401 "1cgb1l0gml1vklxka2djpi5q5b4bgzgm5pahzfjvvgm5vzvrvi9v"))))
402 (build-system ruby-build-system)
404 '(;; No included tests
407 (list ruby-actionpack ruby-activesupport ruby-nio4r
408 ruby-websocket-driver))
409 (synopsis "Integrate integrates WebSockets with Rails applications")
411 "Action Cable integrates WebSockets with Rails applications. Through
412 WebSockets it allows for real-time features in web applications.")
413 (home-page "https://rubyonrails.org/")
414 (license license:expat)))
416 (define-public ruby-activejob
418 (name "ruby-activejob")
423 (uri (rubygems-uri "activejob" version))
426 "175d8q0achdlsxjsvq0w9znvfqfkgbj75kbmdrvg4fb277wwplmf"))))
427 (build-system ruby-build-system)
429 '(;; No included tests
432 (list ruby-activesupport ruby-globalid))
433 (synopsis "Declare job classes for multiple backends")
435 "ActiveJob allows declaring job classes in a common way across Rails
437 (home-page "https://rubyonrails.org/")
438 (license license:expat)))
440 (define-public ruby-activestorage
442 (name "ruby-activestorage")
447 (uri (rubygems-uri "activestorage" version))
450 "0gkxvbi5w8zmdxpiyz3b10kzz8cxqqh9bj81sjl3fp8wa3v2ld4i"))))
451 (build-system ruby-build-system)
453 '(;; No included tests
456 (list ruby-actionpack
462 (synopsis "Integrate file storage services in to Rails applications")
464 "ActiveStorage integrates file storage services with Rails applications,
465 allowing files to be attached to ActiveRecord models.")
466 (home-page "https://rubyonrails.org/")
467 (license license:expat)))
469 (define-public ruby-actionmailbox
471 (name "ruby-actionmailbox")
476 (uri (rubygems-uri "actionmailbox" version))
479 "0wv2p24xn4f0kj8kiyagkn934hzrcp98vzjqxwd4r75qq0cijadp"))))
480 (build-system ruby-build-system)
482 '(;; No included tests
485 (list ruby-actionpack
491 (synopsis "Receive and process incoming emails in Rails applications")
493 "ActionMailbox receives and processes incoming emails in Rails applications.")
494 (home-page "https://rubyonrails.org")
495 (license license:expat)))
497 (define-public ruby-actionmailer
499 (name "ruby-actionmailer")
504 (uri (rubygems-uri "actionmailer" version))
507 "0lic4mc6wqi3p9ipdqljl64vd9ndabm0k8hww0m07sfdhwsl5ba9"))))
508 (build-system ruby-build-system)
510 '(;; No included tests
513 (list ruby-actionpack
518 ruby-rails-dom-testing))
519 (synopsis "Work with emails using the controller/view pattern")
521 "Compose, deliver, receive, and test emails using the controller/view
522 pattern. Including support for multipart email and attachments.")
523 (home-page "https://rubyonrails.org/")
524 (license license:expat)))
526 (define-public ruby-railties
528 (name "ruby-railties")
533 (uri (rubygems-uri "railties" version))
536 "1685y5dcfgcq0b38j13vrpkhiiblmrl64wa9w065669bkgmkw4ra"))))
537 (build-system ruby-build-system)
539 '(;; No included tests
542 (list ruby-actionpack ruby-activesupport ruby-method-source ruby-rake
544 (synopsis "Rails internals, including application bootup and generators")
546 "@code{railties} provides the core Rails internals including handling
547 application bootup, plugins, generators, and Rake tasks.")
548 (home-page "https://rubyonrails.org/")
549 (license license:expat)))
551 (define-public ruby-sprockets-rails
553 (name "ruby-sprockets-rails")
558 (uri (rubygems-uri "sprockets-rails" version))
561 "0ab42pm8p5zxpv3sfraq45b9lj39cz9mrpdirm30vywzrwwkm5p1"))))
562 (build-system ruby-build-system)
564 '(;; No included tests
567 (list ruby-actionpack ruby-activesupport ruby-sprockets))
568 (synopsis "Sprockets Rails integration")
570 "Provides Sprockets implementation for the Rails Asset Pipeline.")
572 "https://github.com/rails/sprockets-rails")
573 (license license:expat)))
575 (define-public ruby-web-console
577 (name "ruby-web-console")
581 ;; Download from GitHub as test files are not provided in the gem.
584 (url "https://github.com/rails/web-console")
585 (commit (string-append "v" version))))
586 (file-name (git-file-name name version))
589 "0azk8nmimnjbh74vxgwcj9jr588rj7kb5rrlclcjfjsw9jqjzckc"))))
590 (build-system ruby-build-system)
593 (modify-phases %standard-phases
594 (add-after 'unpack 'patch-Gemfile
596 (substitute* "Gemfile"
597 ;; Remove the github bit from the Gemfile, so that the Guix
598 ;; packages are used.
599 ((", github: .*") "\n")
600 ;; The usual methods of not loading this group don't work, so
601 ;; patch the Gemfile.
602 (("group :development") "[].each")
603 ;; tzinfo-data is propagated by ruby-activesupport, but it
604 ;; needs to be in the Gemfile to become available.
605 (("group :test do") "group :test do\n gem 'tzinfo-data'"))
608 (list ruby-actionview ruby-activemodel ruby-bindex ruby-railties))
610 (list bundler ruby-rails ruby-mocha ruby-simplecov))
611 (synopsis "Debugging tool for your Ruby on Rails applications")
613 "This package allows you to create an interactive Ruby session in your
614 browser. Those sessions are launched automatically in case of an error and
615 can also be launched manually in any page.")
616 (home-page "https://github.com/rails/web-console")
617 (license license:expat)))
619 (define-public ruby-with-advisory-lock
621 (name "ruby-with-advisory-lock")
626 (uri (rubygems-uri "with_advisory_lock" version))
629 "1k37hxgmaqgsd54gplm5xim9nw3ghvqsbzaw7q4q64ha1nbd9a41"))))
630 (build-system ruby-build-system)
632 '(#:tests? #f)) ; TODO Tests require a running MySQL service
634 (list ruby-activerecord))
636 (list bundler ruby-yard ruby-mysql2))
637 (synopsis "Advisory locking for ActiveRecord")
639 "The With advisory lock gem adds advisory locking to ActiveRecord for
640 PostgreSQL and MySQL. SQLite is also supported, but this uses the file system
642 (home-page "https://closuretree.github.io/with_advisory_lock/")
643 (license license:expat)))
645 (define-public ruby-rails
652 (uri (rubygems-uri "rails" version))
655 "0hdancysa617lzyy5gmrcmnpgyb1mz1lawy0l34ycz2wary7y2bz"))))
656 (build-system ruby-build-system)
659 (modify-phases %standard-phases
660 ;; This gem acts as glue between the gems that actually make up
661 ;; Rails. The important thing to check is that the gemspec matches up
662 ;; with the Guix packages and Rubygems can successfully activate the
665 ;; The following check phase tests this.
667 (add-after 'install 'check
668 (lambda* (#:key tests? outputs #:allow-other-keys)
673 (assoc-ref outputs "out") "/lib/ruby/vendor_ruby"))
675 (invoke "ruby" "-e" "gem 'rails'"))
678 (list ruby-actioncable
691 ruby-sprockets-rails))
692 (synopsis "Full-stack web framework optimized for programmer happiness")
694 "Ruby on Rails is a full-stack web framework optimized for programmer
695 happiness and sustainable productivity. It encourages beautiful code by
696 favoring convention over configuration.")
697 (home-page "https://rubyonrails.org/")
698 (license license:expat)))