Skip to content

Commit d0145b9

Browse files
committed
Can install specific git versions now
1 parent 267c635 commit d0145b9

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

00 Import all to library.applescript

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
-- @description Import all script to user library
22
-- @author Ben Smith
33
-- @link bensmithsound.uk
4-
-- @version 2.0
4+
-- @version 2.1
55
-- @testedmacos 10.14.6
66
-- @testedqlab 4.6.10
77
-- @about Run this script in MacOS's "Script Editor" to import all scripts in a folder (including within subfolders) to the user's "Library/Script Libraries"
88
-- @separateprocess TRUE
99

1010
-- @changelog
11+
-- v2.1 + can install specific versions of the library from github, and notes the version if launched in Qlab.
1112
-- v2.0 + can now optionally import scripts directly from github
1213
-- v1.3 + add default location when choosing a folder
1314
-- v1.2 + creates "Script Libraries" folder if it doesn't already exist
14-
-- v1.1 + remove unnecessary declarations
15+
16+
17+
-- USER DEFINED VARIABLES -----------------
18+
19+
set gitVersionToGet to "latest" -- latest, or a git version tag. If using an old file, set this to the version previously installed.
20+
21+
22+
---------- END OF USER DEFINED VARIABLES --
1523

1624

1725
-- RUN SCRIPT -----------------------------
@@ -26,13 +34,22 @@ if theMethod is "Github" then
2634
tell application "Finder"
2735
set homeLocation to path to home folder
2836

29-
set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp"
37+
if gitVersionToGet is "latest" then
38+
set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp"
39+
else
40+
set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp -b " & gitVersionToGet & " --single-branch"
41+
end if
3042

3143
do shell script gitClone
3244

3345
set scriptFolder to (POSIX path of homeLocation) & "qlab-scripts-temp"
3446
set scriptFolder to (POSIX file scriptFolder) as alias
3547

48+
-- Get version number for notes
49+
set getGitVersion to "cd " & (POSIX path of scriptFolder) & "&& git describe --tags"
50+
51+
set gitVersion to do shell script getGitVersion
52+
3653
end tell
3754
end if
3855

@@ -112,6 +129,18 @@ if theMethod is "Github" then
112129
tell application "Finder"
113130
delete folder scriptFolder
114131
end tell
132+
133+
try
134+
tell application id "com.figure53.Qlab.4" to tell front workspace
135+
-- set q number of (last item of (selected as list)) to gitVersion
136+
set installerCue to last item of (selected as list)
137+
if q type of installerCue is "Script" then
138+
set installerName to q display name of installerCue
139+
set originalInstallerName to last item of my splitString(installerName, " | ")
140+
set q name of installerCue to gitVersion & " installed | " & originalInstallerName
141+
end if
142+
end tell
143+
end try
115144
end if
116145

117146
display notification "Installation complete - all scripts have been compiled into the \"Script Libraries\" folder"

0 commit comments

Comments
 (0)