I have built a ruby gem but I need to make it executable so it could be run from the terminal. I have googled and found that I need to make a file inside the
bin/
chmod +x bin/myfile
console
setup
#!/usr/bin/env ruby
require "sys_libs"
s = SysLibs
.gemspec
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^bin/}) { |f| f[3..-1] }
spec.require_paths = ["lib"]
The spec.bindir = "exe"
attribute should be spec.bindir = 'bin'
.
spec.bindir = 'bin'
spec.executables = ['myfile']
Note that bindir
is optional.