Writing a Rakefile Jeweler file that adds dependencies depending on RUBY_ENGINE (ruby or jruby)

I have a rakefile that includes the following:

Jeweler::Tasks.new do |gem|
  # ...
  gem.add_dependency('json')
end

The gemspec created creates a gem that cannot be installed on jruby because the json gem is native.

For jruby, this should be:

Jeweler::Tasks.new do |gem|
  # ...
  gem.add_dependency('json-jruby')
end

How can I conditionally add a dependency for 'json-jruby' when RUBY_ENGINE == 'java'?

It seems like my only option is to manually edit the gemspec file that the jeweler creates to add the RUBY_ENGINE check. But I would prefer to avoid this, because it seems to hit the purpose of using a jeweler in the first place.

Any ideas?

+3
source share
1

, Jeweler, json-jruby.

json-jruby json. , gem JRuby (.. jgem build json-jruby.gem), gem json-1.4.3-universal-java-1.6.gem (RubyGems "platform" gemspec). . json-jruby. RubyGems .

json, , json-1.4.3-universal-java-1.6.gem, gemcutter, jruby json gem: http://roughest.net/json-1.4.3-universal-java-1.6.gem

+2

Source: https://habr.com/ru/post/1747283/


All Articles