summaryrefslogtreecommitdiff
path: root/lib/ostruct/ostruct.gemspec
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ostruct/ostruct.gemspec')
-rw-r--r--lib/ostruct/ostruct.gemspec14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/ostruct/ostruct.gemspec b/lib/ostruct/ostruct.gemspec
index 4f8507045e..a070e296c0 100644
--- a/lib/ostruct/ostruct.gemspec
+++ b/lib/ostruct/ostruct.gemspec
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-begin
- require_relative "lib/ostruct/version"
-rescue LoadError
- # for Ruby core repository
- require_relative "version"
+name = File.basename(__FILE__, ".gemspec")
+version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
+ break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
+ /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
+ end rescue nil
end
Gem::Specification.new do |spec|
- spec.name = "ostruct"
- spec.version = OpenStruct::VERSION
+ spec.name = name
+ spec.version = version
spec.authors = ["Marc-Andre Lafortune"]
spec.email = ["ruby-core@marc-andre.ca"]