diff --git a/.rubocop.yml b/.rubocop.yml index ab4ac3978..4b2266fde 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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' diff --git a/Gemfile b/Gemfile index 704560aa1..b1fe82ea5 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/puppet-strings.gemspec b/puppet-strings.gemspec index f6191c837..be932d0e0 100644 --- a/puppet-strings.gemspec +++ b/puppet-strings.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.email = 'info@puppet.com' 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', diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2e6598dc0..708e68a3c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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' @@ -22,6 +19,7 @@ end require 'mocha' +require 'mdl' require 'rspec' require 'json_spec' require 'puppet/version' @@ -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 } diff --git a/spec/unit/puppet-strings/markdown_spec.rb b/spec/unit/puppet-strings/markdown_spec.rb index 02ea5d46b..96246e58b 100644 --- a/spec/unit/puppet-strings/markdown_spec.rb +++ b/spec/unit/puppet-strings/markdown_spec.rb @@ -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