Skip to content

Commit 757890a

Browse files
Merge pull request #2 from kate-goldenring/migrate-data-dir
Migrate contents of Spin data directory to spinframework location
2 parents c3bf0b5 + abb7f1b commit 757890a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Formula/spin.rb

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

3030
def post_install
31+
# Migrate plugins and templates and templates data to new data directory
32+
source_dir = "#{HOMEBREW_PREFIX}/etc/fermyon-spin"
33+
dest_dir = "#{HOMEBREW_PREFIX}/etc/spinframework-spin"
34+
if File.directory?(source_dir)
35+
ohai "Migrating Spin data from #{source_dir} to #{dest_dir}"
36+
mkdir_p dest_dir
37+
Dir.glob("#{source_dir}/*").each do |file|
38+
mv(file, dest_dir)
39+
end
40+
Dir.rmdir(source_dir) if Dir.empty?(source_dir) # Remove if empty
41+
end
42+
3143
# Install default templates and plugins for language tooling and deploying apps to the cloud.
3244
# Templates and plugins are installed into `pkgetc/"templates"` and `pkgetc/"plugins"`.
3345
system "#{bin}/spin", "templates", "install", "--git", "https://github.com/fermyon/spin", "--upgrade"

0 commit comments

Comments
 (0)