Skip to content

Commit cf77c6b

Browse files
byrootmame
authored andcommitted
Expose Date::VERSION
An almost universal convention for gems is to expose `Namespace::VERSION` which makes it mcuh easier when debugging etc. Many gems extracted from ruby don't do this, even though it would be even more useful because they ship with ruby, so it's less clear which version it is.
1 parent 2dc0381 commit cf77c6b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

date.gemspec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# frozen_string_literal: true
2+
3+
version = File.foreach(File.expand_path("../lib/date.rb", __FILE__)).find do |line|
4+
/^\s*VERSION\s*=\s*["'](.*)["']/ =~ line and break $1
5+
end
6+
27
Gem::Specification.new do |s|
38
s.name = "date"
4-
s.version = '3.1.2'
9+
s.version = version
510
s.summary = "A subclass of Object includes Comparable module for handling dates."
611
s.description = "A subclass of Object includes Comparable module for handling dates."
712

lib/date.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require 'date_core'
55

66
class Date
7+
VERSION = '3.1.3' # :nodoc:
78

89
def infinite?
910
false

0 commit comments

Comments
 (0)