From e26a740efff7ef533fc68192d41328f6d09f33f0 Mon Sep 17 00:00:00 2001 From: Nathan Bush Date: Mon, 3 Jan 2022 12:44:05 -0500 Subject: [PATCH 1/4] Ruby 2.2.x + Gettext 2.3.9 --- lib/locale/driver/win32.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/locale/driver/win32.rb b/lib/locale/driver/win32.rb index a912984..dbeb624 100644 --- a/lib/locale/driver/win32.rb +++ b/lib/locale/driver/win32.rb @@ -22,7 +22,20 @@ require "locale/driver/env" require "locale/driver/win32_table" -require "dl/import" +if RUBY_VERSION < "2.1" + require "dl/import" +else + require 'fiddle/import' + + # For now map DL to Fiddler versus updating all the code below + # net-ssh did it first + module DL + CPtr ||= Fiddle::Pointer + if RUBY_PLATFORM != "java" + RUBY_FREE ||= Fiddle::RUBY_FREE + end + end +end module Locale # Locale::Driver::Win32 module for win32. From c42d812233742457558b1b73602e90bc52d86fd5 Mon Sep 17 00:00:00 2001 From: nathan-nhm Date: Mon, 3 Jan 2022 12:54:13 -0500 Subject: [PATCH 2/4] Update version.rb Version bump --- lib/locale/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/locale/version.rb b/lib/locale/version.rb index 65d52cc..b11ca14 100644 --- a/lib/locale/version.rb +++ b/lib/locale/version.rb @@ -7,6 +7,6 @@ license terms as Ruby. =end module Locale - VERSION = "2.0.9" + VERSION = "2.0.10" end From 2093b0f388ec3e6c2f835767acdfa9b8042ad680 Mon Sep 17 00:00:00 2001 From: nathan-nhm Date: Mon, 3 Jan 2022 12:58:25 -0500 Subject: [PATCH 3/4] required_ruby_version has been historically ignored --- locale.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locale.gemspec b/locale.gemspec index adcb0e8..f06ec20 100644 --- a/locale.gemspec +++ b/locale.gemspec @@ -44,6 +44,8 @@ Ruby-Locale is the pure ruby library which provides basic APIs for localization. s.test_files = Dir.glob("test/test_*.rb") end + s.required_ruby_version = "< 2.3.0" + s.add_development_dependency("rake") s.add_development_dependency("bundler") s.add_development_dependency("yard") From df1d15bf638e194c12b55d0c5c7e55cb5e93e149 Mon Sep 17 00:00:00 2001 From: Nathan Bush Date: Mon, 3 Jan 2022 13:35:22 -0500 Subject: [PATCH 4/4] DL::Importer not in ruby 2.2 --- lib/locale/driver/win32.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/locale/driver/win32.rb b/lib/locale/driver/win32.rb index dbeb624..ea38808 100644 --- a/lib/locale/driver/win32.rb +++ b/lib/locale/driver/win32.rb @@ -25,6 +25,7 @@ if RUBY_VERSION < "2.1" require "dl/import" else + require 'fiddle' require 'fiddle/import' # For now map DL to Fiddler versus updating all the code below @@ -43,8 +44,13 @@ module Locale # This is a low-level class. Application shouldn't use this directly. module Driver module Win32 + module Kernel32 - extend DL::Importer + if RUBY_VERSION < "2.1" + extend DL::Importer + else + extend Fiddle::Importer + end dlload "kernel32.dll" extern "int GetThreadLocale()" end