Skip to content

Commit

Permalink
Remove OneUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorgalvao committed Dec 13, 2022
1 parent f0454e2 commit 88f712f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 138 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

List File Stream contents from Google Drive

<a href='https://github.com/alfredapp/google-drive-workflow/releases/latest/download/Google.Drive.alfredworkflow'>⤓ Download Workflow</a>

> On Alfred 4 use <a href='https://github.com/alfredapp/google-drive-workflow/releases/download/2022.12/Google.Drive.alfredworkflow'>alternative link</a>
<a href='https://alfred.app/workflows/alfredapp/google-drive'>⤓ Install on the Alfred Gallery</a>

## Usage

Run the Seach Keyword (default: `gd`) or Folder Seach Keyword (default: `gdf`) to filter the contents of your Google Drive.
Search the contents of your Google Drive via the Search Keyword (default: `gd`) or Folder Search Keyword (default: `gdf`).

![Alfred search for gd](Workflow/images/about/gd.png)

Expand All @@ -18,9 +16,7 @@ Run the Seach Keyword (default: `gd`) or Folder Seach Keyword (default: `gdf`) t
* <kbd>⌥</kbd><kbd>⏎</kbd>: Reveal in Finder.
* <kbd>⇧</kbd><kbd>⏎</kbd>: Search on Google Drive’s website.

You’ll be asked to build the cache on your first run. A notification will show when it’s ready. The more files you have, the longer the wait. A macOS launchd agent will be loaded to do it daily and on boot.

To rebuild the cache on demand, run `:gdrebuildcache`.
You’ll be asked to build the cache on your first run. A notification will show when it’s ready. The more files you have, the longer the wait. A macOS launchd agent will be loaded to do it daily and on boot. If necessary, an immediate cache rebuild can be forced with the `:gdrebuildcache` keyword.

