从 Ruby gem 创建 Debian 包

发布于 2024-11-30 08:51:53 字数 1412 浏览 1 评论 0 原文

我正在尝试为我用 简单实用程序 创建 Debian 软件包https://github.com/jordansissel/fpm" rel="nofollow">fpm 和 bundler 但我有困难。以下是我生成 .deb 的方法(我假设您已签出 sns 并位于其根目录中):

$ 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)

gem 创建了一个分流器,它错误地将 ruby​​ 解释器设置为我的开发环境的解释器;而推送到其他计算机时会出现问题。我如何影响分流脚本中设置的解释器?

I'm attempting to create a Debian package for a simple utility I wrote with fpm and bundler but am having difficulties. Here's how I generate my .deb (I assume you've checked out sns and are in it's root):

$ 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

Which is how it should be. Unfortunately

$ 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)

The gem creates a shunt which incorrectly sets the ruby interpreter to that of my development environment; rather a problem when pushing to other computers. How might I influence the interpreter which is set in the shunt script?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨与橙与城 2024-12-07 08:51:53

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

gem install has -E parameter to rewrite the shebang line to use /usr/bin/env. So you need to edit fpm to do this while packaging the gem. /usr/lib/ruby/gems/1.8/gems/fpm-0.3.7/lib/fpm/source/gem.rb line 120 has the parameters, you can try to add it there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文