有没有办法通过路径选项检测环境中的哪些 gem 是从源代码加载的?
IE:
# Gemfile
source 'rubygems.org'
gem 'rails'
gem 'rails-extension', path: '~/code/rails-extension'
.
# some_script.rb
require 'rubygems'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
if defined?(Bundler) and not Bundler.sourced_gems.empty?
puts "Using gems from source. Not safe to push to origin."
end