From 64ea77aa6d6275ed7eede7637ae14477cf78e961 Mon Sep 17 00:00:00 2001 From: Christian Meier Date: Wed, 16 Mar 2016 13:27:41 +0100 Subject: [PATCH] improve setup of rake tests --- Gemfile | 3 +++ Rakefile | 18 ++++++++++-------- src/test/ruby/test_helper.rb | 7 +++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 33f4e55c..6f7251e4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,6 @@ source 'https://rubygems.org' # Specify your gem's dependencies in the gemspec gemspec + +# for the rake task +gem 'ruby-maven', '~> 3.3.8' diff --git a/Rakefile b/Rakefile index 9e9b83af..bd441d81 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ #-*- mode: ruby -*- begin - require 'maven/ruby/tasks' + require 'ruby-maven' rescue LoadError warn "ruby-maven not available - some tasks will not work " << "either `gem install ruby-maven' or use mvn instead of rake" @@ -16,20 +16,22 @@ rescue LoadError end end else - Rake::Task[:jar].clear + #Rake::Task[:jar].clear rescue nil desc "Package jopenssl.jar with the compiled classes" - task :jar => :maven do - maven.prepare_package '-Dmaven.test.skip=true' + task :jar do + RubyMaven.exec( 'prepare_package -Dmaven.test.skip=true' ) end namespace :jar do desc "Package jopenssl.jar file (and dependendent jars)" - task :all => :maven do - maven.package '-Dmaven.test.skip=true' + task :all do + RubyMaven.exec( 'package -Dmaven.test.skip=true' ) end end end -# the actual build configuration is inside the Mavenfile +task :build do + RubyMaven.exec('package -Dmaven.test.skip') +end task :default => :build @@ -64,4 +66,4 @@ namespace :integration do lib = [ 'lib', 'src/test/integration' ] ruby "-I#{lib.join(':')} -e \"#{loader}\" #{test_files.map { |f| "\"#{f}\"" }.join(' ')}" end -end \ No newline at end of file +end diff --git a/src/test/ruby/test_helper.rb b/src/test/ruby/test_helper.rb index 0257f896..2138dd38 100644 --- a/src/test/ruby/test_helper.rb +++ b/src/test/ruby/test_helper.rb @@ -11,7 +11,10 @@ puts Java::OrgBouncycastleJceProvider::BouncyCastleProvider.new.info else base_dir = File.expand_path('../../..', File.dirname(__FILE__)) - $CLASSPATH << File.join(base_dir, 'pkg/classes') + + jar = File.join(base_dir, 'lib/jopenssl.jar') + raise "jopenssl.jar jar not found" unless jar; $CLASSPATH << jar + jar = Dir[File.join(base_dir, 'lib/org/bouncycastle/**/bcprov-*.jar')].first raise "bcprov jar not found" unless jar; $CLASSPATH << jar jar = Dir[File.join(base_dir, 'lib/org/bouncycastle/**/bcpkix-*.jar')].first @@ -205,4 +208,4 @@ def issue_crl(revoke_info, serial, lastup, nextup, extensions, Dir.glob("#{File.join(base, sub)}/**/test_*.rb").each do |test| require test end -end \ No newline at end of file +end