Revert "Rename .tools to .mystools for Arduino IDE" (#687)

This commit is contained in:
Bruce Lacey
2016-12-11 13:28:37 -08:00
committed by GitHub
parent 68ce74d11a
commit 1e37f35dc6
12 changed files with 7 additions and 8 deletions
-95
View File
@@ -1,95 +0,0 @@
#!/bin/bash
###
#
# Tool runtime shim that provides a simple API for running
# tool bundles and convenience functions for other tool developers.
#
##
log() { IFS=" "; >&2 printf "%s\n" "$*"; }
warn() { IFS=" "; >&2 printf "\e[33m%s\e[m\n" "$*"; }
err() { IFS=" "; >&2 printf '\e[31m%s\e[m\n' "$*"; exit 1; }
is_supported_os()
{
[[ ${1} == darwin* ]] || [[ ${1} == linux-gnu ]] || [[ ${1} == freebsd ]] || [[ ${1} == msys ]] || [[ ${1} == cygwin ]]
}
is_installed()
{
which "${1}" > /dev/null 2>&1
}
tools_dir()
{
git_config_tools_dir='git config mysensors.toolsdir'
# Set mysensors.toolsdir in git config if it hasn't been set
if [ ! $($git_config_tools_dir) -o ! -d $($git_config_tools_dir) ]; then
$git_config_tools_dir "$( cd "$(dirname "${BASH_SOURCE[0]}")"; git rev-parse --show-prefix )"
git config alias.mystoolspath '![ -z "${GIT_PREFIX}" ] || cd ${GIT_PREFIX}; echo $(git rev-parse --show-cdup)$(git config mysensors.toolsdir)'
fi
$git_config_tools_dir
}
configure_git_tool_aliases()
{
find "$(git mystoolspath)" -name run.sh -print0 | while IFS= read -r -d '' bundle; do
local tool="$(basename "$(dirname "${bundle}")")"
git config alias.${tool} '!f() { $(git mystoolspath)'${tool}'/run.sh $@; }; f'
done
}
bootstrap_cksum()
{
echo $(git ls-files -s -- $(git mystoolspath)bootstrap-dev.sh | cut -d' ' -f2)
}
bootstrap_version()
{
git_config_bootstrap_version='git config mysensors.bootstrap-cksum'
if [[ $1 == --set ]]; then
$git_config_bootstrap_version $(bootstrap_cksum)
else
echo $($git_config_bootstrap_version)
fi
}
environment_outdated()
{
[[ $(bootstrap_version) != $(bootstrap_cksum) ]]
}
modifiedSourceFiles()
{
against=$(git rev-parse --verify HEAD >/dev/null 2>&1 && echo HEAD || echo 4b825dc642cb6eb9a060e54bf8d69288fbee4904)
git diff $1 --diff-filter=AM --name-only $against | grep -E '.*\.(c|cpp|h|hpp|ino)$'
}
stagedSourceFiles()
{
modifiedSourceFiles '--cached'
}
runBundle()
{
local bundle="$(dirname "${0}")"
local tool=$(basename "${bundle}")
local CMD_OPTIONS=$( TOOLCONFIG="${bundle}/config" "${bundle}/options.sh" )
$tool $CMD_OPTIONS "$@"
}
###
# Common environment variables
#
$(git rev-parse --is-inside-work-tree --quiet >/dev/null 2>&1) || err "Working directory is not a git repository. aborting..."
if environment_outdated && [[ $(basename "${0}") != *bootstrap* ]]; then
err "Your environment is out of date... Re-run $(git mystoolspath)bootstrap-dev.sh and try again"
fi
GITREPO=$(git rev-parse --show-toplevel)
GITDIR=$(git rev-parse --git-dir)
TOOLSDIR="$(tools_dir)"