From 2a53367358317f08947847a10364c2e2b2a744a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 27 Jan 2020 18:37:06 +0100 Subject: Workaround jruby issue --- .github/workflows/jruby.yml | 31 ++++++++++++++++++++++ .rubocop.yml | 2 ++ lib/bundler/source/path.rb | 6 ++++- spec/realworld/fixtures/warbler/.gitignore | 2 ++ spec/realworld/fixtures/warbler/Gemfile | 7 +++++ .../fixtures/warbler/bin/warbler-example.rb | 3 +++ spec/realworld/fixtures/warbler/demo/demo.gemspec | 10 +++++++ 7 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/jruby.yml create mode 100644 spec/realworld/fixtures/warbler/.gitignore create mode 100644 spec/realworld/fixtures/warbler/Gemfile create mode 100644 spec/realworld/fixtures/warbler/bin/warbler-example.rb create mode 100644 spec/realworld/fixtures/warbler/demo/demo.gemspec diff --git a/.github/workflows/jruby.yml b/.github/workflows/jruby.yml new file mode 100644 index 0000000000..4974787eed --- /dev/null +++ b/.github/workflows/jruby.yml @@ -0,0 +1,31 @@ +name: jruby + +on: + pull_request: + + push: + branches: + - staging + - trying + +jobs: + warbler: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Setup ruby + uses: eregon/use-ruby-action@v1 + with: + ruby-version: jruby-9.2.9.0 + + - name: Install local bundler + run: bin/rake install:local + + - name: Run a warbler project + run: | + cd spec/realworld/fixtures/warbler + bundle install + bundle exec warble + java -jar warbler.jar diff --git a/.rubocop.yml b/.rubocop.yml index 604300a117..3a4d8cb295 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -408,6 +408,8 @@ Naming/ConstantName: Naming/FileName: Enabled: true + Exclude: + - 'spec/realworld/fixtures/warbler/bin/warbler-example.rb' Naming/HeredocDelimiterCase: Enabled: true diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index f98f5155fb..e73e33d922 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -132,7 +132,11 @@ module Bundler end def expand(somepath) - somepath.expand_path(root_path) + if Bundler.current_ruby.jruby? # TODO: Unify when https://github.com/rubygems/bundler/issues/7598 fixed upstream and all supported jrubies include the fix + somepath.expand_path(root_path).expand_path + else + somepath.expand_path(root_path) + end rescue ArgumentError => e Bundler.ui.debug(e) raise PathError, "There was an error while trying to use the path " \ diff --git a/spec/realworld/fixtures/warbler/.gitignore b/spec/realworld/fixtures/warbler/.gitignore new file mode 100644 index 0000000000..6ac0bb4663 --- /dev/null +++ b/spec/realworld/fixtures/warbler/.gitignore @@ -0,0 +1,2 @@ +*.jar +Gemfile.lock diff --git a/spec/realworld/fixtures/warbler/Gemfile b/spec/realworld/fixtures/warbler/Gemfile new file mode 100644 index 0000000000..4fbf2d05a7 --- /dev/null +++ b/spec/realworld/fixtures/warbler/Gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "demo", :path => "./demo" +gem "jruby-jars", "~> 9.2" +gem "warbler", "~> 2.0" diff --git a/spec/realworld/fixtures/warbler/bin/warbler-example.rb b/spec/realworld/fixtures/warbler/bin/warbler-example.rb new file mode 100644 index 0000000000..25f614ecc2 --- /dev/null +++ b/spec/realworld/fixtures/warbler/bin/warbler-example.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +puts require "bundler/setup" diff --git a/spec/realworld/fixtures/warbler/demo/demo.gemspec b/spec/realworld/fixtures/warbler/demo/demo.gemspec new file mode 100644 index 0000000000..ed5a0dc080 --- /dev/null +++ b/spec/realworld/fixtures/warbler/demo/demo.gemspec @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +Gem::Specification.new do |spec| + spec.name = "demo" + spec.version = "1.0" + spec.author = "Somebody" + spec.summary = "A demo gem" + spec.license = "MIT" + spec.homepage = "https://example.org" +end -- cgit v1.2.1