From 666768d960d44f76b419e9f0f737a394b414f20b Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 30 Mar 2023 13:14:25 +0900 Subject: [PATCH] Expose OpenURI::VERSION --- lib/open-uri.rb | 3 +++ open-uri.gemspec | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 93e8cfc..0052bb4 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -89,6 +89,9 @@ def self.open(name, *rest, &block) # Author:: Tanaka Akira module OpenURI + + VERSION = "0.3.0" + Options = { :proxy => true, :proxy_http_basic_authentication => true, diff --git a/open-uri.gemspec b/open-uri.gemspec index cad63e4..b6aaf35 100644 --- a/open-uri.gemspec +++ b/open-uri.gemspec @@ -1,6 +1,13 @@ +name = File.basename(__FILE__, ".gemspec") +version = ["lib", "."].find do |dir| + break File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line| + /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 + end rescue nil +end + Gem::Specification.new do |spec| - spec.name = "open-uri" - spec.version = "0.3.0" + spec.name = name + spec.version = version spec.authors = ["Tanaka Akira"] spec.email = ["akr@fsij.org"]