Skip to content

Commit b007c47

Browse files
Copy over preexisting plugins to new directory
Signed-off-by: Kate Goldenring <[email protected]>
1 parent 21bc552 commit b007c47

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Formula/spin.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ def install
2828
end
2929

3030
def post_install
31+
# Migrate plugins and templates and templates data to new data directory
32+
source_dir = etc/"fermyon-spin"
33+
dest_dir = etc/"spinframework-spin"
34+
35+
if File.directory?(source_dir) && !Dir.empty?(source_dir)
36+
ohai "Migrating Spin data from #{source_dir} to #{dest_dir}"
37+
mkdir_p dest_dir
38+
files = Dir.glob("#{source_dir}/*")
39+
40+
if files.any?
41+
files.each do |file|
42+
cp_r file, dest_dir, preserve: true # Copy with permissions preserved
43+
end
44+
else
45+
ohai "No files to migrate from #{source_dir}"
46+
end
47+
end
48+
3149
# Install default templates and plugins for language tooling and deploying apps to the cloud.
3250
# Templates and plugins are installed into `pkgetc/"templates"` and `pkgetc/"plugins"`.
3351
system "#{bin}/spin", "templates", "install", "--git", "https://github.com/fermyon/spin", "--upgrade"

0 commit comments

Comments
 (0)