-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Method to execute commands/scripts before packaging the new gem #16
Comments
Hello @sronsiek, thank you for your interest in gem-compiler. I'm not familiar with passenger gem and where it compiles and places the binaries it produces, so not sure if it will be possible pack those binaries back into the gem. From what I can deduce by looking at Passenger's gemspec (not the one in the repository, but the one obtained using From that, I don't think is possible package binaries for Passenger, at least not with this approach. gem-compiler works great when there is no extra steps to be performed for generating those binaries. Please note that my experience with Passenger and it's setup is limited, so I might be missing something but this will require several things:
What you can do to prove this theory is perform the manual steps involved in this:
If that works, specially the manual hook and that can be automated, then we can figure out extra options to be added to gem-compiler. If that doesn't work, then it means Passenger cannot produce pre-compiled binaries, in which case I will recommend reaching out to Passenger developers for assistance. Will keep this open to hear your feedback once you try the above options. Looking forward your commends. |
@FooBarWidget - would it possible to have a version of passenger gem that does the |
Hi Luis, Thanks very much for your very informative post. I'm not an expert on passenger, but I can tell you that the passenger gem seems to have a two-part compilation process:
However I have found that if these downloads fail (in my case they do fail because there are no pre-built archives for my ruby version), they are later built locally - so download failure does in fact not matter. 2 . In addition to the output from 1., the
Just for info - the following is compiled as part of the extension is included in a gem-compiled gem:
So, in order to automate the entire process, one of the following should do the trick:
The cmd in my case was:
The I'm not familiar with gemspecs - do you need to modify this to add extra files? However - in my particular case you have provided all the cmd steps for me to run individually when I encounter the passenger gem - so for now I'll try that approach, adding the extra cmd where required. Having said that - I think many people would appreciate an all-in-one build soln! cheers, |
I'm currently on a trip in China, so it'll take a while before I can come back with an elaborate answer. But it's tricky, to say the least. The thing with Passenger is that we support a ton of different integrations with the OS.
To give you a good answer, I have to first look into what gem-compiler does and what you exactly want to achieve with the passenger gem. Until then, my above comments may serve as some food for thought. |
I'm failing on the last step:
requiring yaml in irb returns true. Not sure what is wrong here ... gem version is 2.4.8 |
Sorry for that, please try saving the gemspec again using "--ruby" option. Forgot that the default is YAML but we need ruby code for "gem build" to |
Ok - I have it working - although the exact handling of passenger varies with version. I'm supporting 3.0.13 & 5.0.15. I followed Luis' instructions which were a very good guide - here my exact commands.
The ruby script looks as follows:
So basically - yes - a hook where you described would cater for this solution! Now it's time for a beer! |
We need to provide pre-compiled gems without internet access. We download from rubygems.org, compile using gem compiler, and push the compiled gems to our local geminabox server. From here the gems are downloaded onto target machines that do not have compilers.
My problem is the passenger gem. This requires unpacking, then running a cmd which builds mod_passeneger.so. I want to include this file in the compiled gem.
gem compiler unpacks in a tmp area in a dir containing a time stamp - so I cannot unpack, compile & run gem compiler on the same dir hoping it will include mod_passenger.so.
Ideally I need a hook to be able to insert a file into the unpacked area before it is repackaged.
I can use gem unpack - but can I& place a file in the unpacked area and perhaps gem-compile the unpacked gem dir?
Or can I unpack & re-pack the gem-compiled gem file??
The text was updated successfully, but these errors were encountered: