aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/tsort.gemspec11
-rw-r--r--lib/tsort.rb3
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/tsort.gemspec b/lib/tsort.gemspec
index a82393b70b..bd1f55ec7a 100644
--- a/lib/tsort.gemspec
+++ b/lib/tsort.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 = "tsort"
- spec.version = "0.1.1"
+ spec.name = name
+ spec.version = version
spec.authors = ["Tanaka Akira"]
spec.email = ["akr@fsij.org"]
diff --git a/lib/tsort.rb b/lib/tsort.rb
index 00ee609d64..3a2a91a7b4 100644
--- a/lib/tsort.rb
+++ b/lib/tsort.rb
@@ -122,6 +122,9 @@
#
module TSort
+
+ VERSION = "0.1.1"
+
class Cyclic < StandardError
end