diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fadee6d63..2e9fb5515 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -86,7 +86,7 @@ jobs: cache: maven - name: Setup JRuby - uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0 + uses: ruby/setup-ruby@829114fc20da43a41d27359103ec7a63020954d4 # v1.255.0 with: ruby-version: jruby-${{ matrix.jruby_version }} bundler-cache: 'false' # Need to install later so we can vary from Gemfile.lock as required for JRuby version compatibility diff --git a/README.md b/README.md index be4ced7e2..6ab1258de 100644 --- a/README.md +++ b/README.md @@ -348,6 +348,20 @@ package and push the .jar every time a commit changes a source file). * mvn release:perform (possibly with -DuseReleaseProfile=false due to Javadoc doclint failures for now) * rake clean gem SKIP_SPECS=true and push the gem +## Adding testing for new Rails versions + +* Add the new version to `.github/workflows/maven.yml` under the `matrix` section +* Add a new configuration to the `Appraisals` file, then + ```bundle exec appraisal generate``` +* Generate a new stub Rails application for the new version + ```shell + VERSION=rails72 + cd src/spec/stub + rm -rf $VERSION && BUNDLE_GEMFILE=~/Projects/community/jruby-rack/gemfiles/${VERSION}_rack22.gemfile bundle exec rails new $VERSION --minimal --skip-git --skip-docker --skip-active-model --skip-active-record --skip-test --skip-system-test --skip-dev-gems --skip-bundle --skip-keeps --skip-asset-pipeline --skip-ci --skip-brakeman --skip-rubocop + ``` +* Manual changes to make to support testing + * In `config/production.rb` comment out the default `config.logger` value so jruby-rack applies its own `RailsLogger`. + ## Support Please use [github][4] to file bugs, patches and/or pull requests. diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb index 8ee6b1945..6ed0802d5 100644 --- a/src/spec/ruby/jruby/rack/integration_spec.rb +++ b/src/spec/ruby/jruby/rack/integration_spec.rb @@ -14,8 +14,6 @@ before(:all) { require 'fileutils' } - #after(:all) { JRuby::Rack.context = nil } - describe 'rack (lambda)' do before do @@ -86,40 +84,141 @@ end + it "should have defined Rails stub tests" do + expect(File.foreach(__FILE__).select { |line| line.include?("describe") }).to include(/^ describe.*lib: :#{CURRENT_LIB}/), + "Expected rails stub tests to be defined for #{CURRENT_LIB} inside integration_spec.rb" + expect(File.exist?(File.join(STUB_DIR, CURRENT_LIB.to_s))).to be(true), + "Expected rails stub dir for #{CURRENT_LIB.to_s} to exist at #{File.join(STUB_DIR, CURRENT_LIB.to_s).inspect}" + end if CURRENT_LIB.to_s.include?('rails') + shared_examples_for 'a rails app', :shared => true do - let(:servlet_context) { new_servlet_context(base_path) } + base_path = "file://#{STUB_DIR}/#{CURRENT_LIB.to_s}" - it "initializes (pooling by default)" do - listener = org.jruby.rack.rails.RailsServletContextListener.new - listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + let(:servlet_context) do + new_servlet_context(base_path).tap { |servlet_context| prepare_servlet_context(servlet_context, base_path) } + end - rack_factory = servlet_context.getAttribute("rack.factory") - expect(rack_factory).to be_a(RackApplicationFactory) - expect(rack_factory).to be_a(PoolingRackApplicationFactory) - expect(rack_factory).to respond_to(:realFactory) - expect(rack_factory.realFactory).to be_a(RailsRackApplicationFactory) + context "runtime" do + + it "initializes (pooling by default)" do + listener = org.jruby.rack.rails.RailsServletContextListener.new + listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + + rack_factory = servlet_context.getAttribute("rack.factory") + expect(rack_factory).to be_a(RackApplicationFactory) + expect(rack_factory).to be_a(PoolingRackApplicationFactory) + expect(rack_factory).to respond_to(:realFactory) + expect(rack_factory.realFactory).to be_a(RailsRackApplicationFactory) + + expect(servlet_context.getAttribute("rack.context")).to be_a(RackContext) + expect(servlet_context.getAttribute("rack.context")).to be_a(ServletRackContext) - expect(servlet_context.getAttribute("rack.context")).to be_a(RackContext) - expect(servlet_context.getAttribute("rack.context")).to be_a(ServletRackContext) + expect(rack_factory.getApplication).to be_a(DefaultRackApplication) + end + + it "initializes threadsafe!" do + servlet_context.addInitParameter('jruby.max.runtimes', '1') + + listener = org.jruby.rack.rails.RailsServletContextListener.new + listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + + rack_factory = servlet_context.getAttribute("rack.factory") + expect(rack_factory).to be_a(RackApplicationFactory) + expect(rack_factory).to be_a(SharedRackApplicationFactory) + expect(rack_factory.realFactory).to be_a(RailsRackApplicationFactory) - expect(rack_factory.getApplication).to be_a(DefaultRackApplication) + expect(rack_factory.getApplication).to be_a(DefaultRackApplication) + end end - it "initializes threadsafe!" do - servlet_context.addInitParameter('jruby.max.runtimes', '1') + context "initialized" do - listener = org.jruby.rack.rails.RailsServletContextListener.new - listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + before(:all) { copy_gemfile } - rack_factory = servlet_context.getAttribute("rack.factory") - expect(rack_factory).to be_a(RackApplicationFactory) - expect(rack_factory).to be_a(SharedRackApplicationFactory) - expect(rack_factory.realFactory).to be_a(RailsRackApplicationFactory) + before(:all) do + initialize_rails('production', "file://#{base_path}") do |servlet_context, _| + prepare_servlet_context(servlet_context, base_path) + end + end + after(:all) { restore_rails } + + it "loaded rack ~> 2.2.0" do + @runtime = @rack_factory.getApplication.getRuntime + should_eval_as_not_nil "defined?(Rack.release)" + should_eval_as_eql_to "Rack.release.to_s[0, 3]", '2.2' + end + + it "booted with a servlet logger" do + @runtime = @rack_factory.getApplication.getRuntime + should_eval_as_not_nil "defined?(Rails)" + should_eval_as_not_nil "Rails.logger" + + # production.rb: config.log_level = 'info' + should_eval_as_eql_to "Rails.logger.level", Logger::INFO + + # Rails 7.1+ wraps the default in a ActiveSupport::BroadcastLogger + if Rails::VERSION::STRING < '7.1' + should_eval_as_eql_to "Rails.logger.is_a? JRuby::Rack::Logger", true + should_eval_as_eql_to "Rails.logger.is_a? ActiveSupport::TaggedLogging", true + unwrap_logger = "logger = Rails.logger;" + else + should_eval_as_not_nil "defined?(ActiveSupport::BroadcastLogger)" + should_eval_as_eql_to "Rails.logger.is_a? ActiveSupport::BroadcastLogger", true + should_eval_as_eql_to "Rails.logger.broadcasts.size", 1 + should_eval_as_eql_to "Rails.logger.broadcasts.first.is_a? JRuby::Rack::Logger", true + # NOTE: TaggedLogging is a module that extends the logger instance: + should_eval_as_eql_to "Rails.logger.broadcasts.first.is_a? ActiveSupport::TaggedLogging", true + + should_eval_as_eql_to "Rails.logger.broadcasts.first.level", Logger::INFO + + unwrap_logger = "logger = Rails.logger.broadcasts.first;" + end + + # sanity check logger-silence works: + should_eval_as_eql_to "#{unwrap_logger} logger.silence { logger.warn('from-integration-spec') }", true + + should_eval_as_eql_to "#{unwrap_logger} logger.real_logger.is_a?(Java::OrgJrubyRackServlet::DefaultServletRackContext)", true + end + + it "sets up public_path" do + @runtime = @rack_factory.getApplication.getRuntime + should_eval_as_eql_to "Rails.public_path.to_s", "#{base_path}/public" + end - expect(rack_factory.getApplication).to be_a(DefaultRackApplication) + it "disables rack's chunked support (by default)" do + @runtime = @rack_factory.getApplication.getRuntime + expect_to_have_monkey_patched_chunked + end end + end + + describe 'rails 5.0', lib: :rails50 do + it_should_behave_like 'a rails app' + end + + describe 'rails 5.2', lib: :rails52 do + it_should_behave_like 'a rails app' + end + describe 'rails 6.0', lib: :rails60 do + it_should_behave_like 'a rails app' + end + + describe 'rails 6.1', lib: :rails61 do + it_should_behave_like 'a rails app' + end + + describe 'rails 7.0', lib: :rails70 do + it_should_behave_like 'a rails app' + end + + describe 'rails 7.1', lib: :rails71 do + it_should_behave_like 'a rails app' + end + + describe 'rails 7.2', lib: :rails72 do + it_should_behave_like 'a rails app' end def expect_to_have_monkey_patched_chunked @@ -135,8 +234,6 @@ def expect_to_have_monkey_patched_chunked should_eval_as_eql_to script, "1\nsecond" end - ENV_COPY = ENV.to_h - def initialize_rails(env = nil, servlet_context = @servlet_context) if !servlet_context || servlet_context.is_a?(String) base = servlet_context.is_a?(String) ? servlet_context : nil @@ -149,26 +246,23 @@ def initialize_rails(env = nil, servlet_context = @servlet_context) servlet_context.addInitParameter("jruby.runtime.env", the_env) yield(servlet_context, listener) if block_given? + listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) @rack_context = servlet_context.getAttribute("rack.context") @rack_factory = servlet_context.getAttribute("rack.factory") - @servlet_context ||= servlet_context - end - - def restore_rails - #ENV['RACK_ENV'] = ENV_COPY['RACK_ENV'] if ENV.key?('RACK_ENV') - #ENV['RAILS_ENV'] = ENV_COPY['RAILS_ENV'] if ENV.key?('RAILS_ENV') + @servlet_context = servlet_context end def new_servlet_context(base_path = nil) servlet_context = org.jruby.rack.mock.RackLoggingMockServletContext.new base_path - servlet_context.logger = raise_logger - prepare_servlet_context servlet_context + servlet_context.logger = raise_logger('WARN').tap { |logger| logger.setEnabled(false) } servlet_context end - def prepare_servlet_context(servlet_context) + def prepare_servlet_context(servlet_context, base_path) set_compat_version servlet_context + servlet_context.addInitParameter('rails.root', base_path) + servlet_context.addInitParameter('jruby.rack.layout_class', 'FileSystemLayout') end def set_compat_version(servlet_context = @servlet_context); require 'jruby' @@ -176,14 +270,21 @@ def set_compat_version(servlet_context = @servlet_context); require 'jruby' servlet_context.addInitParameter("jruby.compat.version", compat_version.to_s) end - private - GEMFILES_DIR = File.expand_path('../../../gemfiles', STUB_DIR) - def copy_gemfile(name) - # e.g. 'rails30' - FileUtils.cp File.join(GEMFILES_DIR, "#{name}.gemfile"), File.join(STUB_DIR, "#{name}/WEB-INF/Gemfile") - FileUtils.cp File.join(GEMFILES_DIR, "#{name}.gemfile.lock"), File.join(STUB_DIR, "#{name}/WEB-INF/Gemfile.lock") + def copy_gemfile + name = CURRENT_LIB.to_s + raise "Environment variable BUNDLE_GEMFILE seems to not contain #{name}" unless ENV['BUNDLE_GEMFILE']&.include?(name) + FileUtils.cp ENV['BUNDLE_GEMFILE'], File.join(STUB_DIR, "#{name}/Gemfile") + FileUtils.cp "#{ENV['BUNDLE_GEMFILE']}.lock", File.join(STUB_DIR, "#{name}/Gemfile.lock") + Dir.chdir File.join(STUB_DIR, name) + end + + ENV_COPY = ENV.to_h + + def restore_rails + ENV['RACK_ENV'] = ENV_COPY['RACK_ENV'] if ENV.key?('RACK_ENV') + ENV['RAILS_ENV'] = ENV_COPY['RAILS_ENV'] if ENV.key?('RAILS_ENV') end end diff --git a/src/spec/stub/.gitignore b/src/spec/stub/.gitignore index ed438a4a2..7095ce900 100644 --- a/src/spec/stub/.gitignore +++ b/src/spec/stub/.gitignore @@ -1,2 +1,21 @@ */tmp */*.war + +# Rails stub files we don't want +rails*/Rakefile +rails*/Gemfile +rails*/Gemfile.lock +rails*/bin +rails*/README.md +rails*/config.ru +rails*/.ruby-version +rails*/package.json + +# Rails generates assets in samples that we don't really want +rails*/**/*.ico +rails*/**/*.png +rails*/**/*.svg +rails*/**/*.html +rails*/**/*.erb +rails*/**/*.js +rails*/**/*.css diff --git a/src/spec/stub/rails50/app/controllers/application_controller.rb b/src/spec/stub/rails50/app/controllers/application_controller.rb new file mode 100644 index 000000000..1c07694e9 --- /dev/null +++ b/src/spec/stub/rails50/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery with: :exception +end diff --git a/src/spec/stub/rails50/app/helpers/application_helper.rb b/src/spec/stub/rails50/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails50/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails50/app/jobs/application_job.rb b/src/spec/stub/rails50/app/jobs/application_job.rb new file mode 100644 index 000000000..a009ace51 --- /dev/null +++ b/src/spec/stub/rails50/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/src/spec/stub/rails50/config/application.rb b/src/spec/stub/rails50/config/application.rb new file mode 100644 index 000000000..ad7edc7d4 --- /dev/null +++ b/src/spec/stub/rails50/config/application.rb @@ -0,0 +1,25 @@ +require_relative 'boot' + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +require "active_job/railtie" +# require "active_record/railtie" +require "action_controller/railtie" +# require "action_mailer/railtie" +require "action_view/railtie" +# require "action_cable/engine" +# require "sprockets/railtie" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails50 + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + end +end diff --git a/src/spec/stub/rails50/config/boot.rb b/src/spec/stub/rails50/config/boot.rb new file mode 100644 index 000000000..aaead8a69 --- /dev/null +++ b/src/spec/stub/rails50/config/boot.rb @@ -0,0 +1,6 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. + +# workaround for https://github.com/ruby-concurrency/concurrent-ruby/issues/1077 since https://github.com/rails/rails/pull/54264 wont be backported earlier than 7.1. +require "logger" diff --git a/src/spec/stub/rails50/config/environment.rb b/src/spec/stub/rails50/config/environment.rb new file mode 100644 index 000000000..426333bb4 --- /dev/null +++ b/src/spec/stub/rails50/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails50/config/environments/development.rb b/src/spec/stub/rails50/config/environments/development.rb new file mode 100644 index 000000000..2eceb89b3 --- /dev/null +++ b/src/spec/stub/rails50/config/environments/development.rb @@ -0,0 +1,39 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. 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 = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end diff --git a/src/spec/stub/rails50/config/environments/production.rb b/src/spec/stub/rails50/config/environments/production.rb new file mode 100644 index 000000000..6a2b17b6e --- /dev/null +++ b/src/spec/stub/rails50/config/environments/production.rb @@ -0,0 +1,66 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # 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 serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :info + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "rails50_#{Rails.env}" + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end +end diff --git a/src/spec/stub/rails50/config/environments/test.rb b/src/spec/stub/rails50/config/environments/test.rb new file mode 100644 index 000000000..60d9e0c2c --- /dev/null +++ b/src/spec/stub/rails50/config/environments/test.rb @@ -0,0 +1,36 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # 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 + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # 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=3600' + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/src/spec/stub/rails50/config/initializers/application_controller_renderer.rb b/src/spec/stub/rails50/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/src/spec/stub/rails50/config/initializers/backtrace_silencers.rb b/src/spec/stub/rails50/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..59385cdf3 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/src/spec/stub/rails50/config/initializers/cookies_serializer.rb b/src/spec/stub/rails50/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..5a6a32d37 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/src/spec/stub/rails50/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails50/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..4a994e1e7 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/src/spec/stub/rails50/config/initializers/inflections.rb b/src/spec/stub/rails50/config/initializers/inflections.rb new file mode 100644 index 000000000..ac033bf9d --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/src/spec/stub/rails50/config/initializers/mime_types.rb b/src/spec/stub/rails50/config/initializers/mime_types.rb new file mode 100644 index 000000000..dc1899682 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/src/spec/stub/rails50/config/initializers/new_framework_defaults.rb b/src/spec/stub/rails50/config/initializers/new_framework_defaults.rb new file mode 100644 index 000000000..5aa4949b6 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/new_framework_defaults.rb @@ -0,0 +1,23 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +Rails.application.config.action_controller.raise_on_unfiltered_parameters = true + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = true + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = true + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = true + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Previous versions had false. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/src/spec/stub/rails50/config/initializers/session_store.rb b/src/spec/stub/rails50/config/initializers/session_store.rb new file mode 100644 index 000000000..7b3c232ab --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_rails50_session' diff --git a/src/spec/stub/rails50/config/initializers/wrap_parameters.rb b/src/spec/stub/rails50/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..633c1c889 --- /dev/null +++ b/src/spec/stub/rails50/config/initializers/wrap_parameters.rb @@ -0,0 +1,9 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end diff --git a/src/spec/stub/rails50/config/locales/en.yml b/src/spec/stub/rails50/config/locales/en.yml new file mode 100644 index 000000000..065395716 --- /dev/null +++ b/src/spec/stub/rails50/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails50/config/routes.rb b/src/spec/stub/rails50/config/routes.rb new file mode 100644 index 000000000..787824f88 --- /dev/null +++ b/src/spec/stub/rails50/config/routes.rb @@ -0,0 +1,3 @@ +Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html +end diff --git a/src/spec/stub/rails50/config/secrets.yml b/src/spec/stub/rails50/config/secrets.yml new file mode 100644 index 000000000..bb77b0774 --- /dev/null +++ b/src/spec/stub/rails50/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: daaf70a166a792ee9832c7c29b4ae6e0e3d3c11f59a8630a4efb252a9ae8c49f94c9cdbb6fcb19e96578ae22aef45b79ea6b0c78fa0f2ba3ee701f75e8baed30 + +test: + secret_key_base: 1c572c645125b98125007fc859d551d2ece39b8b25469b9180acd310c292baf725d45c987874908acb32806f76ad909d9de4cada1588a37fbdd0c50728229a55 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/src/spec/stub/rails50/db/seeds.rb b/src/spec/stub/rails50/db/seeds.rb new file mode 100644 index 000000000..1beea2acc --- /dev/null +++ b/src/spec/stub/rails50/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). +# +# Examples: +# +# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) +# Character.create(name: 'Luke', movie: movies.first) diff --git a/src/spec/stub/rails50/public/robots.txt b/src/spec/stub/rails50/public/robots.txt new file mode 100644 index 000000000..3c9c7c01f --- /dev/null +++ b/src/spec/stub/rails50/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/src/spec/stub/rails52/app/controllers/application_controller.rb b/src/spec/stub/rails52/app/controllers/application_controller.rb new file mode 100644 index 000000000..09705d12a --- /dev/null +++ b/src/spec/stub/rails52/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/src/spec/stub/rails52/app/helpers/application_helper.rb b/src/spec/stub/rails52/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails52/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails52/app/jobs/application_job.rb b/src/spec/stub/rails52/app/jobs/application_job.rb new file mode 100644 index 000000000..a009ace51 --- /dev/null +++ b/src/spec/stub/rails52/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/src/spec/stub/rails52/config/application.rb b/src/spec/stub/rails52/config/application.rb new file mode 100644 index 000000000..747a5ab9e --- /dev/null +++ b/src/spec/stub/rails52/config/application.rb @@ -0,0 +1,33 @@ +require_relative 'boot' + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +require "action_view/railtie" +# require "action_cable/engine" +# require "sprockets/railtie" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails52 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.2 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. + + # Don't generate system test files. + config.generators.system_tests = nil + end +end diff --git a/src/spec/stub/rails52/config/boot.rb b/src/spec/stub/rails52/config/boot.rb new file mode 100644 index 000000000..aaead8a69 --- /dev/null +++ b/src/spec/stub/rails52/config/boot.rb @@ -0,0 +1,6 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. + +# workaround for https://github.com/ruby-concurrency/concurrent-ruby/issues/1077 since https://github.com/rails/rails/pull/54264 wont be backported earlier than 7.1. +require "logger" diff --git a/src/spec/stub/rails52/config/credentials.yml.enc b/src/spec/stub/rails52/config/credentials.yml.enc new file mode 100644 index 000000000..a8c3024b3 --- /dev/null +++ b/src/spec/stub/rails52/config/credentials.yml.enc @@ -0,0 +1 @@ +Ne9w4AoULBHCChnLav+4TA0ZR23nhmpHOdNnRiNlPBqjWKJD2STfM4NVzlcBBfSuFhxP7fMARjI6XrD+Dzr+9te0HVtunTiAKqJ9vuT/CGaWlx91510SZH2ZHrppJ3F80twKFGIKZUoXhx321W1l3tve0sAVSYsEicbyd2sF9mPzFWemmyf+BaJEHbr+tTLcM/HhrYHNE+4GFOzgnXPkBNSeArBa4CcOC7dETQ2zDRTO1ZCp7ZDaEY5wS93sPdjzttWqt10ZoPVpogdyobGv2J8kIYtEkkgXuZSp1HH7g/nGmFa07OxgKGRYEm0OTSq9bzRcpTjDNIEjT24QdFxwBfpmM2y7sXjXjv6mrw3CQv4Rp9wnd4AAMJBwQ3cgHvMAvrJ+na2FCBXihZCoG6BIqc2wFI4QYmsBYMJv--cLGUnKCq29bH3C4e--B1rz/3d7sS0Uz3mtO4/oxg== \ No newline at end of file diff --git a/src/spec/stub/rails52/config/environment.rb b/src/spec/stub/rails52/config/environment.rb new file mode 100644 index 000000000..426333bb4 --- /dev/null +++ b/src/spec/stub/rails52/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails52/config/environments/development.rb b/src/spec/stub/rails52/config/environments/development.rb new file mode 100644 index 000000000..5426b129a --- /dev/null +++ b/src/spec/stub/rails52/config/environments/development.rb @@ -0,0 +1,40 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. 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 = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # 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.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 + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end diff --git a/src/spec/stub/rails52/config/environments/production.rb b/src/spec/stub/rails52/config/environments/production.rb new file mode 100644 index 000000000..6b5ccc162 --- /dev/null +++ b/src/spec/stub/rails52/config/environments/production.rb @@ -0,0 +1,68 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # 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 + + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :info + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "rails52_#{Rails.env}" + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end +end diff --git a/src/spec/stub/rails52/config/environments/test.rb b/src/spec/stub/rails52/config/environments/test.rb new file mode 100644 index 000000000..bf3aeb3ff --- /dev/null +++ b/src/spec/stub/rails52/config/environments/test.rb @@ -0,0 +1,36 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # 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 + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # 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. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/src/spec/stub/rails52/config/initializers/application_controller_renderer.rb b/src/spec/stub/rails52/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/src/spec/stub/rails52/config/initializers/backtrace_silencers.rb b/src/spec/stub/rails52/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..59385cdf3 --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/src/spec/stub/rails52/config/initializers/content_security_policy.rb b/src/spec/stub/rails52/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..d3bcaa5ec --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# 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 diff --git a/src/spec/stub/rails52/config/initializers/cookies_serializer.rb b/src/spec/stub/rails52/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..5a6a32d37 --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/src/spec/stub/rails52/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails52/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..4a994e1e7 --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/src/spec/stub/rails52/config/initializers/inflections.rb b/src/spec/stub/rails52/config/initializers/inflections.rb new file mode 100644 index 000000000..ac033bf9d --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/src/spec/stub/rails52/config/initializers/mime_types.rb b/src/spec/stub/rails52/config/initializers/mime_types.rb new file mode 100644 index 000000000..dc1899682 --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/src/spec/stub/rails52/config/initializers/wrap_parameters.rb b/src/spec/stub/rails52/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..633c1c889 --- /dev/null +++ b/src/spec/stub/rails52/config/initializers/wrap_parameters.rb @@ -0,0 +1,9 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end diff --git a/src/spec/stub/rails52/config/locales/en.yml b/src/spec/stub/rails52/config/locales/en.yml new file mode 100644 index 000000000..decc5a857 --- /dev/null +++ b/src/spec/stub/rails52/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails52/config/master.key b/src/spec/stub/rails52/config/master.key new file mode 100644 index 000000000..19764a6b8 --- /dev/null +++ b/src/spec/stub/rails52/config/master.key @@ -0,0 +1 @@ +d1c85e30dc5fbbe6f66d8680bfe0084a \ No newline at end of file diff --git a/src/spec/stub/rails52/config/routes.rb b/src/spec/stub/rails52/config/routes.rb new file mode 100644 index 000000000..787824f88 --- /dev/null +++ b/src/spec/stub/rails52/config/routes.rb @@ -0,0 +1,3 @@ +Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html +end diff --git a/src/spec/stub/rails52/public/robots.txt b/src/spec/stub/rails52/public/robots.txt new file mode 100644 index 000000000..37b576a4a --- /dev/null +++ b/src/spec/stub/rails52/public/robots.txt @@ -0,0 +1 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/src/spec/stub/rails60/app/channels/application_cable/channel.rb b/src/spec/stub/rails60/app/channels/application_cable/channel.rb new file mode 100644 index 000000000..d67269728 --- /dev/null +++ b/src/spec/stub/rails60/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/src/spec/stub/rails60/app/channels/application_cable/connection.rb b/src/spec/stub/rails60/app/channels/application_cable/connection.rb new file mode 100644 index 000000000..0ff5442f4 --- /dev/null +++ b/src/spec/stub/rails60/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/src/spec/stub/rails60/app/controllers/application_controller.rb b/src/spec/stub/rails60/app/controllers/application_controller.rb new file mode 100644 index 000000000..09705d12a --- /dev/null +++ b/src/spec/stub/rails60/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/src/spec/stub/rails60/app/helpers/application_helper.rb b/src/spec/stub/rails60/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails60/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails60/app/jobs/application_job.rb b/src/spec/stub/rails60/app/jobs/application_job.rb new file mode 100644 index 000000000..d394c3d10 --- /dev/null +++ b/src/spec/stub/rails60/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError +end diff --git a/src/spec/stub/rails60/app/mailers/application_mailer.rb b/src/spec/stub/rails60/app/mailers/application_mailer.rb new file mode 100644 index 000000000..286b2239d --- /dev/null +++ b/src/spec/stub/rails60/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/src/spec/stub/rails60/config/application.rb b/src/spec/stub/rails60/config/application.rb new file mode 100644 index 000000000..7615e6981 --- /dev/null +++ b/src/spec/stub/rails60/config/application.rb @@ -0,0 +1,35 @@ +require_relative 'boot' + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +require "action_cable/engine" +# require "sprockets/railtie" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails60 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 6.0 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. + + # Don't generate system test files. + config.generators.system_tests = nil + end +end diff --git a/src/spec/stub/rails60/config/boot.rb b/src/spec/stub/rails60/config/boot.rb new file mode 100644 index 000000000..aaead8a69 --- /dev/null +++ b/src/spec/stub/rails60/config/boot.rb @@ -0,0 +1,6 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. + +# workaround for https://github.com/ruby-concurrency/concurrent-ruby/issues/1077 since https://github.com/rails/rails/pull/54264 wont be backported earlier than 7.1. +require "logger" diff --git a/src/spec/stub/rails60/config/cable.yml b/src/spec/stub/rails60/config/cable.yml new file mode 100644 index 000000000..debdc02e7 --- /dev/null +++ b/src/spec/stub/rails60/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: test + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: rails60_production diff --git a/src/spec/stub/rails60/config/credentials.yml.enc b/src/spec/stub/rails60/config/credentials.yml.enc new file mode 100644 index 000000000..4527c803c --- /dev/null +++ b/src/spec/stub/rails60/config/credentials.yml.enc @@ -0,0 +1 @@ +NAfkPXdJHQXHnJ9Qo20pbFYO361Y1u7uIKwEt0zklOwEDJx1ukvNl7de9rVB6X8KtjDJ/WfGN6ATpvD1Vr9aTz9gozmTaA1QRZulMZ9tDHIKa4SnO7hz41Uh8KtDlHhQTCuuQN3PcHcT+V5URHd3Xj7t1KjemOyeqDPiiHZg5ev+5q62QzuU5bua3ZiOqJZkFSFt4ZgBEnoh/dtQ9DGGTx81XAGuDHiqA/E/7eUabTmrQecSLns4MVaQGRxFSc+bwPpXXVAm9mPXDq3a4qIj/QQPdKWUEM9ITGDe8XCWaxuEGE4kJNd5YC4Zt4Y587MDiOfplnNjnMNdl1Ew1Cdu8go1ya/+yTLOo3zth+RFjL3iGwwRpev6iIXV3a5TMSZZBzz1ymhZY1o6vWGxdz48OyQrP/ezEvlKelq0--nnn3tWDCPv01C+/x--h+YZ49jT4YJ51LxO0zFotg== \ No newline at end of file diff --git a/src/spec/stub/rails60/config/environment.rb b/src/spec/stub/rails60/config/environment.rb new file mode 100644 index 000000000..426333bb4 --- /dev/null +++ b/src/spec/stub/rails60/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails60/config/environments/development.rb b/src/spec/stub/rails60/config/environments/development.rb new file mode 100644 index 000000000..f714abbf5 --- /dev/null +++ b/src/spec/stub/rails60/config/environments/development.rb @@ -0,0 +1,46 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. 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 = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # 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 + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + + # Raises error for missing translations. + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end diff --git a/src/spec/stub/rails60/config/environments/production.rb b/src/spec/stub/rails60/config/environments/production.rb new file mode 100644 index 000000000..a559dd684 --- /dev/null +++ b/src/spec/stub/rails60/config/environments/production.rb @@ -0,0 +1,100 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # 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 + + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # 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.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :info + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment). + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "rails60_production" + + config.action_mailer.perform_caching = false + + # 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 locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Inserts middleware to perform automatic connection switching. + # The `database_selector` hash is used to pass options to the DatabaseSelector + # middleware. The `delay` is used to determine how long to wait after a write + # to send a subsequent read to the primary. + # + # The `database_resolver` class is used by the middleware to determine which + # database is appropriate to use based on the time delay. + # + # The `database_resolver_context` class is used by the middleware to set + # timestamps for the last write to the primary. The resolver uses the context + # class timestamps to determine how long to wait before reading from the + # replica. + # + # By default Rails will store a last write timestamp in the session. The + # DatabaseSelector middleware is designed as such you can define your own + # strategy for connection switching and pass that into the middleware through + # these configuration options. + # config.active_record.database_selector = { delay: 2.seconds } + # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session +end diff --git a/src/spec/stub/rails60/config/environments/test.rb b/src/spec/stub/rails60/config/environments/test.rb new file mode 100644 index 000000000..2f62f93cb --- /dev/null +++ b/src/spec/stub/rails60/config/environments/test.rb @@ -0,0 +1,45 @@ +# The test environment is used exclusively to run your application's +# 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 +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # 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. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + config.cache_store = :null_store + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + 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 + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations. + # config.action_view.raise_on_missing_translations = true +end diff --git a/src/spec/stub/rails60/config/initializers/application_controller_renderer.rb b/src/spec/stub/rails60/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/src/spec/stub/rails60/config/initializers/backtrace_silencers.rb b/src/spec/stub/rails60/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..59385cdf3 --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/src/spec/stub/rails60/config/initializers/content_security_policy.rb b/src/spec/stub/rails60/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..35d0f26fc --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/content_security_policy.rb @@ -0,0 +1,30 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # If you are using webpack-dev-server then specify webpack-dev-server host +# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# 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 diff --git a/src/spec/stub/rails60/config/initializers/cookies_serializer.rb b/src/spec/stub/rails60/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..5a6a32d37 --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/src/spec/stub/rails60/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails60/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..4a994e1e7 --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/src/spec/stub/rails60/config/initializers/inflections.rb b/src/spec/stub/rails60/config/initializers/inflections.rb new file mode 100644 index 000000000..ac033bf9d --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/src/spec/stub/rails60/config/initializers/mime_types.rb b/src/spec/stub/rails60/config/initializers/mime_types.rb new file mode 100644 index 000000000..dc1899682 --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/src/spec/stub/rails60/config/initializers/wrap_parameters.rb b/src/spec/stub/rails60/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..633c1c889 --- /dev/null +++ b/src/spec/stub/rails60/config/initializers/wrap_parameters.rb @@ -0,0 +1,9 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end diff --git a/src/spec/stub/rails60/config/locales/en.yml b/src/spec/stub/rails60/config/locales/en.yml new file mode 100644 index 000000000..cf9b342d0 --- /dev/null +++ b/src/spec/stub/rails60/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at https://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails60/config/master.key b/src/spec/stub/rails60/config/master.key new file mode 100644 index 000000000..9a467de86 --- /dev/null +++ b/src/spec/stub/rails60/config/master.key @@ -0,0 +1 @@ +7c54eb30c1bdb8759ce96388e43d9962 \ No newline at end of file diff --git a/src/spec/stub/rails60/config/routes.rb b/src/spec/stub/rails60/config/routes.rb new file mode 100644 index 000000000..c06383a17 --- /dev/null +++ b/src/spec/stub/rails60/config/routes.rb @@ -0,0 +1,3 @@ +Rails.application.routes.draw do + # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html +end diff --git a/src/spec/stub/rails60/public/robots.txt b/src/spec/stub/rails60/public/robots.txt new file mode 100644 index 000000000..c19f78ab6 --- /dev/null +++ b/src/spec/stub/rails60/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/src/spec/stub/rails61/app/controllers/application_controller.rb b/src/spec/stub/rails61/app/controllers/application_controller.rb new file mode 100644 index 000000000..09705d12a --- /dev/null +++ b/src/spec/stub/rails61/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/src/spec/stub/rails61/app/helpers/application_helper.rb b/src/spec/stub/rails61/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails61/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails61/config/application.rb b/src/spec/stub/rails61/config/application.rb new file mode 100644 index 000000000..9f1353e94 --- /dev/null +++ b/src/spec/stub/rails61/config/application.rb @@ -0,0 +1,38 @@ +require_relative "boot" + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +# require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" +# require "sprockets/railtie" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails61 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 6.1 + + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") + + # Don't generate system test files. + config.generators.system_tests = nil + end +end diff --git a/src/spec/stub/rails61/config/boot.rb b/src/spec/stub/rails61/config/boot.rb new file mode 100644 index 000000000..9e68e5f0c --- /dev/null +++ b/src/spec/stub/rails61/config/boot.rb @@ -0,0 +1,6 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require "bundler/setup" # Set up gems listed in the Gemfile. + +# workaround for https://github.com/ruby-concurrency/concurrent-ruby/issues/1077 since https://github.com/rails/rails/pull/54264 wont be backported earlier than 7.1. +require "logger" diff --git a/src/spec/stub/rails61/config/credentials.yml.enc b/src/spec/stub/rails61/config/credentials.yml.enc new file mode 100644 index 000000000..617e129f3 --- /dev/null +++ b/src/spec/stub/rails61/config/credentials.yml.enc @@ -0,0 +1 @@ +h7j6TBtL1MQo4aye3KuFMJqXjsojY1IPfhda51j54oYS0xgUgqz+5wlsyq7mFhh549MUTEWxaYWm1bDOooOtMKrIuUzDkXfgyZLWyvhMtfGRbe74a/SGS+M8SDXN65XgeVcYpiZxIHmTeXj/FQ2t3nXjXkQV1g892+XFzgB1mYE59B6B1b21m0lVVSKMXHZhVguZEMnAB6sdVDIdQQA2xOFllnVcIdAvifHE0GYKgALCgdVeRDs1Ob3xZp0cXaZBqGl27lR1a+8MyR1ZDwZ08aysmtzY4koUE6JR5Auv3SBpVr0xXihTWZB55/H0b6t1SXiGRr06EnsM1libanIX1II36IBcsi4MOMLjj89KDUaLOTfbFMtcRMh+r7YHZEgIQksMVl6yxQVH3tjzlbgPXC5alj+sICKsh1ve--YuCA+1XrgTwmE0Oc--JvkiuzV70g4zSz7VF3/21w== \ No newline at end of file diff --git a/src/spec/stub/rails61/config/environment.rb b/src/spec/stub/rails61/config/environment.rb new file mode 100644 index 000000000..cac531577 --- /dev/null +++ b/src/spec/stub/rails61/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails61/config/environments/development.rb b/src/spec/stub/rails61/config/environments/development.rb new file mode 100644 index 000000000..1181937f3 --- /dev/null +++ b/src/spec/stub/rails61/config/environments/development.rb @@ -0,0 +1,55 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # 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 = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # 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 + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true +end diff --git a/src/spec/stub/rails61/config/environments/production.rb b/src/spec/stub/rails61/config/environments/production.rb new file mode 100644 index 000000000..0d5988d60 --- /dev/null +++ b/src/spec/stub/rails61/config/environments/production.rb @@ -0,0 +1,94 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # 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 + + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Include generic and useful information about system operation, but avoid logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). + config.log_level = :info + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Log disallowed deprecations. + config.active_support.disallowed_deprecation = :log + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require "syslog/logger" + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Inserts middleware to perform automatic connection switching. + # The `database_selector` hash is used to pass options to the DatabaseSelector + # middleware. The `delay` is used to determine how long to wait after a write + # to send a subsequent read to the primary. + # + # The `database_resolver` class is used by the middleware to determine which + # database is appropriate to use based on the time delay. + # + # The `database_resolver_context` class is used by the middleware to set + # timestamps for the last write to the primary. The resolver uses the context + # class timestamps to determine how long to wait before reading from the + # replica. + # + # By default Rails will store a last write timestamp in the session. The + # DatabaseSelector middleware is designed as such you can define your own + # strategy for connection switching and pass that into the middleware through + # these configuration options. + # config.active_record.database_selector = { delay: 2.seconds } + # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session +end diff --git a/src/spec/stub/rails61/config/environments/test.rb b/src/spec/stub/rails61/config/environments/test.rb new file mode 100644 index 000000000..9fa79ddf0 --- /dev/null +++ b/src/spec/stub/rails61/config/environments/test.rb @@ -0,0 +1,49 @@ +require "active_support/core_ext/integer/time" + +# The test environment is used exclusively to run your application's +# 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 +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # 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. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + config.cache_store = :null_store + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true +end diff --git a/src/spec/stub/rails61/config/initializers/application_controller_renderer.rb b/src/spec/stub/rails61/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/src/spec/stub/rails61/config/initializers/backtrace_silencers.rb b/src/spec/stub/rails61/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..33699c309 --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/backtrace_silencers.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code +# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". +Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] diff --git a/src/spec/stub/rails61/config/initializers/content_security_policy.rb b/src/spec/stub/rails61/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..41c43016f --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/content_security_policy.rb @@ -0,0 +1,28 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# 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 diff --git a/src/spec/stub/rails61/config/initializers/cookies_serializer.rb b/src/spec/stub/rails61/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..5a6a32d37 --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/src/spec/stub/rails61/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails61/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..4b34a0366 --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/src/spec/stub/rails61/config/initializers/inflections.rb b/src/spec/stub/rails61/config/initializers/inflections.rb new file mode 100644 index 000000000..ac033bf9d --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/src/spec/stub/rails61/config/initializers/mime_types.rb b/src/spec/stub/rails61/config/initializers/mime_types.rb new file mode 100644 index 000000000..dc1899682 --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/src/spec/stub/rails61/config/initializers/permissions_policy.rb b/src/spec/stub/rails61/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..00f64d71b --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/src/spec/stub/rails61/config/initializers/wrap_parameters.rb b/src/spec/stub/rails61/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..633c1c889 --- /dev/null +++ b/src/spec/stub/rails61/config/initializers/wrap_parameters.rb @@ -0,0 +1,9 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end diff --git a/src/spec/stub/rails61/config/locales/en.yml b/src/spec/stub/rails61/config/locales/en.yml new file mode 100644 index 000000000..cf9b342d0 --- /dev/null +++ b/src/spec/stub/rails61/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at https://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails61/config/master.key b/src/spec/stub/rails61/config/master.key new file mode 100644 index 000000000..bd61b157b --- /dev/null +++ b/src/spec/stub/rails61/config/master.key @@ -0,0 +1 @@ +41965057759dc9068cf6c6ee8a971b61 \ No newline at end of file diff --git a/src/spec/stub/rails61/config/routes.rb b/src/spec/stub/rails61/config/routes.rb new file mode 100644 index 000000000..c06383a17 --- /dev/null +++ b/src/spec/stub/rails61/config/routes.rb @@ -0,0 +1,3 @@ +Rails.application.routes.draw do + # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html +end diff --git a/src/spec/stub/rails61/public/robots.txt b/src/spec/stub/rails61/public/robots.txt new file mode 100644 index 000000000..c19f78ab6 --- /dev/null +++ b/src/spec/stub/rails61/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/src/spec/stub/rails70/app/controllers/application_controller.rb b/src/spec/stub/rails70/app/controllers/application_controller.rb new file mode 100644 index 000000000..09705d12a --- /dev/null +++ b/src/spec/stub/rails70/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/src/spec/stub/rails70/app/helpers/application_helper.rb b/src/spec/stub/rails70/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails70/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails70/config/application.rb b/src/spec/stub/rails70/config/application.rb new file mode 100644 index 000000000..44477b8d5 --- /dev/null +++ b/src/spec/stub/rails70/config/application.rb @@ -0,0 +1,37 @@ +require_relative "boot" + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +# require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails70 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 7.0 + + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") + + # Don't generate system test files. + config.generators.system_tests = nil + end +end diff --git a/src/spec/stub/rails70/config/boot.rb b/src/spec/stub/rails70/config/boot.rb new file mode 100644 index 000000000..0980b3ef5 --- /dev/null +++ b/src/spec/stub/rails70/config/boot.rb @@ -0,0 +1,5 @@ +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "bundler/setup" # Set up gems listed in the Gemfile. +# workaround for https://github.com/ruby-concurrency/concurrent-ruby/issues/1077 since https://github.com/rails/rails/pull/54264 wont be backported earlier than 7.1. +require "logger" diff --git a/src/spec/stub/rails70/config/credentials.yml.enc b/src/spec/stub/rails70/config/credentials.yml.enc new file mode 100644 index 000000000..11e04461a --- /dev/null +++ b/src/spec/stub/rails70/config/credentials.yml.enc @@ -0,0 +1 @@ +Ks8WMqYXI67JiLvqB2XFPU1q+c0phvGDsA4VkaSNJvsZKx3kog3FfnkmGOzK1J7elI+RbI39JzkJrfFyPuglERXgMK+/thpJYKWwhmU1AGsTjSJfumB5jIHIVJhMh1TYKZmas1lzV0SlzUpqJy9UcyucYwqXdCHGyTcHugiv0zwelMO3M/KCDEssNWSAi1fV7lKj/eIdkgE4lOX6XpfF58085OJ5BUZWWKSK1vBq0+xxv8czG7UxaLCv8xu5MEwnhztruuKPE4gV7eVbHcKHfJTibA2MNY1G4LJk9G+wLkg8GIf+oSyB81Y+mTfcaii2fN9FP2+d0aASFYRT6LX1HAnLybxhK5yCLBOK5Hb414TntUwTnun4a+LObZCOcBcFVvC/a3KdDIXfaTvQw72oMz6qcq5YeAkSaWv4--1vC+tsi2Y0YsIwOi--pMvCIu1i4YfRyVxVYg7MIg== \ No newline at end of file diff --git a/src/spec/stub/rails70/config/environment.rb b/src/spec/stub/rails70/config/environment.rb new file mode 100644 index 000000000..cac531577 --- /dev/null +++ b/src/spec/stub/rails70/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails70/config/environments/development.rb b/src/spec/stub/rails70/config/environments/development.rb new file mode 100644 index 000000000..6df11e560 --- /dev/null +++ b/src/spec/stub/rails70/config/environments/development.rb @@ -0,0 +1,54 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # 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 = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable server timing + config.server_timing = true + + # 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 + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # 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 +end diff --git a/src/spec/stub/rails70/config/environments/production.rb b/src/spec/stub/rails70/config/environments/production.rb new file mode 100644 index 000000000..061063854 --- /dev/null +++ b/src/spec/stub/rails70/config/environments/production.rb @@ -0,0 +1,66 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # 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 + + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Include generic and useful information about system operation, but avoid logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). + config.log_level = :info + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require "syslog/logger" + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end +end diff --git a/src/spec/stub/rails70/config/environments/test.rb b/src/spec/stub/rails70/config/environments/test.rb new file mode 100644 index 000000000..eb2f1716c --- /dev/null +++ b/src/spec/stub/rails70/config/environments/test.rb @@ -0,0 +1,50 @@ +require "active_support/core_ext/integer/time" + +# The test environment is used exclusively to run your application's +# 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 +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Turn false under Spring and add config.action_view.cache_template_loading = true. + config.cache_classes = true + + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? + + # 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. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + config.cache_store = :null_store + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true +end diff --git a/src/spec/stub/rails70/config/initializers/content_security_policy.rb b/src/spec/stub/rails70/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..54f47cf15 --- /dev/null +++ b/src/spec/stub/rails70/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header + +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/src/spec/stub/rails70/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails70/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..adc6568ce --- /dev/null +++ b/src/spec/stub/rails70/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# Configure parameters to be 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 +] diff --git a/src/spec/stub/rails70/config/initializers/inflections.rb b/src/spec/stub/rails70/config/initializers/inflections.rb new file mode 100644 index 000000000..3860f659e --- /dev/null +++ b/src/spec/stub/rails70/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym "RESTful" +# end diff --git a/src/spec/stub/rails70/config/initializers/permissions_policy.rb b/src/spec/stub/rails70/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..00f64d71b --- /dev/null +++ b/src/spec/stub/rails70/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/src/spec/stub/rails70/config/locales/en.yml b/src/spec/stub/rails70/config/locales/en.yml new file mode 100644 index 000000000..8ca56fc74 --- /dev/null +++ b/src/spec/stub/rails70/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t "hello" +# +# In views, this is aliased to just `t`: +# +# <%= t("hello") %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# "true": "foo" +# +# To learn more, please read the Rails Internationalization guide +# available at https://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails70/config/master.key b/src/spec/stub/rails70/config/master.key new file mode 100644 index 000000000..2d6deb451 --- /dev/null +++ b/src/spec/stub/rails70/config/master.key @@ -0,0 +1 @@ +61cbceab4f72f0eb29a43fad2807a128 \ No newline at end of file diff --git a/src/spec/stub/rails70/config/puma.rb b/src/spec/stub/rails70/config/puma.rb new file mode 100644 index 000000000..daaf03699 --- /dev/null +++ b/src/spec/stub/rails70/config/puma.rb @@ -0,0 +1,43 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count + +# Specifies the `worker_timeout` threshold that Puma will use to wait before +# terminating a worker in development environments. +# +worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked web server processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. +# +# preload_app! + +# Allow puma to be restarted by `bin/rails restart` command. +plugin :tmp_restart diff --git a/src/spec/stub/rails70/config/routes.rb b/src/spec/stub/rails70/config/routes.rb new file mode 100644 index 000000000..262ffd547 --- /dev/null +++ b/src/spec/stub/rails70/config/routes.rb @@ -0,0 +1,6 @@ +Rails.application.routes.draw do + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + + # Defines the root path route ("/") + # root "articles#index" +end diff --git a/src/spec/stub/rails70/public/robots.txt b/src/spec/stub/rails70/public/robots.txt new file mode 100644 index 000000000..c19f78ab6 --- /dev/null +++ b/src/spec/stub/rails70/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/src/spec/stub/rails71/README.md b/src/spec/stub/rails71/README.md new file mode 100644 index 000000000..7db80e4ca --- /dev/null +++ b/src/spec/stub/rails71/README.md @@ -0,0 +1,24 @@ +# README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... diff --git a/src/spec/stub/rails71/Rakefile b/src/spec/stub/rails71/Rakefile new file mode 100644 index 000000000..9a5ea7383 --- /dev/null +++ b/src/spec/stub/rails71/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative "config/application" + +Rails.application.load_tasks diff --git a/src/spec/stub/rails71/app/controllers/application_controller.rb b/src/spec/stub/rails71/app/controllers/application_controller.rb new file mode 100644 index 000000000..09705d12a --- /dev/null +++ b/src/spec/stub/rails71/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/src/spec/stub/rails71/app/helpers/application_helper.rb b/src/spec/stub/rails71/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails71/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails71/config.ru b/src/spec/stub/rails71/config.ru new file mode 100644 index 000000000..4a3c09a68 --- /dev/null +++ b/src/spec/stub/rails71/config.ru @@ -0,0 +1,6 @@ +# This file is used by Rack-based servers to start the application. + +require_relative "config/environment" + +run Rails.application +Rails.application.load_server diff --git a/src/spec/stub/rails71/config/application.rb b/src/spec/stub/rails71/config/application.rb new file mode 100644 index 000000000..f384d7e7b --- /dev/null +++ b/src/spec/stub/rails71/config/application.rb @@ -0,0 +1,42 @@ +require_relative "boot" + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +# require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails71 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 7.1 + + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w(assets tasks)) + + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") + + # Don't generate system test files. + config.generators.system_tests = nil + end +end diff --git a/src/spec/stub/rails71/config/boot.rb b/src/spec/stub/rails71/config/boot.rb new file mode 100644 index 000000000..282011619 --- /dev/null +++ b/src/spec/stub/rails71/config/boot.rb @@ -0,0 +1,3 @@ +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/src/spec/stub/rails71/config/credentials.yml.enc b/src/spec/stub/rails71/config/credentials.yml.enc new file mode 100644 index 000000000..8a29b57f4 --- /dev/null +++ b/src/spec/stub/rails71/config/credentials.yml.enc @@ -0,0 +1 @@ ++u1GpoOEX4wRcKPVlXaWaCNL2ovW0/lhPoCilF6FPYlM4/gI7IRq7VpswS3TiH39Aak80G/J1NPei+6DInfzHv57o2Id41exbYzXuUwBy1zNXT2Ht4TTCfpRJguGf1OuSeEom+aYps0XL56RGQemudFFV14qJo0odrIGw30qvBo6Pz6qb9qnua07qKlNtosDcCTmdJ77ulXje0p/UyLwzao1yIGWpQc4NvBdxBpg8WuUomp+191LAmkIDWvoXagS5JNGGx7fFnYl8UPkce+W+sUF8SJL0EaJ//+Dipjwvvp0ph9E1UN0G8LDI7ostXDLCZSlgdWE1q7tNGqFYQLBySz6j4mxBkB5wt+/s6J7nhlpLttmDdEFB3YxiI8YC7XxqNt9AfK8BsvpeninsmppeecvMV+R--cSN3EVUUdX/ELvXi--I6//3r/xvpzSXE1dGGfX/w== \ No newline at end of file diff --git a/src/spec/stub/rails71/config/environment.rb b/src/spec/stub/rails71/config/environment.rb new file mode 100644 index 000000000..cac531577 --- /dev/null +++ b/src/spec/stub/rails71/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails71/config/environments/development.rb b/src/spec/stub/rails71/config/environments/development.rb new file mode 100644 index 000000000..2c4802922 --- /dev/null +++ b/src/spec/stub/rails71/config/environments/development.rb @@ -0,0 +1,54 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # 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.enable_reloading = true + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable server timing + config.server_timing = true + + # 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 + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true +end diff --git a/src/spec/stub/rails71/config/environments/production.rb b/src/spec/stub/rails71/config/environments/production.rb new file mode 100644 index 000000000..4f569bf9e --- /dev/null +++ b/src/spec/stub/rails71/config/environments/production.rb @@ -0,0 +1,70 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.enable_reloading = false + + # Eager load code on boot. This eager loads most of Rails and + # 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 + + # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment + # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. + # config.public_file_server.enabled = false + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX + + # 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 + + # Log to STDOUT by default + # config.logger = ActiveSupport::Logger.new(STDOUT) + # .tap { |logger| logger.formatter = ::Logger::Formatter.new } + # .then { |logger| ActiveSupport::TaggedLogging.new(logger) } + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # "info" includes generic and useful information about system operation, but avoids logging too much + # 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. + # config.cache_store = :mem_cache_store + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Don't log any deprecations. + config.active_support.report_deprecations = 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 diff --git a/src/spec/stub/rails71/config/environments/test.rb b/src/spec/stub/rails71/config/environments/test.rb new file mode 100644 index 000000000..d349c3556 --- /dev/null +++ b/src/spec/stub/rails71/config/environments/test.rb @@ -0,0 +1,54 @@ +require "active_support/core_ext/integer/time" + +# The test environment is used exclusively to run your application's +# 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 +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false + + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + config.eager_load = ENV["CI"].present? + + # 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. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + config.cache_store = :null_store + + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true +end diff --git a/src/spec/stub/rails71/config/initializers/content_security_policy.rb b/src/spec/stub/rails71/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..b3076b38f --- /dev/null +++ b/src/spec/stub/rails71/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header + +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap, inline scripts, and inline styles. +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src style-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/src/spec/stub/rails71/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails71/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..c2d89e28a --- /dev/null +++ b/src/spec/stub/rails71/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# 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 +] diff --git a/src/spec/stub/rails71/config/initializers/inflections.rb b/src/spec/stub/rails71/config/initializers/inflections.rb new file mode 100644 index 000000000..3860f659e --- /dev/null +++ b/src/spec/stub/rails71/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym "RESTful" +# end diff --git a/src/spec/stub/rails71/config/initializers/permissions_policy.rb b/src/spec/stub/rails71/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..7db3b9577 --- /dev/null +++ b/src/spec/stub/rails71/config/initializers/permissions_policy.rb @@ -0,0 +1,13 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide HTTP permissions policy. For further +# information see: https://developers.google.com/web/updates/2018/06/feature-policy + +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" +# end diff --git a/src/spec/stub/rails71/config/locales/en.yml b/src/spec/stub/rails71/config/locales/en.yml new file mode 100644 index 000000000..6c349ae5e --- /dev/null +++ b/src/spec/stub/rails71/config/locales/en.yml @@ -0,0 +1,31 @@ +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t "hello" +# +# In views, this is aliased to just `t`: +# +# <%= t("hello") %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. +# +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: +# +# en: +# "yes": yup +# enabled: "ON" + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails71/config/master.key b/src/spec/stub/rails71/config/master.key new file mode 100644 index 000000000..3f482db3b --- /dev/null +++ b/src/spec/stub/rails71/config/master.key @@ -0,0 +1 @@ +6f7c8dd123b7a40e1efe1402ad7fd55f \ No newline at end of file diff --git a/src/spec/stub/rails71/config/puma.rb b/src/spec/stub/rails71/config/puma.rb new file mode 100644 index 000000000..7a709d7b6 --- /dev/null +++ b/src/spec/stub/rails71/config/puma.rb @@ -0,0 +1,44 @@ +# This configuration file will be evaluated by Puma. The top-level methods that +# are invoked here are part of Puma's configuration DSL. For more information +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. + +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count + +rails_env = ENV.fetch("RAILS_ENV") { "development" } + +if rails_env == "production" + # If you are running more than 1 thread per process, the workers count + # should be equal to the number of processors (CPU cores) in production. + # + # It defaults to 1 because it's impossible to reliably detect how many + # CPU cores are available. Make sure to set the `WEB_CONCURRENCY` environment + # variable to match the number of processors. + worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { 1 }) + if worker_count > 1 + workers worker_count + else + preload_app! + end +end +# Specifies the `worker_timeout` threshold that Puma will use to wait before +# terminating a worker in development environments. +worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +environment rails_env + +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } + +# Allow puma to be restarted by `bin/rails restart` command. +plugin :tmp_restart diff --git a/src/spec/stub/rails71/config/routes.rb b/src/spec/stub/rails71/config/routes.rb new file mode 100644 index 000000000..a125ef085 --- /dev/null +++ b/src/spec/stub/rails71/config/routes.rb @@ -0,0 +1,10 @@ +Rails.application.routes.draw do + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + + # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. + # Can be used by load balancers and uptime monitors to verify that the app is live. + get "up" => "rails/health#show", as: :rails_health_check + + # Defines the root path route ("/") + # root "posts#index" +end diff --git a/src/spec/stub/rails71/public/404.html b/src/spec/stub/rails71/public/404.html new file mode 100644 index 000000000..2be3af26f --- /dev/null +++ b/src/spec/stub/rails71/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/src/spec/stub/rails71/public/422.html b/src/spec/stub/rails71/public/422.html new file mode 100644 index 000000000..c08eac0d1 --- /dev/null +++ b/src/spec/stub/rails71/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/src/spec/stub/rails71/public/500.html b/src/spec/stub/rails71/public/500.html new file mode 100644 index 000000000..78a030af2 --- /dev/null +++ b/src/spec/stub/rails71/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/src/spec/stub/rails71/public/apple-touch-icon-precomposed.png b/src/spec/stub/rails71/public/apple-touch-icon-precomposed.png new file mode 100644 index 000000000..e69de29bb diff --git a/src/spec/stub/rails71/public/apple-touch-icon.png b/src/spec/stub/rails71/public/apple-touch-icon.png new file mode 100644 index 000000000..e69de29bb diff --git a/src/spec/stub/rails71/public/favicon.ico b/src/spec/stub/rails71/public/favicon.ico new file mode 100644 index 000000000..e69de29bb diff --git a/src/spec/stub/rails71/public/robots.txt b/src/spec/stub/rails71/public/robots.txt new file mode 100644 index 000000000..c19f78ab6 --- /dev/null +++ b/src/spec/stub/rails71/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/src/spec/stub/rails72/Rakefile b/src/spec/stub/rails72/Rakefile new file mode 100644 index 000000000..9a5ea7383 --- /dev/null +++ b/src/spec/stub/rails72/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative "config/application" + +Rails.application.load_tasks diff --git a/src/spec/stub/rails72/app/controllers/application_controller.rb b/src/spec/stub/rails72/app/controllers/application_controller.rb new file mode 100644 index 000000000..0d95db22b --- /dev/null +++ b/src/spec/stub/rails72/app/controllers/application_controller.rb @@ -0,0 +1,4 @@ +class ApplicationController < ActionController::Base + # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. + allow_browser versions: :modern +end diff --git a/src/spec/stub/rails72/app/helpers/application_helper.rb b/src/spec/stub/rails72/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/src/spec/stub/rails72/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/src/spec/stub/rails72/config/application.rb b/src/spec/stub/rails72/config/application.rb new file mode 100644 index 000000000..fdd8b2b61 --- /dev/null +++ b/src/spec/stub/rails72/config/application.rb @@ -0,0 +1,42 @@ +require_relative "boot" + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +# require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Rails72 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 7.2 + + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w[assets tasks]) + + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") + + # Don't generate system test files. + config.generators.system_tests = nil + end +end diff --git a/src/spec/stub/rails72/config/boot.rb b/src/spec/stub/rails72/config/boot.rb new file mode 100644 index 000000000..282011619 --- /dev/null +++ b/src/spec/stub/rails72/config/boot.rb @@ -0,0 +1,3 @@ +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/src/spec/stub/rails72/config/credentials.yml.enc b/src/spec/stub/rails72/config/credentials.yml.enc new file mode 100644 index 000000000..98b297e5e --- /dev/null +++ b/src/spec/stub/rails72/config/credentials.yml.enc @@ -0,0 +1 @@ +VcfM8jsFjbT1uz41VePTrE2/rI+fGrx6kyrFKJSoflAC2PlYpvBd6JdKeTMi3NFkCV2jsoNeM9ZkoPKffxdu5nBly27ax3A1nxhTRTuqIs2hOizrK2pIVPIAG2Q/rlG7vLuiTLzPQdm1+sapOPWyj7yNGyHckYJZv4jDkEfWZSQ8ERfmwdMSue3AeLWk/mHxq0aHNM26Lg5cCbGcea3No6doXCjk0xVFCY0qpOW1jbV6RrfgOjZ7yy72F37q/38ykPZ+/NyTAChxlkBuhFUf003qzuIirBDsE3zWcrIpKB5vWDPhj5vRS0F0uI1uVnWeeiah/RLc6FmrvCHr72lXeCBMorZBv4K32BI9IERZOCWjK/Yegf6Vfr33MEP9kPxOfu5+cH/apFjFD1+917LEOdHiDxd0--XKF4UI5O521M73io--qlQCj8KMYeYyis/202ipdw== \ No newline at end of file diff --git a/src/spec/stub/rails72/config/environment.rb b/src/spec/stub/rails72/config/environment.rb new file mode 100644 index 000000000..cac531577 --- /dev/null +++ b/src/spec/stub/rails72/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/src/spec/stub/rails72/config/environments/development.rb b/src/spec/stub/rails72/config/environments/development.rb new file mode 100644 index 000000000..992f090dc --- /dev/null +++ b/src/spec/stub/rails72/config/environments/development.rb @@ -0,0 +1,51 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # 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.enable_reloading = true + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable server timing. + config.server_timing = true + + # 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 + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true +end diff --git a/src/spec/stub/rails72/config/environments/production.rb b/src/spec/stub/rails72/config/environments/production.rb new file mode 100644 index 000000000..781b0d383 --- /dev/null +++ b/src/spec/stub/rails72/config/environments/production.rb @@ -0,0 +1,73 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.enable_reloading = false + + # Eager load code on boot. This eager loads most of Rails and + # 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 + + # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment + # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. + # config.public_file_server.enabled = false + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX + + # 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 + + # Skip http-to-https redirect for the default health check endpoint. + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } + + # Log to STDOUT by default +# config.logger = ActiveSupport::Logger.new(STDOUT) +# .tap { |logger| logger.formatter = ::Logger::Formatter.new } +# .then { |logger| ActiveSupport::TaggedLogging.new(logger) } + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # "info" includes generic and useful information about system operation, but avoids logging too much + # 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. + # config.cache_store = :mem_cache_store + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Don't log any deprecations. + config.active_support.report_deprecations = 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 diff --git a/src/spec/stub/rails72/config/environments/test.rb b/src/spec/stub/rails72/config/environments/test.rb new file mode 100644 index 000000000..999db7091 --- /dev/null +++ b/src/spec/stub/rails72/config/environments/test.rb @@ -0,0 +1,51 @@ +require "active_support/core_ext/integer/time" + +# The test environment is used exclusively to run your application's +# 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 +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false + + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + config.eager_load = ENV["CI"].present? + + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + config.cache_store = :null_store + + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true +end diff --git a/src/spec/stub/rails72/config/initializers/content_security_policy.rb b/src/spec/stub/rails72/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..b3076b38f --- /dev/null +++ b/src/spec/stub/rails72/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header + +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap, inline scripts, and inline styles. +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src style-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/src/spec/stub/rails72/config/initializers/filter_parameter_logging.rb b/src/spec/stub/rails72/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..c010b83dd --- /dev/null +++ b/src/spec/stub/rails72/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# 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, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/src/spec/stub/rails72/config/initializers/inflections.rb b/src/spec/stub/rails72/config/initializers/inflections.rb new file mode 100644 index 000000000..3860f659e --- /dev/null +++ b/src/spec/stub/rails72/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym "RESTful" +# end diff --git a/src/spec/stub/rails72/config/initializers/permissions_policy.rb b/src/spec/stub/rails72/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..7db3b9577 --- /dev/null +++ b/src/spec/stub/rails72/config/initializers/permissions_policy.rb @@ -0,0 +1,13 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide HTTP permissions policy. For further +# information see: https://developers.google.com/web/updates/2018/06/feature-policy + +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" +# end diff --git a/src/spec/stub/rails72/config/locales/en.yml b/src/spec/stub/rails72/config/locales/en.yml new file mode 100644 index 000000000..6c349ae5e --- /dev/null +++ b/src/spec/stub/rails72/config/locales/en.yml @@ -0,0 +1,31 @@ +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t "hello" +# +# In views, this is aliased to just `t`: +# +# <%= t("hello") %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. +# +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: +# +# en: +# "yes": yup +# enabled: "ON" + +en: + hello: "Hello world" diff --git a/src/spec/stub/rails72/config/master.key b/src/spec/stub/rails72/config/master.key new file mode 100644 index 000000000..ea0a8e79c --- /dev/null +++ b/src/spec/stub/rails72/config/master.key @@ -0,0 +1 @@ +3950bb2e89efce14a3bb718354edb208 \ No newline at end of file diff --git a/src/spec/stub/rails72/config/puma.rb b/src/spec/stub/rails72/config/puma.rb new file mode 100644 index 000000000..03c166f4c --- /dev/null +++ b/src/spec/stub/rails72/config/puma.rb @@ -0,0 +1,34 @@ +# This configuration file will be evaluated by Puma. The top-level methods that +# are invoked here are part of Puma's configuration DSL. For more information +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. + +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. +# +# The ideal number of threads per worker depends both on how much time the +# application spends waiting for IO operations and on how much you wish to +# to prioritize throughput over latency. +# +# As a rule of thumb, increasing the number of threads will increase how much +# traffic a given process can handle (throughput), but due to CRuby's +# Global VM Lock (GVL) it has diminishing returns and will degrade the +# response time (latency) of the application. +# +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. +# +# Any libraries that use a connection pool or another resource pool should +# be configured to provide at least as many connections as the number of +# threads. This includes Active Record's `pool` parameter in `database.yml`. +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +port ENV.fetch("PORT", 3000) + +# Allow puma to be restarted by `bin/rails restart` command. +plugin :tmp_restart + +# Specify the PID file. Defaults to tmp/pids/server.pid in development. +# In other environments, only set the PID file if requested. +pidfile ENV["PIDFILE"] if ENV["PIDFILE"] diff --git a/src/spec/stub/rails72/config/routes.rb b/src/spec/stub/rails72/config/routes.rb new file mode 100644 index 000000000..33c963903 --- /dev/null +++ b/src/spec/stub/rails72/config/routes.rb @@ -0,0 +1,14 @@ +Rails.application.routes.draw do + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + + # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. + # Can be used by load balancers and uptime monitors to verify that the app is live. + get "up" => "rails/health#show", as: :rails_health_check + + # Render dynamic PWA files from app/views/pwa/* + get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker + get "manifest" => "rails/pwa#manifest", as: :pwa_manifest + + # Defines the root path route ("/") + # root "posts#index" +end diff --git a/src/spec/stub/rails72/public/robots.txt b/src/spec/stub/rails72/public/robots.txt new file mode 100644 index 000000000..c19f78ab6 --- /dev/null +++ b/src/spec/stub/rails72/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file