Skip to content

Commit

Permalink
Bump version 1.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhayward committed Jun 25, 2016
1 parent 6a081f1 commit e79cf79
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 128 deletions.
Binary file modified Extras/Transcode Log Analyzer.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion Extras/uninstallTranscode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin export PATH

function define_Constants () {
# define version number
local versStamp="Version 1.0.8, 06-11-2017"
local versStamp="Version 1.0.9, 06-25-2017"
readonly scriptVers="${versStamp:8:${#versStamp}-20}"

loggerTag="transcode.uninstall"
Expand Down Expand Up @@ -118,6 +118,7 @@ function uninstall_launchDaemons () {
removeThis[1]="${libDir}/LaunchAgents/com.videotranscode.watchfolder.plist"
removeThis[2]="${libDir}/LaunchAgents/com.videotranscode.rsync.watchfolder.plist"
removeThis[3]="${libDir}/LaunchAgents/com.videotranscode.ingest.watchfolder.plist"
removeThis[4]="${libDir}/LaunchAgents/com.videotranscode.gemautoupdate.plist"

# remove LaunchAgents
for i in "${removeThis[@]}"; do
Expand All @@ -142,6 +143,9 @@ function uninstall_preferenceFiles () {
removeThis[6]="${libDir}/Preferences/com.videotranscode.ingest.batch.waiting.plist"
removeThis[7]="${libDir}/Preferences/com.videotranscode.ingest.batch.onhold.plist"
removeThis[8]="${libDir}/Preferences/com.videotranscode.ingest.batch.working.plist"
removeThis[9]="${libDir}/Preferences/com.videotranscode.gem.update.plist"
removeThis[10]="${libDir}/Preferences/com.videotranscode.transcode.update.plist"
removeThis[11]="${libDir}/Preferences/com.videotranscode.transcode.full.update.plist"

# remove preferences
for i in "${removeThis[@]}"; do
Expand Down
Binary file modified Setup Assistant/Transcode Setup Assistant.zip
Binary file not shown.
20 changes: 19 additions & 1 deletion 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.3, 06-18-2016"
local versStamp="Version 1.2.4, 06-25-2016"

loggerTag="transcode.install"
readonly scriptsDirName="com.videotranscode.transcode"
Expand Down Expand Up @@ -138,6 +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"

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

Expand Down Expand Up @@ -189,6 +190,23 @@ function create_Plists () {

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

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 :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
}

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>9a2ccea32ae9979bb9c429411ffda19b5ecf4ac9</string>
<string>6779f5ce54e838751ad2295d3f6673c4a6f043a3</string>
</dict>
</plist>
Binary file modified Updater/Transcode Updater.zip
Binary file not shown.
111 changes: 12 additions & 99 deletions Updater/updateTranscode.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.1.8, 06-22-2016"
local versStamp="Version 1.2.0, 06-24-2016"

loggerTag="transcode.update"

Expand All @@ -31,25 +31,12 @@ function define_Constants () {
readonly sh_ifError="${appScriptsPath}/_ifError.sh"
readonly plistBuddy="/usr/libexec/PlistBuddy"
readonly versCurrent=$(${plistBuddy} -c 'print :CFBundleShortVersionString' "${appScriptsPath}/Transcode Updater.app/Contents/Resources/transcodeVersion.plist")

gemJustChecked="false"

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

function __main__ () {
define_Constants

declare -a gemUpdates

check4Update_Transcode
update_Transcode
check4Update_Gems
update_Gems
}

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

Expand All @@ -61,7 +48,7 @@ function runAndDisown () {
exec 2>/dev/null
fi

"$@" &
"$@" &
}

function clean_Up () {
Expand Down Expand Up @@ -199,101 +186,27 @@ function update_Transcode () {

. "${sh_echoMsg}" "Update complete." ""
else
if [ -e "${prefDir}/${needsFullUpdatePlist}" ]; then
# remove the full update semaphore file
rm -f "${prefDir}/${needsFullUpdatePlist}"
fi

. "${sh_echoMsg}" "SHA1 checksums do not match, update skipped." ""
fi
# delete the sempahore file
rm -f "${needsUpdatePath}"

rm -f "${needsUpdatePath}"
elif [[ -e "${waitingPlist}" || -e "${onHoldPlist}" || -e "${workingPlist}" ]]; then
. "${sh_echoMsg}" "Update deferred." ""
else
. "${sh_echoMsg}" "Already up-to-date." ""
fi
}

function check4Update_Gems () {
loggerTag="gem.update"

local needsUpdatePlist="${comLabel}.gem.update.plist"
local needsUpdatePath="${prefDir}/${needsUpdatePlist}"

. "${sh_echoMsg}" "Checking for gem updates..." ""
# has the update been checked for previously
if [ ! -e "${needsUpdatePath}" ]; then
gemUpdates=( $(gem outdated) )

if [ "${#gemUpdates[@]}" -gt "0" ]; then # create the gem update plist
touch "${needsUpdatePath}"
gemJustChecked="true"
fi
fi
}

function update_Gems () {
local needsUpdatePlist="${comLabel}.gem.update.plist"
local needsUpdatePath="${prefDir}/${needsUpdatePlist}"
local updateVT="false"
local gemVers=""
local loopCounter=0
local msgTxt="Transcode is ready to install "
# need to update?
if [ -e "${needsUpdatePath}" ]; then
# get what needs to be updated
if [ "${gemJustChecked}" = "false" ]; then
gemUpdates=( $(gem outdated) )
fi
# check which gems need to be updated
if [[ ${gemUpdates[*]} =~ video_transcoding || ${gemUpdates[*]} =~ terminal-notifier ]]; then

for i in "${gemUpdates[@]}"; do
if [[ "${i}" == *"video_transcoding"* ]]; then
. "${sh_echoMsg}" "Update available for video_transcoding" ""

updateVT="true"
gemVers="${gemUpdates[loopCounter+3]%)*}"
msgTxt="${msgTxt} video_transcoding ${gemVers}"
fi

if [[ "${i}" == *"terminal-notifier"* ]]; then
. "${sh_echoMsg}" "Update available for terminal-notifier" ""

gemVers="${gemUpdates[loopCounter+3]%)*}"
if [ "${updateVT}" = "false" ]; then
msgTxt="${msgTxt} terminal-notifier ${gemVers}"
else
msgTxt="${msgTxt} and terminal-notifier ${gemVers}"
fi
fi

((loopCounter++))
done
# display update notification dialog
local btnPressed=$(/usr/bin/osascript << EOT
set iconPath to "$icnsPath" as string
set posixPath to POSIX path of iconPath
set hfsPath to POSIX file posixPath
set btnPressed to display dialog "$msgTxt" buttons {"Install Later", "Install Update"} default button "Install Update" with title "Transcode" with icon file hfsPath
if button returned of the result is "Install Later" then
return 1
else
return 0
end if
EOT)
function __main__ () {
define_Constants

if [ "${btnPressed}" = "0" ] ; then
# open the Automator app to update the gems
open "${appScriptsPath}/Transcode Updater.app"
else
. "${sh_echoMsg}" "User deferred update" ""
fi
else
. "${sh_echoMsg}" "All gems are up-to-date" ""
fi
# delete the sempahore file
rm -f "${needsUpdatePath}"
fi
check4Update_Transcode
update_Transcode
}


Expand Down
27 changes: 16 additions & 11 deletions Updater/updateTranscodeGems.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#----------------------------------------------------------FUNCTIONS----------------------------------------------------------------

function define_Constants () {
local versStamp="Version 1.0.4, 05-24-2016"
local versStamp="Version 1.0.6, 06-25-2016"

loggerTag="gem.update"

Expand All @@ -28,12 +28,14 @@ function define_Constants () {

readonly sh_echoMsg="${appScriptsPath}/_echoMsg.sh"
readonly sh_ifError="${appScriptsPath}/_ifError.sh"

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

function updateGems () {
local updateVT="false"

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

declare -a gemUpdates
gemUpdates=( $(gem outdated) )
Expand All @@ -44,35 +46,37 @@ function updateGems () {
if [[ ${gemUpdates[*]} =~ video_transcoding ]]; then
local updateVT="true"
# upgrade video_transcoding
. "${sh_echoMsg}" "Updating transcode-video..." ""
. "${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"
msgTxt="${msgTxt} video_transcoding gem"
fi

if [[ ${gemUpdates[*]} =~ terminal-notifier ]]; then
# upgrade terminal-notifier
. "${sh_echoMsg}" "Updating 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"
msgTxt="${msgTxt} terminal-notifier gem"
else
msgTxt="${msgTxt} and terminal-notifier"
msgTxt="${msgTxt} and terminal-notifier gem"
fi
fi
# remove the semaphore file
rm -f "${libDir}/Preferences/com.videotranscode.transcode.gem.update.plist"
fi
}

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

function __main__ () {
define_Constants

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

updateGems

cat << EOF | osascript -l AppleScript > /dev/null
Expand All @@ -87,6 +91,7 @@ EOF

#----------------------------------------------------------MAIN----------------------------------------------------------------
# Execute
trap clean_Up INT TERM EXIT # always run clean_Up regardless of how the script terminates
trap '. "${sh_ifError}" ${LINENO} $?' ERR # trap errors

__main__
Expand Down
Loading

0 comments on commit e79cf79

Please sign in to comment.