Skip to content

Commit

Permalink
Compatibility with newer ruby 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelaossa committed Aug 21, 2023
1 parent 604667b commit 04a0132
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ rvm:
- "2.4"
- "2.5"
- "2.6"
- "2.7"

before_install:
- ./cleanup_bundler
- gem install bundler -v '< 2'
script:
- bundle exec rake
- bundle exec script/sync-readme-usage
Expand Down
1 change: 1 addition & 0 deletions aptible-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'chronic_duration', '~> 0.10.6'
spec.add_dependency 'cbor'
spec.add_dependency 'aws-sdk', '~> 2.0'
spec.add_dependency 'bigdecimal', '~> 1.3.5' # https://github.com/ruby/bigdecimal#which-version-should-you-select

# Temporarily pin ffi until https://github.com/ffi/ffi/issues/868 is fixed
spec.add_dependency 'ffi', '<= 1.14.1' if Gem.win_platform?
Expand Down
14 changes: 14 additions & 0 deletions cleanup_bundler
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

# Newer rubies have Bundler 2.x installed as default so it can't be deleted
# We need Bundler 1.x

gempaths = `gem env gempath`.split(':')
gempaths.each do |gempath|
# lookup bundler-*.gemspec files and delete them
# this is the only way to completely cleanup default bundler
# Note: the bundler gemspecs' paths are different for CRuby and JRuby
Dir.glob(gempath.strip + '/specifications/**/bundler-*.gemspec').each do |p|
File.delete(p)
end
end

0 comments on commit 04a0132

Please sign in to comment.