Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
788 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...