Module: Kettle::Jem::Appraisals::XStdLibsExclusion
- Defined in:
- lib/kettle/jem/appraisals/x_std_libs_exclusion.rb,
sig/kettle/jem/appraisals.rbs
Overview
Introspects the kettle-jem template's x_std_libs/vHEAD.gemfile to determine
which gems are already handled by the standard library extraction framework.
These gems should be excluded from appraisal matrix generation because they
are managed separately via the x_std_libs modular gemfiles.
Constant Summary collapse
- ALWAYS_EXCLUDED =
Returns gem names that are always excluded regardless of template content.
%w[version_gem].freeze
Class Method Summary collapse
-
.default_template_path ⇒ String?
Locates the
x_std_libs/vHEAD.gemfilein the installed kettle-jem gem. -
.excluded?(gem_name, exclusion_list: nil) ⇒ Boolean
Returns whether the gem should be excluded from the appraisal matrix.
-
.from_template(template_path = nil) ⇒ Array<String>
Parses the x_std_libs vHEAD template to extract the set of gems managed by the x_std_libs framework.
Class Method Details
.default_template_path ⇒ String?
Locates the x_std_libs/vHEAD.gemfile in the installed kettle-jem gem.
50 51 52 53 54 55 56 |
# File 'lib/kettle/jem/appraisals/x_std_libs_exclusion.rb', line 50 def default_template_path spec = Gem::Specification.find_by_name("kettle-jem") path = File.join(spec.gem_dir, "template", "gemfiles", "modular", "x_std_libs", "vHEAD.gemfile.example") File.exist?(path) ? path : nil rescue Gem::MissingSpecError nil end |
.excluded?(gem_name, exclusion_list: nil) ⇒ Boolean
Returns whether the gem should be excluded from the appraisal matrix.
64 65 66 |
# File 'lib/kettle/jem/appraisals/x_std_libs_exclusion.rb', line 64 def excluded?(gem_name, exclusion_list: nil) (exclusion_list || from_template).include?(gem_name) end |
.from_template(template_path = nil) ⇒ Array<String>
Parses the x_std_libs vHEAD template to extract the set of gems managed by the x_std_libs framework.
The template contains eval_gemfile lines like:
eval_gemfile "../erb/vHEAD.gemfile"
eval_gemfile "../mutex_m/vHEAD.gemfile"
This extracts the gem directory names (+erb+, mutex_m, etc.)
and merges them with ALWAYS_EXCLUDED.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/kettle/jem/appraisals/x_std_libs_exclusion.rb', line 33 def from_template(template_path = nil) template_path ||= default_template_path return ALWAYS_EXCLUDED.dup unless template_path && File.exist?(template_path) gems = File.readlines(template_path).filter_map { |line| if (match = line.match(%r{eval_gemfile\s+["']\.\./([\w-]+)/})) match[1] end } (gems + ALWAYS_EXCLUDED).uniq.freeze end |