forked from Bash-it/bash-it
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a plugin that makes it easier to use the gradle wrapper if a proj…
…ect has one.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cite about-plugin | ||
about-plugin 'Add a gw command to use gradle wrapper if present, else use system gradle' | ||
|
||
function gw() { | ||
local file="gradlew" | ||
local curr_path="${PWD}" | ||
local result="gradle" | ||
|
||
# Search recursively upwards for file. | ||
until [[ "${curr_path}" == "/" ]]; do | ||
if [[ -e "${curr_path}/${file}" ]]; then | ||
result="${curr_path}/${file}" | ||
break | ||
else | ||
curr_path=$(dirname "${curr_path}") | ||
fi | ||
done | ||
|
||
# Call gradle | ||
"${result}" $* | ||
} | ||
|