[前][次][番号順一覧][スレッド一覧]

ruby-changes:64977

From: Takashi <ko1@a...>
Date: Thu, 21 Jan 2021 14:43:48 +0900 (JST)
Subject: [ruby-changes:64977] 5f7df72b56 (master): [ruby/erb] Unify ERB version definitions

https://git.ruby-lang.org/ruby.git/commit/?id=5f7df72b56

From 5f7df72b56ebb741dcc1935897a79f42bc077bcf Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 20 Jan 2021 21:43:04 -0800
Subject: [ruby/erb] Unify ERB version definitions

https://github.com/ruby/erb/commit/5df06b8473

diff --git a/lib/erb.gemspec b/lib/erb.gemspec
index d310f40..bb3f10f 100644
--- a/lib/erb.gemspec
+++ b/lib/erb.gemspec
@@ -1,6 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/lib/erb.gemspec#L1
+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@r...']
 
diff --git a/lib/erb.rb b/lib/erb.rb
index f8533ef..48e0505 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -12,7 +12,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L12
 #
 # 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
@@ -260,7 +261,7 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L261
 
   # 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
 
diff --git a/lib/erb/version.rb b/lib/erb/version.rb
new file mode 100644
index 0000000..83a88f3
--- /dev/null
+++ b/lib/erb/version.rb
@@ -0,0 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/erb/version.rb#L1
+# frozen_string_literal: false
+class ERB
+  VERSION = '2.2.0'
+  private_constant :VERSION
+end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]