<commit_before>#!/bin/sh

# This script installs the Alfred Bundler.

# Path to this file
path="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd -P )"
# Define the global bundler version.
bundler_version=$(cat "$path/meta/version_major")

echo $bundler_version
# Define locations
git="https://raw.githubusercontent.com/shawnrice/alfred-bundler/blob/$bundler_version"
__data="$HOME/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-$bundler_version"
__cache="$HOME/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/alfred.bundler-$bundler_version"
# For now, we're using the 'initial' branch.
gitzip="https://github.com/shawnrice/alfred-bundler/archive/$bundler_version.zip"

# Make the directory structure
if [ ! -d "$__data" ]; then
  mkdir "$__data"
fi
if [ ! -d "$__data/assets" ]; then
  mkdir "$__data/assets"
fi
if [ ! -d "$__data/assets/utility" ]; then
  mkdir "$__data/assets/utility"
fi
if [ ! -d "$__data/assets/utility/terminal-notifier" ]; then
  mkdir "$__data/assets/utility/terminal-notifier"
fi
if [ ! -d "$__data/assets/utility/terminal-notifier/default" ]; then
  mkdir "$__data/assets/utility/terminal-notifier/default"
fi
if [ ! -d "$__cache" ]; then
  mkdir "$__cache"
fi
if [ ! -d "$__cache/installer" ]; then
  mkdir "$__cache/installer"
fi

# Grab the zip of the Github repo, unpack it, and move it to the data folder
curl -sL "$gitzip" > "$__cache/installer/$bundler_version.zip"
cd "$__cache/installer"
unzip -oq "$bundler_version.zip"
rm "$bundler_version.zip"
mv -f "alfred-bundler-$bundler_version"/* "$__data"
rm -fR "alfred-bundler-$bundler_version"
cd ..
rm -fR installer

# Grab the Terminal-Notifier utility, and install it to the data directory
curl -sL "https://github.com/shawnrice/Alfred-Helpers/blob/master/terminal-notifier.app.zip?raw=true" > "$__cache/terminal-notifier.zip"
cd "$__cache"
unzip -oq "terminal-notifier.zip"
cp -fR terminal-notifier.app "$__data/assets/utility/terminal-notifier/default"
rm -fR "$__cache/terminal*"
cd - > /dev/null

# Create the "invoke" file
echo "terminal-notifier.app/Contents/MacOS/terminal-notifier" \
> "$__data/assets/utility/terminal-notifier/default/invoke"

# Send a message to the user via the terminal-notifier
`"$__data/assets/utility/terminal-notifier/default/terminal-notifier.app/Contents/MacOS/terminal-notifier" \
-title 'Alfred Bundler Installation' -message 'A workflow that you use has \
requested its installation.'`

# That's it. We're installed.
<commit_msg>retooling install script<commit_after>#!/bin/sh

# This script installs the Alfred Bundler.

# Path to this file
path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
# Define the global bundler version.
bundler_version=$(cat "$path/meta/version_major")

# Define locations
git="https://raw.githubusercontent.com/shawnrice/alfred-bundler/blob/$bundler_version"
__data="$HOME/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-$bundler_version"
__cache="$HOME/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/alfred.bundler-$bundler_version"
# For now, we're using the 'initial' branch.
gitzip="https://github.com/shawnrice/alfred-bundler/archive/$bundler_version.zip"

# Make the directory structure
if [ ! -d "$__data" ]; then
  mkdir "$__data"
fi
if [ ! -d "$__data/assets" ]; then
  mkdir "$__data/assets"
fi
if [ ! -d "$__data/assets/utility" ]; then
  mkdir "$__data/assets/utility"
fi
if [ ! -d "$__data/assets/utility/terminal-notifier" ]; then
  mkdir "$__data/assets/utility/terminal-notifier"
fi
if [ ! -d "$__data/assets/utility/terminal-notifier/default" ]; then
  mkdir "$__data/assets/utility/terminal-notifier/default"
fi
if [ ! -d "$__cache" ]; then
  mkdir "$__cache"
fi
if [ ! -d "$__cache/installer" ]; then
  mkdir "$__cache/installer"
fi

# Grab the zip of the Github repo, unpack it, and move it to the data folder
curl -sL "$gitzip" > "$__cache/installer/$bundler_version.zip"
cd "$__cache/installer"
unzip -oq "$bundler_version.zip"
rm "$bundler_version.zip"
mv -f "alfred-bundler-$bundler_version"/* "$__data"
rm -fR "alfred-bundler-$bundler_version"
cd ..
rm -fR installer

# Grab the Terminal-Notifier utility, and install it to the data directory
curl -sL "https://github.com/shawnrice/Alfred-Helpers/blob/master/terminal-notifier.app.zip?raw=true" > "$__cache/terminal-notifier.zip"
cd "$__cache"
unzip -oq "terminal-notifier.zip"
cp -fR terminal-notifier.app "$__data/assets/utility/terminal-notifier/default"
rm -fR "$__cache/terminal*"
cd - > /dev/null

# Create the "invoke" file
echo "terminal-notifier.app/Contents/MacOS/terminal-notifier" \
> "$__data/assets/utility/terminal-notifier/default/invoke"

# Send a message to the user via the terminal-notifier
`"$__data/assets/utility/terminal-notifier/default/terminal-notifier.app/Contents/MacOS/terminal-notifier" \
-title 'Alfred Bundler Installation' -message 'A workflow that you use has \
requested its installation.'`

# That's it. We're installed.

{'fraction_non_alphanumeric': 0.14970783800120896, 'fraction_numerical': 0.0012089462018940156, 'mean_word_length': 4.778812572759022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1308403', 'n_tokens_mistral': 1787, 'n_tokens_neox': 1706, 'n_words': 396}