summaryrefslogtreecommitdiff
path: root/tool/lib/vcs.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-29 20:08:56 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-30 10:39:43 +0900
commitab31d2e69fc8602514b19c90d3f6cc3d6893eb58 (patch)
treef0735878a5e7365e53c92aabf64d131b4296749f /tool/lib/vcs.rb
parent5a5644dadcd5e00b571d0029af4d96849e254cd4 (diff)
downloadruby-ab31d2e69fc8602514b19c90d3f6cc3d6893eb58.tar.gz
Add `--zone` option to `VCS`
Which controls the timezone offset for `RUBY_RELEASE_DATE`.
Diffstat (limited to 'tool/lib/vcs.rb')
-rw-r--r--tool/lib/vcs.rb4
1 files changed, 3 insertions, 1 deletions
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
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
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