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

ruby-changes:74109

From: nagachika <ko1@a...>
Date: Tue, 18 Oct 2022 21:52:05 +0900 (JST)
Subject: [ruby-changes:74109] 9b1cf2c258 (ruby_3_1): merge revision(s) 762fca9b12b9cfb0159404c95ee4275100169c17:

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

From 9b1cf2c258f11b2931e2c5c34924e72a502618d4 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Tue, 18 Oct 2022 21:46:18 +0900
Subject: merge revision(s) 762fca9b12b9cfb0159404c95ee4275100169c17:

	Prefer `File` class methods to write a string

	---
	 tool/make-snapshot | 23 ++++++++++-------------
	 1 file changed, 10 insertions(+), 13 deletions(-)
---
 tool/make-snapshot | 23 ++++++++++-------------
 version.h          |  2 +-
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/tool/make-snapshot b/tool/make-snapshot
index 5c66d5b76f..eb6858e906 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -341,7 +341,7 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L341
     v = v[0]
   end
 
-  open("#{v}/revision.h", "wb") {|f|
+  File.open("#{v}/revision.h", "wb") {|f|
     short = vcs.short_revision(revision)
     f.puts "#define RUBY_REVISION #{short.inspect}"
     unless short == revision
@@ -387,6 +387,7 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L387
     return
   end
   def (clean = []).add(n) push(n); n end
+  def clean.create(file, content = "") File.binwrite(add(file), content) end
   Dir.chdir(v) do
     unless File.exist?("ChangeLog")
       vcs.export_changelog(url, nil, revision, "ChangeLog")
@@ -434,14 +435,12 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L435
       rescue Errno::ENOENT
         # use fallback file
       end
-      File.open(clean.add("config.status"), "w") {|f|
-        f.print status
-      }
+      clean.create("config.status", status)
       FileUtils.mkpath(hdrdir = "#{extout}/include/ruby")
-      File.open("#{hdrdir}/config.h", "w") {}
+      File.binwrite("#{hdrdir}/config.h", "")
       FileUtils.mkpath(defaults = "#{extout}/rubygems/defaults")
-      File.open("#{defaults}/operating_system.rb", "w") {}
-      File.open("#{defaults}/ruby.rb", "w") {}
+      File.binwrite("#{defaults}/operating_system.rb", "")
+      File.binwrite("#{defaults}/ruby.rb", "")
       miniruby = ENV['MINIRUBY'] + " -I. -I#{extout} -rcross"
       baseruby = ENV["BASERUBY"]
       mk = (IO.read("template/Makefile.in") rescue IO.read("Makefile.in")).
@@ -477,11 +476,9 @@ update-gems: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L476
 $(UNICODE_SRC_DATA_DIR)/.unicode-tables.time:
 touch-unicode-files:
       APPEND
-      open(clean.add("Makefile"), "w") do |f|
-        f.puts mk
-      end
-      File.open(clean.add("revision.tmp"), "w") {}
-      File.open(clean.add(".revision.time"), "w") {}
+      clean.create("Makefile", mk)
+      clean.create("revision.tmp")
+      clean.create(".revision.time")
       ENV["CACHE_SAVE"] = "no"
       make = MAKE.new(args)
       return unless make.run("update-download")
@@ -615,7 +612,7 @@ revisions.collect {|rev| package(vcs, rev, destdir, tmp)}.flatten.each do |name| https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L612
     success = false
     next
   end
-  str = open(name, "rb") {|f| f.read}
+  str = File.binread(name)
   pathname = Pathname(name)
   basename = pathname.basename.to_s
   extname = pathname.extname.sub(/\A\./, '')
diff --git a/version.h b/version.h
index fa917168d5..0cfbd23844 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L11
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 3
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 105
+#define RUBY_PATCHLEVEL 106
 
 #define RUBY_RELEASE_YEAR 2022
 #define RUBY_RELEASE_MONTH 10
-- 
cgit v1.2.3


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

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