Module: Kettle::Jem::Appraisals::GemAbbreviations
- Defined in:
- lib/kettle/jem/appraisals/gem_abbreviations.rb,
sig/kettle/jem/appraisals.rbs
Overview
Registry of common gem name abbreviations for appraisal naming.
All generated appraisal names are prefixed with PREFIX so that regeneration can reliably identify and remove stale entries.
Naming format: kja-{tier1-abbrev}-{t1-version}-{tier2-abbrev}-{t2-version}-{ruby-series}
Constant Summary collapse
- PREFIX =
Returns prefix applied to every generated appraisal name, used to identify entries managed by kettle-jem-appraisals for cleanup.
"kja"- ABBREVIATIONS =
Returns mapping of full gem names to short abbreviations.
{ "activerecord" => "ar", "actionmailer" => "am", "actionpack" => "ap", "activesupport" => "as", "activejob" => "aj", "actioncable" => "ac", "actionview" => "av", "activestorage" => "ast", "actionmailbox" => "amb", "actiontext" => "at", "omniauth" => "oa", "mongoid" => "mo", "sequel" => "sq", "couch_potato" => "cp", "rom" => "rom", "rom-sql" => "rsql" }.freeze
Class Method Summary collapse
-
.abbreviate(gem_name) ⇒ String
Returns the abbreviation for a gem name.
-
.appraisal_name(tier1_gem, tier1_version, tier2_gem, tier2_version, ruby_series) ⇒ String
Builds a full appraisal name from tier1, tier2, and ruby series components.
-
.format_version(version) ⇒ String
Formats a version string for use in appraisal names.
Class Method Details
.abbreviate(gem_name) ⇒ String
Returns the abbreviation for a gem name.
Falls back to the full gem name (with hyphens preserved) when no abbreviation is registered in ABBREVIATIONS.
53 54 55 |
# File 'lib/kettle/jem/appraisals/gem_abbreviations.rb', line 53 def abbreviate(gem_name) ABBREVIATIONS.fetch(gem_name, gem_name) end |
.appraisal_name(tier1_gem, tier1_version, tier2_gem, tier2_version, ruby_series) ⇒ String
Builds a full appraisal name from tier1, tier2, and ruby series components.
All names are prefixed with PREFIX for reliable cleanup on regeneration.
When tier2_gem is nil, the tier2 segment is omitted.
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/kettle/jem/appraisals/gem_abbreviations.rb', line 87 def appraisal_name(tier1_gem, tier1_version, tier2_gem, tier2_version, ruby_series) parts = [ PREFIX, abbreviate(tier1_gem), format_version(tier1_version) ] if tier2_gem parts << abbreviate(tier2_gem) parts << format_version(tier2_version) end parts << ruby_series parts.join("-") end |
.format_version(version) ⇒ String
Formats a version string for use in appraisal names.
Replaces dots with hyphens so the name is safe for filenames and shell identifiers.
66 67 68 |
# File 'lib/kettle/jem/appraisals/gem_abbreviations.rb', line 66 def format_version(version) version.to_s.tr(".", "-") end |