The [Universal Actions](https://www.alfredapp.com/help/features/universal-actions/) make it straightforward to copy and move files to a Google Drive folder.

Expand Down
140 changes: 9 additions & 131 deletions Workflow/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.alfredapp.googledrive</string>
<string>com.alfredapp.vitor.googledrive</string>
<key>connections</key>
<dict>
<key>0364D5B3-0C34-4B98-93E5-9A1A625A84C3</key>
Expand Down Expand Up @@ -89,16 +89,6 @@
</array>
<key>24E99691-8B40-4D5E-9803-AC2BDDEDCD32</key>
<array>
<dict>
<key>destinationuid</key>
<string>D33C8AF8-FC41-4038-A469-3E65C7F569C8</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>D5A28DD0-88F4-4CB2-A750-118B1E0ADEE7</string>
Expand Down Expand Up @@ -629,8 +619,6 @@
<integer>0</integer>
<key>hotmod</key>
<integer>0</integer>
<key>hotstring</key>
<string></string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
Expand Down Expand Up @@ -694,101 +682,6 @@
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string># Special values for OneUpdater reuse
readonly workflow_webaddress="$(/usr/libexec/PlistBuddy -c 'print webaddress' './info.plist')"
readonly workflow_repo="$(basename "$(dirname "${workflow_webaddress}")")/$(basename "${workflow_webaddress}")"
# THESE VARIABLES MUST BE SET. SEE THE ONEUPDATER README FOR AN EXPLANATION OF EACH.
readonly remote_info_plist="${workflow_webaddress}/raw/main/Workflow/info.plist"
readonly workflow_url="${workflow_repo}"
readonly download_type='github_release'
readonly frequency_check='4'
# FROM HERE ON, CODE SHOULD BE LEFT UNTOUCHED!
function abort {
echo "${1}" &gt;&amp;2
exit 1
}
function url_exists {
curl --silent --location --output /dev/null --fail --range 0-0 "${1}"
}
function notification {
local -r notificator="$(find . -type d -name 'Notificator.app')"
if [[ -n "${notificator}" ]]; then
"${notificator}/Contents/Resources/Scripts/notificator" --message "${1}" --title "${alfred_workflow_name}" --subtitle 'A new version is available'
return
fi
local -r terminal_notifier="$(find . -type f -name 'terminal-notifier')"
if [[ -n "${terminal_notifier}" ]]; then
"${terminal_notifier}" -title "${alfred_workflow_name}" -subtitle 'A new version is available' -message "${1}"
return
fi
osascript -e "display notification \"${1}\" with title \"${alfred_workflow_name}\" subtitle \"A new version is available\""
}
# Local sanity checks
readonly local_info_plist='info.plist'
readonly local_version="$(/usr/libexec/PlistBuddy -c 'print version' "${local_info_plist}")"
[[ -n "${local_version}" ]] || abort 'You need to set a workflow version in the configuration sheet.'
[[ "${download_type}" =~ ^(direct|page|github_release)$ ]] || abort "'download_type' (${download_type}) needs to be one of 'direct', 'page', or 'github_release'."
[[ "${frequency_check}" =~ ^[0-9]+$ ]] || abort "'frequency_check' (${frequency_check}) needs to be a number."
# Check for updates
if [[ $(find "${local_info_plist}" -mtime +"${frequency_check}"d) ]]; then
if ! url_exists "${remote_info_plist}"; then abort "'remote_info_plist' (${remote_info_plist}) appears to not be reachable."; fi # Remote sanity check
readonly tmp_file="$(mktemp)"
curl --silent --location --output "${tmp_file}" "${remote_info_plist}"
readonly remote_version="$(/usr/libexec/PlistBuddy -c 'print version' "${tmp_file}")"
if [[ "${local_version}" == "${remote_version}" ]]; then
touch "${local_info_plist}" # Reset timer by touching local file
exit 0
fi
if [[ "${download_type}" == 'page' ]]; then
notification 'Opening download page…'
open "${workflow_url}"
exit 0
fi
download_url="$([[ "${download_type}" == 'github_release' ]] &amp;&amp; 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}")"
if url_exists "${download_url}"; then
notification 'Downloading and installing…'
curl --silent --location --output "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" "${download_url}"
open "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow"
else
abort "'workflow_url' (${download_url}) appears to not be reachable."
fi
fi</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>D33C8AF8-FC41-4038-A469-3E65C7F569C8</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -892,8 +785,6 @@ fi</string>
<integer>0</integer>
<key>hotmod</key>
<integer>0</integer>
<key>hotstring</key>
<string></string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
Expand Down Expand Up @@ -1858,19 +1749,17 @@ fi</string>
<key>readme</key>
<string>## Usage
Run the Seach Keyword (default: `gd`) or Folder Seach Keyword (default: `gdf`) to filter the contents of your Google Drive.
Search the contents of your Google Drive via the Search Keyword (default: `gd`) or Folder Search Keyword (default: `gdf`).
![Alfred search for gd](images/about/gd.png)
![Alfred search for gd fran](images/about/gdfran.png)
* ↩: Open.
* ⌥↩: Reveal in Finder.
* ⇧↩: Search on Google Drive’s website.
You’ll be asked to build the cache on your first run. A notification will show when it’s ready. The more files you have, the longer the wait. A macOS launchd agent will be loaded to do it daily and on boot.
* &lt;kbd&gt;&lt;/kbd&gt;: Open.
* &lt;kbd&gt;&lt;/kbd&gt;&lt;kbd&gt;&lt;/kbd&gt;: Reveal in Finder.
* &lt;kbd&gt;&lt;/kbd&gt;&lt;kbd&gt;&lt;/kbd&gt;: Search on Google Drive’s website.
To rebuild the cache on demand, run `:gdrebuildcache`.
You’ll be asked to build the cache on your first run. A notification will show when it’s ready. The more files you have, the longer the wait. A macOS launchd agent will be loaded to do it daily and on boot. If necessary, an immediate cache rebuild can be forced with the `:gdrebuildcache` keyword.
The [Universal Actions](https://www.alfredapp.com/help/features/universal-actions/) make it straightforward to copy and move files to a Google Drive folder.
Expand Down Expand Up @@ -2124,17 +2013,6 @@ To report a problem, run `!gddiagnostic`.</string>
<key>ypos</key>
<real>490</real>
</dict>
<key>D33C8AF8-FC41-4038-A469-3E65C7F569C8</key>
<dict>
<key>colorindex</key>
<integer>12</integer>
<key>note</key>
<string>OneUpdater</string>
<key>xpos</key>
<real>1050</real>
<key>ypos</key>
<real>195</real>
</dict>
<key>D5A28DD0-88F4-4CB2-A750-118B1E0ADEE7</key>
<dict>
<key>xpos</key>
Expand Down Expand Up @@ -2332,20 +2210,20 @@ To report a problem, run `!gddiagnostic`.</string>
<key>required</key>
<false/>
<key>text</key>
<string>Periodically update file cache</string>
<string>Automatically update the cache on a schedule</string>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>Auto Cache Rebuilding</string>
<string>Periodic Refresh</string>
<key>type</key>
<string>checkbox</string>
<key>variable</key>
<string>auto_refresh</string>
</dict>
</array>
<key>version</key>
<string>2022.22</string>
<string>2022.23</string>
<key>webaddress</key>
<string>https://github.com/alfredapp/google-drive-workflow/</string>
</dict>
Expand Down

0 comments on commit 88f712f

Please sign in to comment.