Class: CreateRubyGem::Compatibility::Matrix
- Inherits:
-
Object
- Object
- CreateRubyGem::Compatibility::Matrix
- Defined in:
- lib/create_ruby_gem/compatibility/matrix.rb
Overview
Static lookup table mapping Bundler version ranges to the bundle gem options each range supports.
This is the single source of truth for what each Bundler version can do. The wizard, validator, and builder all consult it.
Defined Under Namespace
Classes: Entry
Constant Summary collapse
- TABLE =
Returns all known Bundler compatibility entries.
[ Entry.new( requirement: Gem::Requirement.new('>= 2.4', '< 3.0'), supported_options: { exe: nil, coc: nil, ext: %w[c], git: nil, github_username: nil, mit: nil, test: %w[minitest rspec test-unit], ci: %w[circle github gitlab], edit: nil, bundle_install: nil } ), Entry.new( requirement: Gem::Requirement.new('>= 3.0', '< 4.0'), supported_options: { exe: nil, coc: nil, changelog: nil, ext: %w[c], git: nil, github_username: nil, mit: nil, test: %w[minitest rspec test-unit], ci: %w[circle github gitlab], linter: %w[rubocop standard], edit: nil, bundle_install: nil } ), Entry.new( requirement: Gem::Requirement.new('>= 4.0', '< 5.0'), supported_options: { exe: nil, coc: nil, changelog: nil, ext: %w[c go rust], git: nil, github_username: nil, mit: nil, test: %w[minitest rspec test-unit], ci: %w[circle github gitlab], linter: %w[rubocop standard], edit: nil, bundle_install: nil } ) ].freeze
Class Method Summary collapse
-
.for(bundler_version) ⇒ Entry
Finds the compatibility entry for the given Bundler version.
-
.supported_ranges ⇒ Array<String>
Returns human-readable version range strings for all entries.
Class Method Details
.for(bundler_version) ⇒ Entry
Finds the compatibility entry for the given Bundler version.
107 108 109 110 111 112 113 114 115 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 107 def self.for(bundler_version) version = Gem::Version.new(bundler_version.to_s) entry = TABLE.find { |candidate| candidate.match?(version) } return entry if entry = "Unsupported bundler version: #{version}. " += "Supported ranges: #{supported_ranges.join(' | ')}" raise UnsupportedBundlerVersionError, end |
.supported_ranges ⇒ Array<String>
Returns human-readable version range strings for all entries.
98 99 100 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 98 def self.supported_ranges TABLE.map { |entry| entry.requirement.requirements.map(&:join).join(', ') } end |