Skip to content

Commit

Permalink
Merge pull request #261 from chadlwilson/get-tests-working
Browse files Browse the repository at this point in the history
Re-enable specs to run via JRuby-provided bundler
  • Loading branch information
enebo authored Jul 18, 2024
2 parents b5c44cf + 5748707 commit 55b183e
Show file tree
Hide file tree
Showing 31 changed files with 207 additions and 577 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group :default do
if rack_version = ENV['RACK_VERSION']
gem 'rack', rack_version
else
gem 'rack'
gem 'rack', '< 3.0'
end
end

Expand All @@ -14,4 +14,3 @@ end

gem 'rake', '~> 13.2', :group => :test, :require => nil
gem 'rspec', :group => :test
gem 'jruby-openssl', :group => :test if JRUBY_VERSION < '1.7.0'
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ GEM
bundler
rake
diff-lcs (1.5.1)
rack (3.0.11)
rack (2.2.9)
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
Expand All @@ -26,9 +26,9 @@ PLATFORMS

DEPENDENCIES
appraisal (< 1.0)
rack
rack (< 3.0)
rake (~> 13.2)
rspec

BUNDLED WITH
2.4.19
2.3.26
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ task :unpack_gem => "target" do |t|
mkdir_p "target/vendor"
require 'rubygems/installer'
rack_dir = File.basename(gem_file).sub(/\.gem$/, '')
Gem::Installer.new(Gem::Package.new(gem_file), :unpack => true, :install_dir => rack_dir).unpack "#{target}/#{rack_dir}"
Gem::Package.new(gem_file).extract_files("#{target}/#{rack_dir}")
File.open("#{target}/vendor/rack.rb", "w") do |f|
f << "dir = File.dirname(__FILE__)\n"
f << "if dir =~ /.jar!/ && dir !~ /^file:/\n"
Expand Down Expand Up @@ -109,8 +109,9 @@ task :speconly => [ :resources, :test_resources ] do
opts = ENV['SPEC_OPTS'] ? ENV['SPEC_OPTS'] : %q{ --format documentation --color }
spec = ENV['SPEC'] || File.join(Dir.getwd, "src/spec/ruby/**/*_spec.rb")
opts = opts.split(' ').push *FileList[spec].to_a
exec = 'rspec'; exec = Gem.bin_path('rspec', exec) if ENV['FULL_BIN_PATH']
ruby "-Isrc/spec/ruby", "-rbundler/setup", "-S", exec, *opts
ruby = ENV['RUBY'] || 'jruby'
args = ruby.split(' ') + %w{-Isrc/spec/ruby -rbundler/setup -S rspec}
sh *args, *opts
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/camping/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'http://rubygems.org'
source 'https://rubygems.org'

gem 'rack'
gem 'camping'
Expand Down
2 changes: 1 addition & 1 deletion examples/rails3/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'http://rubygems.org'
source 'https://rubygems.org'

gem 'rails', '3.1.0'

Expand Down
2 changes: 1 addition & 1 deletion examples/sinatra/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source :rubygems
source 'https://rubygems.org'

gem 'sinatra'
134 changes: 49 additions & 85 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,22 @@
<artifactId>jruby-rack</artifactId>
<version>1.2.3-SNAPSHOT</version>
<name>JRuby-Rack</name>
<url>http://github.com/jruby/jruby-rack/</url>
<url>https://github.com/jruby/jruby-rack/</url>
<description>
A servlet bridge for (Ruby-based) Rack applications that allow them
to run in Java Application servers using JRuby.
</description>

<properties>
<jruby.version>9.4.7.0</jruby.version>
<vendor.gems.path>vendor/gems</vendor.gems.path>
<bundler.version>2.4.19</bundler.version>
<bundler.local>false</bundler.local> <!-- true by default -->
<jruby.maven.plugins.version>3.0.3</jruby.maven.plugins.version>
<gem.home>${project.build.directory}/rubygems</gem.home>
<slf4j.version>2.0.12</slf4j.version>
</properties>

<issueManagement>
<system>Github</system>
<url>http://github.com/jruby/jruby-rack/issues</url>
<url>https://github.com/jruby/jruby-rack/issues</url>
</issueManagement>

