summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-30 14:19:53 +0900
committergit <svn-admin@ruby-lang.org>2023-04-03 02:45:18 +0000
commitba4f01f0a03403bea72b129e5935f5a4b79b9402 (patch)
tree2bcf82c182935d1d3a32049229bee26779b0cbf2
parent6dcd39997679914dad1c23f95adb3f7d84ec5942 (diff)
downloadruby-ba4f01f0a03403bea72b129e5935f5a4b79b9402.tar.gz
[ruby/yaml] Expose YAML::VERSION
https://github.com/ruby/yaml/commit/8776bc2634
-rw-r--r--lib/yaml.rb1
-rw-r--r--lib/yaml/yaml.gemspec11
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/yaml.rb b/lib/yaml.rb
index 6d5d5ebd4c..cdacfaf69e 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -66,4 +66,5 @@ YAML = Psych # :nodoc:
#
# Syck can also be found on github: https://github.com/ruby/syck
module YAML
+ VERSION = "0.2.1"
end
diff --git a/lib/yaml/yaml.gemspec b/lib/yaml/yaml.gemspec
index 80554d8a7a..afe65a2c64 100644
--- a/lib/yaml/yaml.gemspec
+++ b/lib/yaml/yaml.gemspec
@@ -1,6 +1,13 @@
+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 = "yaml"
- spec.version = "0.2.1"
+ spec.name = name
+ spec.version = version
spec.authors = ["Aaron Patterson", "SHIBATA Hiroshi"]
spec.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org"]