[英]Is it possible to include a Bash script within a gem?
这是可能的,但脚本只能在类似unix的环境中执行,包括bash。 您可以将.sh放入bin/
或share/
文件夹,然后只需调用:
name = 'your_gem_name'
g = Gem::Specification.find_by_name( name )
system( File.join( g.full_gem_path, 'share/myscript.sh' ) )
当然,您总是可以使用bundler gem模块来控制当前的gem而不是运行shell脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.