Skip to content

Commit 2450c1a

Browse files
committed
(#301) Update minimum Ruby version to 2.5.0
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.
1 parent c23ddf2 commit 2450c1a

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require: rubocop-performance
22
inherit_from: .rubocop_todo.yml
33

44
AllCops:
5-
TargetRubyVersion: 2.3
5+
TargetRubyVersion: 2.5
66
Exclude:
77
# Ignore HTML related things
88
- '**/*.erb'

Gemfile

+5-8
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,21 @@ group :test do
2222
gem 'simplecov-console'
2323
gem 'rspec', '~> 3.1'
2424
gem 'json_spec', '~> 1.1', '>= 1.1.5'
25-
gem 'mdl', '~> 0.8.0' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.4.0')
25+
gem 'mdl'
2626
end
2727

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

3633
group :development do
37-
gem 'github_changelog_generator', '~> 1.15' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')
34+
gem 'github_changelog_generator'
3835
gem 'pry'
3936
gem 'pry-byebug'
4037
end
4138

42-
gem 'rubocop', '~> 0.81.0' # last release that supports Ruby 2.3.0
39+
gem 'rubocop', '~> 0.81.0' # Requires work to upgrade
4340
gem 'rubocop-rspec'
4441
gem 'rubocop-performance'
4542

puppet-strings.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
1313
s.email = '[email protected]'
1414
s.homepage = 'https://github.com/puppetlabs/puppet-strings'
1515
s.description = s.summary
16-
s.required_ruby_version = '>= 2.3.0'
16+
s.required_ruby_version = '>= 2.5.0'
1717

1818
s.extra_rdoc_files = [
1919
'CHANGELOG.md',

spec/spec_helper.rb

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# frozen_string_literal: true
22

33
if ENV['COVERAGE'] == 'yes'
4+
require 'codecov'
45
require 'simplecov'
56
require 'simplecov-console'
67

78
SimpleCov.formatters = [
89
SimpleCov::Formatter::HTMLFormatter,
910
SimpleCov::Formatter::Console,
11+
SimpleCov::Formatter::Codecov,
1012
]
1113

12-
unless Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.3.0')
13-
require 'codecov'
14-
SimpleCov.formatters << SimpleCov::Formatter::Codecov
15-
end
16-
1714
SimpleCov.start do
1815
track_files 'lib/**/*.rb'
1916

@@ -22,6 +19,7 @@
2219
end
2320

2421
require 'mocha'
22+
require 'mdl'
2523
require 'rspec'
2624
require 'json_spec'
2725
require 'puppet/version'
@@ -54,15 +52,7 @@
5452
end
5553
end
5654

57-
def mdl_available
58-
@mdl_available ||= !Gem::Specification.select { |item| item.name.casecmp('mdl').zero? }.empty?
59-
end
60-
6155
def lint_markdown(content)
62-
return [] unless mdl_available
63-
64-
require 'mdl'
65-
6656
# Load default mdl ruleset
6757
ruleset = MarkdownLint::RuleSet.new.tap { |r| r.load_default }
6858

spec/unit/puppet-strings/markdown_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def parse_data_type_content
4646
let(:output) { PuppetStrings::Markdown.generate }
4747

4848
RSpec.shared_examples 'markdown lint checker' do |parameter|
49-
it 'should not generate markdown lint errors from the rendered markdown', if: mdl_available do
49+
it 'should not generate markdown lint errors from the rendered markdown' do
5050
expect(output).to have_no_markdown_lint_errors
5151
end
5252
end

0 commit comments

Comments
 (0)