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>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages rails)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix packages)
25 #:use-module (gnu packages node)
26 #:use-module (gnu packages ruby)
27 #:use-module (guix build-system ruby))
29 (define-public ruby-spring
37 (string-append "https://github.com/rails/spring/archive/v"
39 (file-name (string-append name "-" version ".tar.gz"))
42 "1dd58y0cpsm2izj74yscn0ybfygmgcbbfdw1891g7cq41aai4b35"))))
43 (build-system ruby-build-system)
45 `(#:test-target "test:unit"
47 (modify-phases %standard-phases
48 (add-before 'check 'remove-bump
50 (substitute* "spring.gemspec"
51 (("gem.add_development_dependency 'bump'") "")
52 (("gem.add_development_dependency 'activesupport'.*")
53 "gem.add_development_dependency 'activesupport'\n"))
54 (substitute* "Rakefile"
55 (("require \\\"bump/tasks\\\"") ""))
58 `(("bundler" ,bundler)
59 ("ruby-activesupport" ,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 `(("ruby-railties" ,ruby-railties)
85 ("ruby-sass" ,ruby-sass)
86 ("ruby-sprockets" ,ruby-sprockets)
87 ("ruby-sprockets-rails" ,ruby-sprockets-rails)
88 ("ruby-tilt" ,ruby-tilt)))
89 (synopsis "Sass adapter for the Rails asset pipeline")
91 "This library integrates the SASS stylesheet language into Ruby on
93 (home-page "https://github.com/rails/sass-rails")
94 (license license:expat)))
96 (define-public ruby-debug-inspector
98 (name "ruby-debug-inspector")
103 (uri (rubygems-uri "debug_inspector" version))
106 "0vxr0xa1mfbkfcrn71n7c4f2dj7la5hvphn904vh20j3x4j5lrx0"))))
107 (build-system ruby-build-system)
110 (modify-phases %standard-phases
113 (invoke "rake" "compile")
114 (invoke "ruby" "-Ilib" "-e"
116 "require 'debug_inspector'; RubyVM::DebugInspector."
117 "open{|dc| p dc.backtrace_locations}")))))))
118 (synopsis "Ruby wrapper for the MRI 2.0 debug_inspector API")
120 "This package provides a Ruby wrapper for the MRI 2.0 debug_inspector
123 "https://github.com/banister/debug_inspector")
124 (license license:expat)))
126 (define-public ruby-autoprefixer-rails
128 (name "ruby-autoprefixer-rails")
133 (uri (rubygems-uri "autoprefixer-rails" version))
136 "0fxbfl3xrrjj84n98x24yzxbz4nvm6c492dxj41kkrl9z97ga13i"))))
137 (build-system ruby-build-system)
139 '(#:test-target "spec"
141 (modify-phases %standard-phases
142 (add-after 'extract-gemspec 'remove-unnecessary-dependencies
144 ;; Remove the testing of compass, as it's use is deprecated, and
145 ;; it's unpackaged for Guix
146 (substitute* "autoprefixer-rails.gemspec"
147 ((".*%q<compass>.*") "\n")
148 (("\"spec/compass_spec\\.rb\"\\.freeze, ") ""))
149 (delete-file "spec/compass_spec.rb")
151 (substitute* "Gemfile"
152 ;; Remove overly strict requirement on sprockets
153 ((", '>= 4\\.0\\.0\\.beta1'") "")
154 ;; The mini_racer gem isn't packaged yet, and it's not directly
155 ;; required, as other backends for ruby-execjs can be used.
156 (("gem 'mini_racer'") "")
157 ;; For some reason, this is required for the gems to be picked
159 (("gemspec") "gemspec\ngem 'tzinfo-data'\ngem 'sass'"))
162 `(("bundler" ,bundler)
163 ("ruby-rails" ,ruby-rails)
164 ("ruby-rspec-rails" ,ruby-rspec-rails)
165 ;; This is needed for a test, but I'm unsure why
166 ("ruby-sass" ,ruby-sass)
167 ;; This is used as the ruby-execjs runtime
170 `(("ruby-execjs" ,ruby-execjs)))
171 (synopsis "Parse CSS and add vendor prefixes to CSS rules")
173 "This gem provides Ruby and Ruby on Rails integration with Autoprefixer,
174 which can parse CSS and add vendor prefixes to CSS rules using values from the
176 (home-page "https://github.com/ai/autoprefixer-rails")
177 (license license:expat)))
179 (define-public ruby-activemodel
181 (name "ruby-activemodel")
186 (uri (rubygems-uri "activemodel" version))
189 "1idmvqvpgri34k31s44pjb88rc3jad3yxra7fd1kpidpnv5f3v65"))))
190 (build-system ruby-build-system)
192 '(;; No included tests
195 `(("ruby-activesupport" ,ruby-activesupport)))
196 (synopsis "Toolkit for building modeling frameworks like Active Record")
198 "This package provides a toolkit for building modeling frameworks like
199 Active Record. ActiveSupport handles attributes, callbacks, validations,
200 serialization, internationalization, and testing.")
201 (home-page "https://rubyonrails.org/")
202 (license license:expat)))
204 (define-public ruby-activerecord
206 (name "ruby-activerecord")
211 (uri (rubygems-uri "activerecord" version))
214 "1c5cz9v7ggpqjxf0fqs1xhy1pb9m34cp31pxarhs9aqb71qjl98v"))))
215 (build-system ruby-build-system)
217 '(;; No included tests
220 `(("ruby-activemodel" ,ruby-activemodel)
221 ("ruby-activesupport" ,ruby-activesupport)
222 ("ruby-arel" ,ruby-arel)))
223 (synopsis "Ruby library to connect to relational databases")
225 "Active Record connects classes to relational database table to establish
226 an almost zero-configuration persistence layer for applications.")
227 (home-page "https://rubyonrails.org")
228 (license license:expat)))
230 (define-public ruby-rspec-rails
232 (name "ruby-rspec-rails")
237 (uri (rubygems-uri "rspec-rails" version))
240 "1pf6n9l4sw1arlax1bdbm1znsvl8cgna2n6k6yk1bi8vz2n73ls1"))))
241 (build-system ruby-build-system)
243 '(#:tests? #f)) ; No included tests
245 `(("ruby-actionpack" ,ruby-actionpack)
246 ("ruby-activesupport" ,ruby-activesupport)
247 ("ruby-railties" ,ruby-railties)
248 ("ruby-rspec-core" ,ruby-rspec-core)
249 ("ruby-rspec-expectations" ,ruby-rspec-expectations)
250 ("ruby-rspec-mocks" ,ruby-rspec-mocks)
251 ("ruby-rspec-support" ,ruby-rspec-support)))
252 (synopsis "Use RSpec to test Ruby on Rails applications")
254 "This package provides support for using RSpec to test Ruby on Rails
255 applications, in pace of the default Minitest testing library.")
256 (home-page "https://github.com/rspec/rspec-rails")
257 (license license:expat)))
259 (define-public ruby-rails-html-sanitizer
261 (name "ruby-rails-html-sanitizer")
266 (uri (rubygems-uri "rails-html-sanitizer" version))
269 "1gv7vr5d9g2xmgpjfq4nxsqr70r9pr042r9ycqqnfvw5cz9c7jwr"))))
270 (build-system ruby-build-system)
272 '(;; No included tests
275 `(("ruby-loofah" ,ruby-loofah)))
276 (synopsis "HTML sanitization for Rails applications")
278 "This gem is used to handle HTML sanitization in Rails applications. If
279 you need similar functionality in non Rails apps consider using Loofah
281 (home-page "https://github.com/rails/rails-html-sanitizer")
282 (license license:expat)))
284 (define-public ruby-rails-dom-testing
286 (name "ruby-rails-dom-testing")
292 (url "https://github.com/rails/rails-dom-testing.git")
293 (commit (string-append "v" version))))
294 (file-name (git-file-name name version))
297 "0zrg6x1w3wjgklbhcphjmggl11jx5s8cl21qjqij7wknm412i5wl"))))
298 (build-system ruby-build-system)
300 `(("bundler" ,bundler)))
302 `(("ruby-activesupport" ,ruby-activesupport)
303 ("ruby-nokogiri" ,ruby-nokogiri)))
304 (synopsis "Compare HTML DOMs and assert certain elements exists")
306 "This gem can compare HTML and assert certain elements exists. This is
307 useful when writing tests.")
308 (home-page "https://github.com/rails/rails-dom-testing")
309 (license license:expat)))
311 (define-public ruby-actionview
313 (name "ruby-actionview")
318 (uri (rubygems-uri "actionview" version))
321 "0832vlx37rly8ryfgi01b20mld8b3bv9cg62n5wax4zpzgn6jdxb"))))
322 (build-system ruby-build-system)
324 '(;; No included tests
327 `(("ruby-activesupport" ,ruby-activesupport)
328 ("ruby-builder" ,ruby-builder)
329 ("ruby-erubi" ,ruby-erubi)
330 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)
331 ("ruby-rails-html-sanitizer" ,ruby-rails-html-sanitizer)))
332 (synopsis "Conventions and helpers for building web pages")
334 "ActionView provides conventions and helpers for building web pages in
336 (home-page "https://rubyonrails.org/")
337 (license license:expat)))
339 (define-public ruby-actionpack
341 (name "ruby-actionpack")
346 (uri (rubygems-uri "actionpack" version))
349 "1lxqzxa728dqg42yw0q4hqkaawqagiw1k0392an2ghjfgb16pafx"))))
350 (build-system ruby-build-system)
352 '(;; No included tests
355 `(("ruby-actionview" ,ruby-actionview)
356 ("ruby-activesupport" ,ruby-activesupport)
357 ("ruby-rack" ,ruby-rack)
358 ("ruby-rack-test" ,ruby-rack-test)
359 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)
360 ("ruby-rails-html-sanitizer" ,ruby-rails-html-sanitizer)))
361 (synopsis "Conventions for building and testing MVC web applications")
363 "ActionPack provides conventions for building and testing MVC web
364 applications. These work with any Rack-compatible server.")
365 (home-page "https://rubyonrails.org/")
366 (license license:expat)))
368 (define-public ruby-actioncable
370 (name "ruby-actioncable")
375 (uri (rubygems-uri "actioncable" version))
378 "1x5fxhsr2mxq5r6258s48xsn7ld081d3qaavppvj7yp7w9vqn871"))))
379 (build-system ruby-build-system)
381 '(;; No included tests
384 `(("ruby-actionpack" ,ruby-actionpack)
385 ("ruby-nio4r" ,ruby-nio4r)
386 ("ruby-websocket-driver" ,ruby-websocket-driver)))
387 (synopsis "Integrate integrates WebSockets with Rails applications")
389 "Action Cable integrates WebSockets with Rails applications. Through
390 WebSockets it allows for real-time features in web applications.")
391 (home-page "https://rubyonrails.org/")
392 (license license:expat)))
394 (define-public ruby-activejob
396 (name "ruby-activejob")
401 (uri (rubygems-uri "activejob" version))
404 "1zma452lc3qp4a7r10zbdmsci0kv9a3gnk4da2apbdrc8fib5mr3"))))
405 (build-system ruby-build-system)
407 '(;; No included tests
410 `(("ruby-activesupport" ,ruby-activesupport)
411 ("ruby-globalid" ,ruby-globalid)))
412 (synopsis "Declare job classes for multiple backends")
414 "ActiveJob allows declaring job classes in a common way across Rails
416 (home-page "https://rubyonrails.org/")
417 (license license:expat)))
419 (define-public ruby-activestorage
421 (name "ruby-activestorage")
426 (uri (rubygems-uri "activestorage" version))
429 "155xpbzrz0kr0argx0vsh5prvadd2h1g1m61kdiabvfy2iygc02n"))))
430 (build-system ruby-build-system)
432 '(;; No included tests
435 `(("ruby-actionpack" ,ruby-actionpack)
436 ("ruby-activerecord" ,ruby-activerecord)
437 ("ruby-marcel" ,ruby-marcel)))
438 (synopsis "Integrate file storage services in to Rails applications")
440 "ActiveStorage integrates file storage services with Rails applications,
441 allowing files to be attached to ActiveRecord models..")
442 (home-page "https://rubyonrails.org/")
443 (license license:expat)))
445 (define-public ruby-actionmailer
447 (name "ruby-actionmailer")
452 (uri (rubygems-uri "actionmailer" version))
455 "10n2v2al68rsq5ghrdp7cpycsc1q0m19fcd8cd5i528n30nl23iw"))))
456 (build-system ruby-build-system)
458 '(;; No included tests
461 `(("ruby-actionpack" ,ruby-actionpack)
462 ("ruby-actionview" ,ruby-actionview)
463 ("ruby-activejob" ,ruby-activejob)
464 ("ruby-mail" ,ruby-mail)
465 ("ruby-rails-dom-testing" ,ruby-rails-dom-testing)))
466 (synopsis "Work with emails using the controller/view pattern")
468 "Compose, deliver, receive, and test emails using the controller/view
469 pattern. Including support for multipart email and attachments.")
470 (home-page "https://rubyonrails.org/")
471 (license license:expat)))
473 (define-public ruby-railties
475 (name "ruby-railties")
480 (uri (rubygems-uri "railties" version))
483 "0al6mvh2jvr3n7cxkx0yvhgiiarby6gxc93vl5xg1yxkvx27qzd6"))))
484 (build-system ruby-build-system)
486 '(;; No included tests
489 `(("ruby-actionpack" ,ruby-actionpack)
490 ("ruby-activesupport" ,ruby-activesupport)
491 ("ruby-method-source" ,ruby-method-source)
492 ("ruby-thor" ,ruby-thor)))
493 (synopsis "Rails internals, including application bootup and generators")
495 "@code{railties} provides the core Rails internals including handling
496 application bootup, plugins, generators, and Rake tasks.")
497 (home-page "https://rubyonrails.org/")
498 (license license:expat)))
500 (define-public ruby-sprockets-rails
502 (name "ruby-sprockets-rails")
507 (uri (rubygems-uri "sprockets-rails" version))
510 "0ab42pm8p5zxpv3sfraq45b9lj39cz9mrpdirm30vywzrwwkm5p1"))))
511 (build-system ruby-build-system)
513 '(;; No included tests
516 `(("ruby-actionpack" ,ruby-actionpack)
517 ("ruby-activesupport" ,ruby-activesupport)
518 ("ruby-sprockets" ,ruby-sprockets)))
519 (synopsis "Sprockets Rails integration")
521 "Provides Sprockets implementation for the Rails Asset Pipeline.")
523 "https://github.com/rails/sprockets-rails")
524 (license license:expat)))
526 (define-public ruby-web-console
528 (name "ruby-web-console")
532 ;; Download from GitHub as test files are not provided in the gem.
535 (url "https://github.com/rails/web-console.git")
536 (commit (string-append "v" version))))
537 (file-name (git-file-name name version))
540 "0ir999p8cnm3l3zwbgpwxxcq1vwkj8d0d3r24362cyaf4v1rglq2"))))
541 (build-system ruby-build-system)
544 (modify-phases %standard-phases
545 (add-after 'unpack 'patch-Gemfile
547 (substitute* "Gemfile"
548 ;; Remove the github bit from the Gemfile, so that the Guix
549 ;; packages are used.
550 ((", github: .*") "\n")
551 ;; The usual methods of not loading this group don't work, so
552 ;; patch the Gemfile.
553 (("group :development") "[].each")
554 ;; tzinfo-data is propagated by ruby-activesupport, but it
555 ;; needs to be in the Gemfile to become available.
556 (("group :test do") "group :test do\n gem 'tzinfo-data'"))
558 (add-after 'unpack 'fix-mocha-minitest-require
560 (substitute* "test/test_helper.rb"
561 ;; This chanegd in recent versions of Mocha
562 (("mocha/minitest") "mocha/mini_test"))
565 `(("ruby-actionview" ,ruby-actionview)
566 ("ruby-activemodel" ,ruby-activemodel)
567 ("ruby-bindex" ,ruby-bindex)
568 ("ruby-railties" ,ruby-railties)))
570 `(("bundler" ,bundler)
571 ("ruby-rails" ,ruby-rails)
572 ("ruby-mocha" ,ruby-mocha)
573 ("ruby-simplecov" ,ruby-simplecov)))
574 (synopsis "Debugging tool for your Ruby on Rails applications")
576 "This package allows you to create an interactive Ruby session in your
577 browser. Those sessions are launched automatically in case of an error and
578 can also be launched manually in any page.")
579 (home-page "https://github.com/rails/web-console")
580 (license license:expat)))
582 (define-public ruby-with-advisory-lock
584 (name "ruby-with-advisory-lock")
589 (uri (rubygems-uri "with_advisory_lock" version))
592 "1k37hxgmaqgsd54gplm5xim9nw3ghvqsbzaw7q4q64ha1nbd9a41"))))
593 (build-system ruby-build-system)
595 '(#:tests? #f)) ; TODO Tests require a running MySQL service
597 `(("ruby-activerecord" ,ruby-activerecord)))
599 `(("bundler" ,bundler)
600 ("ruby-yard" ,ruby-yard)
601 ("ruby-mysql2" ,ruby-mysql2)))
602 (synopsis "Advisory locking for ActiveRecord")
604 "The With advisory lock gem adds advisory locking to ActiveRecord for
605 PostgreSQL and MySQL. SQLite is also supported, but this uses the file system
607 (home-page "https://closuretree.github.io/with_advisory_lock/")
608 (license license:expat)))
610 (define-public ruby-rails
617 (uri (rubygems-uri "rails" version))
620 "1jxmwrykwgbn116hhmi7h75hcsdifhj89wk12m7ch2f3mn1lrmp9"))))
621 (build-system ruby-build-system)
624 (modify-phases %standard-phases
625 ;; This gem acts as glue between the gems that actually make up
626 ;; Rails. The important thing to check is that the gemspec matches up
627 ;; with the Guix packages and Rubygems can successfully activate the
630 ;; The following check phase tests this.
632 (add-after 'install 'check
633 (lambda* (#:key tests? outputs #:allow-other-keys)
638 (assoc-ref outputs "out") "/lib/ruby/vendor_ruby"))
640 (invoke "ruby" "-e" "gem 'rails'"))
643 `(("ruby-activesupport" ,ruby-activesupport)
644 ("ruby-actionpack" ,ruby-actionpack)
645 ("ruby-actionview" ,ruby-actionview)
646 ("ruby-activemodel" ,ruby-activemodel)
647 ("ruby-activerecord" ,ruby-activerecord)
648 ("ruby-actionmailer" ,ruby-actionmailer)
649 ("ruby-activejob" ,ruby-activejob)
650 ("ruby-actioncable" ,ruby-actioncable)
651 ("ruby-activestorage" ,ruby-activestorage)
652 ("ruby-railties" ,ruby-railties)
654 ("ruby-sprockets-rails" ,ruby-sprockets-rails)))
655 (synopsis "Full-stack web framework optimized for programmer happiness")
657 "Ruby on Rails is a full-stack web framework optimized for programmer
658 happiness and sustainable productivity. It encourages beautiful code by
659 favoring convention over configuration.")
660 (home-page "https://rubyonrails.org/")
661 (license license:expat)))