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

Can't enhance gemspec task #262

Open
patrickhno opened this issue Apr 14, 2014 · 2 comments
Open

Can't enhance gemspec task #262

patrickhno opened this issue Apr 14, 2014 · 2 comments

Comments

@patrickhno
Copy link

I have enhanced the gemspec task to include platform specific patches, but "rake release" generates a new gemspec file ignoring the enhanced task.

Rake::Task["gemspec"].enhance do
  spec = "opine.gemspec"
  text = File.read(spec)
  text.gsub!(/^(.*<cocoa>.*)$/, '\1 if RUBY_PLATFORM =~ /darwin/')
  text.gsub!(/^(.*<stench>.*)$/, '\1 if RUBY_PLATFORM =~ /cygwin|mingw|mswin|windows/')
  File.open(spec, 'w') { |file| file.write(text) }
end
@technicalpickles
Copy link
Owner

I'm not really familiar with Rake::Task#enhance, so can't comment on it's effectiveness here.

What I do know is that multiplatform gems are tricky with jeweler, because the gemspec only gets evaluated once, and then written to disk. At the time it's evaluated (or enhanced), it's on a specific RUBY_PLATFORM doing so. The Gem specification does not, to my knowledge, have a builtin concept of platform. You'd have to release separate gems for that.

@mfazekas
Copy link

FYI this can be worked around like: #170 (comment)

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

No branches or pull requests

4 participants