mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add --zone
option to VCS
Which controls the timezone offset for `RUBY_RELEASE_DATE`.
This commit is contained in:
parent
5a5644dadc
commit
ab31d2e69f
Notes:
git
2022-09-30 12:49:34 +09:00
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue