diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5fe864f7c..8c8aa4bbc 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -9,7 +9,7 @@ on: env: # Default versions for canonical release build DEFAULT_JAVA_VERSION: '8' - DEFAULT_JRUBY_VERSION: '9.4.15.0' # Should match pom.xml property (AND a version inside the test matrix) + DEFAULT_JRUBY_VERSION: '10.0.6.0' # Should match pom.xml property (AND a version inside the test matrix) DEFAULT_RACK_VERSION: '~> 2.2.0' # Should match Gemfile (AND a version inside the test matrix) jobs: @@ -19,22 +19,9 @@ jobs: strategy: matrix: - jruby_version: [ '9.4.15.0', '10.0.6.0', '10.1.0.0' ] - java_version: [ '8', '11', '17', '21', '25' ] + jruby_version: [ '10.0.6.0', '10.1.0.0' ] + java_version: [ '21', '25' ] rack_version: [ '~> 2.2.0' ] - exclude: - - jruby_version: '10.0.6.0' - java_version: '8' # JRuby 10 requires Java 21 - - jruby_version: '10.0.6.0' - java_version: '11' # JRuby 10 requires Java 21 - - jruby_version: '10.0.6.0' - java_version: '17' # JRuby 10 requires Java 21 - - jruby_version: '10.1.0.0' - java_version: '8' # JRuby 10 requires Java 21 - - jruby_version: '10.1.0.0' - java_version: '11' # JRuby 10 requires Java 21 - - jruby_version: '10.1.0.0' - java_version: '17' # JRuby 10 requires Java 21 fail-fast: false steps: @@ -65,28 +52,11 @@ jobs: strategy: matrix: appraisal: [ - 'rails70_rack22', - 'rails71_rack22', 'rails72_rack22', 'rails80_rack22', ] - jruby_version: [ '9.4.15.0', '10.0.6.0', '10.1.0.0' ] - java_version: [ '8', '11', '17', '21', '25' ] - exclude: - - jruby_version: '10.0.6.0' - java_version: '8' # JRuby 10 requires Java 21 - - jruby_version: '10.0.6.0' - java_version: '11' # JRuby 10 requires Java 21 - - jruby_version: '10.0.6.0' - java_version: '17' # JRuby 10 requires Java 21 - - jruby_version: '10.1.0.0' - java_version: '8' # JRuby 10 requires Java 21 - - jruby_version: '10.1.0.0' - java_version: '11' # JRuby 10 requires Java 21 - - jruby_version: '10.1.0.0' - java_version: '17' # JRuby 10 requires Java 21 - - appraisal: 'rails80_rack22' - jruby_version: '9.4.15.0' # Rails 8 requires Ruby 3.4 compatibility, which JRuby 9.4 does not support + jruby_version: [ '10.0.6.0', '10.1.0.0' ] + java_version: [ '21', '25' ] fail-fast: false env: diff --git a/Appraisals b/Appraisals index 3275e1525..65e16b3ef 100644 --- a/Appraisals +++ b/Appraisals @@ -3,8 +3,6 @@ version_spec = ->(prefix, desc) { "~> #{desc.split(prefix).last.insert(1, ".")}. # Rails version -> rack versions in format # rails#{MAJOR}#{MINOR} => %w[ rack#{MAJOR}#{MINOR} ] { - "rails70" => %w[rack22], - "rails71" => %w[rack22], "rails72" => %w[rack22], "rails80" => %w[rack22] }.each do |rails_desc, rack_descs| diff --git a/CHANGELOG.md b/CHANGELOG.md index 1267216a8..2f9c33035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ - Officially support Javax Servlet API 4.0 (JEE 8) Breaking compatibility changes -- Drop support for JRuby 9.3 -- Drop support for Rails < 7.0 +- Drop support for JRuby 9.x +- Drop support for Rails < 7.2 Breaking behavioral changes - Change context listener to throw by default in case of an exception during initialization diff --git a/README.md b/README.md index 4c53bbec1..3d7bc6787 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ For more information on Rack, visit http://rack.github.io/. ## Compatibility -| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes | -|----------------------------------------------------------------|---------------|-----------|------------|------|-----------|---------------------|----------------------------------------------------------------| -| **2.0 (_planned_, _unreleased_)** | Dev | 2.2 | 9.4 → 10.1 | 8+ | 7.0 → 8.0 | 5.0+ (Jakarta EE 9) | ❌ Servlet < 5.0 containers will not work | -| **1.3 (master, _unreleased_)** | Dev | 2.2 | 9.4 → 10.1 | 8+ | 7.0 → 8.0 | 4.0 (Java EE 8) | ✅ _Unofficial_: Servlet 2.5 → 3.1 & Rails 6.1 likely working | -| [**1.2**](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 10.1 | 8+ | 5.0 → 8.0 | 3.0 (Java EE 6) | ✅ _Unofficial_: Servlet 3.1 → 4.0 also OK with most containers | -| [**1.1**](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL @ 2024-05 | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 (Java EE 5) | ✅ _Unofficial_: Servlet 3.0 → 4.0 also OK with most containers | -| [**1.0**](https://github.com/jruby/jruby-rack/tree/1.0.10) | EOL @ 2011-11 | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | | +| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes | +|----------------------------------------------------------------|---------------|-----------|-------------|------|-----------|---------------------|----------------------------------------------------------------| +| **2.0 (_planned_, _unreleased_)** | Dev | 2.2 | 10.0 → 10.1 | 8+ | 7.2 → 8.0 | 5.0+ (Jakarta EE 9) | ❌ Servlet < 5.0 containers will not work | +| **1.3 (master, _unreleased_)** | Dev | 2.2 | 10.0 → 10.1 | 8+ | 7.2 → 8.0 | 4.0 (Java EE 8) | ✅ _Unofficial_: Servlet 2.5 → 3.1 & Rails 6.1 likely working | +| [**1.2**](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 10.1 | 8+ | 5.0 → 8.0 | 3.0 (Java EE 6) | ✅ _Unofficial_: Servlet 3.1 → 4.0 also OK with most containers | +| [**1.1**](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL @ 2024-05 | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 (Java EE 5) | ✅ _Unofficial_: Servlet 3.0 → 4.0 also OK with most containers | +| [**1.0**](https://github.com/jruby/jruby-rack/tree/1.0.10) | EOL @ 2011-11 | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | | ## Getting Started diff --git a/Rakefile b/Rakefile index b281c1b5e..366f71510 100644 --- a/Rakefile +++ b/Rakefile @@ -45,7 +45,10 @@ directory 'target/test-classes' desc "Compile test classes" task(:test_prepare => ['target/classes', 'target/test-classes']) do - sh "./mvnw -ntp -Dstyle.color=always test-compile" + # This has to be jruby-complete when running with bundler-maven-plugin since it has special logic to + # exclude jruby-complete - otherwise it conflicts with the bootclasspath if using different + # "target compile version" to "runtime version" + sh "./mvnw -ntp -Dstyle.color=always -Djruby.compat.artifact=jruby-complete test-compile" end desc "Unpack the rack gem" @@ -175,7 +178,7 @@ task :gem => [target_jar, target_jruby_rack, target_jruby_rack_version] do gem.email = ['nick@nicksieger.com'] gem.files = FileList["./**/*"].exclude("*.gem").map{ |f| f.sub(/^\.\//, '') } gem.homepage = %q{http://jruby.org} - gem.required_ruby_version = '>= 3.1.0' # JRuby >= 9.4 + gem.required_ruby_version = '>= 3.4.0' # JRuby >= 10.0 end require 'rubygems/package' diff --git a/examples/README.md b/examples/README.md index 3b6160845..56a34ba0a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,7 +4,7 @@ This directory includes samples using JRuby-Rack to build Rack web applications into Java app servers. - All use [Warbler](https://github.com/jruby/warbler) to do so for easy of packaging. -- Require JRuby `9.4` and a compatible JVM (Java `8` -> `25`). +- Require JRuby `10.0` and a compatible JVM (Java `21` -> `25`). ### Building/running diff --git a/gemfiles/rails61_rack22.gemfile b/gemfiles/rails61_rack22.gemfile deleted file mode 100644 index 9aedc1049..000000000 --- a/gemfiles/rails61_rack22.gemfile +++ /dev/null @@ -1,15 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 13.3", group: :test, require: nil -gem "rspec", group: :test - -group :default do - gem "rack", "~> 2.2.0" - gem "rails", "~> 6.1.0" -end - -group :development do - gem "appraisal", require: nil -end diff --git a/gemfiles/rails70_rack22.gemfile b/gemfiles/rails70_rack22.gemfile deleted file mode 100644 index 3cbbc1613..000000000 --- a/gemfiles/rails70_rack22.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -group :default do - gem "rack", "~> 2.2.0" - gem "rails", "~> 7.0.0" -end - -group :development do - gem "appraisal", require: nil -end - -group :test do - gem "rake", "~> 13.4", require: nil - gem "rspec" - gem "logger" -end diff --git a/gemfiles/rails71_rack22.gemfile b/gemfiles/rails71_rack22.gemfile deleted file mode 100644 index 8a4d75270..000000000 --- a/gemfiles/rails71_rack22.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -group :default do - gem "rack", "~> 2.2.0" - gem "rails", "~> 7.1.0" -end - -group :development do - gem "appraisal", require: nil -end - -group :test do - gem "rake", "~> 13.4", require: nil - gem "rspec" - gem "logger" -end diff --git a/pom.xml b/pom.xml index 0ab63912f..f16b53630 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,8 @@ UTF-8 - 9.4.15.0 + 10.0.6.0 + jruby ${jruby.compat.version} @@ -80,9 +81,10 @@ org.jruby - - jruby-complete + + ${jruby.compat.artifact} ${jruby.compat.version} provided @@ -199,7 +201,7 @@ maven-compiler-plugin 3.15.0 - 8 + 21 true true diff --git a/src/main/java/org/jruby/rack/AbstractRackDispatcher.java b/src/main/java/org/jruby/rack/AbstractRackDispatcher.java index 95cde5ea8..e6f6600ca 100644 --- a/src/main/java/org/jruby/rack/AbstractRackDispatcher.java +++ b/src/main/java/org/jruby/rack/AbstractRackDispatcher.java @@ -60,7 +60,7 @@ protected void handleException( protected abstract RackApplication getApplication() throws RackException; - protected abstract void afterProcess(RackApplication app) throws IOException; + protected abstract void afterProcess(RackApplication app); protected abstract void afterException( RackEnvironment request, diff --git a/src/main/java/org/jruby/rack/DefaultErrorApplication.java b/src/main/java/org/jruby/rack/DefaultErrorApplication.java index 866bd938e..eaab9e5e4 100644 --- a/src/main/java/org/jruby/rack/DefaultErrorApplication.java +++ b/src/main/java/org/jruby/rack/DefaultErrorApplication.java @@ -149,7 +149,7 @@ public void respond(RackResponseEnvironment response) { } private void log(RackLogger.Level level, String message, Throwable e) { - if ( context != null ) context.log(level, (CharSequence) message, e); + if ( context != null ) context.log(level, message, e); } } diff --git a/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java b/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java index 0b4c6ba4e..006f6090f 100644 --- a/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java +++ b/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java @@ -190,9 +190,11 @@ public IRubyObject createErrorApplicationObject(final Ruby runtime) { } if (errorApp == null) { - errorApp = "require 'jruby/rack/error_app' \n" + - "use JRuby::Rack::ErrorApp::ShowStatus \n" + - "run JRuby::Rack::ErrorApp.new"; + errorApp = """ + require 'jruby/rack/error_app' + use JRuby::Rack::ErrorApp::ShowStatus + run JRuby::Rack::ErrorApp.new + """; } runtime.evalScriptlet("load 'jruby/rack/boot/rack.rb'"); return createRackServletWrapper(runtime, errorApp, errorAppPath); diff --git a/src/main/java/org/jruby/rack/RackDispatcher.java b/src/main/java/org/jruby/rack/RackDispatcher.java index b187bcc13..a0ea2f1ad 100644 --- a/src/main/java/org/jruby/rack/RackDispatcher.java +++ b/src/main/java/org/jruby/rack/RackDispatcher.java @@ -15,7 +15,6 @@ * @author nicksieger */ public interface RackDispatcher { - void process(RackEnvironment request, RackResponseEnvironment response) - throws ServletException, IOException; + void process(RackEnvironment request, RackResponseEnvironment response) throws IOException; void destroy(); } diff --git a/src/main/java/org/jruby/rack/RackResponseEnvironment.java b/src/main/java/org/jruby/rack/RackResponseEnvironment.java index 6771704bf..b5f14bc7a 100644 --- a/src/main/java/org/jruby/rack/RackResponseEnvironment.java +++ b/src/main/java/org/jruby/rack/RackResponseEnvironment.java @@ -102,22 +102,19 @@ public interface RackResponseEnvironment { /** * Send a simple error page response (based on the status code). * @param code the (HTTP) status code - * @throws IOException if there's an IO exception */ - void sendError(int code) throws IOException ; + void sendError(int code) throws IOException; /** * @see javax.servlet.ServletResponse#getOutputStream() * @return the output stream - * @throws IOException if there's an IO exception */ - OutputStream getOutputStream() throws IOException ; + OutputStream getOutputStream() throws IOException; /** * @see javax.servlet.ServletResponse#getWriter() * @return the writer - * @throws IOException if there's an IO exception */ - PrintWriter getWriter() throws IOException ; + PrintWriter getWriter() throws IOException; } diff --git a/src/main/java/org/jruby/rack/UnmappedRackFilter.java b/src/main/java/org/jruby/rack/UnmappedRackFilter.java index da64da12a..0ad45a67e 100644 --- a/src/main/java/org/jruby/rack/UnmappedRackFilter.java +++ b/src/main/java/org/jruby/rack/UnmappedRackFilter.java @@ -11,7 +11,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import javax.servlet.FilterChain; @@ -46,18 +45,12 @@ public class UnmappedRackFilter extends AbstractFilter { private boolean responseHandledByDefault = true; - private static final Collection RESPONSE_NOT_HANDLED_STATUSES; - static { - final Set statuses = new HashSet<>(8, 1); - statuses.add(404); - // 403 due containers not supporting PUT/DELETE correctly (Tomcat 6) - statuses.add(403); - // 405 returned by Jetty 7/8 on PUT/DELETE requests by default - statuses.add(405); - // 501 is returned for non standard http verbs like PATCH - statuses.add(501); - RESPONSE_NOT_HANDLED_STATUSES = Collections.unmodifiableSet(statuses); - } + private static final Collection RESPONSE_NOT_HANDLED_STATUSES = Set.of( + 404, + 403, // 403 due to containers not supporting PUT/DELETE correctly (Tomcat 6) + 405, // 405 returned by Jetty 7/8 on PUT/DELETE requests by default + 501 // 501 is returned for non-standard http verbs like PATCH + ); private Collection responseNotHandledStatuses = RESPONSE_NOT_HANDLED_STATUSES; private RackContext context; diff --git a/src/main/java/org/jruby/rack/embed/Dispatcher.java b/src/main/java/org/jruby/rack/embed/Dispatcher.java index f7a618dd5..315992d8f 100644 --- a/src/main/java/org/jruby/rack/embed/Dispatcher.java +++ b/src/main/java/org/jruby/rack/embed/Dispatcher.java @@ -10,6 +10,7 @@ import java.io.IOException; import org.jruby.Ruby; +import org.jruby.api.Access; import org.jruby.javasupport.JavaUtil; import org.jruby.rack.AbstractRackDispatcher; import org.jruby.rack.DefaultRackApplication; @@ -18,6 +19,7 @@ import org.jruby.rack.RackEnvironment; import org.jruby.rack.RackInitializationException; import org.jruby.rack.RackResponseEnvironment; +import org.jruby.runtime.ThreadContext; import org.jruby.runtime.builtin.IRubyObject; /** @@ -40,10 +42,11 @@ private void initialize() { if (context instanceof Context) { ((Context) context).getConfig().doInitialize(runtime); } - IRubyObject rubyContext = JavaUtil.convertJavaToRuby(runtime, context); - IRubyObject rackModule = runtime.getModule("JRuby").getConstantAt("Rack"); + ThreadContext currentContext = runtime.getCurrentContext(); // `JRuby::Rack.context = context` - rackModule.callMethod(runtime.getCurrentContext(), "context=", rubyContext); + Access.getModule(currentContext, "JRuby") + .getConstantAt(currentContext, "Rack") + .callMethod(currentContext, "context=", JavaUtil.convertJavaToRuby(runtime, context)); } @Override @@ -70,7 +73,7 @@ protected void afterException( } @Override - protected void afterProcess(RackApplication app) throws IOException { + protected void afterProcess(RackApplication app) { // NOOP } diff --git a/src/main/java/org/jruby/rack/ext/Input.java b/src/main/java/org/jruby/rack/ext/Input.java index f50a26d8c..8c29a9a92 100644 --- a/src/main/java/org/jruby/rack/ext/Input.java +++ b/src/main/java/org/jruby/rack/ext/Input.java @@ -15,10 +15,10 @@ import org.jruby.Ruby; import org.jruby.RubyClass; -import org.jruby.RubyModule; import org.jruby.RubyObject; import org.jruby.RubyString; import org.jruby.anno.JRubyMethod; +import org.jruby.api.Access; import org.jruby.javasupport.JavaEmbedUtils; import org.jruby.rack.RackEnvironment; import org.jruby.rack.servlet.RewindableInputStream; @@ -36,15 +36,12 @@ * * @author nicksieger */ -@SuppressWarnings("serial") public class Input extends RubyObject { static final ObjectAllocator ALLOCATOR = Input::new; static RubyClass getClass(final Ruby runtime) { - final RubyModule _JRuby_Rack = (RubyModule) - runtime.getModule("JRuby").getConstantAt("Rack"); - return (RubyClass) _JRuby_Rack.getConstantAt("Input"); + return Access.getClass(runtime.getCurrentContext(), "JRuby", "Rack", "Input"); } private boolean rewindable; @@ -135,7 +132,7 @@ public IRubyObject gets(final ThreadContext context) { public IRubyObject read(final ThreadContext context, final IRubyObject[] args) { int readLen = 0; if ( args.length > 0 ) { - long len = args[0].convertToInteger("to_i").getLongValue(); + long len = args[0].convertToInteger("to_i").asLong(context); readLen = (int) Math.min(len, Integer.MAX_VALUE); } final RubyString buffer = args.length > 1 ? args[1].asString() : null; @@ -143,7 +140,7 @@ public IRubyObject read(final ThreadContext context, final IRubyObject[] args) { final byte[] bytes = readUntil(MATCH_NONE, readLen); if ( bytes != null ) { if ( buffer != null ) { - buffer.clear(); + buffer.clear(context); buffer.catWithCodeRange(new ByteList(bytes, false), StringSupport.CR_UNKNOWN); return buffer; } diff --git a/src/main/java/org/jruby/rack/ext/Logger.java b/src/main/java/org/jruby/rack/ext/Logger.java index aa651c2b0..86ae1c295 100644 --- a/src/main/java/org/jruby/rack/ext/Logger.java +++ b/src/main/java/org/jruby/rack/ext/Logger.java @@ -34,6 +34,7 @@ import org.jruby.RubyTime; import org.jruby.anno.JRubyClass; import org.jruby.anno.JRubyMethod; +import org.jruby.api.Access; import org.jruby.exceptions.RaiseException; import org.jruby.javasupport.JavaEmbedUtils; import org.jruby.rack.RackContext; @@ -86,8 +87,7 @@ protected Logger(Ruby runtime, RubyClass metaClass) { @Override @JRubyMethod(required = 0) public IRubyObject initialize(final ThreadContext context) { - IRubyObject jrubyRack = context.runtime.getModule("JRuby").getConstant("Rack"); - initialize( jrubyRack.callMethod(context, "context") ); // JRuby::Rack.context + initialize(Access.getModule(context, "JRuby").getConstant(context, "Rack").callMethod(context, "context") ); // JRuby::Rack.context return this; } @@ -194,14 +194,14 @@ private boolean isEnabledFor(final int severity, final RackLogger.Level loggerLe } private static RackLogger.Level mapLevel(final int level) { - switch (level) { - case DEBUG: return RackLogger.Level.DEBUG; - case INFO : return RackLogger.Level.INFO ; - case WARN : return RackLogger.Level.WARN ; - case ERROR: return RackLogger.Level.ERROR; - case FATAL: return RackLogger.Level.FATAL; - } - return null; + return switch (level) { + case DEBUG -> RackLogger.Level.DEBUG; + case INFO -> RackLogger.Level.INFO; + case WARN -> RackLogger.Level.WARN; + case ERROR -> RackLogger.Level.ERROR; + case FATAL -> RackLogger.Level.FATAL; + default -> null; + }; } @JRubyMethod(name = "progname") @@ -386,8 +386,7 @@ private boolean add(final int severity, final ThreadContext context, IRubyObject final long datetime = System.currentTimeMillis(); msg = format_message(context, severity, datetime, progname, msg); } - else if ( msg instanceof RubyException ) { - final RubyException ex = (RubyException) msg; + else if (msg instanceof RubyException ex) { doLog( loggerLevel, ex.toThrowable() ); return true; } @@ -444,18 +443,18 @@ public IRubyObject format_severity(final ThreadContext context, final IRubyObjec new ByteList(new byte[] { 'A','N','Y' }, false); private static ByteList formatSeverity(final int severity) { - switch ( severity) { - case DEBUG: return FORMATTED_DEBUG; - case INFO : return FORMATTED_INFO ; - case WARN : return FORMATTED_WARN ; - case ERROR: return FORMATTED_ERROR; - case FATAL: return FORMATTED_FATAL; - } - return FORMATTED_ANY; + return switch (severity) { + case DEBUG -> FORMATTED_DEBUG; + case INFO -> FORMATTED_INFO; + case WARN -> FORMATTED_WARN; + case ERROR -> FORMATTED_ERROR; + case FATAL -> FORMATTED_FATAL; + default -> FORMATTED_ANY; + }; } private static int toInt(final IRubyObject level) { - return level.convertToInteger("to_i").getIntValue(); + return level.convertToInteger("to_i").asInt(level.getRuntime().getCurrentContext()); } @SuppressWarnings("unchecked") @@ -496,7 +495,7 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a final IRubyObject rackContext; if ( args != null && args.length > 0 ) rackContext = args[0]; else { - IRubyObject jrubyRack = context.runtime.getModule("JRuby").getConstant("Rack"); + IRubyObject jrubyRack = Access.getModule(context, "JRuby").getConstant("Rack"); rackContext = jrubyRack.callMethod(context, "context"); // JRuby::Rack.context } if ( rackContext.isNil() ) { diff --git a/src/main/java/org/jruby/rack/ext/RackLibrary.java b/src/main/java/org/jruby/rack/ext/RackLibrary.java index 4ef62965f..b749d4e41 100644 --- a/src/main/java/org/jruby/rack/ext/RackLibrary.java +++ b/src/main/java/org/jruby/rack/ext/RackLibrary.java @@ -26,6 +26,8 @@ import org.jruby.Ruby; import org.jruby.RubyClass; import org.jruby.RubyModule; +import org.jruby.api.Define; +import org.jruby.runtime.ThreadContext; import org.jruby.runtime.load.BasicLibraryService; import org.jruby.runtime.load.Library; @@ -37,48 +39,40 @@ public class RackLibrary implements Library, BasicLibraryService { public static void load(final Ruby runtime) { - final RubyModule _JRuby = runtime.getOrCreateModule("JRuby"); - final RubyModule _JRuby_Rack = _JRuby.defineModuleUnder("Rack"); + ThreadContext context = runtime.getCurrentContext(); + final RubyModule _JRuby = Define.defineModule(context, "JRuby"); + final RubyModule _JRuby_Rack = _JRuby.defineModuleUnder(context, "Rack"); final RubyClass _Object = runtime.getObject(); // JRuby::Rack::Response - final RubyClass _Response = _JRuby_Rack.defineClassUnder( - "Response", _Object, Response.ALLOCATOR - ); - _Response.defineAnnotatedMethods(Response.class); + final RubyClass _Response = _JRuby_Rack.defineClassUnder(context, "Response", _Object, Response.ALLOCATOR); + _Response.defineMethods(context, Response.class); // JRuby::Rack::Input - final RubyClass _Input = _JRuby_Rack.defineClassUnder( - "Input", _Object, Input.ALLOCATOR - ); - _Input.defineAnnotatedMethods(Input.class); + final RubyClass _Input = _JRuby_Rack.defineClassUnder(context, "Input", _Object, Input.ALLOCATOR); + _Input.defineMethods(context, Input.class); // JRuby::Rack::Logger - final RubyClass _Logger = _JRuby_Rack.defineClassUnder( - "Logger", _Object, Logger.ALLOCATOR - ); - _Logger.defineAnnotatedMethods(Logger.class); + final RubyClass _Logger = _JRuby_Rack.defineClassUnder(context, "Logger", _Object, Logger.ALLOCATOR); + _Logger.defineMethods(context, Logger.class); // Rails compatibility as it assumes logger.class::DEBUG to work : - _Logger.setConstant("DEBUG", runtime.newFixnum(Logger.DEBUG)); - _Logger.setConstant("INFO", runtime.newFixnum(Logger.INFO)); - _Logger.setConstant("WARN", runtime.newFixnum(Logger.WARN)); - _Logger.setConstant("ERROR", runtime.newFixnum(Logger.ERROR)); - _Logger.setConstant("FATAL", runtime.newFixnum(Logger.FATAL)); + _Logger.setConstant(context, "DEBUG", runtime.newFixnum(Logger.DEBUG)); + _Logger.setConstant(context, "INFO", runtime.newFixnum(Logger.INFO)); + _Logger.setConstant(context, "WARN", runtime.newFixnum(Logger.WARN)); + _Logger.setConstant(context, "ERROR", runtime.newFixnum(Logger.ERROR)); + _Logger.setConstant(context, "FATAL", runtime.newFixnum(Logger.FATAL)); //_Logger.setConstant("UNKNOWN", runtime.newFixnum(Logger.UNKNOWN)); // JRuby::Rack::ServletLog - final RubyClass _ServletLog = _JRuby_Rack.defineClassUnder( - "ServletLog", _Object, Logger.ServletLog.ALLOCATOR - ); - _ServletLog.defineAnnotatedMethods(Logger.ServletLog.class); + final RubyClass _ServletLog = _JRuby_Rack.defineClassUnder(context, "ServletLog", _Object, Logger.ServletLog.ALLOCATOR); + _ServletLog.defineMethods(context, Logger.ServletLog.class); - final RubyModule _Rack = runtime.getOrCreateModule("Rack"); - final RubyModule _Rack_Handler = _Rack.defineModuleUnder("Handler"); + final RubyModule _Rack = Define.defineModule(context, "Rack"); + final RubyModule _Rack_Handler = _Rack.defineModuleUnder(context, "Handler"); // Rack::Handler::Servlet - final RubyClass _Servlet = _Rack_Handler.defineClassUnder( - "Servlet", _Object, Servlet.ALLOCATOR); - _Servlet.defineAnnotatedMethods(Servlet.class); + final RubyClass _Servlet = _Rack_Handler.defineClassUnder(context, "Servlet", _Object, Servlet.ALLOCATOR); + _Servlet.defineMethods(context, Servlet.class); } @Override diff --git a/src/main/java/org/jruby/rack/ext/Response.java b/src/main/java/org/jruby/rack/ext/Response.java index 446b098eb..8e7d0670a 100644 --- a/src/main/java/org/jruby/rack/ext/Response.java +++ b/src/main/java/org/jruby/rack/ext/Response.java @@ -168,7 +168,7 @@ public static IRubyObject set_channel_chunk_size(final IRubyObject self, final I channelChunkSize = null; } else { - final long val = value.convertToInteger("to_i").getLongValue(); + final long val = value.convertToInteger("to_i").asLong(self.getRuntime().getCurrentContext()); channelChunkSize = (int) val; } return value; @@ -203,7 +203,7 @@ public static IRubyObject set_channel_buffer_size(final IRubyObject self, final channelBufferSize = 16 * 1024; } else { - final long val = value.convertToInteger("to_i").getLongValue(); + final long val = value.convertToInteger("to_i").asLong(self.getRuntime().getCurrentContext()); channelBufferSize = (int) val; } return value; @@ -227,18 +227,17 @@ protected Response(Ruby runtime, RubyClass metaClass) { */ @JRubyMethod(required = 1) public IRubyObject initialize(final ThreadContext context, final IRubyObject arg) { - if ( arg instanceof RubyArray ) { - final RubyArray arr = (RubyArray) arg; + if (arg instanceof RubyArray arr) { if ( arr.size() < 3 ) { - throw context.runtime.newArgumentError("expected 3 array elements (rack-respose)"); + throw context.runtime.newArgumentError("expected 3 array elements (rack-response)"); } - this.status = (int) arr.eltInternal(0).convertToInteger("to_i").getLongValue(); + this.status = (int) arr.eltInternal(0).convertToInteger("to_i").asLong(context); this.headers = arr.eltInternal(1).convertToHash(); this.body = arr.eltInternal(2); } else { this.status = (int) arg.callMethod(context, "[]", context.runtime.newFixnum(0)). - convertToInteger("to_i").getLongValue(); + convertToInteger("to_i").asLong(context); this.headers = arg.callMethod(context, "[]", context.runtime.newFixnum(1)).convertToHash(); this.body = arg.callMethod(context, "[]", context.runtime.newFixnum(2)); } @@ -327,7 +326,7 @@ public IRubyObject yield(ThreadContext context, IRubyObject part) { public void respond(final RackResponseEnvironment response) throws RackException { if ( ! response.isCommitted() ) { try { // NOTE: we're assuming possible overrides are out of our NS - if ( getMetaClass().getName().startsWith("JRuby::Rack") ) { + if (getMetaClass().getName(currentContext()).startsWith("JRuby::Rack")) { // do the Java 'optimized' version : writeStatus(response); writeHeaders(response); @@ -364,8 +363,8 @@ public IRubyObject write_headers(final ThreadContext context, final IRubyObject private static final ByteList NEW_LINE = new ByteList(new byte[] { '\n' }, false); - protected void writeHeaders(final RackResponseEnvironment response) throws IOException { - this.headers.visitAll(getRuntime().getCurrentContext(), new RubyHash.Visitor() { // headers.each { |key, val| } + protected void writeHeaders(final RackResponseEnvironment response) { + this.headers.visitAll(currentContext(), new RubyHash.Visitor() { // headers.each { |key, val| } @Override public void visit(final IRubyObject key, final IRubyObject val) { final String name = key.toString(); @@ -376,7 +375,7 @@ public void visit(final IRubyObject key, final IRubyObject val) { if ( name.equalsIgnoreCase("Content-Length") ) { if ( isChunked() ) return; - final long length = val.convertToInteger("to_i").getLongValue(); + final long length = val.convertToInteger("to_i").asLong(currentContext()); if ( length < Integer.MAX_VALUE ) { response.setContentLength( (int) length ); return; } // else will do addHeader @@ -390,11 +389,10 @@ public void visit(final IRubyObject key, final IRubyObject val) { // rack handler does to guard against response splitting attacks ! final boolean each_line = val.respondsTo("each_line"); if ( each_line || val.respondsTo("each") ) { - final ThreadContext context = getRuntime().getCurrentContext(); - final RubyString newLine = RubyString.newString(context.runtime, NEW_LINE); + final RubyString newLine = RubyString.newString(currentContext().runtime, NEW_LINE); // value.each_line { |val| response.addHeader(key.to_s, val.chomp("\n")) } - invoke(context, val, each_line ? "each_line" : "each", - new JavaInternalBlockBody(context.runtime, Signature.ONE_REQUIRED) { + invoke(currentContext(), val, each_line ? "each_line" : "each", + new JavaInternalBlockBody(currentContext().runtime, Signature.ONE_REQUIRED) { @Override public IRubyObject yield(ThreadContext context, IRubyObject[] args) { return this.yield(context, args[0]); @@ -412,7 +410,7 @@ public IRubyObject yield(ThreadContext context, IRubyObject value) { } if ( val instanceof RubyNumeric ) { - final long value = val.convertToInteger("to_i").getLongValue(); + final long value = val.convertToInteger("to_i").asLong(currentContext()); if ( value < Integer.MAX_VALUE ) { response.addIntHeader(name, (int) value); return; } // else will do addHeader @@ -435,10 +433,10 @@ public IRubyObject write_body(final ThreadContext context, final IRubyObject res } protected void writeBody(final RackResponseEnvironment response) throws IOException { + final ThreadContext context = currentContext(); Channel bodyChannel = null; IRubyObject body = this.body; try { if ( body.respondsTo("call") && ! body.respondsTo("each") ) { - final ThreadContext context = currentContext(); final IRubyObject outputStream = JavaUtil.convertJavaToRuby(context.runtime, response.getOutputStream()); this.body.callMethod(context, "call", outputStream); @@ -446,7 +444,6 @@ protected void writeBody(final RackResponseEnvironment response) throws IOExcept } if ( body.respondsTo("to_path") ) { // send_file - final ThreadContext context = currentContext(); final IRubyObject path = body.callMethod(context, "to_path"); callMethod("send_file", path, JavaUtil.convertJavaToRuby(context.runtime, response)); return; @@ -461,7 +458,7 @@ protected void writeBody(final RackResponseEnvironment response) throws IOExcept bodyChannel = ((RubyIO) body).getChannel(); } else { - final ThreadContext context = currentContext(); + final IRubyObject channel = body.callMethod(context, "to_channel"); bodyChannel = channel.toJava(Channel.class); } @@ -476,7 +473,6 @@ protected void writeBody(final RackResponseEnvironment response) throws IOExcept // NOTE: we no longer handle "to_inputstream" since in 1.7 "to_channel" covers those ... final OutputStream output = response.getOutputStream(); - final ThreadContext context = currentContext(); IOException error = null; if ( doDechunk() ) { final IRubyObject output_stream = JavaUtil.convertJavaToRuby(context.runtime, output); @@ -684,7 +680,7 @@ private void transferChannel(final ReadableByteChannel channel, final OutputStre } } - ThreadContext currentContext() { return getRuntime().getCurrentContext(); } + private ThreadContext currentContext() { return getRuntime().getCurrentContext(); } static IRubyObject invoke( final ThreadContext context, final IRubyObject self, diff --git a/src/main/java/org/jruby/rack/logging/CommonsLoggingLogger.java b/src/main/java/org/jruby/rack/logging/CommonsLoggingLogger.java index 458aecc22..a9ea2e6d9 100644 --- a/src/main/java/org/jruby/rack/logging/CommonsLoggingLogger.java +++ b/src/main/java/org/jruby/rack/logging/CommonsLoggingLogger.java @@ -34,14 +34,13 @@ public void setLoggerName(String loggerName) { @Override public boolean isEnabled(Level level) { if ( level == null ) return logger.isInfoEnabled(); // TODO ???! - switch ( level ) { - case DEBUG: return logger.isDebugEnabled(); - case INFO: return logger.isInfoEnabled(); - case WARN: return logger.isWarnEnabled(); - case ERROR: return logger.isErrorEnabled(); - case FATAL: return logger.isFatalEnabled(); - } - return logger.isTraceEnabled(); + return switch (level) { + case DEBUG -> logger.isDebugEnabled(); + case INFO -> logger.isInfoEnabled(); + case WARN -> logger.isWarnEnabled(); + case ERROR -> logger.isErrorEnabled(); + case FATAL -> logger.isFatalEnabled(); + }; } @Override diff --git a/src/main/java/org/jruby/rack/logging/JulLogger.java b/src/main/java/org/jruby/rack/logging/JulLogger.java index 4d91710e1..229345de6 100644 --- a/src/main/java/org/jruby/rack/logging/JulLogger.java +++ b/src/main/java/org/jruby/rack/logging/JulLogger.java @@ -76,14 +76,12 @@ public void log(Level level, CharSequence message, Throwable e) { private static java.util.logging.Level mapLevel( final Level level, java.util.logging.Level defaultLevel) { if ( level == null ) { return defaultLevel; } - switch ( level ) { - case DEBUG: return java.util.logging.Level.FINE; - case INFO: return java.util.logging.Level.INFO; - case WARN: return java.util.logging.Level.WARNING; - case ERROR: return java.util.logging.Level.SEVERE; - case FATAL: return java.util.logging.Level.SEVERE; - } - return defaultLevel; + return switch (level) { + case DEBUG -> java.util.logging.Level.FINE; + case INFO -> java.util.logging.Level.INFO; + case WARN -> java.util.logging.Level.WARNING; + case ERROR, FATAL -> java.util.logging.Level.SEVERE; + }; } @Override @@ -92,7 +90,6 @@ public Level getLevel() { if ( logger.isLoggable(java.util.logging.Level.INFO) ) return Level.INFO ; if ( logger.isLoggable(java.util.logging.Level.WARNING) ) return Level.WARN ; if ( logger.isLoggable(java.util.logging.Level.SEVERE) ) return Level.ERROR; - if ( logger.isLoggable(java.util.logging.Level.SEVERE) ) return Level.FATAL; return null; } diff --git a/src/main/java/org/jruby/rack/logging/Log4jLogger.java b/src/main/java/org/jruby/rack/logging/Log4jLogger.java index f7ded7b01..e4a5fa77d 100644 --- a/src/main/java/org/jruby/rack/logging/Log4jLogger.java +++ b/src/main/java/org/jruby/rack/logging/Log4jLogger.java @@ -36,14 +36,13 @@ public void setLoggerName(String loggerName) { @Override public boolean isEnabled(Level level) { if ( level == null ) return logger.isInfoEnabled(); - switch ( level ) { - case DEBUG: return logger.isDebugEnabled(); - case INFO: return logger.isInfoEnabled(); - case WARN: return logger.isWarnEnabled(); - case ERROR: return logger.isErrorEnabled(); - case FATAL: return logger.isFatalEnabled(); - } - return logger.isTraceEnabled(); + return switch (level) { + case DEBUG -> logger.isDebugEnabled(); + case INFO -> logger.isInfoEnabled(); + case WARN -> logger.isWarnEnabled(); + case ERROR -> logger.isErrorEnabled(); + case FATAL -> logger.isFatalEnabled(); + }; } @Override diff --git a/src/main/java/org/jruby/rack/logging/Slf4jLogger.java b/src/main/java/org/jruby/rack/logging/Slf4jLogger.java index af36a3849..99956346a 100644 --- a/src/main/java/org/jruby/rack/logging/Slf4jLogger.java +++ b/src/main/java/org/jruby/rack/logging/Slf4jLogger.java @@ -38,14 +38,12 @@ public void setLoggerName(String loggerName) { @Override public boolean isEnabled(Level level) { if ( level == null ) return logger.isInfoEnabled(); // TODO ???! - switch ( level ) { - case DEBUG: return logger.isDebugEnabled(); - case INFO: return logger.isInfoEnabled(); - case WARN: return logger.isWarnEnabled(); - case ERROR: return logger.isErrorEnabled(); - case FATAL: return logger.isErrorEnabled(); - } - return logger.isTraceEnabled(); + return switch (level) { + case DEBUG -> logger.isDebugEnabled(); + case INFO -> logger.isInfoEnabled(); + case WARN -> logger.isWarnEnabled(); + case ERROR, FATAL -> logger.isErrorEnabled(); + }; } @Override @@ -55,8 +53,7 @@ public void log(Level level, CharSequence message) { case DEBUG: logger.debug(message.toString()); break; case INFO: logger.info(message.toString()); break; case WARN: logger.warn(message.toString()); break; - case ERROR: logger.error(message.toString()); break; - case FATAL: logger.error(message.toString()); break; + case ERROR, FATAL: logger.error(message.toString()); break; } } @@ -67,8 +64,7 @@ public void log(Level level, CharSequence message, Throwable ex) { case DEBUG: logger.debug(message.toString(), ex); break; case INFO: logger.info(message.toString(), ex); break; case WARN: logger.warn(message.toString(), ex); break; - case ERROR: logger.error(message.toString(), ex); break; - case FATAL: logger.error(message.toString(), ex); break; + case ERROR, FATAL: logger.error(message.toString(), ex); break; } } @@ -78,7 +74,6 @@ public Level getLevel() { if ( logger.isInfoEnabled() ) return Level.INFO ; if ( logger.isWarnEnabled() ) return Level.WARN ; if ( logger.isErrorEnabled() ) return Level.ERROR; - if ( logger.isErrorEnabled() ) return Level.FATAL; return null; } diff --git a/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java b/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java index b100f72cf..13fb2af5d 100644 --- a/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java +++ b/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java @@ -9,6 +9,8 @@ import java.io.InputStream; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Enumeration; import java.util.EventListener; @@ -82,14 +84,14 @@ public String getRealPath(final String path) { // still might end up as an URL with path "file:/home" if (urlPath.startsWith("file:")) { // handles "file:/home" and "file:///home" as well - realPath = new URL(urlPath).getPath(); // "/home" + realPath = new URI(urlPath).toURL().getPath(); // "/home" } else { realPath = urlPath; } } } - catch (MalformedURLException e) { /* ignored */ } + catch (URISyntaxException | MalformedURLException e) { /* ignored */ } } return realPath; } diff --git a/src/main/java/org/jruby/rack/servlet/RequestCapture.java b/src/main/java/org/jruby/rack/servlet/RequestCapture.java index dfa04cc3d..81f0e8354 100644 --- a/src/main/java/org/jruby/rack/servlet/RequestCapture.java +++ b/src/main/java/org/jruby/rack/servlet/RequestCapture.java @@ -10,8 +10,8 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; @@ -78,8 +78,9 @@ public Map getParameterMap() { @Override public Enumeration getParameterNames() { if ( requestParametersParsed() ) { - return new Enumeration() { + return new Enumeration<>() { final Iterator keys = requestParams.keySet().iterator(); + @Override public boolean hasMoreElements() { return keys.hasNext(); @@ -122,27 +123,25 @@ private boolean parseRequestParams() { final Map params = new HashMap<>(); final String[] pairs = line.split("\\&"); for (String pair : pairs) { - try { - String[] fields = pair.split("=", 2); - String key = URLDecoder.decode(fields[0], "UTF-8"); - String value = null; - if (fields.length == 2) { - value = URLDecoder.decode(fields[1], "UTF-8"); - } - if (value != null) { - String[] newValues; - if (params.containsKey(key)) { - String[] values = params.get(key); - newValues = new String[values.length + 1]; - System.arraycopy(values, 0, newValues, 0, values.length); - newValues[values.length] = value; - } else { - newValues = new String[1]; - newValues[0] = value; - } - params.put(key, newValues); + String[] fields = pair.split("=", 2); + String key = URLDecoder.decode(fields[0], StandardCharsets.UTF_8); + String value = null; + if (fields.length == 2) { + value = URLDecoder.decode(fields[1], StandardCharsets.UTF_8); + } + if (value != null) { + String[] newValues; + if (params.containsKey(key)) { + String[] values = params.get(key); + newValues = new String[values.length + 1]; + System.arraycopy(values, 0, newValues, 0, values.length); + newValues[values.length] = value; + } else { + newValues = new String[1]; + newValues[0] = value; } - } catch (UnsupportedEncodingException ignore) { /* UTF-8 should be fine */ } + params.put(key, newValues); + } } this.requestParams = params; diff --git a/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java b/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java index d35f9518f..b8f7a96b3 100644 --- a/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java +++ b/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java @@ -15,8 +15,9 @@ * * @author tyler */ -public class FakeJspWriter extends JspWriter{ - private StringBuilder sb = new StringBuilder(); +@SuppressWarnings("unused") // Used from Ruby +public class FakeJspWriter extends JspWriter { + private final StringBuilder sb = new StringBuilder(); public FakeJspWriter() { super(0, false); @@ -27,32 +28,32 @@ public String toString() { } @Override - public void write(String str) throws IOException { + public void write(String str) { sb.append(str); } @Override - public void write(char[] arg0, int arg1, int arg2) throws IOException { + public void write(char[] arg0, int arg1, int arg2) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void clear() throws IOException { + public void clear() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void clearBuffer() throws IOException { + public void clearBuffer() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void close() throws IOException { + public void close() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void flush() throws IOException { + public void flush() { throw new UnsupportedOperationException("Not supported yet."); } @@ -62,102 +63,102 @@ public int getRemaining() { } @Override - public void newLine() throws IOException { + public void newLine() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(boolean arg0) throws IOException { + public void print(boolean arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(char arg0) throws IOException { + public void print(char arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(int arg0) throws IOException { + public void print(int arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(long arg0) throws IOException { + public void print(long arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(float arg0) throws IOException { + public void print(float arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(double arg0) throws IOException { + public void print(double arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(char[] arg0) throws IOException { + public void print(char[] arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(String arg0) throws IOException { + public void print(String arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void print(Object arg0) throws IOException { + public void print(Object arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println() throws IOException { + public void println() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(boolean arg0) throws IOException { + public void println(boolean arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(char arg0) throws IOException { + public void println(char arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(int arg0) throws IOException { + public void println(int arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(long arg0) throws IOException { + public void println(long arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(float arg0) throws IOException { + public void println(float arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(double arg0) throws IOException { + public void println(double arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(char[] arg0) throws IOException { + public void println(char[] arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(String arg0) throws IOException { + public void println(String arg0) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void println(Object arg0) throws IOException { + public void println(Object arg0) { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/src/spec/java/org/jruby/rack/fake/FakePageContext.java b/src/spec/java/org/jruby/rack/fake/FakePageContext.java index 28efa949d..aceb30439 100644 --- a/src/spec/java/org/jruby/rack/fake/FakePageContext.java +++ b/src/spec/java/org/jruby/rack/fake/FakePageContext.java @@ -120,7 +120,7 @@ public void handlePageException(Throwable arg0) { } @Override - public void include(String arg0) throws ServletException, IOException { + public void include(String arg0) { throw new UnsupportedOperationException("Not supported yet. include"); } @@ -155,7 +155,7 @@ public void setAttribute(String arg0, Object arg1, int arg2) { } @Override - public void include(String arg0, boolean arg1) throws ServletException, IOException { + public void include(String arg0, boolean arg1) { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb index 561d91f92..ff24c5acc 100644 --- a/src/spec/ruby/jruby/rack/integration_spec.rb +++ b/src/spec/ruby/jruby/rack/integration_spec.rb @@ -203,14 +203,6 @@ end 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 diff --git a/src/spec/stub/rails70/app/controllers/application_controller.rb b/src/spec/stub/rails70/app/controllers/application_controller.rb deleted file mode 100644 index 09705d12a..000000000 --- a/src/spec/stub/rails70/app/controllers/application_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index de6be7945..000000000 --- a/src/spec/stub/rails70/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/src/spec/stub/rails70/config/application.rb b/src/spec/stub/rails70/config/application.rb deleted file mode 100644 index 44477b8d5..000000000 --- a/src/spec/stub/rails70/config/application.rb +++ /dev/null @@ -1,37 +0,0 @@ -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 deleted file mode 100644 index 0980b3ef5..000000000 --- a/src/spec/stub/rails70/config/boot.rb +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 11e04461a..000000000 --- a/src/spec/stub/rails70/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index cac531577..000000000 --- a/src/spec/stub/rails70/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# 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 deleted file mode 100644 index 6df11e560..000000000 --- a/src/spec/stub/rails70/config/environments/development.rb +++ /dev/null @@ -1,54 +0,0 @@ -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 deleted file mode 100644 index 061063854..000000000 --- a/src/spec/stub/rails70/config/environments/production.rb +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index eb2f1716c..000000000 --- a/src/spec/stub/rails70/config/environments/test.rb +++ /dev/null @@ -1,50 +0,0 @@ -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 deleted file mode 100644 index 54f47cf15..000000000 --- a/src/spec/stub/rails70/config/initializers/content_security_policy.rb +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index adc6568ce..000000000 --- a/src/spec/stub/rails70/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index 3860f659e..000000000 --- a/src/spec/stub/rails70/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# 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 deleted file mode 100644 index 00f64d71b..000000000 --- a/src/spec/stub/rails70/config/initializers/permissions_policy.rb +++ /dev/null @@ -1,11 +0,0 @@ -# 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 deleted file mode 100644 index 8ca56fc74..000000000 --- a/src/spec/stub/rails70/config/locales/en.yml +++ /dev/null @@ -1,33 +0,0 @@ -# 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 deleted file mode 100644 index 2d6deb451..000000000 --- a/src/spec/stub/rails70/config/master.key +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index daaf03699..000000000 --- a/src/spec/stub/rails70/config/puma.rb +++ /dev/null @@ -1,43 +0,0 @@ -# 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 deleted file mode 100644 index 262ffd547..000000000 --- a/src/spec/stub/rails70/config/routes.rb +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index c19f78ab6..000000000 --- a/src/spec/stub/rails70/public/robots.txt +++ /dev/null @@ -1 +0,0 @@ -# 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 deleted file mode 100644 index 7db80e4ca..000000000 --- a/src/spec/stub/rails71/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# 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 deleted file mode 100644 index 9a5ea7383..000000000 --- a/src/spec/stub/rails71/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -# 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 deleted file mode 100644 index 09705d12a..000000000 --- a/src/spec/stub/rails71/app/controllers/application_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index de6be7945..000000000 --- a/src/spec/stub/rails71/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/src/spec/stub/rails71/config.ru b/src/spec/stub/rails71/config.ru deleted file mode 100644 index 4a3c09a68..000000000 --- a/src/spec/stub/rails71/config.ru +++ /dev/null @@ -1,6 +0,0 @@ -# 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 deleted file mode 100644 index f384d7e7b..000000000 --- a/src/spec/stub/rails71/config/application.rb +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 282011619..000000000 --- a/src/spec/stub/rails71/config/boot.rb +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 8a29b57f4..000000000 --- a/src/spec/stub/rails71/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -+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 deleted file mode 100644 index cac531577..000000000 --- a/src/spec/stub/rails71/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# 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 deleted file mode 100644 index 2c4802922..000000000 --- a/src/spec/stub/rails71/config/environments/development.rb +++ /dev/null @@ -1,54 +0,0 @@ -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 deleted file mode 100644 index 4f569bf9e..000000000 --- a/src/spec/stub/rails71/config/environments/production.rb +++ /dev/null @@ -1,70 +0,0 @@ -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 deleted file mode 100644 index d349c3556..000000000 --- a/src/spec/stub/rails71/config/environments/test.rb +++ /dev/null @@ -1,54 +0,0 @@ -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 deleted file mode 100644 index b3076b38f..000000000 --- a/src/spec/stub/rails71/config/initializers/content_security_policy.rb +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index c2d89e28a..000000000 --- a/src/spec/stub/rails71/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index 3860f659e..000000000 --- a/src/spec/stub/rails71/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# 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 deleted file mode 100644 index 7db3b9577..000000000 --- a/src/spec/stub/rails71/config/initializers/permissions_policy.rb +++ /dev/null @@ -1,13 +0,0 @@ -# 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 deleted file mode 100644 index 6c349ae5e..000000000 --- a/src/spec/stub/rails71/config/locales/en.yml +++ /dev/null @@ -1,31 +0,0 @@ -# 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 deleted file mode 100644 index 3f482db3b..000000000 --- a/src/spec/stub/rails71/config/master.key +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 7a709d7b6..000000000 --- a/src/spec/stub/rails71/config/puma.rb +++ /dev/null @@ -1,44 +0,0 @@ -# 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 deleted file mode 100644 index a125ef085..000000000 --- a/src/spec/stub/rails71/config/routes.rb +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index 2be3af26f..000000000 --- a/src/spec/stub/rails71/public/404.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - 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 deleted file mode 100644 index c08eac0d1..000000000 --- a/src/spec/stub/rails71/public/422.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - 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 deleted file mode 100644 index 78a030af2..000000000 --- a/src/spec/stub/rails71/public/500.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - 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 deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/spec/stub/rails71/public/apple-touch-icon.png b/src/spec/stub/rails71/public/apple-touch-icon.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/spec/stub/rails71/public/favicon.ico b/src/spec/stub/rails71/public/favicon.ico deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/spec/stub/rails71/public/robots.txt b/src/spec/stub/rails71/public/robots.txt deleted file mode 100644 index c19f78ab6..000000000 --- a/src/spec/stub/rails71/public/robots.txt +++ /dev/null @@ -1 +0,0 @@ -# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file