diff --git a/json-java.gemspec b/json-java.gemspec index b766fa2f..5a5b61a5 100644 --- a/json-java.gemspec +++ b/json-java.gemspec @@ -1,6 +1,10 @@ +version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line| + /^\s*VERSION\s*=\s*'(.*)'/ =~ line and break $1 +end rescue nil + spec = Gem::Specification.new do |s| s.name = "json" - s.version = File.read("VERSION").chomp + s.version = version s.summary = "JSON Implementation for Ruby" s.description = "A JSON implementation as a JRuby extension." diff --git a/json.gemspec b/json.gemspec index 9cd4ceee..33d21407 100644 --- a/json.gemspec +++ b/json.gemspec @@ -1,6 +1,10 @@ +version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line| + /^\s*VERSION\s*=\s*'(.*)'/ =~ line and break $1 +end rescue nil + Gem::Specification.new do |s| s.name = "json" - s.version = File.read(File.expand_path('../VERSION', __FILE__)).chomp + s.version = version s.summary = "JSON Implementation for Ruby" s.description = "This is a JSON implementation as a Ruby extension in C." diff --git a/json_pure.gemspec b/json_pure.gemspec index 7b42a714..26f1fb3a 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -1,6 +1,10 @@ +version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line| + /^\s*VERSION\s*=\s*'(.*)'/ =~ line and break $1 +end rescue nil + Gem::Specification.new do |s| s.name = "json_pure".freeze - s.version = File.read("VERSION").chomp + s.version = version s.summary = "JSON Implementation for Ruby".freeze s.description = "This is a JSON implementation in pure Ruby.".freeze