|
32 | 32 | </dict> |
33 | 33 | </array> |
34 | 34 | <key>0A704625-29E6-450E-8F2C-8E4EC7179899</key> |
35 | | - <array> |
36 | | - <dict> |
37 | | - <key>destinationuid</key> |
38 | | - <string>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</string> |
39 | | - <key>modifiers</key> |
40 | | - <integer>0</integer> |
41 | | - <key>modifiersubtext</key> |
42 | | - <string></string> |
43 | | - <key>vitoclose</key> |
44 | | - <false/> |
45 | | - </dict> |
46 | | - </array> |
| 35 | + <array/> |
47 | 36 | <key>0C5C8FC6-44C4-4EF6-B764-AA6026E0585C</key> |
48 | 37 | <array> |
49 | 38 | <dict> |
|
127 | 116 | </dict> |
128 | 117 | </array> |
129 | 118 | <key>1A806429-BBAB-4227-B0C9-46E96CD3E492</key> |
130 | | - <array> |
131 | | - <dict> |
132 | | - <key>destinationuid</key> |
133 | | - <string>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</string> |
134 | | - <key>modifiers</key> |
135 | | - <integer>0</integer> |
136 | | - <key>modifiersubtext</key> |
137 | | - <string></string> |
138 | | - <key>vitoclose</key> |
139 | | - <false/> |
140 | | - </dict> |
141 | | - </array> |
| 119 | + <array/> |
142 | 120 | <key>265DF548-7D96-4F94-AB0E-6AD26F31B4A1</key> |
143 | 121 | <array> |
144 | 122 | <dict> |
|
209 | 187 | </dict> |
210 | 188 | </array> |
211 | 189 | <key>348251C4-2B72-432F-A923-B082C6740DEA</key> |
212 | | - <array> |
213 | | - <dict> |
214 | | - <key>destinationuid</key> |
215 | | - <string>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</string> |
216 | | - <key>modifiers</key> |
217 | | - <integer>0</integer> |
218 | | - <key>modifiersubtext</key> |
219 | | - <string></string> |
220 | | - <key>vitoclose</key> |
221 | | - <false/> |
222 | | - </dict> |
223 | | - </array> |
| 190 | + <array/> |
224 | 191 | <key>436DF03B-19A8-47CA-A8C6-27C31A52BB22</key> |
225 | 192 | <array> |
226 | 193 | <dict> |
|
564 | 531 | </dict> |
565 | 532 | </array> |
566 | 533 | <key>A6F75F15-2128-4002-A841-2872651A1640</key> |
567 | | - <array> |
568 | | - <dict> |
569 | | - <key>destinationuid</key> |
570 | | - <string>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</string> |
571 | | - <key>modifiers</key> |
572 | | - <integer>0</integer> |
573 | | - <key>modifiersubtext</key> |
574 | | - <string></string> |
575 | | - <key>vitoclose</key> |
576 | | - <false/> |
577 | | - </dict> |
578 | | - </array> |
| 534 | + <array/> |
579 | 535 | <key>A7CD4656-328C-4B54-B34C-F38C9B4B7984</key> |
580 | 536 | <array> |
581 | 537 | <dict> |
|
909 | 865 | </dict> |
910 | 866 | </array> |
911 | 867 | <key>E928110A-9651-4404-BCF3-CCF77B35BB0B</key> |
912 | | - <array> |
913 | | - <dict> |
914 | | - <key>destinationuid</key> |
915 | | - <string>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</string> |
916 | | - <key>modifiers</key> |
917 | | - <integer>0</integer> |
918 | | - <key>modifiersubtext</key> |
919 | | - <string></string> |
920 | | - <key>vitoclose</key> |
921 | | - <false/> |
922 | | - </dict> |
923 | | - </array> |
| 868 | + <array/> |
924 | 869 | <key>F1559F42-7F85-4A26-A604-6E31BD686380</key> |
925 | 870 | <array> |
926 | 871 | <dict> |
|
1451 | 1396 | <key>version</key> |
1452 | 1397 | <integer>3</integer> |
1453 | 1398 | </dict> |
1454 | | - <dict> |
1455 | | - <key>config</key> |
1456 | | - <dict> |
1457 | | - <key>concurrently</key> |
1458 | | - <false/> |
1459 | | - <key>escaping</key> |
1460 | | - <integer>0</integer> |
1461 | | - <key>script</key> |
1462 | | - <string># THESE VARIABLES MUST BE SET. SEE THE ONEUPDATER README FOR AN EXPLANATION OF EACH. |
1463 | | -readonly remote_info_plist='https://raw.githubusercontent.com/willfarrell/alfred-pkgman-workflow/master/info.plist' |
1464 | | -readonly workflow_url='https://github.com/willfarrell/alfred-pkgman-workflow/releases/latest/download/Package.Managers.alfredworkflow' |
1465 | | -readonly download_type='direct' |
1466 | | -readonly frequency_check='4' |
1467 | | -
|
1468 | | -# FROM HERE ON, CODE SHOULD BE LEFT UNTOUCHED! |
1469 | | -function abort { |
1470 | | - echo "${1}" >&2 |
1471 | | - exit 1 |
1472 | | -} |
1473 | | -
|
1474 | | -function url_exists { |
1475 | | - curl --silent --location --output /dev/null --fail --range 0-0 "${1}" |
1476 | | -} |
1477 | | -
|
1478 | | -function notification { |
1479 | | - local -r notificator="$(find . -type d -name 'Notificator.app')" |
1480 | | - if [[ -n "${notificator}" ]]; then |
1481 | | - "${notificator}/Contents/Resources/Scripts/notificator" --message "${1}" --title "${alfred_workflow_name}" --subtitle 'A new version is available' |
1482 | | - return |
1483 | | - fi |
1484 | | -
|
1485 | | - local -r terminal_notifier="$(find . -type f -name 'terminal-notifier')" |
1486 | | - if [[ -n "${terminal_notifier}" ]]; then |
1487 | | - "${terminal_notifier}" -title "${alfred_workflow_name}" -subtitle 'A new version is available' -message "${1}" |
1488 | | - return |
1489 | | - fi |
1490 | | -
|
1491 | | - osascript -e "display notification \"${1}\" with title \"${alfred_workflow_name}\" subtitle \"A new version is available\"" |
1492 | | -} |
1493 | | -
|
1494 | | -# Local sanity checks |
1495 | | -readonly local_info_plist='info.plist' |
1496 | | -readonly local_version="$(/usr/libexec/PlistBuddy -c 'print version' "${local_info_plist}")" |
1497 | | -
|
1498 | | -[[ -n "${local_version}" ]] || abort 'You need to set a workflow version in the configuration sheet.' |
1499 | | -[[ "${download_type}" =~ ^(direct|page|github_release)$ ]] || abort "'download_type' (${download_type}) needs to be one of 'direct', 'page', or 'github_release'." |
1500 | | -[[ "${frequency_check}" =~ ^[0-9]+$ ]] || abort "'frequency_check' (${frequency_check}) needs to be a number." |
1501 | | -
|
1502 | | -# Check for updates |
1503 | | -if [[ $(find "${local_info_plist}" -mtime +"${frequency_check}"d) ]]; then |
1504 | | - if ! url_exists "${remote_info_plist}"; then abort "'remote_info_plist' (${remote_info_plist}) appears to not be reachable."; fi # Remote sanity check |
1505 | | -
|
1506 | | - readonly tmp_file="$(mktemp)" |
1507 | | - curl --silent --location --output "${tmp_file}" "${remote_info_plist}" |
1508 | | - readonly remote_version="$(/usr/libexec/PlistBuddy -c 'print version' "${tmp_file}")" |
1509 | | -
|
1510 | | - if [[ "${local_version}" == "${remote_version}" ]]; then |
1511 | | - touch "${local_info_plist}" # Reset timer by touching local file |
1512 | | - exit 0 |
1513 | | - fi |
1514 | | -
|
1515 | | - if [[ "${download_type}" == 'page' ]]; then |
1516 | | - notification 'Opening download page…' |
1517 | | - open "${workflow_url}" |
1518 | | - exit 0 |
1519 | | - fi |
1520 | | -
|
1521 | | - download_url="$([[ "${download_type}" == 'github_release' ]] && curl --silent "https://api.github.com/repos/${workflow_url}/releases/latest" | grep 'browser_download_url' | head -1 | sed -E 's/.*browser_download_url": "(.*)"/\1/' || echo "${workflow_url}")" |
1522 | | -
|
1523 | | - if url_exists "${download_url}"; then |
1524 | | - notification 'Downloading and installing…' |
1525 | | - curl --silent --location --output "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" "${download_url}" |
1526 | | - open "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" |
1527 | | - else |
1528 | | - abort "'workflow_url' (${download_url}) appears to not be reachable." |
1529 | | - fi |
1530 | | -fi</string> |
1531 | | - <key>scriptargtype</key> |
1532 | | - <integer>1</integer> |
1533 | | - <key>scriptfile</key> |
1534 | | - <string></string> |
1535 | | - <key>type</key> |
1536 | | - <integer>0</integer> |
1537 | | - </dict> |
1538 | | - <key>type</key> |
1539 | | - <string>alfred.workflow.action.script</string> |
1540 | | - <key>uid</key> |
1541 | | - <string>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</string> |
1542 | | - <key>version</key> |
1543 | | - <integer>2</integer> |
1544 | | - </dict> |
1545 | 1399 | <dict> |
1546 | 1400 | <key>config</key> |
1547 | 1401 | <dict> |
@@ -3144,17 +2998,6 @@ The Python Package Index is very slow due to a lack on API and pagination. A min |
3144 | 2998 | <key>ypos</key> |
3145 | 2999 | <real>1930</real> |
3146 | 3000 | </dict> |
3147 | | - <key>EDFF14C6-DDD5-4CA8-BEE4-E651942DF753</key> |
3148 | | - <dict> |
3149 | | - <key>colorindex</key> |
3150 | | - <integer>12</integer> |
3151 | | - <key>note</key> |
3152 | | - <string>OneUpdater</string> |
3153 | | - <key>xpos</key> |
3154 | | - <real>1150</real> |
3155 | | - <key>ypos</key> |
3156 | | - <real>935</real> |
3157 | | - </dict> |
3158 | 3001 | <key>F1559F42-7F85-4A26-A604-6E31BD686380</key> |
3159 | 3002 | <dict> |
3160 | 3003 | <key>xpos</key> |
|
0 commit comments