<distributionManagement>
Expand All @@ -46,14 +44,14 @@
<scm>
<connection>scm:git:git://github.com/jruby/jruby-rack.git</connection>
<developerConnection>scm:git:[email protected]:jruby/jruby-rack.git</developerConnection>
<url>http://github.com/jruby/jruby-rack/</url>
<url>https://github.com/jruby/jruby-rack/</url>
<tag>HEAD</tag>
</scm>

<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<url>https://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
Expand Down Expand Up @@ -97,74 +95,54 @@
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>${jruby.version}</version>
</dependency>
<!-- JavaEE 6 APIs -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_3.0_spec</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jsp_2.2_spec</artifactId>
<version>1.2</version>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-el_2.2_spec</artifactId>
<version>1.0.4</version>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>2.3.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
<groupId>jakarta.jms</groupId>
<artifactId>jakarta.jms-api</artifactId>
<version>2.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
<artifactId>commons-logging</artifactId>
<version>1.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>provided</scope>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.10.RELEASE</version>
<version>3.2.18.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.6</version>
<type>gem</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>bundler</artifactId>
<version>${bundler.version}</version>
<type>gem</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -198,7 +176,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.13.0</version>
<configuration>
<source>8</source>
<target>8</target>
Expand All @@ -209,17 +187,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<version>3.7.1</version>
<executions>
<execution>
<phase>process-sources</phase>
Expand All @@ -234,26 +212,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jruby.maven</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>${jruby.maven.plugins.version}</version>
<configuration>
<includeOpenSSL>false</includeOpenSSL>
<gemHomes>
<provided>${gem.home}</provided>
</gemHomes>
</configuration>
<executions>
<execution>
<id>gem-install-bundler</id>
<phase>test</phase>
<goals>
<goal>initialize</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jruby.maven</groupId>
<artifactId>bundler-maven-plugin</artifactId>
Expand All @@ -264,9 +222,9 @@
<phase>test</phase>
<goals><goal>install</goal></goals>
<configuration>
<jruby.version>${jruby.version}</jruby.version>
<!--<local>false</local>-->
<bundlerVersion>${bundler.version}</bundlerVersion>
<jrubyVersion>${jruby.version}</jrubyVersion>
<local>false</local>
<quiet>false</quiet>
</configuration>
</execution>
</executions>
Expand All @@ -275,29 +233,35 @@
<groupId>org.jruby.maven</groupId>
<artifactId>rake-maven-plugin</artifactId>
<version>${jruby.maven.plugins.version}</version>
<configuration>
<jrubyVersion>${jruby.version}</jrubyVersion>
</configuration>
<executions>
<!-- <execution>-->
<!-- <id>rake-spec</id>-->
<!-- <phase>test</phase>-->
<!-- <goals><goal>rake</goal></goals>-->
<!-- <configuration>-->
<!-- <jruby.version>${jruby.version}</jruby.version>-->
<!-- <args>speconly SKIP_SPECS=${maven.test.skip} FULL_BIN_PATH=true</args>-->
<!-- </configuration>-->
<!-- </execution>-->
<execution>
<id>rake-spec</id>
<phase>test</phase>
<goals><goal>rake</goal></goals>
<configuration>
<args>speconly SKIP_SPECS=${maven.test.skip}</args>
</configuration>
</execution>
<execution>
<!-- additional (ruby) generated resources -->
<id>rake-resources</id>
<phase>prepare-package</phase>
<!-- bind "late" so we do not run during compile/test-compile -->
<goals><goal>rake</goal></goals>
<configuration>
<jruby.version>${jruby.version}</jruby.version>
<args>resources VERSION=${project.version}</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.17.1</version>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -328,7 +292,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<version>3.7.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jruby/rack/DefaultRackConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ private static Map<String,String> getLoggerTypes() {
final Map<String,String> loggerTypes = new HashMap<String, String>(8);
loggerTypes.put("commons_logging", "org.jruby.rack.logging.CommonsLoggingLogger");
loggerTypes.put("clogging", "org.jruby.rack.logging.CommonsLoggingLogger");
loggerTypes.put("log4j", "org.jruby.rack.logging.Log4jLogger");
loggerTypes.put("slf4j", "org.jruby.rack.logging.Slf4jLogger");
loggerTypes.put("jul", "org.jruby.rack.logging.JulLogger");
//loggerTypes.put("servlet_context", "org.jruby.rack.logging.ServletContextLogger");
Expand Down
Loading

0 comments on commit 55b183e

Please sign in to comment.