Skip to content

Commit

Permalink
Merge pull request #56 from ShawHahnLab/hotfix-macos-icon
Browse files Browse the repository at this point in the history
Release 0.3.1
  • Loading branch information
ressy authored Jan 31, 2020
2 parents f9225a3 + a510753 commit e6f6121
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: chiimp
Title: Computational, High-throughput Individual Identification through Microsatellite Profiling
Version: 0.3.0
Version: 0.3.1
Authors@R: person("Jesse", "Connell", email = "[email protected]", role = c("aut", "cre"))
Description: An R package to analyze microsatellites in high-throughput sequencing datasets.
Depends: R (>= 3.2.3)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# chiimp 0.3.1

* Fixed icon setup on Mac OS ([#56]).

# chiimp 0.3.0

* Improved icon setup on Mac OS ([#48]).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ high-throughput sequencing datasets.

For automated installation and program usage see [GUIDE.pdf] here or in a
[released version](https://github.com/ShawHahnLab/chiimp/releases), and the [worked examples].
The most recent released version is [0.3.0](https://github.com/ShawHahnLab/chiimp/releases/tag/0.3.0).
The most recent released version is [0.3.1](https://github.com/ShawHahnLab/chiimp/releases/tag/0.3.1).
For usage as an R package also see the built-in package documentation. The
package-level page (`?chiimp`) provides an overview with links to specific
functions.
Expand Down
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
set -e

# On MacOS, compile the AppleScript for the desktop icon into an application.
# In the installed package chiimp.app will be at the top level of the package
# directory.
if test $(uname -s) = Darwin; then
# I tried exec/chiimp.app, but R CMD install seems to skip directories
# when copying (which chimp.app actually is)
Expand Down
12 changes: 8 additions & 4 deletions exec/chiimp.command
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Mac OS wrapper to the CHIIMP command-line script.
#
# This script will wait for a keypress before exiting since it presumably
# opened its own terminal window.
# opened its own terminal window and Terminal may or may not be configured to
# auto-close windows when commands finish. If CHIIMP_AUTOCLOSE is set to yes,
# this is skipped.

# This directory
dir=$(dirname $BASH_SOURCE)
Expand All @@ -22,7 +24,9 @@ else
rel=$(pwd)
fi
cd "$cfg_dir"
Rscript "$rel/$dir/chiimp" $*
Rscript "$rel/$dir/chiimp" "$@"
fi
if [[ "$CHIIMP_AUTOCLOSE" != "yes" ]]; then
read -p "Press any key to continue... " -n1 -s
echo
fi
read -p "Press any key to continue... " -n1 -s
echo
25 changes: 23 additions & 2 deletions tools/chiimp.AppleScript
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,31 @@ end open
-- Note that the path used will only work on an installed
-- (non-inst-directory-containing) copy of the package.
on process_item(this_item)
set chiimp_autoclose to system attribute "CHIIMP_AUTOCLOSE"
-- Build up a command string that incorporates the full path to the
-- .command file, the config file argument, and the special environment variable
-- CHIIMP_AUTOCLOSE (this isn't automatically exported to the Terminal
-- call but it works to just build it into the string here.)
set UnixPath to quoted form of POSIX path of ((path to me as text) & "::")
set runCmd to UnixPath & "/../exec/chiimp.command " & quoted form of POSIX path of this_item
set runCmd to UnixPath & "/exec/chiimp.command " & quoted form of POSIX path of this_item
set runCmd to "CHIIMP_AUTOCLOSE=" & chiimp_autoclose & " " & runCmd & "; exit"
-- Send the command string to the Terminal app, and wait for it to
-- complete.
tell application "Terminal"
activate
do script runCmd
-- This is the cleanest way I could find to have the
-- AppleScript wait for the shell script to finish.
-- https://stackoverflow.com/a/17225439
set w to do script runCmd
repeat
delay 0.1
if not busy of w then exit repeat
end repeat
end tell
-- Now use the CHIIMP_AUTOCLOSE environment variable here to decide if
-- we should close the terminal window
if (chiimp_autoclose is "yes") then
-- https://stackoverflow.com/a/57415817
tell application "Terminal" to close (get window 1)
end if
end process_item
33 changes: 27 additions & 6 deletions tools/travis_install_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash

# This is a helper script for Travis testing.
# Assumes working directory is the project directory.

Expand All @@ -23,11 +22,33 @@ elif [[ $TRAVIS_OS_NAME == "osx" ]]; then
# Desktop icon should be a symbolic link to an existent directory
test -d ~/Desktop/CHIIMP
test -h ~/Desktop/CHIIMP
# TODO we may be able to test the drag-and-drop behavior with a command like this:
# open -W -a ~/Desktop/CHIIMP .../config.yml
# Currently the .app exits and leaves the Terminal window open, though,
# so -W doesn't work as expected. Changing the AppleScript .app export
# options might resolve this.
# Desktop icon should run chiimp.command when a config file is dragged
# onto it
# First, set up inputs in a temp location.
# TODO This is largely a repeat of what's in demo.sh
cd "$(dirname $BASH_SOURCE)"
dir=$(pwd -P)
inst="../inst"
scratch=$(mktemp -d)
R --vanilla -q -e "devtools::load_all('..', quiet=T); test_data\$write_seqs(test_data\$seqs, '$scratch/str-dataset', 'Replicate1-Sample%s-%s.fasta')" > /dev/null
cp "$dir/$inst/example_locus_attrs.csv" "$scratch/locus_attrs.csv"
cp "$dir/$inst/example_config.yml" "$scratch/config.yml"
cd "$scratch"
# Simulate drag-and-drop onto the icon, and specify that it should exit
# automatically when finished so Travis can continue
# TODO why do we need to call it multiple times? It's not just the
# output that's not there at first, we actually need to try the open
# command a couple of times in some cases.
timeout=60
while [[ $timeout -gt 0 ]]; do
CHIIMP_AUTOCLOSE=yes open -W -a ~/Desktop/CHIIMP config.yml
test -e str-results/summary.csv && break || true
echo "waiting for str-results/summary.csv... (${timeout}s)"
timeout=$((timeout - 5))
sleep 5
done
# In case we timed out, run one final check (and fail, if we did time out)
test -e str-results/summary.csv
elif [[ $TRAVIS_OS_NAME == "windows" ]]; then
# (If and when enabled in the Travis config.)
yes | ./install_windows.cmd
Expand Down

0 comments on commit e6f6121

Please sign in to comment.