Join GitHub today
Make rubygem use /usr/bin/env in shebang in script #4907
I have another issue, kind of related to #4890, which affects portability. I want to use jruby in a portable way within a build machine. In my particular case, I'm using jekyll installed by rubygems in jruby, setting the PATH variable to include
I'd like to propose to use
There seems to be a configuration variable which is used by the
I don't really know a thing about ruby and how things work together in detail, but in contrast to #4890 it looks to me as if this issue should be directly fixable in jruby by setting the configuration. But I might be completely wrong, of course.
I have a python script for "bootstraping" jruby with jekyll on a Windows 7 machine because -- as I have written in #4890 -- I need to later run jekyll on build machines with no internet access. The bootstrap python script does the following steps:
I have to note that
One more insight:
I've run my bootstrap script on a linux machine and got a
This is a bit assymetric. "Bootstrapping" on Windows produces batch files and shell scripts (with the latter having wrong shebangs), while "bootstrapping" on Linux produces correct shell scripts, but no batch files at all.
This breaks my naive assumption that I could "bootstrap" jruby with jekyll on any platform, either Windows or Linux, and then use the produced self-contained jruby folder on any machine with an installed JRE, be it Windows or Linux.
To clarify what I'm hearing:
Here's the code that generates the .bat files:
def generate_windows_script(filename, bindir) if Gem.win_platform? then script_name = filename + ".bat" script_path = File.join bindir, File.basename(script_name) File.open script_path, 'w' do |file| file.puts windows_stub_script(bindir, filename) end verbose script_path end end
Seems like you want a new feature for RubyGems to force it to always generate both.
Is this correct?
In any case this seems like RubyGems issues or features, so perhaps there's nothing to do on JRuby's end.
Thank you very much for your time looking into it. Your summary is correct.
I'm sorry for the noise here on the jruby issue tracker. The fact that the behavior was inconsistent depending on the platform misled me into thinking that some config option has not been set correctly in jruby. But as you have already pointed out, this seems to be an issue with rubygems.
Being completely new to the ruby ecosystem, it was hard for me to see where exactly the root cause might have been. So thanks again for pointing me in the right direction.
Then again, it is not yet completely clear to me whether the behaviour I naively expected would be a feature request for jruby or rubygems. I was thinking of jruby as a portable alternative to a native ruby setup and therefore assumed that it just came with working scripts for Windows (batch files) and Unix-style systems (shebang). And I think my assumption was not too far-stretched as the vanilla jruby distribution contains batch files and shebang-files for jruby, gem, rake etc.
I assume that asking rubygems to generate batch files on Unix-like systems and shebang-style files on Windows systems per default would be frowned upon for a native ruby installation, don't you think? So maybe the feature request for rubygems would be the following:
Once this is possible, a feature request for jruby might be:
This would result in a jruby folder with optionally addition gems that could be just copied over across different host operating systems. Things would then work as long as there is a JRE installed and the PATH variable set correctly.
Does that sound reasonable to you?
referenced this issue
Dec 20, 2017
I think one possible solution would be for users to be able to generate the desired variants,