From 553ee7f02d891b5a140711aa5ae92548b83bd017 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Fri, 6 Nov 2020 13:43:34 -0500 Subject: [PATCH] macho: 2.4.0 (#284) * rubocop, gemspec: Enforce Ruby >= 2.5 This is the earliest Ruby we test in CI. * fat_file: RuboCop autocorrection * macho: 2.4.0 --- .rubocop.yml | 1 + lib/macho.rb | 2 +- lib/macho/fat_file.rb | 14 ++++++-------- ruby-macho.gemspec | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ee22ae7f5..572a4d0cd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,5 @@ AllCops: + TargetRubyVersion: 2.5 NewCops: enable Style/StringLiterals: diff --git a/lib/macho.rb b/lib/macho.rb index e8ab0dd19..20f413fca 100644 --- a/lib/macho.rb +++ b/lib/macho.rb @@ -16,7 +16,7 @@ # The primary namespace for ruby-macho. module MachO # release version - VERSION = "2.3.0" + VERSION = "2.4.0" # Opens the given filename as a MachOFile or FatFile, depending on its magic. # @param filename [String] the file being opened diff --git a/lib/macho/fat_file.rb b/lib/macho/fat_file.rb index f389159af..0eecdcf32 100644 --- a/lib/macho/fat_file.rb +++ b/lib/macho/fat_file.rb @@ -398,16 +398,14 @@ def each_macho(options = {}) errors = [] machos.each_with_index do |macho, index| - begin - yield macho - rescue RecoverableModificationError => e - e.macho_slice = index + yield macho + rescue RecoverableModificationError => e + e.macho_slice = index - # Strict mode: Immediately re-raise. Otherwise: Retain, check later. - raise e if strict + # Strict mode: Immediately re-raise. Otherwise: Retain, check later. + raise e if strict - errors << e - end + errors << e end # Non-strict mode: Raise first error if *all* Mach-O slices failed. diff --git a/ruby-macho.gemspec b/ruby-macho.gemspec index 2c0ade9b2..31c1f2879 100644 --- a/ruby-macho.gemspec +++ b/ruby-macho.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.authors = ["William Woodruff"] s.email = "william@yossarian.net" s.files = Dir["LICENSE", "README.md", ".yardopts", "lib/**/*"] - s.required_ruby_version = ">= 2.3" + s.required_ruby_version = ">= 2.5" s.homepage = "https://github.com/Homebrew/ruby-macho" s.license = "MIT" end