Skip to content

Commit

Permalink
Bump to version 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhayward committed Jul 15, 2016
1 parent 4c47eb0 commit b1e20e0
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 164 deletions.
Binary file modified Extras/Transcode Log Analyzer.zip
Binary file not shown.
Binary file modified Setup Assistant/Transcode Setup Assistant.zip
Binary file not shown.
17 changes: 7 additions & 10 deletions Setup Assistant/videoTranscodeSetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin export PATH
#----------------------------------------------------------FUNCTIONS----------------------------------------------------------------

function define_Constants () {
local versStamp="Version 1.2.4, 06-25-2016"
local versStamp="Version 1.2.6, 07-14-2016"

loggerTag="transcode.install"
readonly scriptsDirName="com.videotranscode.transcode"
Expand Down Expand Up @@ -138,7 +138,7 @@ function create_Plists () {
plistName[0]="com.videotranscode.brewautoupdate"
plistName[1]="com.videotranscode.watchfolder"
plistName[2]="com.videotranscode.rsync.watchfolder"
plistName[3]="com.videotranscode.gemautoupdate"
plistName[3]="com.videotranscode.gem.check"

plistFile="${plistDir}/${plistName[0]}.plist"

Expand Down Expand Up @@ -194,19 +194,16 @@ function create_Plists () {
plistFile="${plistDir}/${plistName[3]}.plist" # get the watch folder launch agent

if [ ! -e "${plistFile}" ]; then # write out the watch folder LaunchAgent plist to ~/Library/LaunchAgent
local watchPath="${libDir}/Preferences/com.videotranscode.gem.update.plist" # get the path to the watch plist

${plistBuddy} -c 'Add :Label string "'"${plistName[3]}"'"' "${plistFile}"; cat "${plistFile}" > /dev/null 2>&1
${plistBuddy} -c 'Add :Label string "'"${plistName}"'"' "${plistFile}"; cat "${plistFile}" > /dev/null 2>&1
${plistBuddy} -c 'Add :Disabled bool true' "${plistFile}"
${plistBuddy} -c 'Add :EnvironmentVariables dict' "${plistFile}"
${plistBuddy} -c 'Add :EnvironmentVariables:PATH string /usr/local/bin:/usr/bin:/usr/sbin' "${plistFile}"
${plistBuddy} -c 'Add :ProgramArguments array' "${plistFile}"
${plistBuddy} -c 'Add :ProgramArguments:0 string "'"${scriptsDir}/${scriptsDirName}/Transcode Updater.app/Contents/Resources/updateTranscodeGemsCheck.sh"'"' "${plistFile}"
${plistBuddy} -c 'Add :RunAtLoad bool true' "${plistFile}"
${plistBuddy} -c 'Add :WatchPaths array' "${plistFile}"
${plistBuddy} -c 'Add :WatchPaths:0 string "'"${watchPath}"'"' "${plistFile}"

chmod 644 "${plistFile}"

launchctl load "${plistFile}" # load the launchAgent
fi
fi
}

function install_brewPkgs () {
Expand Down
Binary file modified Updater/AutoUpdater.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Updater/SHA1_AU.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>SHA1checksum</key>
<string>be71bdba34b30f3652fa545b521ae50be52f40db</string>
<string>dd756c433ec7dd1790b2c4c5a54e01e5a9865fd3</string>
</dict>
</plist>
Binary file modified Updater/Transcode Updater.zip
Binary file not shown.
66 changes: 23 additions & 43 deletions Updater/updateTranscode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,23 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin export PATH
#----------------------------------------------------------FUNCTIONS----------------------------------------------------------------

function define_Constants () {
local versStamp="Version 1.2.4, 06-28-2016"
local versStamp="Version 1.2.7, 07-09-2016"

loggerTag="transcode.update"

local DIR=""
local SOURCE="${BASH_SOURCE[0]}"

while [ -h "${SOURCE}" ]; do # resolve ${SOURCE} until the file is no longer a symlink
DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
SOURCE="$(readlink "${SOURCE}")"
[[ ${SOURCE} != /* ]] && SOURCE="${DIR}/${SOURCE}" # if ${SOURCE} was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done

readonly comLabel="com.videotranscode.transcode"

readonly libDir="${HOME}/Library"
readonly appScriptsPath="${libDir}/Application Scripts/${comLabel}"
readonly prefDir="${libDir}/Preferences"
readonly workDir=$(aliasPath "${libDir}/Application Support/Transcode/Transcode alias")

Expand All @@ -34,24 +47,6 @@ function define_Constants () {
fullUpdate="false"
needsUpdate="false"
SHA1Clean="false"

# From brewAutoUpdate:
# readonly libDir="${HOME}/Library"
# readonly appScriptsPath="${libDir}/Application Scripts/com.videotranscode.transcode"
}

function runAndDisown () {
# ${1}: path to script to execute

if test -t 1; then
exec 1>/dev/null
fi

if test -t 2; then
exec 2>/dev/null
fi

"$@" &
}

function check4Update_Transcode () {
Expand Down Expand Up @@ -186,35 +181,20 @@ function update_Transcode () {
}

function clean_Up () {
local plistDir="${libDir}/LaunchAgents"
local plistName="com.videotranscode.gem.check"
local plistFile="${plistDir}/${plistName}.plist"
# delete the auto-update files from /tmp
rm -rf "${updaterPath}"

# make sure everything can execute
find "${appScriptsPath}/" -name "*.sh" -exec chmod +x {} \;
find "${workDir}/" -name "*.command" -exec chmod +x {} \;
find "${workDir}/Extras/" -name "*.command" -exec chmod +x {} \;

local gemUpdatePlist="com.videotranscode.gem.update.plist"
local plistName="com.videotranscode.gemautoupdate"
local plistFile="${libDir}/LaunchAgents/${plistName}.plist" # get the watch folder launch agent

if [ ! -e "${plistFile}" ]; then # write out the watch folder LaunchAgent plist to ~/Library/LaunchAgent
local watchPath="${libDir}/Preferences/${gemUpdatePlist}" # get the path to the watch plist

${plistBuddy} -c 'Add :Label string "'"${plistName}"'"' "${plistFile}"; cat "${plistFile}" > /dev/null 2>&1
${plistBuddy} -c 'Add :ProgramArguments array' "${plistFile}"
${plistBuddy} -c 'Add :ProgramArguments:0 string "'"${appScriptsPath}/Transcode Updater.app/Contents/Resources/updateTranscodeGemsCheck.sh"'"' "${plistFile}"
${plistBuddy} -c 'Add :RunAtLoad bool true' "${plistFile}"
${plistBuddy} -c 'Add :WatchPaths array' "${plistFile}"
${plistBuddy} -c 'Add :WatchPaths:0 string "'"${watchPath}"'"' "${plistFile}"

chmod 644 "${plistFile}"

launchctl load "${plistFile}" # load the launchAgent

. "${sh_echoMsg}" "Created and started launchAgent ${watchPath}..." ""
fi
# run updateTranscodeGemsCheck independently
touch "${prefDir}/${gemUpdatePlist}"
# launchAgent to run updateTranscodeGemsCheck.sh
${plistBuddy} -c 'Set :Disabled true' "${plistFile}"
launchctl unload "${plistFile}"
${plistBuddy} -c 'Set :Disabled false' "${plistFile}"
launchctl load "${plistFile}"
}

function __main__ () {
Expand Down
33 changes: 19 additions & 14 deletions Updater/updateTranscodeGems.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,65 @@
#----------------------------------------------------------FUNCTIONS----------------------------------------------------------------

function define_Constants () {
local versStamp="Version 1.0.7, 06-27-2016"
local versStamp="Version 1.0.9, 07-09-2016"

loggerTag="gem.update"

readonly libDir="${HOME}/Library"

readonly appScriptsPath="${libDir}/Application Scripts/com.videotranscode.transcode"
readonly icnsPath="${libDir}/Application Support/Transcode/Transcode_custom.icns"
readonly icnsPath="${libDir}/Application Scripts/com.videotranscode.transcode/Transcode Updater.app/Contents/Resources/AutomatorApplet.icns"

readonly plistBuddy="/usr/libexec/PlistBuddy"
readonly sh_echoMsg="${appScriptsPath}/_echoMsg.sh"
readonly sh_ifError="${appScriptsPath}/_ifError.sh"

msgTxt="You're up-to-date!"
}

function updateGems () {
local updateVT="false"
local plistName="com.videotranscode.gem.update"
local plistDir="/tmp"
local plistFile="${plistDir}/${plistName}.plist"

. "${sh_echoMsg}" "Checking updates..." ""

declare -a gemUpdates
gemUpdates=( $(gem outdated) )
vtVers=$(${plistBuddy} -c 'print :video_transcoding' "${plistFile}")
ntVers=$(${plistBuddy} -c 'print :terminal-notifier' "${plistFile}")
# delete the info plist
rm -f "${plistFile}"

if [ "${#gemUpdates[@]}" -gt "0" ]; then
if [[ "${vtVers}" != "0" || "${ntVers}" != "0" ]]; then
msgTxt="Transcode successfully updated"
# update the gems
if [[ ${gemUpdates[*]} =~ video_transcoding ]]; then
local updateVT="true"
if [ "${vtVers}" != "0" ]; then
# upgrade video_transcoding
. "${sh_echoMsg}" "Updating video_transcoding gem..." ""

sudo gem update video_transcoding 2>&1 | logger -t gem.video_transcoding.update
gem cleanup video_transcoding 2>&1 | logger -t gem.video_transcoding.update

msgTxt="${msgTxt} video_transcoding gem"
msgTxt="${msgTxt} video_transcoding gem to version ${vtVers}"
fi

if [[ ${gemUpdates[*]} =~ terminal-notifier ]]; then
if [ "${ntVers}" != "0" ]; then
# upgrade terminal-notifier
. "${sh_echoMsg}" "Updating terminal-notifier gem..." ""

sudo gem update terminal-notifier 2>&1 | logger -t gem.terminal-notifier.update
gem cleanup terminal-notifier 2>&1 | logger -t gem.terminal-notifier.update

if [ "${updateVT}" = "false" ]; then
msgTxt="${msgTxt} terminal-notifier gem"
if [ "${vtVers}" = "0" ]; then
msgTxt="${msgTxt} terminal-notifier gem to version ${ntVers}"
else
msgTxt="${msgTxt} and terminal-notifier gem"
msgTxt="${msgTxt} and terminal-notifier gem to version ${ntVers}"
fi
fi
fi
}

function clean_Up () {
# remove the semaphore files
rm -f "${libDir}/Preferences/com.videotranscode.gem.update.plist"
rm -f "${libDir}/Preferences/com.videotranscode.gem.update.inprogress.plist"
}

Expand Down
Loading

0 comments on commit b1e20e0

Please sign in to comment.