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 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 "1idmvqvpgri34k31s44pjb88rc3jad3yxra7fd1kpidpnv5f3v65"))))
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 "1c5cz9v7ggpqjxf0fqs1xhy1pb9m34cp31pxarhs9aqb71qjl98v"))))
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 "1gv7vr5d9g2xmgpjfq4nxsqr70r9pr042r9ycqqnfvw5cz9c7jwr"))))
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.git")
294 (commit (string-append "v" version))))
295 (file-name (git-file-name name version))
298 "0zrg6x1w3wjgklbhcphjmggl11jx5s8cl21qjqij7wknm412i5wl"))))
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-actionview
314 (name "ruby-actionview")
319 (uri (rubygems-uri "actionview" version))
322 "0832vlx37rly8ryfgi01b20mld8b3bv9cg62n5wax4zpzgn6jdxb"))))
323 (build-system ruby-build-system)
325 '(;; No included tests
328 `(("ruby-activesupport" ,ruby-activesupport)
329 ("ruby-builder" ,ruby-builder)
330 ("ruby-erubi" ,ruby-erubi)
331 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)
332 ("ruby-rails-html-sanitizer" ,ruby-rails-html-sanitizer)))
333 (synopsis "Conventions and helpers for building web pages")
335 "ActionView provides conventions and helpers for building web pages in
337 (home-page "https://rubyonrails.org/")
338 (license license:expat)))
340 (define-public ruby-actionpack
342 (name "ruby-actionpack")
347 (uri (rubygems-uri "actionpack" version))
350 "1lxqzxa728dqg42yw0q4hqkaawqagiw1k0392an2ghjfgb16pafx"))))
351 (build-system ruby-build-system)
353 '(;; No included tests
356 `(("ruby-actionview" ,ruby-actionview)
357 ("ruby-activesupport" ,ruby-activesupport)
358 ("ruby-rack" ,ruby-rack)
359 ("ruby-rack-test" ,ruby-rack-test)
360 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)
361 ("ruby-rails-html-sanitizer" ,ruby-rails-html-sanitizer)))
362 (synopsis "Conventions for building and testing MVC web applications")
364 "ActionPack provides conventions for building and testing MVC web
365 applications. These work with any Rack-compatible server.")
366 (home-page "https://rubyonrails.org/")
367 (license license:expat)))
369 (define-public ruby-actioncable
371 (name "ruby-actioncable")
376 (uri (rubygems-uri "actioncable" version))
379 "1x5fxhsr2mxq5r6258s48xsn7ld081d3qaavppvj7yp7w9vqn871"))))
380 (build-system ruby-build-system)
382 '(;; No included tests
385 `(("ruby-actionpack" ,ruby-actionpack)
386 ("ruby-nio4r" ,ruby-nio4r)
387 ("ruby-websocket-driver" ,ruby-websocket-driver)))
388 (synopsis "Integrate integrates WebSockets with Rails applications")
390 "Action Cable integrates WebSockets with Rails applications. Through
391 WebSockets it allows for real-time features in web applications.")
392 (home-page "https://rubyonrails.org/")
393 (license license:expat)))
395 (define-public ruby-activejob
397 (name "ruby-activejob")
402 (uri (rubygems-uri "activejob" version))
405 "1zma452lc3qp4a7r10zbdmsci0kv9a3gnk4da2apbdrc8fib5mr3"))))
406 (build-system ruby-build-system)
408 '(;; No included tests
411 `(("ruby-activesupport" ,ruby-activesupport)
412 ("ruby-globalid" ,ruby-globalid)))
413 (synopsis "Declare job classes for multiple backends")
415 "ActiveJob allows declaring job classes in a common way across Rails
417 (home-page "https://rubyonrails.org/")
418 (license license:expat)))
420 (define-public ruby-activestorage
422 (name "ruby-activestorage")
427 (uri (rubygems-uri "activestorage" version))
430 "155xpbzrz0kr0argx0vsh5prvadd2h1g1m61kdiabvfy2iygc02n"))))
431 (build-system ruby-build-system)
433 '(;; No included tests
436 `(("ruby-actionpack" ,ruby-actionpack)
437 ("ruby-activerecord" ,ruby-activerecord)
438 ("ruby-marcel" ,ruby-marcel)))
439 (synopsis "Integrate file storage services in to Rails applications")
441 "ActiveStorage integrates file storage services with Rails applications,
442 allowing files to be attached to ActiveRecord models..")
443 (home-page "https://rubyonrails.org/")
444 (license license:expat)))
446 (define-public ruby-actionmailer
448 (name "ruby-actionmailer")
453 (uri (rubygems-uri "actionmailer" version))
456 "10n2v2al68rsq5ghrdp7cpycsc1q0m19fcd8cd5i528n30nl23iw"))))
457 (build-system ruby-build-system)
459 '(;; No included tests
462 `(("ruby-actionpack" ,ruby-actionpack)
463 ("ruby-actionview" ,ruby-actionview)
464 ("ruby-activejob" ,ruby-activejob)
465 ("ruby-mail" ,ruby-mail)
466 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)))
467 (synopsis "Work with emails using the controller/view pattern")
469 "Compose, deliver, receive, and test emails using the controller/view
470 pattern. Including support for multipart email and attachments.")
471 (home-page "https://rubyonrails.org/")
472 (license license:expat)))
474 (define-public ruby-railties
476 (name "ruby-railties")
481 (uri (rubygems-uri "railties" version))
484 "0al6mvh2jvr3n7cxkx0yvhgiiarby6gxc93vl5xg1yxkvx27qzd6"))))
485 (build-system ruby-build-system)
487 '(;; No included tests
490 `(("ruby-actionpack" ,ruby-actionpack)
491 ("ruby-activesupport" ,ruby-activesupport)
492 ("ruby-method-source" ,ruby-method-source)
493 ("ruby-thor" ,ruby-thor)))
494 (synopsis "Rails internals, including application bootup and generators")
496 "@code{railties} provides the core Rails internals including handling
497 application bootup, plugins, generators, and Rake tasks.")
498 (home-page "https://rubyonrails.org/")
499 (license license:expat)))
501 (define-public ruby-sprockets-rails
503 (name "ruby-sprockets-rails")
508 (uri (rubygems-uri "sprockets-rails" version))
511 "0ab42pm8p5zxpv3sfraq45b9lj39cz9mrpdirm30vywzrwwkm5p1"))))
512 (build-system ruby-build-system)
514 '(;; No included tests
517 `(("ruby-actionpack" ,ruby-actionpack)
518 ("ruby-activesupport" ,ruby-activesupport)
519 ("ruby-sprockets" ,ruby-sprockets)))
520 (synopsis "Sprockets Rails integration")
522 "Provides Sprockets implementation for the Rails Asset Pipeline.")
524 "https://github.com/rails/sprockets-rails")
525 (license license:expat)))
527 (define-public ruby-web-console
529 (name "ruby-web-console")
533 ;; Download from GitHub as test files are not provided in the gem.
536 (url "https://github.com/rails/web-console.git")
537 (commit (string-append "v" version))))
538 (file-name (git-file-name name version))
541 "0ir999p8cnm3l3zwbgpwxxcq1vwkj8d0d3r24362cyaf4v1rglq2"))))
542 (build-system ruby-build-system)
545 (modify-phases %standard-phases
546 (add-after 'unpack 'patch-Gemfile
548 (substitute* "Gemfile"
549 ;; Remove the github bit from the Gemfile, so that the Guix
550 ;; packages are used.
551 ((", github: .*") "\n")
552 ;; The usual methods of not loading this group don't work, so
553 ;; patch the Gemfile.
554 (("group :development") "[].each")
555 ;; tzinfo-data is propagated by ruby-activesupport, but it
556 ;; needs to be in the Gemfile to become available.
557 (("group :test do") "group :test do\n gem 'tzinfo-data'"))
559 (add-after 'unpack 'fix-mocha-minitest-require
561 (substitute* "test/test_helper.rb"
562 ;; This chanegd in recent versions of Mocha
563 (("mocha/minitest") "mocha/mini_test"))
566 `(("ruby-actionview" ,ruby-actionview)
567 ("ruby-activemodel" ,ruby-activemodel)
568 ("ruby-bindex" ,ruby-bindex)
569 ("ruby-railties" ,ruby-railties)))
571 `(("bundler" ,bundler)
572 ("ruby-rails" ,ruby-rails)
573 ("ruby-mocha" ,ruby-mocha)
574 ("ruby-simplecov" ,ruby-simplecov)))
575 (synopsis "Debugging tool for your Ruby on Rails applications")
577 "This package allows you to create an interactive Ruby session in your
578 browser. Those sessions are launched automatically in case of an error and
579 can also be launched manually in any page.")
580 (home-page "https://github.com/rails/web-console")
581 (license license:expat)))
583 (define-public ruby-with-advisory-lock
585 (name "ruby-with-advisory-lock")
590 (uri (rubygems-uri "with_advisory_lock" version))
593 "1k37hxgmaqgsd54gplm5xim9nw3ghvqsbzaw7q4q64ha1nbd9a41"))))
594 (build-system ruby-build-system)
596 '(#:tests? #f)) ; TODO Tests require a running MySQL service
598 `(("ruby-activerecord" ,ruby-activerecord)))
600 `(("bundler" ,bundler)
601 ("ruby-yard" ,ruby-yard)
602 ("ruby-mysql2" ,ruby-mysql2)))
603 (synopsis "Advisory locking for ActiveRecord")
605 "The With advisory lock gem adds advisory locking to ActiveRecord for
606 PostgreSQL and MySQL. SQLite is also supported, but this uses the file system
608 (home-page "https://closuretree.github.io/with_advisory_lock/")
609 (license license:expat)))
611 (define-public ruby-rails
618 (uri (rubygems-uri "rails" version))
621 "1jxmwrykwgbn116hhmi7h75hcsdifhj89wk12m7ch2f3mn1lrmp9"))))
622 (build-system ruby-build-system)
625 (modify-phases %standard-phases
626 ;; This gem acts as glue between the gems that actually make up
627 ;; Rails. The important thing to check is that the gemspec matches up
628 ;; with the Guix packages and Rubygems can successfully activate the
631 ;; The following check phase tests this.
633 (add-after 'install 'check
634 (lambda* (#:key tests? outputs #:allow-other-keys)
639 (assoc-ref outputs "out") "/lib/ruby/vendor_ruby"))
641 (invoke "ruby" "-e" "gem 'rails'"))
644 `(("ruby-activesupport" ,ruby-activesupport)
645 ("ruby-actionpack" ,ruby-actionpack)
646 ("ruby-actionview" ,ruby-actionview)
647 ("ruby-activemodel" ,ruby-activemodel)
648 ("ruby-activerecord" ,ruby-activerecord)
649 ("ruby-actionmailer" ,ruby-actionmailer)
650 ("ruby-activejob" ,ruby-activejob)
651 ("ruby-actioncable" ,ruby-actioncable)
652 ("ruby-activestorage" ,ruby-activestorage)
653 ("ruby-railties" ,ruby-railties)
655 ("ruby-sprockets-rails" ,ruby-sprockets-rails)))
656 (synopsis "Full-stack web framework optimized for programmer happiness")
658 "Ruby on Rails is a full-stack web framework optimized for programmer
659 happiness and sustainable productivity. It encourages beautiful code by
660 favoring convention over configuration.")
661 (home-page "https://rubyonrails.org/")
662 (license license:expat)))