Skip to content

Commit 47bcad1

Browse files
committed
Expose UN::VERSION
1 parent 8f1c78e commit 47bcad1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/un.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,9 @@ def help
412412
end
413413

414414
module UN # :nodoc:
415+
416+
VERSION = "0.2.1"
417+
415418
module_function
416419
def help(argv, output: $stdout)
417420
all = argv.empty?

un.gemspec

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# frozen_string_literal: true
22

3+
name = File.basename(__FILE__, ".gemspec")
4+
version = ["lib", Array.new(name.count("-")+1).join("/")].find do |dir|
5+
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
6+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
7+
end rescue nil
8+
end
9+
310
Gem::Specification.new do |spec|
4-
spec.name = "un"
5-
spec.version = "0.2.1"
11+
spec.name = name
12+
spec.version = version
613
spec.authors = ["WATANABE Hirofumi"]
714
spec.email = ["eban@ruby-lang.org"]
815

0 commit comments

Comments
 (0)