Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
789 views
in Technique[技术] by (71.8m points)

git - How would you put an AppleScript script under version control?

I was wondering if this was the best solution:

  • Put the .applescript files under version control
  • Create an installation script to compile the files with osacompile

But there is also the .scptd directory. Or I could put both .applescript and .scpt files under version control?

What is the best solution?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I love @DanielTrebbien's solution, but it is a little too complex for me to expect people to implement in order to use for my github project. A simpler option that just empowers you to see text changes in the diff is to tell the diff process to textconv with osadecompile.

Add to .gitattributes

*.scpt diff=scpt

Add to .git/config

[diff "scpt"]
  textconv = osadecompile
  binary=true

Here is sample diff from my AppleScript-droplet github project

$ git diff
--- a/AppleScript-droplet.app/Contents/Resources/Scripts/main.scpt
+++ b/AppleScript-droplet.app/Contents/Resources/Scripts/main.scpt
@@ -1,3 +1,3 @@
-on open filelist
-       ## Set useTerminal to true to run the script in a terminal
-       set useTerminal to true
+on open file_list
+       ## Set use_terminal to true to run the script in a terminal
+       set use_terminal to true

Big thanks to @DanielTrebbien for his answer that lead me to osadecompile.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...