Skip to content

Commit 651622f

Browse files
authored
Merge pull request #30 from ruby/expose-gem-version
Expose Pathname::VERSION
2 parents 4c2952a + 2b0b1a8 commit 651622f

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

lib/pathname.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
class Pathname
1616

17+
VERSION = "0.2.1"
18+
1719
# :stopdoc:
1820

1921
# to_path is implemented so Pathname objects are usable with File.open, etc.

pathname.gemspec

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
name = File.basename(__FILE__, ".gemspec")
2+
version = ["lib", "ext/lib"].find do |dir|
3+
break File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line|
4+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
5+
end rescue nil
6+
end
7+
18
Gem::Specification.new do |spec|
2-
spec.name = "pathname"
3-
spec.version = "0.2.1"
9+
spec.name = name
10+
spec.version = version
411
spec.authors = ["Tanaka Akira"]
512
spec.email = ["akr@fsij.org"]
613

0 commit comments

Comments
 (0)