Skip to content

Commit

Permalink
Expose Date::VERSION
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
byroot committed Nov 17, 2021
1 parent d034d92 commit fef7ec1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion date.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# frozen_string_literal: true

version = File.foreach(File.expand_path("../lib/date.rb", __FILE__)).find do |line|
/^\s*VERSION\s*=\s*["'](.*)["']/ =~ line and break $1
end

Gem::Specification.new do |s|
s.name = "date"
s.version = '3.2.1'
s.version = version
s.summary = "A subclass of Object includes Comparable module for handling dates."
s.description = "A subclass of Object includes Comparable module for handling dates."

Expand Down
1 change: 1 addition & 0 deletions lib/date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'date_core'

class Date
VERSION = '3.2.1' # :nodoc:

def infinite?
false
Expand Down

0 comments on commit fef7ec1

Please sign in to comment.