Skip to content

Commit

Permalink
Fix loading the gemspec file from rake with Ruby 3.3.
Browse files Browse the repository at this point in the history
Calculating the current directory name from within the gemspec would
fail.

`__FILE__` was '(eval)' with Ruby < 3.3. `File.dirname(__FILE__)` is
'.'.

`__FILE__` is '(eval at /path/Rakefile:linenumber)' with Ruby >= 3.3.
`File.dirname(__FILE__)` is '(eval at /path'.
  • Loading branch information
philr committed Dec 16, 2023
1 parent 4197543 commit 9e04c58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -11,11 +11,11 @@ rescue LoadError, RuntimeError
end

BASE_DIR = File.expand_path(File.dirname(__FILE__))
GEMSPEC_PATH = File.join(BASE_DIR, 'tzinfo.gemspec')
spec = TOPLEVEL_BINDING.eval(File.read(GEMSPEC_PATH), GEMSPEC_PATH)

task default: [:test]

spec = eval(File.read('tzinfo.gemspec'))

class TZInfoPackageTask < Gem::PackageTask
alias_method :orig_sh, :sh
private :orig_sh
Expand Down

0 comments on commit 9e04c58

Please sign in to comment.