Skip to content

Commit

Permalink
Unify ERB version definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jan 21, 2021
1 parent c68c947 commit 5df06b8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
source 'https://rubygems.org'

gemspec

gem 'rake'
gem 'test-unit'
9 changes: 8 additions & 1 deletion erb.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
begin
require_relative 'lib/erb/version'
rescue LoadError
# for Ruby core repository
require_relative 'version'
end

Gem::Specification.new do |spec|
spec.name = 'erb'
spec.version = '2.2.0'
spec.version = ERB.const_get(:VERSION, false)
spec.authors = ['Masatoshi SEKI']
spec.email = ['seki@ruby-lang.org']

Expand Down
5 changes: 3 additions & 2 deletions lib/erb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#
# You can redistribute it and/or modify it under the same terms as Ruby.

require "cgi/util"
require 'cgi/util'
require 'erb/version'

#
# = ERB -- Ruby Templating
Expand Down Expand Up @@ -260,7 +261,7 @@ class ERB

# Returns revision information for the erb.rb module.
def self.version
"erb.rb [2.2.0 #{ERB::Revision.split[1]}]"
"erb.rb [#{VERSION} #{ERB::Revision.split[1]}]"
end
end

Expand Down
5 changes: 5 additions & 0 deletions lib/erb/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: false
class ERB
VERSION = '2.2.0'
private_constant :VERSION
end

0 comments on commit 5df06b8

Please sign in to comment.