From abb7f1b6ae350344b119afb02d700ef7f3dec9a2 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Fri, 7 Mar 2025 14:47:33 -0800 Subject: [PATCH] Migrate contents of Spin data directory to spinframework location Signed-off-by: Kate Goldenring --- Formula/spin.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Formula/spin.rb b/Formula/spin.rb index 1f5e7d0..c4e82cd 100644 --- a/Formula/spin.rb +++ b/Formula/spin.rb @@ -28,6 +28,18 @@ def install end def post_install + # Migrate plugins and templates and templates data to new data directory + source_dir = "#{HOMEBREW_PREFIX}/etc/fermyon-spin" + dest_dir = "#{HOMEBREW_PREFIX}/etc/spinframework-spin" + if File.directory?(source_dir) + ohai "Migrating Spin data from #{source_dir} to #{dest_dir}" + mkdir_p dest_dir + Dir.glob("#{source_dir}/*").each do |file| + mv(file, dest_dir) + end + Dir.rmdir(source_dir) if Dir.empty?(source_dir) # Remove if empty + end + # Install default templates and plugins for language tooling and deploying apps to the cloud. # Templates and plugins are installed into `pkgetc/"templates"` and `pkgetc/"plugins"`. system "#{bin}/spin", "templates", "install", "--git", "https://github.com/fermyon/spin", "--upgrade"