我有一个代码库,它有一个类似于:
require "rubygems"
::Gem::Specification.new do |specification|
specification.add_development_dependency "yard", "~> 0.9"
specification.add_runtime_dependency "dry-validation", "~> 0.13"
endbundle install将安装这两种依赖类型。因此,我只想安装CI脚本的运行时依赖项。我看到了bundle install --with <group>的存在,但我没有团队。交互运行时,返回的规范有一个从.groups返回的空结果。我很想把这两个世界合理化。必须为每个gem依赖项显式添加一个组吗?add_runtime_dependency和add_development_dependency有什么不同吗?
发布于 2020-10-24 16:06:51
来自邦德勒文件
由于Gemfile中有
gemspec方法调用,邦德勒将自动将此gem添加到一个名为“development”的组中,然后我们可以在任何时候使用以下行引用这些宝石: Bundler.require(:default,:development)
在您的示例中,如果您希望安装所有不用于开发的rubygems,请尝试
bundle install --without development对于未来的bundler版本,可以在本地(或全局)配置它。
bundle config set --local without 'development'要使其全部正常工作,请验证您的项目中有一个Gemfile,它将如下所示
# frozen_string_literal: true
source 'https://rubygems.org'
gemspechttps://stackoverflow.com/questions/64486486
复制相似问题