Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec.platform to .gemspec if on JRuby #17

Merged
merged 1 commit into from
Jun 7, 2017
Merged

Add spec.platform to .gemspec if on JRuby #17

merged 1 commit into from
Jun 7, 2017

Conversation

boris-petrov
Copy link
Contributor

Thanks for merging the other pull-request!

Of course, it doesn't work simply like that, because of these:

phatworx/easy_captcha#30
rubygems/rubygems#1662 (comment)

I couldn't have caught this as this doesn't happen during development, only after a gem is released.

In short - this means that you have to build a Java specific version of the gem because the .gemspec file is evaluated only at gem-build-time. You're building it (I guess) with gem build dotdiff which builds it with a RUBY_PLATFORM which is not java and that's it - the gem will then require rmagick and not rmagick4j. I read in a bunch of places and the easiest way to "fix" this is to create a java-specific gem.

With this pull-request, doing a gem build dotdiff does what it did before (i.e. it outputs a dotdiff-2.0.1.gem file) but doing a jruby -S gem build dotdiff outputs a dotdiff-2.0.1-java.gem file. Unfortunately I'm unfamiliar with publishing gems so you'll have to test this - I'm not sure whether the gem also has to have a different name (something like: spec.name = "dotdiff" + (is_java ? '-java' : '')) or the fact that -java is automatically added to the version number is enough.

Thanks!

@boris-petrov
Copy link
Contributor Author

@jnormington - ping. :)

@jnormington
Copy link
Owner

Sorry @boris-petrov I'll have a look at this today and see what I need to do - thanks for the ping

@jnormington jnormington merged commit 486aa52 into jnormington:master Jun 7, 2017
@jnormington
Copy link
Owner

jnormington commented Jun 7, 2017

@boris-petrov : Sorry for the delay, this should now be done when I installed the gem with jruby it correctly pulled the -java version. Thanks for your help getting this supported!

$ jruby -S gem install dotdiff
Fetching: rmagick4j-0.4.0-java.gem (100%)
Successfully installed rmagick4j-0.4.0-java
Fetching: dotdiff-2.0.3-java.gem (100%)
Successfully installed dotdiff-2.0.3-java
2 gems installed

same for MRI version it pulled the normal gem from rubygems. So you should be able to do the following

jruby -S gem install dotdiff and it just work.

Let me know if it doesn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants