Skip to content

Commit

Permalink
Fix Ruby 3 compatibility (#60)
Browse files Browse the repository at this point in the history
- Replace various calls to `File.exists?` with `File.exist?`
- Update gem dependencies
  • Loading branch information
silug authored Aug 28, 2023
1 parent 175a325 commit e66c222
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2023-08-28 / 3.7.0 - Fix Ruby 3 compatibility
- Replace various calls to `File.exists?` with `File.exist?`
- Update gem dependencies

## 2023-05-15 / 3.6.3 - Update facter 4.4 factsets with legacy facts
- updated 4.4 factsets with legacy facts
- modified beaker task to include legacy facts in the future
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
# PUPPET_VERSION | specifies the version of the puppet gem to load
# FACTER_GEM_VERSION | specifies the version of the facter to load
puppetversion = ENV.fetch('PUPPET_VERSION', '~> 7.0')
puppetversion = ENV.fetch('PUPPET_VERSION', ['>= 7.0', '< 9.0'])
gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']

gem_sources.each { |gem_source| source gem_source }
Expand All @@ -21,8 +21,8 @@ group :test do
gem 'beaker-rspec'
gem 'beaker-windows'
gem 'simp-beaker-helpers', ['>= 1.25.0', '< 2.0']
gem 'puppetlabs_spec_helper', '~> 4.0'
gem 'puppetlabs_spec_helper', '~> 6.0'
# For EL9
gem 'net-ssh', :git => "https://github.com/net-ssh/net-ssh", :ref => 'v7.0.0.beta1'
gem 'net-ssh', '~> 7.0'
gem 'bcrypt_pbkdf' unless RUBY_PLATFORM == 'java'
end
2 changes: 1 addition & 1 deletion facts/scripts/gce_scrub_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def scrub_data(f)
ff = "#{f}.yaml"
File.open(ff,'w'){|fd| fd.puts data.to_yaml }
fb = f.sub(/.facts$/,'.facts.bak')
unless File.exists? fb
unless File.exist? fb
File.open(fb,'w'){|fd| fd.puts data}
warn "== wrote '#{fb}'"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/simp/rspec-puppet-facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def load_facts( fact_dir_path )
facter_xy_version = Facter.version.split('.')[0..1].join('.')
fact_dir = File.join(fact_dir_path,facter_xy_version)

unless File.exists? fact_dir
unless File.exist? fact_dir
_msg = "Can't find SIMP facts for Facter #{facter_xy_version}, skipping...
HINT: If this version of Facter has been released recently, try running
Expand Down
2 changes: 1 addition & 1 deletion lib/simp/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Simp; end
module Simp::RspecPuppetFacts
VERSION = '3.6.3'
VERSION = '3.7.0'
end
16 changes: 8 additions & 8 deletions simp-rspec-puppet-facts.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ Gem::Specification.new do |s|
s.files = Dir['Rakefile', '{bin,lib,facts,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z .`.split("\0")
s.test_files = Dir['Rakefile', '{spec,test,facts}/**/*'] & `git ls-files -z .`.split("\0")

s.add_runtime_dependency 'rspec-puppet-facts' , '>= 0'
s.add_development_dependency 'puppetlabs_spec_helper' , '>= 0'
s.add_development_dependency 'rake' , '~> 10'
s.add_development_dependency 'rspec' , '~> 3.2'
s.add_runtime_dependency 'rspec-puppet-facts', '>= 0'
s.add_development_dependency 'puppetlabs_spec_helper', '>= 0'
s.add_development_dependency 'rake', '>= 10', '< 14'
s.add_development_dependency 'rspec', '~> 3.2'

s.add_runtime_dependency 'json' , '>= 1.0'
s.add_runtime_dependency 'facter' , '>= 2.5.0', '< 5.0'
s.add_runtime_dependency 'json', '>= 1.0'
s.add_runtime_dependency 'facter', '>= 2.5.0', '< 5.0'

s.add_development_dependency 'pry' , '>= 0'
s.add_development_dependency 'tins' , '>= 1.6'
s.add_development_dependency 'pry', '>= 0'
s.add_development_dependency 'tins', '>= 1.6'

s.requirements << 'rspec-puppet-facts'
end

0 comments on commit e66c222

Please sign in to comment.