summaryrefslogtreecommitdiff
path: root/tool/sync_default_gems.rb
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2023-06-20 11:46:51 -0400
committerTakashi Kokubun <takashikkbn@gmail.com>2023-06-21 11:25:39 -0700
commit03f1a6c4c57c469e8fb5858cf9676b6479f4610d (patch)
treecc95634cb8bb7cd70faee6f2def22b16d7d80636 /tool/sync_default_gems.rb
parenta87bce86bb2a7581943355b41abaf41a6ad18218 (diff)
[Feature #19741] Add yarp to `tool/sync_default_gems.rb` sync script
The default gems sync script now includes YARP, found in the ruby/yarp repo. This script primarily syncs over the src, test, lib directories. It also migrates all encoding files to be prefixed with `yp_` in order to deconflict from existing encoding files.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7964
Diffstat (limited to 'tool/sync_default_gems.rb')
-rwxr-xr-xtool/sync_default_gems.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 48f5406be4..316bbc0891 100755
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -80,6 +80,7 @@ module SyncDefaultGems
syntax_suggest: ["ruby/syntax_suggest", "main"],
un: "ruby/un",
win32ole: "ruby/win32ole",
+ yarp: "ruby/yarp",
}
CLASSICAL_DEFAULT_BRANCH = "master"
@@ -396,6 +397,31 @@ module SyncDefaultGems
rm_rf(%w[spec/syntax_suggest libexec/syntax_suggest])
cp_r("#{upstream}/spec", "spec/syntax_suggest")
cp_r("#{upstream}/exe/syntax_suggest", "libexec/syntax_suggest")
+ when "yarp"
+ # We don't want to remove yarp_init.c, so we temporarily move it
+ # out of the yarp dir, wipe the yarp dir, and then put it back
+ mv("yarp/yarp_init.c", ".") if File.exist? "yarp/yarp_init.c"
+ rm_rf(%w[test/yarp yarp])
+
+ # Run the YARP templating scripts
+ system("ruby #{upstream}/templates/template.rb")
+ cp_r("#{upstream}/ext/yarp", "yarp")
+ cp_r("#{upstream}/lib/.", "lib")
+ cp_r("#{upstream}/test", "test/yarp")
+ cp_r("#{upstream}/src/.", "yarp")
+
+ # Move all files in enc to be prefixed with yp_ in order
+ # to deconflict them from non-yarp enc files
+ (Dir.entries("yarp/enc/") - ["..", "."]).each do |f|
+ mv "yarp/enc/#{f}", "yarp/enc/yp_#{f}"
+ end
+
+ cp_r("#{upstream}/include/yarp/.", "yarp")
+ cp_r("#{upstream}/include/yarp.h", "yarp")
+
+ rm("yarp/extconf.rb")
+
+ mv("yarp_init.c", "yarp/")
else
sync_lib gem, upstream
end