From 52d32a643ee9505ab01176adb100b0836bf89653 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 15 Jun 2016 12:45:40 -0700 Subject: [PATCH 2/9] Now remove JRuby and ruby-head from matrix. --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b24b213..13c17f90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,8 @@ rvm: - &ruby1 2.3.0 - &ruby2 2.2.4 - &ruby3 2.1.8 - - &jruby jruby-9.0.5.0 - - &rhead ruby-head matrix: - fast_finish: true - allow_failures: - - rvm: *jruby - - rvm: *rhead include: - rvm: 2.3.0 env: TEST_SUITE=fmt From aeca7a195e83b1fc3440435001d6e206bb41b639 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 23 Jun 2016 19:00:29 -0700 Subject: [PATCH 3/9] Run the unit tests in jruby. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 13c17f90..57140623 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ matrix: include: - rvm: 2.3.0 env: TEST_SUITE=fmt + - rvm: jruby-9.0.5.0 + env: TEST_SUITE=test env: matrix: - TEST_SUITE=test From 6f5ad2530e3e1dd028335ca10429516d10c52c26 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 23 Jun 2016 19:08:53 -0700 Subject: [PATCH 4/9] Only run tests with --profile when using MRI. --- script/rubies | 14 ++++++++++++++ script/test | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) create mode 100755 script/rubies diff --git a/script/rubies b/script/rubies new file mode 100755 index 00000000..fb00ac61 --- /dev/null +++ b/script/rubies @@ -0,0 +1,14 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# If you send us a ruby then we use that, if you do not then we test with +# whatever we can detect, this way you can run both suites when you test out +# your source, we expect full coverage now, not just MRI. +# ----------------------------------------------------------------------------- + +rubies=() +for r in jruby ruby; do + if which "$r" > /dev/null 2>&1 + then + echo $r + fi +done diff --git a/script/test b/script/test index 5aab2f06..133b9807 100755 --- a/script/test +++ b/script/test @@ -31,26 +31,26 @@ then shift else - rubies=() - for r in jruby ruby; do - if which "$r" - then - rubies+=( - $r - ) - fi - done + rubies=($(script/rubies)) fi + for ruby in $rubies; do + if [[ "$ruby" == "jruby" ]] + then + testopts="" + else + testopts="--profile" + fi + if [[ $# -lt 1 ]] then set -x time $ruby -S bundle exec \ - rake TESTOPTS='--profile' test + rake TESTOPTS=$testopts test else set -x time $ruby -S bundle exec ruby -Itest \ - "$@" --profile + "$@" $testops fi done From 12c1ada0e582a37427761fec0f9917ca975c317d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 28 Jun 2016 12:43:15 -0700 Subject: [PATCH 5/9] test: skip openssl test for jruby --- test/test_commands_serve.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 50fe9f83..244ca444 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -114,6 +114,8 @@ class TestCommandsServe < JekyllUnitTest end should "allow SSL with a key and cert" do + skip "JRuby does not have OpenSSL bindings." if jruby? + expect(OpenSSL::PKey::RSA).to receive(:new).and_return("c2") expect(OpenSSL::X509::Certificate).to receive(:new).and_return("c1") allow(File).to receive(:read).and_return("foo") From 89c6b0ec0de27e7b99c53fb6e2f27258cbea1d6a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 28 Jun 2016 12:43:34 -0700 Subject: [PATCH 6/9] travis: do not run 'bundle update' any longer. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 57140623..f33cba09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -before_script: bundle update bundler_args: --without benchmark:site:development script: script/cibuild cache: bundler From 2ef70fd34860e0c067117c5fdd587d6eb9b06664 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 28 Jun 2016 14:39:06 -0700 Subject: [PATCH 7/9] Some weird stuff with Colorator on my machine & jruby. --- test/test_configuration.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index eddb2c96..0e0a69c7 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -1,4 +1,5 @@ require "helper" +require "colorator" class TestConfiguration < JekyllUnitTest test_config = { @@ -260,7 +261,9 @@ class TestConfiguration < JekyllUnitTest allow(SafeYAML).to receive(:load_file).with(@path) do raise SystemCallError, "No such file or directory - #{@path}" end - allow($stderr).to receive(:puts).with("Configuration file: none".yellow) + allow($stderr).to receive(:puts).with( + Colorator.yellow("Configuration file: none") + ) assert_equal site_configuration, Jekyll.configuration(test_config) end @@ -275,13 +278,12 @@ class TestConfiguration < JekyllUnitTest allow($stderr) .to receive(:puts) .and_return( - ("WARNING: " - .rjust(20) + "Error reading configuration. Using defaults (and options).") - .yellow + "WARNING: ".rjust(20) + + Colorator.yellow("Error reading configuration. Using defaults (and options).") ) allow($stderr) .to receive(:puts) - .and_return("Configuration file: (INVALID) #{@path}".yellow) + .and_return(Colorator.yellow("Configuration file: (INVALID) #{@path}")) assert_equal site_configuration, Jekyll.configuration(test_config) end @@ -291,10 +293,10 @@ class TestConfiguration < JekyllUnitTest end allow($stderr) .to receive(:puts) - .with(( + .with(Colorator.red( "Fatal: ".rjust(20) + \ "The configuration file '#{@user_config}' could not be found." - ).red) + )) assert_raises LoadError do Jekyll.configuration({ "config" => [@user_config] }) end From 6f3c01ca8772434f8e205bd7c06c0750233cec92 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 28 Jun 2016 18:30:02 -0700 Subject: [PATCH 8/9] Fix for jruby --- Gemfile | 2 ++ test/test_commands_serve.rb | 3 +-- test/test_utils.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 253826aa..3dc758ef 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,8 @@ group :test do gem "nokogiri" gem "rspec" gem "test-theme", path: File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__)) + + gem "jruby-openssl" if RUBY_ENGINE == "jruby" end # diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 244ca444..f129a07e 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -1,6 +1,7 @@ require "webrick" require "mercenary" require "helper" +require "openssl" class TestCommandsServe < JekyllUnitTest def custom_opts(what) @@ -114,8 +115,6 @@ class TestCommandsServe < JekyllUnitTest end should "allow SSL with a key and cert" do - skip "JRuby does not have OpenSSL bindings." if jruby? - expect(OpenSSL::PKey::RSA).to receive(:new).and_return("c2") expect(OpenSSL::X509::Certificate).to receive(:new).and_return("c1") allow(File).to receive(:read).and_return("foo") diff --git a/test/test_utils.rb b/test/test_utils.rb index e2a50c58..5fbb99fc 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -320,7 +320,7 @@ class TestUtils < JekyllUnitTest context "The \`Utils.safe_glob\` method" do should "not apply pattern to the dir" do dir = "test/safe_glob_test[" - assert_equal [], Dir.glob(dir + "/*") + assert_equal [], Dir.glob(dir + "/*") unless jruby? assert_equal ["test/safe_glob_test[/find_me.txt"], Utils.safe_glob(dir, "*") end