Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 为什么bundler加载的是我所有的宝石而不是特定的宝石_Ruby_Bundler - Fatal编程技术网

Ruby 为什么bundler加载的是我所有的宝石而不是特定的宝石

Ruby 为什么bundler加载的是我所有的宝石而不是特定的宝石,ruby,bundler,Ruby,Bundler,我有一个Sinatra应用程序,我试图在我的Gemfile中使用组,以便只加载指定的Gem。但是,当我限制只加载一个组时,bundler仍然加载文件中的每个gem。这是我的档案: source 'https://rubygems.org' group :one do gem 'sinatra' end group :two do gem 'bitly' end 这是我的申请表: require 'bundler/setup' Bundler.require(:one) clas

我有一个Sinatra应用程序,我试图在我的Gemfile中使用组,以便只加载指定的Gem。但是,当我限制只加载一个组时,bundler仍然加载文件中的每个gem。这是我的档案:

source 'https://rubygems.org'

group :one do
  gem 'sinatra'
end

group :two do 
  gem 'bitly'
end
这是我的申请表:

require 'bundler/setup'
Bundler.require(:one)

class App < Sinatra::Base

  configure do
    puts Gem.loaded_specs.keys.sort.join("\t")
  end

  get '/foo' do
  end

end
需要“捆绑机/设置”
Bundler.require(:一个)
类应用程序
当应用程序启动时,我可以清楚地看到加载的Bitly gem。我做错了什么?

使用

require 'bundler'
而不是

require 'bundler/setup'
最后一个自动加载Gemfile中的所有gem: