Skip to content

Commit

Permalink
(puppetlabs#301) Update minimum Ruby version to 2.5.0
Browse files Browse the repository at this point in the history
Previously, the minimum Ruby version was 2.3.0, but it was dificult to
get it working and some of the code had been updated to use features as
new as 2.4.6.

This clears out code that checked for old Ruby versions, and removes
some version constraints in Gemfile that were needed to work with Ruby
2.3.0.
  • Loading branch information
danielparks committed Sep 26, 2022
1 parent c23ddf2 commit 2450c1a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require: rubocop-performance
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 2.5
Exclude:
# Ignore HTML related things
- '**/*.erb'
Expand Down
13 changes: 5 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,21 @@ group :test do
gem 'simplecov-console'
gem 'rspec', '~> 3.1'
gem 'json_spec', '~> 1.1', '>= 1.1.5'
gem 'mdl', '~> 0.8.0' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.4.0')
gem 'mdl'
end

group :acceptance do
# Litmus has dependencies which require Ruby 2.5 (Puppet 6) or above.
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.5.0')
gem 'puppet_litmus', '~> 0.18'
gem 'net-ssh', '~> 5.2'
end
gem 'puppet_litmus'
gem 'net-ssh'
end

group :development do
gem 'github_changelog_generator', '~> 1.15' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')
gem 'github_changelog_generator'
gem 'pry'
gem 'pry-byebug'
end

gem 'rubocop', '~> 0.81.0' # last release that supports Ruby 2.3.0
gem 'rubocop', '~> 0.81.0' # Requires work to upgrade
gem 'rubocop-rspec'
gem 'rubocop-performance'

Expand Down
2 changes: 1 addition & 1 deletion puppet-strings.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.email = '[email protected]'
s.homepage = 'https://github.com/puppetlabs/puppet-strings'
s.description = s.summary
s.required_ruby_version = '>= 2.3.0'
s.required_ruby_version = '>= 2.5.0'

s.extra_rdoc_files = [
'CHANGELOG.md',
Expand Down
16 changes: 3 additions & 13 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# frozen_string_literal: true

if ENV['COVERAGE'] == 'yes'
require 'codecov'
require 'simplecov'
require 'simplecov-console'

SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console,
SimpleCov::Formatter::Codecov,
]

unless Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.3.0')
require 'codecov'
SimpleCov.formatters << SimpleCov::Formatter::Codecov
end

SimpleCov.start do
track_files 'lib/**/*.rb'

Expand All @@ -22,6 +19,7 @@
end

require 'mocha'
require 'mdl'
require 'rspec'
require 'json_spec'
require 'puppet/version'
Expand Down Expand Up @@ -54,15 +52,7 @@
end
end

def mdl_available
@mdl_available ||= !Gem::Specification.select { |item| item.name.casecmp('mdl').zero? }.empty?
end

def lint_markdown(content)
return [] unless mdl_available

require 'mdl'

# Load default mdl ruleset
ruleset = MarkdownLint::RuleSet.new.tap { |r| r.load_default }

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet-strings/markdown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def parse_data_type_content
let(:output) { PuppetStrings::Markdown.generate }

RSpec.shared_examples 'markdown lint checker' do |parameter|
it 'should not generate markdown lint errors from the rendered markdown', if: mdl_available do
it 'should not generate markdown lint errors from the rendered markdown' do
expect(output).to have_no_markdown_lint_errors
end
end
Expand Down

0 comments on commit 2450c1a

Please sign in to comment.