Skip to content

Commit 3e4abb0

Browse files
Merge pull request #9 from kate-goldenring/migrate-plugins-by-cp
Copy over preexisting plugins to new directory
2 parents 21bc552 + 8cccc0e commit 3e4abb0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Formula/spin.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ 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+
if File.directory?(source_dir) && !Dir.empty?(source_dir)
35+
ohai "Migrating Spin data from #{source_dir} to #{dest_dir}"
36+
mkdir_p dest_dir
37+
files = Dir.glob("#{source_dir}/*")
38+
39+
if files.any?
40+
files.each do |file|
41+
cp_r file, dest_dir, preserve: true
42+
end
43+
else
44+
ohai "No files to migrate from #{source_dir}"
45+
end
46+
end
47+
3148
# Install default templates and plugins for language tooling and deploying apps to the cloud.
3249
# Templates and plugins are installed into `pkgetc/"templates"` and `pkgetc/"plugins"`.
3350
system "#{bin}/spin", "templates", "install", "--git", "https://github.com/fermyon/spin", "--upgrade"

0 commit comments

Comments
 (0)