File: default_preview_path

package info (click to toggle)
ruby-rspec-rails 8.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,804 kB
  • sloc: ruby: 10,881; sh: 198; makefile: 6
file content (71 lines) | stat: -rwxr-xr-x 2,178 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env ruby
# Transparent helper to simply document code sections
def require_file_stub(_name)
  yield
end

ENV['RAILS_ENV'] ||= 'development'
# Pick the frameworks you want:
begin
  require "openssl"
  require "active_storage"
  require "active_storage/engine"
rescue LoadError
end

require_file_stub 'config/environment' do
  # Load the Rails application.
  require_file_stub 'config/application' do
    require_file_stub 'config/boot' do
      # Set up gems listed in the Gemfile.
      ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
      require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
    end

    # Pick the frameworks you want:
    require "active_record/railtie"
    require "action_controller/railtie"
    require "action_mailer/railtie" unless ENV['NO_ACTION_MAILER']
    require "action_view/railtie"
    require "action_cable/engine"
    require "active_job/railtie"
    require "action_mailbox/engine"

    # Require the gems listed in Gemfile, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(*Rails.groups)

    module ExampleApp
      class Application < Rails::Application
        config.eager_load = false
        config.active_support.cache_format_version = 7.0

        # Don't care if the mailer can't send.
        config.action_mailer.raise_delivery_errors = false unless ENV['NO_ACTION_MAILER']
        if ENV['CUSTOM_PREVIEW_PATH']
          config.action_mailer.preview_paths = [ENV['CUSTOM_PREVIEW_PATH']]
        end
        if ENV['SHOW_PREVIEWS']
          config.action_mailer.show_previews = (ENV['SHOW_PREVIEWS'] == 'true')
        end
      end
    end

    I18n.enforce_available_locales = true
  end

  # Initialize the Rails application.
  Rails.application.initialize!
end

exit(0) if ENV['NO_ACTION_MAILER']
if ENV['DEFAULT_URL']
  puts ActionMailer::Base.default_url_options[:host]
elsif defined?(::ActionMailer::Preview)
  puts Rails.application.config.action_mailer.preview_paths
end

# This will force the loading of ActionMailer settings to ensure we do not
# accidentally set something we should not
ActionMailer::Base.smtp_settings
exit 0