У меня есть драгоценный камень с зависимостью от 'typhoeus'
spec.add_dependency 'typhoeus', '~> 1.3.0'
, но Typhoeus доступен только в режиме разработки, а не в производственном режиме.
Включение этого драгоценного камня в мое приложение и :
$ rails c
Running via Spring preloader in process 24723
Loading development environment (Rails 5.2.4.2)
irb: warn: can't alias context from irb_context.
2.6.5 :001 > Typhoeus
=> Typhoeus
$ rails c -e production
Running via Spring preloader in process 24792
Loading production environment (Rails 5.2.4.2)
2.6.5 :001 > Typhoeus
Traceback (most recent call last):
16: from -e:1:in `<main>'
15: from /home/user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
14: from /home/user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
13: from bin/rails:9:in `<top (required)>'
12: from polyglot (0.3.5) lib/polyglot.rb:65:in `require'
11: from polyglot (0.3.5) lib/polyglot.rb:65:in `require'
10: from railties (5.2.4.2) lib/rails/commands.rb:18:in `<top (required)>'
9: from railties (5.2.4.2) lib/rails/command.rb:46:in `invoke'
8: from railties (5.2.4.2) lib/rails/command/base.rb:69:in `perform'
7: from thor (1.0.1) lib/thor.rb:392:in `dispatch'
6: from thor (1.0.1) lib/thor/invocation.rb:127:in `invoke_command'
5: from thor (1.0.1) lib/thor/command.rb:27:in `run'
4: from railties (5.2.4.2) lib/rails/commands/console/console_command.rb:96:in `perform'
3: from railties (5.2.4.2) lib/rails/commands/console/console_command.rb:19:in `start'
2: from railties (5.2.4.2) lib/rails/commands/console/console_command.rb:64:in `start'
1: from (irb):1
NameError (uninitialized constant Typhoeus)
В производстве, если я сделаю
$ rails c -e production
Running via Spring preloader in process 24847
Loading production environment (Rails 5.2.4.2)
2.6.5 :001 > require 'typhoeus'
=> true
2.6.5 :002 > Typhoeus
=> Typhoeus
, тогда это работает.
Почему камень должен быть доступен в разработке, но не в производстве? Зачем это нужно? Где я должен требовать, чтобы это работало?