diff --git a/lib/open-uri.gemspec b/lib/open-uri.gemspec index cad63e4d80..b6aaf35200 100644 --- a/lib/open-uri.gemspec +++ b/lib/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"] diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 93e8cfcdb7..0052bb49fb 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -89,6 +89,9 @@ end # Author:: Tanaka Akira module OpenURI + + VERSION = "0.3.0" + Options = { :proxy => true, :proxy_http_basic_authentication => true,