gpt4 book ai didi

ruby-on-rails - Bundler 正在弃用 bundle 控制台以支持 bin/console。谁能更清楚地说明 bin/console 应该如何工作?

转载 作者:行者123 更新时间:2023-12-03 23:46:45 28 4
gpt4 key购买 nike

我有一个自定义的 ruby​​ gem,它严重依赖于 bundle console .没有什么特别或花哨的,只是一个交互式控制台,其中包含 Gemfile 定义的一组 gem。我们在开发过程中经常使用控制台。

目前,当我运行命令时,我收到以下弃用消息:

[DEPRECATED] bundle console will be replaced by bin/console generated by bundle gem <name>



bundler docs 中挖掘我找到了以下解释:

  • The bundle console will be removed and replaced with bin/console.

Over time we found bundle console hard to maintain because every user would want to add her own specific tweaks to it. In order to ease maintenance and reduce bikeshedding discussions, we're removing the bundle console command in favor of a bin/console script created by bundle gem on gem generation that users can tweak to their needs.



有没有懂的人能提供更详细的解释吗?该 gem 目前没有 bin目录。我很高兴制作一个,我只是不确定文件中应该包含什么。运行 bundle gem如上面注释中所述,会引发错误(如预期)。

最佳答案

这是在 bin/console 生成的文件:

#!/usr/bin/env ruby

require "bundler/setup"
require "(your gem name here)"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
您可以在 ruby​​gems GitHub repo 中看到模板.

关于ruby-on-rails - Bundler 正在弃用 bundle 控制台以支持 bin/console。谁能更清楚地说明 bin/console 应该如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62289286/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com