-
Notifications
You must be signed in to change notification settings - Fork 444
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
Installation fails when the extension is cached #121
Comments
I'm not 100% sure you can drop a .rb file in ext/ and require it the same way, but that would be one solution. Another would be this stupid hack, if it were to write the file out and then compile it: #include "ruby.h"
VALUE cMimeMagic;
void Init_MimeMagic() {
cMimeMagic = rb_define_class("MimeMagic", rb_cObject);
rb_define_const(cMimeMagic, "DATABASE_PATH", rb_str_new_cstr("plug the path in here"));
} Probably would be a good idea to ensure that the path doesn't contain the double quote character or anything that would be a C escape before interpolating it in :). |
You can - as long as you add Update: spoke too soon... although it works from the |
Ok, take two - I worked out where Rubygems expects the compiled files to be written (it passes the destination path as the Note that this directory is automatically added to the load path, so with this approach we don't have to modify |
Our CI builds are failing because the generated
lib/mimemagic/path.rb
file is missing, but only when the mimemagic extension has been cached by Bundler. A fresh install always succeeds.Here's a minimal reproduction:
As you can see,
path.rb
isBundler only caches the gem's extension directory, meaning that writing to
lib
in the extension build is problematic:https://github.com/rubygems/rubygems/blob/dcf7c3f5def6078f5e9c48a8e345135cdb7f1bb5/bundler/lib/bundler/rubygems_gem_installer.rb#L78
The text was updated successfully, but these errors were encountered: