TIL: RubyGem executables now go in exe
18 February 2015
Tweet Follow @hazula
Tweet Follow @hazula
Update 2015-03-20: Now cross-posted at http://bundler.io/blog/2015/03/20/moving-bins-to-exe.html.
Bundler diff: move gem bins to exe
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
I really like this new convention. Since we’ve started generating
binstubs in bin
, I’ve had bizarre errors resulting from forgetting that
my gemspec was specifying that my gem should install all the files in bin
as executables. Changing the executables
directory to exe
means that
I needn’t worry my gem might be including binstubs as exectubles.
I had noticed that RSpec is already doing this when I wrote some code to check if RSpec was running before starting Simplecov.
if defined?(@running_tests)
@running_tests = false
else
@running_tests = caller.any? {|line| line =~ /exe\/RSpec/ }
end
But it turns out RSpec has been doing that since 2011.
I hope you found this helpful. :)
blog comments powered by Disqus