Skip to content

Instantly share code, notes, and snippets.

@abdellani
Created December 22, 2023 09:37
Show Gist options
  • Save abdellani/a2c89a905c7092ce89d0b7872c6fbb74 to your computer and use it in GitHub Desktop.
Save abdellani/a2c89a905c7092ce89d0b7872c6fbb74 to your computer and use it in GitHub Desktop.
rails app:update
conflict config/boot.rb
Overwrite /home/user/openfoodnetwork/config/boot.rb? (enter "h" for help) [Ynaqdhm] d
- require 'rubygems'
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
- # Set up gems listed in the Gemfile.
+ require "bundler/setup" # Set up gems listed in the Gemfile.
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
-
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
- require 'bootsnap/setup'
Retrying...
Overwrite /home/user/openfoodnetwork/config/boot.rb? (enter "h" for help) [Ynaqdhm] n
skip config/boot.rb
exist config
conflict config/application.rb
Overwrite /home/user/openfoodnetwork/config/application.rb? (enter "h" for help) [Ynaqdhm] d
- require_relative 'boot'
+ require_relative "boot"
require "rails"
- [
+ # Pick the frameworks you want:
- "active_record/railtie",
+ require "active_model/railtie"
- "active_storage/engine",
+ require "active_job/railtie"
- "action_controller/railtie",
+ require "active_record/railtie"
- "action_view/railtie",
+ require "active_storage/engine"
- "action_mailer/railtie",
+ require "action_controller/railtie"
- "active_job/railtie",
+ require "action_mailer/railtie"
- "action_cable/engine",
+ # require "action_mailbox/engine"
- #"action_mailbox/engine",
+ # require "action_text/engine"
- #"action_text/engine",
+ require "action_view/railtie"
- "rails/test_unit/railtie",
+ require "action_cable/engine"
- "sprockets/railtie" # Disable this after migrating to Webpacker
+ require "rails/test_unit/railtie"
- ].each do |railtie|
- begin
- require railtie
- rescue LoadError
- end
- end
- require_relative "../lib/open_food_network/i18n_config"
+ # Require the gems listed in Gemfile, including any gems
- require_relative '../lib/spree/core/environment'
+ # you've limited to :test, :development, or :production.
- require_relative '../lib/spree/core/mail_interceptor'
+ Bundler.require(*Rails.groups)
- require_relative "../lib/i18n_digests"
- require_relative "../lib/git_utils"
- if defined?(Bundler)
- # If you precompile assets before deploying to production, use this line
- Bundler.require(*Rails.groups(:assets => %w(development test)))
- # If you want your assets lazily compiled in production, use this line
- # Bundler.require(:default, :assets, Rails.env)
- end
-
module Openfoodnetwork
class Application < Rails::Application
- # Store a description of the current version
+ # Initialize configuration defaults for originally generated Rails version.
- config.x.git_version = GitUtils::git_version
+ config.load_defaults 6.1
- config.after_initialize do
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
- # We need this here because the test env file loads before the Spree engine is loaded
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
- Spree::Core::Engine.routes.default_url_options[:host] = ENV["SITE_URL"] if Rails.env == 'test'
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
- end
+ config.autoload_lib(ignore: %w(assets tasks))
- # We reload the routes here
+ # Configuration for the application, engines, and railties goes here.
- # so that the appended/prepended routes are available to the application.
- config.after_initialize do
- Rails.application.routes_reloader.reload!
- end
-
- initializer "spree.environment", before: :load_config_initializers do |app|
- Rails.application.reloader.to_prepare do
- app.config.spree = Spree::Core::Environment.new
- Spree::Config = app.config.spree.preferences # legacy access
- end
- end
-
- initializer "spree.register.payment_methods" do |app|
- Rails.application.reloader.to_prepare do
- app.config.spree.payment_methods = [
- Spree::PaymentMethod::Check
- ]
- end
- end
-
- initializer "spree.mail.settings" do |_app|
- Rails.application.reloader.to_prepare do
- Spree::Core::MailSettings.init
- Mail.register_interceptor(Spree::Core::MailInterceptor)
- end
- end
-
- # filter sensitive information during logging
- initializer "spree.params.filter" do |app|
- app.config.filter_parameters += [
- :password,
- :password_confirmation,
- :number,
- :verification_value
- ]
- end
-
- # Settings dependent on locale
#
- # We need to set this config before the promo environment gets loaded and
+ # These settings can be overridden in specific environments using the files
- # after the spree environment gets loaded...
+ # in config/environments, which are processed later.
- # This is because Spree uses `Spree::Config` while evaluating classes :scream:
#
- # https://github.com/spree/spree/blob/2-0-stable/core/app/models/spree/calculator/per_item.rb#L6
+ # config.time_zone = "Central Time (US & Canada)"
- #
+ # config.eager_load_paths << Rails.root.join("extras")
- # TODO: move back to spree initializer once we upgrade to a more recent version
- # of Spree
- initializer 'ofn.spree_locale_settings', before: 'spree.promo.environment' do |app|
- Rails.application.reloader.to_prepare do
- Spree::Config['checkout_zone'] = ENV['CHECKOUT_ZONE']
- Spree::Config['currency'] = ENV['CURRENCY']
- end
- end
-
- initializer "load_spree_calculators" do |app|
- # Register Spree calculators
- Rails.application.reloader.to_prepare do
- app.config.spree.calculators.shipping_methods = [
- Calculator::FlatPercentItemTotal,
- Calculator::FlatRate,
- Calculator::FlexiRate,
- Calculator::PerItem,
- Calculator::PriceSack,
- Calculator::Weight,
- Calculator::None
- ]
-
- app.config.spree.calculators.add_class('enterprise_fees')
- app.config.spree.calculators.enterprise_fees = [
- Calculator::FlatPercentPerItem,
- Calculator::FlatRate,
- Calculator::FlexiRate,
- Calculator::PerItem,
- Calculator::PriceSack,
- Calculator::Weight
- ]
-
- app.config.spree.calculators.add_class('payment_methods')
- app.config.spree.calculators.payment_methods = [
- Calculator::FlatPercentItemTotal,
- Calculator::FlatRate,
- Calculator::FlexiRate,
- Calculator::PerItem,
- Calculator::PriceSack,
- Calculator::None
- ]
-
- app.config.spree.calculators.add_class('tax_rates')
- app.config.spree.calculators.tax_rates = [
- Calculator::DefaultTax
- ]
- end
- end
-
- # Register Spree payment methods
- initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app|
- Rails.application.reloader.to_prepare do
- app.config.spree.payment_methods << Spree::Gateway::StripeSCA
- app.config.spree.payment_methods << Spree::Gateway::PayPalExpress
- end
- end
-
- initializer "ofn.reports" do |app|
- module ::Reporting; end
- Rails.application.reloader.to_prepare do
- next if defined?(::Reporting) && defined?(::Reporting::Errors)
- loader = Zeitwerk::Loader.new
- loader.push_dir("#{Rails.root}/lib/reporting", namespace: ::Reporting)
- loader.enable_reloading
- loader.setup
- loader.eager_load
-
- if Rails.env.development?
- require 'listen'
- Listen.to("lib/reporting") { loader.reload }.start
- end
- end
- end
-
- config.paths["config/routes.rb"] = %w(
- config/routes/api.rb
- config/routes.rb
- config/routes/admin.rb
- config/routes/spree.rb
- ).map { |relative_path| Rails.root.join(relative_path) }
-
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named.
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Activate observers that should always be running.
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
-
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
- config.time_zone = ENV["TIMEZONE"]
-
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- config.i18n.default_locale = OpenFoodNetwork::I18nConfig.default_locale
- config.i18n.available_locales = OpenFoodNetwork::I18nConfig.available_locales
- I18n.locale = config.i18n.locale = config.i18n.default_locale
-
- # Calculate digests for locale files so we can know when they change
- I18nDigests.build_digests config.i18n.available_locales
-
- # Setting this to true causes a performance regression in Rails 3.2.17
- # When we're on a version with the fix below, we can set it to true
- # https://github.com/svenfuchs/i18n/issues/230
- I18n.config.enforce_available_locales = false
-
- # Configure the default encoding used in templates for Ruby 1.9.
- config.encoding = "utf-8"
-
- # Enable the asset pipeline
- config.assets.enabled = true
-
- # Version of your assets, change this if you want to expire all your assets
- config.assets.version = '1.2'
-
- # Unset X-Frame-Options header for embedded pages.
- config.action_dispatch.default_headers.except! "X-Frame-Options"
-
- # css and js files other than application.* are not precompiled by default
- # Instead, they must be explicitly included below
- # http://stackoverflow.com/questions/8012434/what-is-the-purpose-of-config-assets-precompile
- config.assets.initialize_on_precompile = true
- config.assets.precompile += ['admin/*.js', 'admin/**/*.js', 'admin_minimal.js']
- config.assets.precompile += ['web/all.js']
- config.assets.precompile += ['darkswarm/all.js']
- config.assets.precompile += ['shared/*']
- config.assets.precompile += ['*.jpg', '*.jpeg', '*.png', '*.gif' '*.svg']
-
- # Highlight code that triggered database queries in logs.
- config.active_record.verbose_query_logs = ENV.fetch("VERBOSE_QUERY_LOGS", false)
-
- # Apply framework defaults. New recommended defaults are successively added with each Rails version and
- # include the defaults from previous versions. For more info see:
- # https://guides.rubyonrails.org/configuring.html#results-of-config-load-defaults
- config.load_defaults 6.1
- config.action_view.form_with_generates_remote_forms = false
- config.active_record.cache_versioning = false
- config.active_record.has_many_inversing = false
- config.active_record.yaml_column_permitted_classes = [BigDecimal, Symbol]
-
- config.active_support.escape_html_entities_in_json = true
-
- config.active_job.queue_adapter = :sidekiq
-
- config.action_controller.include_all_helpers = false
-
- config.generators.template_engine = :haml
-
- Rails.application.routes.default_url_options[:host] = ENV["SITE_URL"]
- DfcProvider::Engine.routes.default_url_options[:host] = ENV["SITE_URL"]
-
- Rails.autoloaders.main.ignore(Rails.root.join('app/webpacker'))
-
- config.active_storage.service = ENV["S3_BUCKET"].present? ? :amazon : :local
- config.active_storage.content_types_to_serve_as_binary -= ["image/svg+xml"]
- config.active_storage.variable_content_types += ["image/svg+xml"]
- config.active_storage.url_options = config.action_controller.default_url_options
-
- config.exceptions_app = self.routes
-
- config.view_component.generate.sidecar = true # Always generate components in subfolders
end
end
Retrying...
Overwrite /home/user/openfoodnetwork/config/application.rb? (enter "h" for help) [Ynaqdhm] n
skip config/application.rb
conflict config/environment.rb
Overwrite /home/user/openfoodnetwork/config/environment.rb? (enter "h" for help) [Ynaqdhm] d
- # Load the rails application
+ # Load the Rails application.
- require_relative 'application'
+ require_relative "application"
- # Initialize the rails application
+ # Initialize the Rails application.
- Openfoodnetwork::Application.initialize!
+ Rails.application.initialize!
-
- ActiveRecord::Base.include_root_in_json = true
Retrying...
Overwrite /home/user/openfoodnetwork/config/environment.rb? (enter "h" for help) [Ynaqdhm] n
skip config/environment.rb
exist config/environments
conflict config/environments/development.rb
Overwrite /home/user/openfoodnetwork/config/environments/development.rb? (enter "h" for help) [Ynaqdhm] d
- Openfoodnetwork::Application.configure do
+ require "active_support/core_ext/integer/time"
- config.action_controller.default_url_options = {host: "localhost", port: 3000}
- # Settings specified here will take precedence over those in config/application.rb
- #
- # PROFILE switches several settings to a more "production-like" value
- # for profiling and benchmarking the application locally. All changes you
- # make to the app will require restart.
- # In the development environment your application's code is reloaded on
+ Rails.application.configure do
- # every request. This slows down response time but is perfect for development
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
- config.cache_classes = !!ENV["PROFILE"]
+ config.enable_reloading = true
- config.action_controller.default_url_options = {host: "localhost", port: 3000}
+ # Do not eager load code on boot.
+ config.eager_load = false
- # :file_store is used by default when no cache store is specifically configured.
+ # Show full error reports.
- if !!ENV["PROFILE"] || !!ENV["DEV_CACHING"]
+ config.consider_all_requests_local = true
- config.cache_store = :redis_cache_store, {
+
- driver: :hiredis,
+ # Enable server timing
- url: ENV.fetch("OFN_REDIS_URL", "redis://localhost:6379/1"),
+ config.server_timing = true
- expires_in: 90.minutes
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
}
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
end
- config.eager_load = false
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
- # Show full error reports and disable caching
+ # Don't care if the mailer can't send.
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = !!ENV["PROFILE"] || !!ENV["DEV_CACHING"]
-
- # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
- # Print deprecation notices to the Rails logger
+ config.action_mailer.perform_caching = false
+
+ # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
- # Only use best-standards-support built into browsers
+ # Raise exceptions for disallowed deprecations.
- config.action_dispatch.best_standards_support = :builtin
+ config.active_support.disallowed_deprecation = :raise
- # Do not compress assets
+ # Tell Active Support which deprecation messages to disallow.
- config.assets.compress = false
+ config.active_support.disallowed_deprecation_warnings = []
- # Generate digests for assets URLs.
+ # Raise an error on page load if there are pending migrations.
- #
+ config.active_record.migration_error = :page_load
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
- # yet still be able to expire them through the digest params.
- config.assets.digest = !!ENV["PROFILE"]
- # Expands the lines which load the assets
+ # Highlight code that triggered database queries in logs.
- #
+ config.active_record.verbose_query_logs = true
- # Setting this to false makes Rails bundle assets into all.js and all.css.
- #
- # Disabling asset debugging still requires that assets be compiled for each
- # request. You can avoid that by precompiling the assets as in production:
- #
- # $ bundle exec rake assets:precompile:primary assets:precompile:nondigest
- #
- # You can remove them by simply running:
- #
- # $ bundle exec rake assets:clean
- config.assets.debug = !!ENV["DEBUG_ASSETS"]
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Highlight code that enqueued background job in logs.
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ config.active_job.verbose_enqueue_logs = true
- #
- # To override this, set the appropriate locale in .env[.*] file.
- config.time_zone = ENV.fetch("TIMEZONE", "UTC")
- config.i18n.fallbacks = [:en]
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
- # Show emails using Letter Opener
+ # Raises error for missing translations.
- config.action_mailer.delivery_method = :letter_opener
+ # config.i18n.raise_on_missing_translations = true
- config.action_mailer.default_url_options = { host: "0.0.0.0:3000" }
- config.action_mailer.asset_host = "http://localhost:3000"
- config.log_level = ENV.fetch("DEV_LOG_LEVEL", :debug)
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
end
Retrying...
Overwrite /home/user/openfoodnetwork/config/environments/development.rb? (enter "h" for help) [Ynaqdhm] n
skip config/environments/development.rb
conflict config/environments/production.rb
Overwrite /home/user/openfoodnetwork/config/environments/production.rb? (enter "h" for help) [Ynaqdhm] d
- Openfoodnetwork::Application.configure do
+ require "active_support/core_ext/integer/time"
- # Settings specified here will take precedence over those in config/application.rb
- config.eager_load = true
+ Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
- # Code is not reloaded between requests
+ # Code is not reloaded between requests.
- config.cache_classes = true
+ config.enable_reloading = false
- # Full error reports are disabled and caching is turned on
+ # Eager load code on boot. This eager loads most of Rails and
- config.consider_all_requests_local = false
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Disable Rails's static asset server (Apache or nginx will already do this)
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
- config.public_file_server.enabled = false
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
- # Compress JavaScripts and CSS
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
- config.assets.compress = true
+ # config.public_file_server.enabled = false
- # Don't fallback to assets pipeline if a precompiled asset is missed
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
- config.assets.digest = true
+ # config.asset_host = "http://assets.example.com"
- # Defaults to Rails.root.join("public/assets")
+ # Specifies the header that your server uses for sending files.
- # config.assets.manifest = YOUR_PATH
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
- # Specifies the header that your server uses for sending files
+ # Store uploaded files on the local file system (see config/storage.yml for options).
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
+ config.active_storage.service = :local
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # Mount Action Cable outside main process or domain.
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = "wss://example.com/cable"
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+ # config.assume_ssl = true
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
- # Use https in email links
+ # Log to STDOUT by default
- config.action_mailer.default_url_options = { protocol: 'https' }
+ config.logger = ActiveSupport::Logger.new(STDOUT)
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
- # Set log level (default is :debug in Rails 4)
+ # Prepend all log lines with the following tags.
- config.log_level = :info
+ config.log_tags = [ :request_id ]
- # Configure logging:
+ # Info include generic and useful information about system operation, but avoids logging too much
- config.log_formatter = Logger::Formatter.new.tap { |f| f.datetime_format = "%Y-%m-%d %H:%M:%S" }
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+ # want to log everything, set the level to "debug".
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
- # Use a different cache store in production
+ # Use a different cache store in production.
- config.cache_store = :redis_cache_store, {
+ # config.cache_store = :mem_cache_store
- driver: :hiredis,
- url: ENV.fetch("OFN_REDIS_URL", "redis://localhost:6380/0"),
- reconnect_attempts: 1
- }
- config.action_cable.url = "#{ENV['OFN_URL']}/cable"
+ # Use a real queuing backend for Active Job (and separate queues per environment).
- config.action_cable.allowed_request_origins = [/http:\/\/#{ENV['OFN_URL']}\/*/, /https:\/\/#{ENV['OFN_URL']}\/*/]
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "openfoodnetwork_production"
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ config.action_mailer.perform_caching = false
- # config.action_controller.asset_host = "http://assets.example.com"
- # Disable delivery errors, bad email addresses will be ignored
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
- # Enable threaded mode
- # config.threadsafe!
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found)
+ # the I18n.default_locale when a translation cannot be found).
- config.i18n.fallbacks = [:en]
+ config.i18n.fallbacks = true
- # Send deprecation notices to registered listeners
+ # Don't log any deprecations.
- config.active_support.deprecation = :notify
+ config.active_support.report_deprecations = false
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
end
Retrying...
Overwrite /home/user/openfoodnetwork/config/environments/production.rb? (enter "h" for help) [Ynaqdhm] n
skip config/environments/production.rb
conflict config/environments/test.rb
Overwrite /home/user/openfoodnetwork/config/environments/test.rb? (enter "h" for help) [Ynaqdhm] d
- Openfoodnetwork::Application.configure do
+ require "active_support/core_ext/integer/time"
- # Settings specified here will take precedence over those in config/application.rb
- # The test environment is used exclusively to run your application's
+ # The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
+ # test suite. You never need to work with it otherwise. Remember that
- # your test database is "scratch space" for the test suite and is wiped
+ # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
+ # and recreated between test runs. Don't rely on the data there!
- config.cache_classes = false
- config.eager_load = false
+ Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
- # Configure static asset server for tests with Cache-Control for performance
+ # While tests run files are not watched, reloading is not necessary.
- config.public_file_server.enabled = true
+ config.enable_reloading = false
- config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
- # Separate cache stores when running in parallel
+ # Eager loading loads your entire application. When running a single test locally,
- config.cache_store = :redis_cache_store, {
+ # this is usually not necessary, and can slow down your test suite. However, it's
- driver: :hiredis,
+ # recommended that you enable it in continuous integration systems to ensure eager
- # Unique database number to avoid conflict with others
+ # loading is working properly before deploying your code.
- url: ENV.fetch("OFN_REDIS_TEST_URL", "redis://localhost:6379/3"),
+ config.eager_load = ENV["CI"].present?
- reconnect_attempts: 1
+
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
- # Show full error reports and disable caching
+ # Show full error reports and disable caching.
- config.consider_all_requests_local = true
+ config.consider_all_requests_local = true
config.action_controller.perform_caching = false
+ config.cache_store = :null_store
- # Raise exceptions instead of rendering exception templates
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
- config.action_dispatch.show_exceptions = false
+ config.action_dispatch.show_exceptions = :rescuable
- # Disable request forgery protection in test environment
+ # Disable request forgery protection in test environment.
- config.action_controller.allow_forgery_protection = false
+ config.action_controller.allow_forgery_protection = false
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ config.action_mailer.perform_caching = false
+
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
- # Tests should fail when translations are missing.
+ # Print deprecation notices to the stderr.
- config.i18n.raise_on_missing_translations = true
+ config.active_support.deprecation = :stderr
- config.time_zone = ENV.fetch("TIMEZONE", "UTC")
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
- # Tests assume English text on the site.
+ # Tell Active Support which deprecation messages to disallow.
- config.i18n.default_locale = "en"
+ config.active_support.disallowed_deprecation_warnings = []
- config.i18n.available_locales = ['en', 'es', 'pt']
- config.i18n.fallbacks = [:en]
- I18n.locale = config.i18n.locale = config.i18n.default_locale
- # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # Raises error for missing translations.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # config.i18n.raise_on_missing_translations = true
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
- # Print deprecation notices to the stderr
+ # Annotate rendered view with file names.
- config.active_support.deprecation = :stderr
+ # config.action_view.annotate_rendered_view_with_filenames = true
- config.active_job.queue_adapter = :test
+ # Raise error when a before_action's only/except options reference missing actions
+ config.action_controller.raise_on_missing_callback_actions = true
end
Retrying...
Overwrite /home/user/openfoodnetwork/config/environments/test.rb? (enter "h" for help) [Ynaqdhm] n
skip config/environments/test.rb
exist config/initializers
conflict config/initializers/assets.rb
Overwrite /home/user/openfoodnetwork/config/initializers/assets.rb? (enter "h" for help) [Ynaqdhm] d
- Rails.application.config.assets.paths << Rails.root.join('node_modules')
+ # Be sure to restart your server when you modify this file.
+
+ # Version of your assets, change this if you want to expire all your assets.
+ Rails.application.config.assets.version = "1.0"
+
+ # Add additional assets to the asset load path.
+ # Rails.application.config.assets.paths << Emoji.images_path
+
+ # Precompile additional assets.
+ # application.js, application.css, and all non-JS/CSS in the app/assets
+ # folder are already added.
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
Retrying...
Overwrite /home/user/openfoodnetwork/config/initializers/assets.rb? (enter "h" for help) [Ynaqdhm] n
skip config/initializers/assets.rb
conflict config/initializers/content_security_policy.rb
Overwrite /home/user/openfoodnetwork/config/initializers/content_security_policy.rb? (enter "h" for help) [Ynaqdhm] d
# Be sure to restart your server when you modify this file.
- # Define an application-wide content security policy
+ # Define an application-wide content security policy.
- # For further information see the following documentation
+ # See the Securing Rails Applications Guide for more information:
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
- Rails.application.config.content_security_policy do |policy|
+ # Rails.application.configure do
- policy.default_src :self, :https
+ # config.content_security_policy do |policy|
- policy.font_src :self, :https, :data, "fonts.gstatic.com"
+ # policy.default_src :self, :https
- policy.img_src :self, :https, :data, "*.s3.amazonaws.com"
+ # policy.font_src :self, :https, :data
- policy.img_src :self, :http, :data, ENV["SITE_URL"] if Rails.env.development?
+ # policy.img_src :self, :https, :data
- policy.object_src :none
+ # policy.object_src :none
- policy.frame_ancestors :none
+ # policy.script_src :self, :https
- policy.script_src :self, :https, :unsafe_inline, :unsafe_eval, "*.stripe.com", "openfoodnetwork.innocraft.cloud",
+ # policy.style_src :self, :https
- "maps.googleapis.com", "maps.gstatic.com", "d2wy8f7a9ursnm.cloudfront.net"
+ # # Specify URI for violation reports
- policy.style_src :self, :https, :unsafe_inline, "fonts.googleapis.com", "cdnjs.cloudflare.com"
+ # # policy.report_uri "/csp-violation-report-endpoint"
-
+ # end
- if Rails.env.development?
+ #
- policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035", "ws://localhost:3000"
+ # # Generate session nonces for permitted importmap, inline scripts, and inline styles.
- else
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
- policy.connect_src :self, :https, "https://#{ENV["SITE_URL"]}", "wss://#{ENV["SITE_URL"]}"
+ # config.content_security_policy_nonce_directives = %w(script-src style-src)
- end
+ #
-
+ # # Report violations without enforcing the policy.
- # Specify URI for violation reports
+ # # config.content_security_policy_report_only = true
- # policy.report_uri "/csp-violation-report-endpoint"
+ # end
- end
-
- # If you are using UJS then enable automatic nonce generation
- # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
-
- # Set the nonce only to specific directives
- # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
-
- # Report CSP violations to a specified URI
- # For further information see the following documentation:
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
- # Rails.application.config.content_security_policy_report_only = true
Retrying...
Overwrite /home/user/openfoodnetwork/config/initializers/content_security_policy.rb? (enter "h" for help) [Ynaqdhm] n
skip config/initializers/content_security_policy.rb
create config/initializers/cors.rb
conflict config/initializers/filter_parameter_logging.rb
Overwrite /home/user/openfoodnetwork/config/initializers/filter_parameter_logging.rb? (enter "h" for help) [Ynaqdhm] d
- # Configure sensitive parameters which will be filtered from the log file.
+ # Be sure to restart your server when you modify this file.
- Rails.application.config.filter_parameters += [:password]
+
+ # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+ # Use this to limit dissemination of sensitive information.
+ # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+ Rails.application.config.filter_parameters += [
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+ ]
Retrying...
Overwrite /home/user/openfoodnetwork/config/initializers/filter_parameter_logging.rb? (enter "h" for help) [Ynaqdhm] n
skip config/initializers/filter_parameter_logging.rb
conflict config/initializers/inflections.rb
Overwrite /home/user/openfoodnetwork/config/initializers/inflections.rb? (enter "h" for help) [Ynaqdhm] d
# Be sure to restart your server when you modify this file.
- # Add new inflection rules using the following format
+ # Add new inflection rules using the following format. Inflections
- # (all these examples are active by default):
+ # are locale specific, and you may define rules for as many different
- # ActiveSupport::Inflector.inflections do |inflect|
+ # locales as you wish. All of these examples are active by default:
- # inflect.plural /^(ox)$/i, '\1en'
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
- # inflect.singular /^(ox)en/i, '\1'
+ # inflect.plural /^(ox)$/i, "\\1en"
- # inflect.irregular 'person', 'people'
+ # inflect.singular /^(ox)en/i, "\\1"
+ # inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep )
# end
- Rails.autoloaders.each do |autoloader|
+
- autoloader.inflector.inflect(
+ # These inflection rules are supported but not enabled by default:
- "stripe_sca" => "StripeSCA"
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
- )
+ # inflect.acronym "RESTful"
- end
+ # end
Retrying...
Overwrite /home/user/openfoodnetwork/config/initializers/inflections.rb? (enter "h" for help) [Ynaqdhm] n
skip config/initializers/inflections.rb
create config/initializers/new_framework_defaults_7_1.rb
create config/initializers/permissions_policy.rb
remove config/initializers/cors.rb
exist bin
conflict bin/rails
Overwrite /home/user/openfoodnetwork/bin/rails? (enter "h" for help) [Ynaqdhm] d
#!/usr/bin/env ruby
- load File.expand_path("spring", __dir__)
+ APP_PATH = File.expand_path("../config/application", __dir__)
- APP_PATH = File.expand_path('../config/application', __dir__)
+ require_relative "../config/boot"
- require_relative '../config/boot'
+ require "rails/commands"
- require 'rails/commands'
Retrying...
Overwrite /home/user/openfoodnetwork/bin/rails? (enter "h" for help) [Ynaqdhm] n
skip bin/rails
conflict bin/rake
Overwrite /home/user/openfoodnetwork/bin/rake? (enter "h" for help) [Ynaqdhm] d
#!/usr/bin/env ruby
- load File.expand_path("spring", __dir__)
+ require_relative "../config/boot"
- require_relative '../config/boot'
+ require "rake"
- require 'rake'
Rake.application.run
Retrying...
Overwrite /home/user/openfoodnetwork/bin/rake? (enter "h" for help) [Ynaqdhm] n
skip bin/rake
conflict bin/setup
Overwrite /home/user/openfoodnetwork/bin/setup? (enter "h" for help) [Ynaqdhm] d
#!/usr/bin/env ruby
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
- BUNDLE_ENV = { "BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES"=> "true" }
-
def system!(*args)
- system(*args) || abort("\n== Command #{args} failed ==")
+ system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts "== Installing dependencies =="
- system! "script/install-bundler"
+ system! "gem install bundler --conservative"
- # Check first (it's quicker), then install new gems if necessary
+ system("bundle check") || system!("bundle install")
- system("bundle check 2> /dev/null") || system!(BUNDLE_ENV, "bundle install")
- # Install JavaScript dependencies
- system("script/nodenv-install.sh")
- system("bin/yarn")
-
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
- puts "\n== Preparing database, removing old logs and tempfiles =="
+ puts "\n== Preparing database =="
- system! "bin/rails db:prepare log:clear tmp:clear"
+ system! "bin/rails db:prepare"
+ puts "\n== Removing old logs and tempfiles =="
+ system! "bin/rails log:clear tmp:clear"
+
puts "\n== Restarting application server =="
- # system! "bin/rails restart"
+ system! "bin/rails restart"
- # Faster to do it manually:
- system! "touch tmp/restart.txt"
end
Retrying...
Overwrite /home/user/openfoodnetwork/bin/setup? (enter "h" for help) [Ynaqdhm] n
skip bin/setup
rails active_storage:update
DEPRECATION WARNING: Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2.
Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
for more information on how to upgrade.
(called from <main> at /home/user/openfoodnetwork/config/environment.rb:5)
Heads up! 🔥
👉 StimulusReflex requires caching to be enabled. Caching allows the session to be modified during ActionCable requests.
To enable caching in development, run:
rails dev:cache
bin/rails aborted!
NoMethodError: undefined method `include?' for :generate:Symbol
if to&.include?("#")
^^^^^^^^^^
/home/user/openfoodnetwork/config/routes/spree.rb:114:in `block (4 levels) in <main>'
/home/user/openfoodnetwork/config/routes/spree.rb:113:in `block (3 levels) in <main>'
/home/user/openfoodnetwork/config/routes/spree.rb:94:in `block (2 levels) in <main>'
/home/user/openfoodnetwork/config/routes/spree.rb:47:in `block in <main>'
/home/user/openfoodnetwork/config/routes/spree.rb:10:in `<main>'
/home/user/openfoodnetwork/config/application.rb:49:in `block in <class:Application>'
/home/user/openfoodnetwork/config/environment.rb:5:in `<main>'
/home/user/openfoodnetwork/bin/rails:5:in `<top (required)>'
/home/user/openfoodnetwork/bin/spring:12:in `require'
/home/user/openfoodnetwork/bin/spring:12:in `block in <top (required)>'
/home/user/openfoodnetwork/bin/spring:9:in `<top (required)>'
Tasks: TOP => active_storage:update => environment
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment