mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-05 20:19:24 +08:00
* Add README.md to scripts/check. * Generalized the check_components script. * Renamed `missing_readme` to `readme`. * Added documentation to the `scripts/check` directory. * Disabled the `scripts/check/missing_example_language` script. * Cleanup verbose echoing in check_components script. * Added more verbosity options. * Added check for accessible URLs. * Added option parsing. * Added left-nav checks. * Added license stanza check. * Added reporting of failed components to check_components script. * Added a script to convert between naming conventions. * Added script to check for videos. * Added check for video still. * Added script to check for site icon. * Added DO NOT SUBMIT check. * Properly quoted output file paths. * Added check for examples. * Updated checklist docs for new script setup. * Added check for example languages in README.md files. Deleted old PHP code. * Added missing exit(-1) from example_languages. * Added uniform error output to example_languages. * Fixed verbosity of scripts/check_components.
116 lines
3.1 KiB
Bash
Executable File
116 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright 2016-present the Material Components for iOS authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# To check all components:
|
|
#
|
|
# $ check_components
|
|
#
|
|
# To check specific components:
|
|
#
|
|
# $ check_components path/to/component [path/to/component [...]]
|
|
|
|
function verbose_echo() {
|
|
if [[ $verbose -ne 0 ]]; then
|
|
echo "$*"
|
|
fi
|
|
}
|
|
|
|
verbose=0
|
|
checks=""
|
|
components=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
"-h" | "--help")
|
|
echo "Usage: $0 [-h] [-v] [-c check_script ...] [path/to/component ...]"
|
|
echo
|
|
echo "Check all components with all checks:"
|
|
echo "\$ $0"
|
|
echo
|
|
echo "Do the same but report what is going on:"
|
|
echo "\$ $0 -v"
|
|
echo
|
|
echo "Check all components with scripts/check/script1 scripts/check/script2:"
|
|
echo "\$ $0 -c scripts/check/script1 -c scripts/check/script2"
|
|
echo
|
|
echo "Check only components/Foo and components/private/Bar:"
|
|
echo "\$ $0 components/Foo components/private/Bar"
|
|
exit 0
|
|
;;
|
|
"-v" | "--verbose")
|
|
verbose=1
|
|
shift 1
|
|
;;
|
|
"-c" | "--check")
|
|
checks="$checks $2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
components="$components $1"
|
|
shift 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
readonly SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
readonly ROOT_DIR=$(dirname "$SCRIPTS_DIR")
|
|
verbose_echo "SCRIPTS_DIR: $SCRIPTS_DIR"
|
|
verbose_echo "ROOT_DIR: $ROOT_DIR"
|
|
|
|
# If no component listed on the command line, find them all.
|
|
if [[ -z "$components" ]]; then
|
|
readonly PUBLIC_COMPONENTS=$(cd $ROOT_DIR && find components -maxdepth 1 -type d | grep -v "components$" | grep -v "components/private$")
|
|
readonly PRIVATE_COMPONENTS=$(cd $ROOT_DIR && find components/private -maxdepth 1 -type d | grep -v "components/private$")
|
|
components="$PUBLIC_COMPONENTS $PRIVATE_COMPONENTS"
|
|
fi
|
|
verbose_echo "components: $components"
|
|
|
|
# Find all the check scripts.
|
|
if [[ -z "$checks" ]]; then
|
|
checks=$(find $SCRIPTS_DIR/check -type f -perm +111)
|
|
fi
|
|
verbose_echo "checks: $checks"
|
|
|
|
# Run through each component, running each check in turn.
|
|
# Keep track of the number that fail any check.
|
|
verbose_echo
|
|
failed=""
|
|
for component in $components; do
|
|
echo "Checking $component ..."
|
|
|
|
all_checks_passed=1
|
|
for check in $checks; do
|
|
$check $ROOT_DIR/$component
|
|
if [[ $? -ne 0 ]]; then
|
|
all_checks_passed=0
|
|
fi
|
|
done
|
|
|
|
if [[ $all_checks_passed -ne 1 ]]; then
|
|
failed="$failed $component"
|
|
fi
|
|
echo
|
|
done
|
|
echo
|
|
|
|
if [[ -z $failed ]]; then
|
|
echo Component checks passed.
|
|
else
|
|
echo "The following components failed:"
|
|
for i in $failed; do
|
|
echo $i
|
|
done
|
|
fi
|