summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-14 11:06:40 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-14 12:42:36 +0900
commit8a06f1a69f987d37aa1b3701668a1a1b6c826667 (patch)
treeff411464786e519fc4e49543d4ceb7f0f46500c9 /ext
parent389ea0ae4c5607f0aa1c4b74e90c50493392a820 (diff)
downloadruby-8a06f1a69f987d37aa1b3701668a1a1b6c826667.tar.gz
[ruby/pathname] Expose Pathname::VERSION
https://github.com/ruby/pathname/commit/2b0b1a82ee
Diffstat (limited to 'ext')
-rw-r--r--ext/pathname/lib/pathname.rb2
-rw-r--r--ext/pathname/pathname.gemspec11
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 7bdfd0eb39..e0f38b2b37 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -14,6 +14,8 @@ require 'pathname.so'
class Pathname
+ VERSION = "0.2.1"
+
# :stopdoc:
# to_path is implemented so Pathname objects are usable with File.open, etc.
diff --git a/ext/pathname/pathname.gemspec b/ext/pathname/pathname.gemspec
index 92bc02b0db..890bc2fde9 100644
--- a/ext/pathname/pathname.gemspec
+++ b/ext/pathname/pathname.gemspec
@@ -1,6 +1,13 @@
+name = File.basename(__FILE__, ".gemspec")
+version = ["lib", "ext/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 = "pathname"
- spec.version = "0.2.1"
+ spec.name = name
+ spec.version = version
spec.authors = ["Tanaka Akira"]
spec.email = ["akr@fsij.org"]