我正在创建一个gem (参见https://github.com/hamchapman/rewinder),它将ruby (https://github.com/schacon/ruby-git)作为依赖项。
我的gem的一部分有一个可执行的https://github.com/hamchapman/rewinder/blob/master/bin/rewinder
它基本上只需要主库文件https://github.com/hamchapman/rewinder/blob/master/lib/rewinder.rb。
然后在那里运行该方法(目前一切都很混乱--暂时忽略它)。
当我在本地安装创业板并在另一个回购中使用它时,我会得到以下错误:
/Users/Hami/.rvm/gems/ruby-2.1.2/gems/git-1.2.7/lib/git/lib.rb:764:in `command': git checkout '6eef72baf24bed761f753267cce16402e4a947f8' 2>&1:Note: checking out '6eef72baf24bed761f753267cce16402e4a947f8'. (Git::GitExecuteError)
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 6eef72b... Trying another bg-color change for homeboy
/Users/Hami/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/rubygems_integration.rb:252:in `block in replace_gem': hookup is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/hookup:22:in `<main>'
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/git-1.2.7/lib/git/lib.rb:528:in `checkout'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/git-1.2.7/lib/git/base.rb:325:in `checkout'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/rewinder-0.0.1/lib/rewinder.rb:11:in `block in heloo'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/rewinder-0.0.1/lib/rewinder.rb:10:in `each'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/rewinder-0.0.1/lib/rewinder.rb:10:in `each_with_index'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/rewinder-0.0.1/lib/rewinder.rb:10:in `heloo'
from /Users/Hami/.rvm/gems/ruby-2.1.2/gems/rewinder-0.0.1/bin/rewinder:4:in `<top (required)>'
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/rewinder:23:in `load'
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/rewinder:23:in `<main>'
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/Hami/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'我真的不明白错误既不是我的宝石,也不是红宝石,而是把hookup作为依赖项。如果我加载文件/Users/Hami/.rvm/gems/ruby-2.1.2/bin/hookup
然后注释掉下面两行代码:
#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'hookup' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
#gem 'hookup', version
#load Gem.bin_path('hookup', 'hookup', version)那么错误就不会发生。
根据我所读到的,它看起来可能与我的zsh如何包装某些命令有关--也许它正在包装一个git命令?
有什么建议吗?
发布于 2014-07-30 09:42:48
来自连接文件
每次您当前的头部发生变化时,都会检查您的
Gemfile、Gemfile.lock或gem规范是否发生了变化。如果是这样,则运行bundle检查,如果这表明任何依赖项都不满意,则运行bundle安装。
由此,我认为gem会监听git checkout事件。因为您在代码中这样做,所以连接钩子就会活跃起来,并且会感到困惑(不管它是否是您的ruby应用程序的一部分)。
尝试卸载创业板,然后再试一次。
如果这解决了您的问题,您可以考虑向创业板的作者打开一个问题来解决这个问题。
https://stackoverflow.com/questions/25021077
复制相似问题