Class: BundlerSkills::Discoverer

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler_skills/discoverer.rb

Overview

Finds skills bundled in the resolved dependency gems.

This is the ONLY place that touches the Bundler spec API. The default ‘specs` come from Bundler.load.specs, which reflects the current environment’s resolved gems (includes development/test groups unless ‘without` excludes them). Each spec exposes full_gem_path / name / version and works for rubygems, path and git sources alike.

Constant Summary collapse

SKILL_FILE =
"SKILL.md"

Instance Method Summary collapse

Constructor Details

#initialize(specs: nil, config: Config.new(Config::DEFAULTS), logger: nil) ⇒ Discoverer

Returns a new instance of Discoverer.



16
17
18
19
20
# File 'lib/bundler_skills/discoverer.rb', line 16

def initialize(specs: nil, config: Config.new(Config::DEFAULTS), logger: nil)
  @specs = specs
  @config = config
  @logger = logger
end

Instance Method Details

#discoverArray<DiscoveredSkill>

Returns:



23
24
25
# File 'lib/bundler_skills/discoverer.rb', line 23

def discover
  specs.flat_map { |spec| skills_in(spec) }.compact
end