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 (list bundler ruby-activesupport))
60 (synopsis "Ruby on Rails application preloader")
62 "Spring is a Ruby on Rails application preloader. It speeds up
63 development by keeping your application running in the background so the
64 application does need to boot it every time you run a test, rake task or
66 (home-page "https://github.com/rails/spring")
67 (license license:expat)))
69 (define-public ruby-sass-rails
71 (name "ruby-sass-rails")
76 (uri (rubygems-uri "sass-rails" version))
79 "1wa63sbsimrsf7nfm8h0m1wbsllkfxvd7naph5d1j6pbc555ma7s"))))
80 (build-system ruby-build-system)
82 '(#:tests? #f)) ; No included tests
84 (list ruby-railties ruby-sass ruby-sprockets ruby-sprockets-rails
86 (synopsis "Sass adapter for the Rails asset pipeline")
88 "This library integrates the SASS stylesheet language into Ruby on
90 (home-page "https://github.com/rails/sass-rails")
91 (license license:expat)))
93 (define-public ruby-debug-inspector
95 (name "ruby-debug-inspector")
100 (uri (rubygems-uri "debug_inspector" version))
103 "0vxr0xa1mfbkfcrn71n7c4f2dj7la5hvphn904vh20j3x4j5lrx0"))))
104 (build-system ruby-build-system)
107 (modify-phases %standard-phases
110 (invoke "rake" "compile")
111 (invoke "ruby" "-Ilib" "-e"
113 "require 'debug_inspector'; RubyVM::DebugInspector."
114 "open{|dc| p dc.backtrace_locations}")))))))
115 (synopsis "Ruby wrapper for the MRI 2.0 debug_inspector API")
117 "This package provides a Ruby wrapper for the MRI 2.0 debug_inspector
120 "https://github.com/banister/debug_inspector")
121 (license license:expat)))
123 (define-public ruby-autoprefixer-rails
125 (name "ruby-autoprefixer-rails")
130 (uri (rubygems-uri "autoprefixer-rails" version))
133 "0fxbfl3xrrjj84n98x24yzxbz4nvm6c492dxj41kkrl9z97ga13i"))))
134 (build-system ruby-build-system)
136 '(#:test-target "spec"
138 (modify-phases %standard-phases
139 (add-after 'extract-gemspec 'remove-unnecessary-dependencies
141 ;; Remove the testing of compass, as its use is deprecated, and
142 ;; it's unpackaged for Guix.
143 (substitute* "autoprefixer-rails.gemspec"
144 ((".*%q<compass>.*") "\n")
145 (("\"spec/compass_spec\\.rb\"\\.freeze, ") ""))
146 (delete-file "spec/compass_spec.rb")
148 (substitute* "Gemfile"
149 ;; Remove overly strict requirement on sprockets
150 ((", '>= 4\\.0\\.0\\.beta1'") "")
151 ;; The mini_racer gem isn't packaged yet, and it's not directly
152 ;; required, as other backends for ruby-execjs can be used.
153 (("gem 'mini_racer'") "")
154 ;; For some reason, this is required for the gems to be picked
156 (("gemspec") "gemspec\ngem 'tzinfo-data'\ngem 'sass'"))
162 ;; This is needed for a test, but I'm unsure why
164 ;; This is used as the ruby-execjs runtime
168 (synopsis "Parse CSS and add vendor prefixes to CSS rules")
170 "This gem provides Ruby and Ruby on Rails integration with Autoprefixer,
171 which can parse CSS and add vendor prefixes to CSS rules using values from the
173 (home-page "https://github.com/ai/autoprefixer-rails")
174 (license license:expat)))
176 (define-public ruby-activemodel
178 (name "ruby-activemodel")
183 (uri (rubygems-uri "activemodel" version))
186 "07m85r00cd1dzxg65zr9wjrdqppw51b5ka9c5mrz92vnw18kfb70"))))
187 (build-system ruby-build-system)
189 '(;; No included tests
192 (list ruby-activesupport))
193 (synopsis "Toolkit for building modeling frameworks like Active Record")
195 "This package provides a toolkit for building modeling frameworks like
196 Active Record. ActiveSupport handles attributes, callbacks, validations,
197 serialization, internationalization, and testing.")
198 (home-page "https://rubyonrails.org/")
199 (license license:expat)))
201 (define-public ruby-activerecord
203 (name "ruby-activerecord")
208 (uri (rubygems-uri "activerecord" version))
211 "03kr6vslwd9iw89jidjpjlp7prr2rf7kpsfa4fz03g9by0kliivs"))))
212 (build-system ruby-build-system)
214 '(;; No included tests
217 (list ruby-activemodel ruby-activesupport ruby-arel))
218 (synopsis "Ruby library to connect to relational databases")
220 "Active Record connects classes to relational database table to establish
221 an almost zero-configuration persistence layer for applications.")
222 (home-page "https://rubyonrails.org")
223 (license license:expat)))
225 (define-public ruby-rspec-rails
227 (name "ruby-rspec-rails")
232 (uri (rubygems-uri "rspec-rails" version))
235 "1pf6n9l4sw1arlax1bdbm1znsvl8cgna2n6k6yk1bi8vz2n73ls1"))))
236 (build-system ruby-build-system)
238 '(#:tests? #f)) ; No included tests
240 (list ruby-actionpack
244 ruby-rspec-expectations
247 (synopsis "Use RSpec to test Ruby on Rails applications")
249 "This package provides support for using RSpec to test Ruby on Rails
250 applications, in pace of the default Minitest testing library.")
251 (home-page "https://github.com/rspec/rspec-rails")
252 (license license:expat)))
254 (define-public ruby-rails-html-sanitizer
256 (name "ruby-rails-html-sanitizer")
261 (uri (rubygems-uri "rails-html-sanitizer" version))
264 "1icpqmxbppl4ynzmn6dx7wdil5hhq6fz707m9ya6d86c7ys8sd4f"))))
265 (build-system ruby-build-system)
267 '(;; No included tests
271 (synopsis "HTML sanitization for Rails applications")
273 "This gem is used to handle HTML sanitization in Rails applications. If
274 you need similar functionality in non Rails apps consider using Loofah
276 (home-page "https://github.com/rails/rails-html-sanitizer")
277 (license license:expat)))
279 (define-public ruby-rails-dom-testing
281 (name "ruby-rails-dom-testing")
287 (url "https://github.com/rails/rails-dom-testing")
288 (commit (string-append "v" version))))
289 (file-name (git-file-name name version))
292 "17vdh273cmmfpzy5m546dd13zqmimv54jjx0f7sl0zi5lwz0gnck"))))
293 (build-system ruby-build-system)
297 (list ruby-activesupport ruby-nokogiri))
298 (synopsis "Compare HTML DOMs and assert certain elements exists")
300 "This gem can compare HTML and assert certain elements exists. This is
301 useful when writing tests.")
302 (home-page "https://github.com/rails/rails-dom-testing")
303 (license license:expat)))
305 (define-public ruby-actiontext
307 (name "ruby-actiontext")
312 (uri (rubygems-uri "actiontext" version))
315 "04k4z4xj40sbzbgx0x9m6i8k0nc22jb6dkrlslj16p2z2dfnwhqg"))))
316 (build-system ruby-build-system)
318 '(;; No included tests
321 (list ruby-actionpack ruby-activerecord ruby-activestorage
322 ruby-activesupport ruby-nokogiri))
323 (synopsis "Edit and display rich text in Rails applications")
325 "ActionText edits and displays rich text in Rails applications.")
326 (home-page "https://rubyonrails.org")
327 (license license:expat)))
329 (define-public ruby-actionview
331 (name "ruby-actionview")
336 (uri (rubygems-uri "actionview" version))
339 "1s5kc1abi7id1g54lz1npgc42zl7pbz172wp8pi7j3s7qljafzw5"))))
340 (build-system ruby-build-system)
342 '(;; No included tests
345 (list ruby-activesupport ruby-builder ruby-erubi
346 ruby-rails-dom-testing ruby-rails-html-sanitizer))
347 (synopsis "Conventions and helpers for building web pages")
349 "ActionView provides conventions and helpers for building web pages in
351 (home-page "https://rubyonrails.org/")
352 (license license:expat)))
354 (define-public ruby-actionpack
356 (name "ruby-actionpack")
361 (uri (rubygems-uri "actionpack" version))
364 "030yyaskzlic5cp4d9zbwwr3rhf4k6hsls44a7ihsfd6r8mlivq5"))))
365 (build-system ruby-build-system)
367 '(;; No included tests
370 (list ruby-actionview
374 ruby-rails-dom-testing
375 ruby-rails-html-sanitizer))
376 (synopsis "Conventions for building and testing MVC web applications")
378 "ActionPack provides conventions for building and testing MVC web
379 applications. These work with any Rack-compatible server.")
380 (home-page "https://rubyonrails.org/")
381 (license license:expat)))
383 (define-public ruby-actioncable
385 (name "ruby-actioncable")
390 (uri (rubygems-uri "actioncable" version))
393 "1cgb1l0gml1vklxka2djpi5q5b4bgzgm5pahzfjvvgm5vzvrvi9v"))))
394 (build-system ruby-build-system)
396 '(;; No included tests
399 (list ruby-actionpack ruby-activesupport ruby-nio4r
400 ruby-websocket-driver))
401 (synopsis "Integrate integrates WebSockets with Rails applications")
403 "Action Cable integrates WebSockets with Rails applications. Through
404 WebSockets it allows for real-time features in web applications.")
405 (home-page "https://rubyonrails.org/")
406 (license license:expat)))
408 (define-public ruby-activejob
410 (name "ruby-activejob")
415 (uri (rubygems-uri "activejob" version))
418 "175d8q0achdlsxjsvq0w9znvfqfkgbj75kbmdrvg4fb277wwplmf"))))
419 (build-system ruby-build-system)
421 '(;; No included tests
424 (list ruby-activesupport ruby-globalid))
425 (synopsis "Declare job classes for multiple backends")
427 "ActiveJob allows declaring job classes in a common way across Rails
429 (home-page "https://rubyonrails.org/")
430 (license license:expat)))
432 (define-public ruby-activestorage
434 (name "ruby-activestorage")
439 (uri (rubygems-uri "activestorage" version))
442 "0gkxvbi5w8zmdxpiyz3b10kzz8cxqqh9bj81sjl3fp8wa3v2ld4i"))))
443 (build-system ruby-build-system)
445 '(;; No included tests
448 (list ruby-actionpack
454 (synopsis "Integrate file storage services in to Rails applications")
456 "ActiveStorage integrates file storage services with Rails applications,
457 allowing files to be attached to ActiveRecord models.")
458 (home-page "https://rubyonrails.org/")
459 (license license:expat)))
461 (define-public ruby-actionmailbox
463 (name "ruby-actionmailbox")
468 (uri (rubygems-uri "actionmailbox" version))
471 "0wv2p24xn4f0kj8kiyagkn934hzrcp98vzjqxwd4r75qq0cijadp"))))
472 (build-system ruby-build-system)
474 '(;; No included tests
477 (list ruby-actionpack
483 (synopsis "Receive and process incoming emails in Rails applications")
485 "ActionMailbox receives and processes incoming emails in Rails applications.")
486 (home-page "https://rubyonrails.org")
487 (license license:expat)))
489 (define-public ruby-actionmailer
491 (name "ruby-actionmailer")
496 (uri (rubygems-uri "actionmailer" version))
499 "0lic4mc6wqi3p9ipdqljl64vd9ndabm0k8hww0m07sfdhwsl5ba9"))))
500 (build-system ruby-build-system)
502 '(;; No included tests
505 (list ruby-actionpack
510 ruby-rails-dom-testing))
511 (synopsis "Work with emails using the controller/view pattern")
513 "Compose, deliver, receive, and test emails using the controller/view
514 pattern. Including support for multipart email and attachments.")
515 (home-page "https://rubyonrails.org/")
516 (license license:expat)))
518 (define-public ruby-railties
520 (name "ruby-railties")
525 (uri (rubygems-uri "railties" version))
528 "1685y5dcfgcq0b38j13vrpkhiiblmrl64wa9w065669bkgmkw4ra"))))
529 (build-system ruby-build-system)
531 '(;; No included tests
534 (list ruby-actionpack ruby-activesupport ruby-method-source ruby-rake
536 (synopsis "Rails internals, including application bootup and generators")
538 "@code{railties} provides the core Rails internals including handling
539 application bootup, plugins, generators, and Rake tasks.")
540 (home-page "https://rubyonrails.org/")
541 (license license:expat)))
543 (define-public ruby-sprockets-rails
545 (name "ruby-sprockets-rails")
550 (uri (rubygems-uri "sprockets-rails" version))
553 "0ab42pm8p5zxpv3sfraq45b9lj39cz9mrpdirm30vywzrwwkm5p1"))))
554 (build-system ruby-build-system)
556 '(;; No included tests
559 (list ruby-actionpack ruby-activesupport ruby-sprockets))
560 (synopsis "Sprockets Rails integration")
562 "Provides Sprockets implementation for the Rails Asset Pipeline.")
564 "https://github.com/rails/sprockets-rails")
565 (license license:expat)))
567 (define-public ruby-web-console
569 (name "ruby-web-console")
573 ;; Download from GitHub as test files are not provided in the gem.
576 (url "https://github.com/rails/web-console")
577 (commit (string-append "v" version))))
578 (file-name (git-file-name name version))
581 "0azk8nmimnjbh74vxgwcj9jr588rj7kb5rrlclcjfjsw9jqjzckc"))))
582 (build-system ruby-build-system)
585 (modify-phases %standard-phases
586 (add-after 'unpack 'patch-Gemfile
588 (substitute* "Gemfile"
589 ;; Remove the github bit from the Gemfile, so that the Guix
590 ;; packages are used.
591 ((", github: .*") "\n")
592 ;; The usual methods of not loading this group don't work, so
593 ;; patch the Gemfile.
594 (("group :development") "[].each")
595 ;; tzinfo-data is propagated by ruby-activesupport, but it
596 ;; needs to be in the Gemfile to become available.
597 (("group :test do") "group :test do\n gem 'tzinfo-data'"))
600 (list ruby-actionview ruby-activemodel ruby-bindex ruby-railties))
602 (list bundler ruby-rails ruby-mocha ruby-simplecov))
603 (synopsis "Debugging tool for your Ruby on Rails applications")
605 "This package allows you to create an interactive Ruby session in your
606 browser. Those sessions are launched automatically in case of an error and
607 can also be launched manually in any page.")
608 (home-page "https://github.com/rails/web-console")
609 (license license:expat)))
611 (define-public ruby-with-advisory-lock
613 (name "ruby-with-advisory-lock")
618 (uri (rubygems-uri "with_advisory_lock" version))
621 "1k37hxgmaqgsd54gplm5xim9nw3ghvqsbzaw7q4q64ha1nbd9a41"))))
622 (build-system ruby-build-system)
624 '(#:tests? #f)) ; TODO Tests require a running MySQL service
626 (list ruby-activerecord))
628 (list bundler ruby-yard ruby-mysql2))
629 (synopsis "Advisory locking for ActiveRecord")
631 "The With advisory lock gem adds advisory locking to ActiveRecord for
632 PostgreSQL and MySQL. SQLite is also supported, but this uses the file system
634 (home-page "https://closuretree.github.io/with_advisory_lock/")
635 (license license:expat)))
637 (define-public ruby-rails
644 (uri (rubygems-uri "rails" version))
647 "0hdancysa617lzyy5gmrcmnpgyb1mz1lawy0l34ycz2wary7y2bz"))))
648 (build-system ruby-build-system)
651 (modify-phases %standard-phases
652 ;; This gem acts as glue between the gems that actually make up
653 ;; Rails. The important thing to check is that the gemspec matches up
654 ;; with the Guix packages and Rubygems can successfully activate the
657 ;; The following check phase tests this.
659 (add-after 'install 'check
660 (lambda* (#:key tests? outputs #:allow-other-keys)
665 (assoc-ref outputs "out") "/lib/ruby/vendor_ruby"))
667 (invoke "ruby" "-e" "gem 'rails'"))
670 (list ruby-actioncable
683 ruby-sprockets-rails))
684 (synopsis "Full-stack web framework optimized for programmer happiness")
686 "Ruby on Rails is a full-stack web framework optimized for programmer
687 happiness and sustainable productivity. It encourages beautiful code by
688 favoring convention over configuration.")
689 (home-page "https://rubyonrails.org/")
690 (license license:expat)))