在 Rails 应用程序的 gemfile 中使用 Bundler 和 :path 选项

发布于 2024-12-21 23:17:19 字数 275 浏览 4 评论 0原文

我正在开发一个 Rails 应用程序,它也在开发中使用 gem。在我的 Rails 应用程序中,我有

gem 'somegem', :path => '~/r/somegem'

但是,当我更改 somegem 中的代码时,它不会在我的 Rails 应用程序中更新。我不确定在进行更改后应该使用哪些捆绑器命令,或者是否需要这样做。重新启动 Rails 应用程序也没有帮助。

关于使用捆绑器和 :path 选项开发 Rails 应用程序有什么建议吗?

I am working on a rails app which uses a gem also in development. In my rails app, I have

gem 'somegem', :path => '~/r/somegem'

However, when I make changes to the code in somegem it does not update in my rails app. I'm not sure which bundler commands I should be using after making changes, or if I need to at all. Restarting the rails app doesn't help either.

Any suggestions on developing rails app with bundler and the :path option?

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

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

发布评论

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

评论(2

大姐,你呐 2024-12-28 23:17:19

运行此命令:

bundle install

此命令评估您的 Gemfile 并安装所有缺少的依赖项。它将从该位置重新打包您的 gem,并在您下次使用它时通过 bundle exec 使其可用。

另外,请务必使用以下命令启动服务器:

bundle exec rails s

以确保您正在使用捆绑包的 gems。

Run this command:

bundle install

This command evaluates your Gemfile and installs all missing dependencies. It will re-package your gem from that location and make it available via bundle exec next time you use it.

Also, be sure to start the server with:

bundle exec rails s

to be sure you're using your bundle's gems.

梦萦几度 2024-12-28 23:17:19

如捆绑程序网页中所示,使用 :path 时,不要忘记在代码顶部添加所需的 require。

require 'bundler/setup'

As indicated in the bundler webpage, don't forget to add the needed require at the top of your code when using :path.

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