2011-08-19 104 views
4

我正在尝试创建一个simple utility的Debian软件包,我用fpmbundler写了一些但有困难。以下是我生成我.deb(我假定你已经签出sns,并且在它的根):从Ruby宝石创建Debian软件包

$ bundle install 
$ rake install 
$ fpm -s gem -t deb --prefix /var/lib/gems/1.8/ pkg/sns-0.1.1.gem 
Successfully installed sns-0.1.1 
1 gem installed 
md5sum: : No such file or directory 
Created /home/blt/projects/com/carepilot/sns/rubygem-sns_0.1.1_all.deb 
$ dpkg-deb -c rubygem-sns_0.1.1_all.deb | grep sns_hosts 
-rwxr-xr-x root/root  762 2011-08-18 22:28 ./var/lib/gems/1.8/gems/sns-0.1.1/bin/sns_hosts 
-rwxr-xr-x root/root  398 2011-08-18 22:28 ./var/lib/gems/1.8/bin/sns_hosts 

这是应该的。不幸的是

$ cat /var/lib/gems/1.8/bin/sns_hosts 
#!/home/blt/.rbenv/versions/1.9.2-p290/bin/ruby 
# 
# This file was generated by RubyGems. 
# 
# The application 'sns' is installed as part of a gem, and 
# this file is here to facilitate running it. 
# 

require 'rubygems' 

version = ">= 0" 

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then 
    version = $1 
    ARGV.shift 
end 

gem 'sns', version 
load Gem.bin_path('sns', 'sns_hosts', version) 

宝石创建它错误地将Ruby解释给我的开发环境的分流;而推向其他计算机时则是一个问题。我如何影响在分流脚本中设置的解释器?

回答

5

gem install具有-E参数来重写shebang行以使用/ usr/bin/env。所以你需要编辑fpm来打包宝石。 /usr/lib/ruby/gems/1.8/gems/fpm-0.3.7/lib/fpm/source/gem.rb第120行有参数,你可以尝试在那里添加它。

+0

听起来像是一个很好的补丁,推动上游。 –

+0

Tatu Lahtela来通过:https://github.com/ration/fpm/commit/372a74682d5fa911189b3d82211a143bc7d2fc4e – troutwine

+0

拉请求合并到主,所以参数应在未来的版本中设置。 –