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

ruby-changes:73800

From: Nobuyoshi <ko1@a...>
Date: Fri, 30 Sep 2022 12:49:30 +0900 (JST)
Subject: [ruby-changes:73800] ab31d2e69f (master): Add `--zone` option to `VCS`

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

From ab31d2e69fc8602514b19c90d3f6cc3d6893eb58 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 29 Sep 2022 20:08:56 +0900
Subject: Add `--zone` option to `VCS`

Which controls the timezone offset for `RUBY_RELEASE_DATE`.
---
 tool/lib/vcs.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb
index 8944189bce..3b60385e59 100644
--- a/tool/lib/vcs.rb
+++ b/tool/lib/vcs.rb
@@ -95,11 +95,12 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L95
     parser.separator("  VCS common options:")
     parser.define("--[no-]dryrun") {|v| opts[:dryrun] = v}
     parser.define("--[no-]debug") {|v| opts[:debug] = v}
+    parser.define("-z", "--zone=OFFSET", /\A[-+]\d\d:\d\d\z/) {|v| opts[:zone] = v}
     opts
   end
 
   def release_date(time)
-    t = time.utc
+    t = time.getlocal(@zone)
     [
       t.strftime('#define RUBY_RELEASE_YEAR %Y'),
       t.strftime('#define RUBY_RELEASE_MONTH %-m'),
@@ -128,6 +129,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L129
   def set_options(opts)
     @debug = opts.fetch(:debug) {$DEBUG}
     @dryrun = opts.fetch(:dryrun) {@debug}
+    @zone = opts.fetch(:zone) {'+09:00'}
   end
 
   attr_reader :dryrun, :debug
-- 
cgit v1.2.1


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

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