Module: StillActive::BundlerHelper

Extended by:
BundlerHelper
Included in:
BundlerHelper
Defined in:
lib/helpers/bundler_helper.rb

Instance Method Summary collapse

Instance Method Details

#gemfile_dependencies(gemfile_path: StillActive.config.gemfile_path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/helpers/bundler_helper.rb', line 7

def gemfile_dependencies(gemfile_path: StillActive.config.gemfile_path)
  ::Bundler::SharedHelpers.set_env("BUNDLE_GEMFILE", File.expand_path(gemfile_path))
  gemfile_gems = ::Bundler.definition.dependencies.map(&:name)
  Bundler
    .definition
    .locked_gems
    .specs
    .select { |spec| gemfile_gems.include?(spec.name) }
    .each_with_object([]) { |spec, array| array << { name: spec.name, version: spec.version.version } }
end