加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – rake release失败(使用gem bundler)

发布时间:2020-12-17 04:32:21 所属栏目:百科 来源:网络整理
导读:我在这里发布了我的第一个 rubygem: https://rubygems.org/gems/blomming_api (源代码: https://github.com/solyaris/blomming_api) 我使用了bundler,它使用bundle gem命令创建了三个rake任务: $rake -Trake build # Build blomming_api-0.3.7.gem into t
我在这里发布了我的第一个 rubygem: https://rubygems.org/gems/blomming_api
(源代码: https://github.com/solyaris/blomming_api)

我使用了bundler,它使用bundle gem命令创建了三个rake任务:

$rake -T
rake build    # Build blomming_api-0.3.7.gem into the pkg directory
rake install  # Build and install blomming_api-0.3.7.gem into system gems
rake release  # Create tag v0.3.7 and build and push blomming_api-0.3.7.gem to Rubygems

如果使用rake install在本地安装gem,那一切都很好:

$rake install
blomming_api 0.3.7 built to pkg/blomming_api-0.3.7.gem.
blomming_api (0.3.7) installed.

当我尝试发布时出现问题:

$rake release
blomming_api 0.3.7 built to pkg/blomming_api-0.3.7.gem.
Tagged v0.3.7.
Untagging v0.3.7 due to error.
rake aborted!
Couldn't git push. `git push  2>&1' failed with the following output:

fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>


/home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:104:in `perform_git_push'
/home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:96:in `git_push'
/home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:77:in `block in release_gem'
/home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:129:in `tag_version'
/home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:77:in `release_gem'
/home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:50:in `block in install'
Tasks: TOP => release
(See full trace by running task with --trace)

不过我可以使用成功的gem push命令发布gem:

$gem push pkg/blomming_api-0.3.7.gem
Pushing gem to https://rubygems.org...
Successfully registered gem: blomming_api (0.3.7)

我认为问题出在git push远程配置上……
有没有想过帮我配置git让rake发布运行?

顺便说一下,我已经在/home/solyaris/.gem上配置了我的rubygems凭据
并且git push在github上运行正常.
我知道……我的git不情愿很大;-)
谢谢
乔治

解决方法

命令rake release尝试将代码推送到远程存储库(隐式假设您正在使用git)并创建标记.

在您的情况下,看起来没有为您的存储库配置git远程并且任务失败.

我个人不喜欢这样的任务.我倾向于使用

$rake build

然后,构建包

$gem push pkg/...

将gem发布到RubyGems.

如果你想使用rake release我建议你覆盖默认实现来跳过/替换/自定义Git提交.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读