From 300f94cb0e1121e7796edbedcbc6d686e755be5b Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Tue, 12 Mar 2013 13:11:18 -0400 Subject: [PATCH 1/2] Use [ -nt ] instead of stat -f%m to check cache files. --- plugins/ant/ant.plugin.zsh | 16 +++------------- plugins/cake/cake.plugin.zsh | 11 ++++------- plugins/gradle/gradle.plugin.zsh | 19 +++---------------- plugins/phing/phing.plugin.zsh | 9 +++------ 4 files changed, 13 insertions(+), 42 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 691d4d2d..45f2b06e 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,17 +1,7 @@ -stat -f%m . > /dev/null 2>&1 -if [ "$?" = 0 ]; then - stat_cmd=(stat -f%m) -else - stat_cmd=(stat -L --format=%Y) -fi - _ant_does_target_list_need_generating () { - if [ ! -f .ant_targets ]; then return 0; - else - accurate=$($stat_cmd .ant_targets) - changed=$($stat_cmd build.xml) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .ant_targets ] && return 0; + [ .ant_targets -nt build.xml ] && return 0; + return 1; } _ant () { diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index 1d0d196e..44cc4747 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -14,12 +14,9 @@ _cake_does_target_list_need_generating () { return 1; fi - if [ ! -f ${_cake_task_cache_file} ]; then return 0; - else - accurate=$(stat -f%m $_cake_task_cache_file) - changed=$(stat -f%m Cakefile) - return $(expr $accurate '>=' $changed) - fi + [ ! -f ${_cake_task_cache_file} ] && return 0; + [ ${_cake_task_cache_file} -nt Cakefile ] && return 0; + return 1; } _cake () { @@ -33,4 +30,4 @@ _cake () { fi } -compdef _cake cake \ No newline at end of file +compdef _cake cake diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index fc4c78c5..9229512f 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -54,27 +54,14 @@ function in_gradle() { fi } -############################################################################ -# Define the stat_cmd command based on platform behavior -########################################################################## -stat -f%m . > /dev/null 2>&1 -if [ "$?" = 0 ]; then - stat_cmd=(stat -f%m) -else - stat_cmd=(stat -L --format=%Y) -fi - ############################################################################## Examine the build.gradle file to see if its # timestamp has changed, and if so, regen # the .gradle_tasks cache file ############################################################################ _gradle_does_task_list_need_generating () { - if [ ! -f .gradletasknamecache ]; then return 0; - else - accurate=$($stat_cmd .gradletasknamecache) - changed=$($stat_cmd build.gradle) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .gradletasknamecache ] && return 0; + [ .gradletasknamecache -nt build.gradle ] && return 0; + return 1; } diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 8f4adca0..1abf0a95 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -1,10 +1,7 @@ _phing_does_target_list_need_generating () { - if [ ! -f .phing_targets ]; then return 0; - else - accurate=$(stat -f%m .phing_targets) - changed=$(stat -f%m build.xml) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .phing_targets ] && return 0; + [ .phing_targets -nt build.xml ] && return 0; + return 1; } _phing () { From bdf4f5a347789069dda438e64467344b551fff00 Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Tue, 12 Mar 2013 13:15:05 -0400 Subject: [PATCH 2/2] Allow ":" and "-" characters in phing tasks. Tasks that included hyphens or colons were being excluded from completion. This improves the usage for this. --- plugins/phing/phing.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 1abf0a95..795f1db8 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -7,7 +7,7 @@ _phing_does_target_list_need_generating () { _phing () { if [ -f build.xml ]; then if _phing_does_target_list_need_generating; then - phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets + phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets fi compadd `cat .phing_targets` fi