ruby / zlib

Ruby interface for the zlib compression/decompression library
Other
49 stars 35 forks source link

Fix a "missing zlib.c" error when loading the zlib.gemspec outside of ruby-src #8

Closed colby-swandale closed 5 years ago

colby-swandale commented 5 years ago

There is currently an error that is being raised when working on the gem:

[!] There was an error parsing `Gemfile`:
[!] There was an error while loading `zlib.gemspec`: No such file or directory @ rb_sysopen - /Users/colby/Github/zlib/zlib.c. Bundler cannot continue.

 #  from /Users/colby/Github/zlib/zlib.gemspec:3
 #  -------------------------------------------
 #  # frozen_string_literal: true
 >  source_version = File.open(File.join(__dir__, "zlib.c")) {|f|
 #    f.gets("\n#define RUBY_ZLIB_VERSION ")
 #  -------------------------------------------
. Bundler cannot continue.

This is occurring because of the change in https://github.com/ruby/zlib/commit/c6d8649ebaf8c99c96402094bb648aabe87dc222 which looks for the zlib.c extension in the current folder. While this is correct in ruby-src project, this is not in the gem project as zlib.c lives inside ext/zlib.

This PR is adding a fix so that the gemspec can be loaded correctly in both projects by checking which file exists.