Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#301) Update minimum Ruby version to 2.5.0 #313

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = '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',
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