Compare commits
No commits in common. "8f12b643b82c307d403e7ce3ad5c8d155f21333f" and "d9163bcff87d55182d3b8759ffeeec7f7d66400b" have entirely different histories.
8f12b643b8
...
d9163bcff8
15
Dockerfile
15
Dockerfile
@ -17,23 +17,20 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
|||||||
RUN curl -L http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -o /usr/local/bin/php-cs-fixer && \
|
RUN curl -L http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -o /usr/local/bin/php-cs-fixer && \
|
||||||
chmod a+x /usr/local/bin/php-cs-fixer
|
chmod a+x /usr/local/bin/php-cs-fixer
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# add csscomb and prettier
|
# add csscomb and prettier
|
||||||
RUN yarn add prettier csscomb --global && \
|
RUN yarn add prettier csscomb --global && \
|
||||||
ln -s /app/node_modules/.bin/prettier /usr/local/bin/prettier && \
|
ln -s /node_modules/.bin/prettier /usr/local/bin/prettier && \
|
||||||
ln -s /app/node_modules/.bin/csscomb /usr/local/bin/csscomb
|
ln -s /node_modules/.bin/csscomb /usr/local/bin/csscomb
|
||||||
|
|
||||||
COPY ["src/entry.sh", "/app/entry.sh"]
|
COPY ["src/entry.sh", "/entry.sh"]
|
||||||
|
|
||||||
COPY ["src/inc", "/app/inc"]
|
COPY ["src/inc", "/inc"]
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
|
CMD ["/entry.sh"]
|
||||||
|
|
||||||
CMD ["/app/entry.sh"]
|
ENTRYPOINT ["/entry.sh"]
|
||||||
ENTRYPOINT ["/app/entry.sh"]
|
|
||||||
|
|
||||||
|
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
ARG COMMIT_SHA
|
ARG COMMIT_SHA
|
||||||
|
|||||||
18
src/entry.sh
18
src/entry.sh
@ -46,24 +46,6 @@ main() {
|
|||||||
process
|
process
|
||||||
return $?
|
return $?
|
||||||
;;
|
;;
|
||||||
prettier)
|
|
||||||
__initVariables "$@"
|
|
||||||
source ${INCLUDES_PATH}/formatters/prettier.shinc
|
|
||||||
__prettier
|
|
||||||
return $?
|
|
||||||
;;
|
|
||||||
csscomb)
|
|
||||||
__initVariables "$@"
|
|
||||||
source ${INCLUDES_PATH}/formatters/csscomb.shinc
|
|
||||||
__csscomb
|
|
||||||
return $?
|
|
||||||
;;
|
|
||||||
php-cs-fixer)
|
|
||||||
__initVariables "$@"
|
|
||||||
source ${INCLUDES_PATH}/formatters/php-cs-fixer.shinc
|
|
||||||
__phpFixer
|
|
||||||
return $?
|
|
||||||
;;
|
|
||||||
help|--help|-h)
|
help|--help|-h)
|
||||||
usage
|
usage
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
|
|
||||||
__csscomb() {
|
|
||||||
__msg "Csscomb:"
|
|
||||||
|
|
||||||
if [[ ${DRY_RUN} -eq 0 ]]; then
|
|
||||||
csscomb -v "${CSS_FILES[@]}"
|
|
||||||
else
|
|
||||||
csscomb --lint -v "${CSS_FILES[@]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
|
|
||||||
__phpFixer() {
|
|
||||||
local failed=0
|
|
||||||
|
|
||||||
__msg "PHP-cs-fixer"
|
|
||||||
|
|
||||||
# Cannot chain php files without specifying a config CS file :(
|
|
||||||
if [[ ${DRY_RUN} -eq 0 ]]; then
|
|
||||||
for file in "${PHP_FILES[@]}"; do
|
|
||||||
php-cs-fixer fix "${file}"
|
|
||||||
[[ $? -ne 0 ]] && failed=1
|
|
||||||
done
|
|
||||||
else
|
|
||||||
local needs_fixing=()
|
|
||||||
local invalid_syntax=()
|
|
||||||
|
|
||||||
for file in "${PHP_FILES[@]}"; do
|
|
||||||
php-cs-fixer fix --dry-run "${file}"
|
|
||||||
case $? in
|
|
||||||
0)
|
|
||||||
#all good
|
|
||||||
;;
|
|
||||||
4)
|
|
||||||
invalid_syntax+=("${file}")
|
|
||||||
;;
|
|
||||||
8)
|
|
||||||
needs_fixing+=("${file}")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__err "There was an error with php-cs-fixer configuration"
|
|
||||||
failed=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ ${#needs_fixing[@]} -gt 0 ]]; then
|
|
||||||
failed=1
|
|
||||||
|
|
||||||
__err "Needs fixing:" 1
|
|
||||||
for file in "${needs_fixing[@]}"; do
|
|
||||||
__msg "${file}" 2
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${#invalid_syntax[@]} -gt 0 ]]; then
|
|
||||||
failed=1
|
|
||||||
|
|
||||||
__err "Invalid syntax:" 1
|
|
||||||
for file in "${invalid_syntax[@]}"; do
|
|
||||||
__msg "${file}" 2
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
return ${failed}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
|
|
||||||
__prettier() {
|
|
||||||
__msg "Prettier:"
|
|
||||||
|
|
||||||
if [[ ${DRY_RUN} -eq 0 ]]; then
|
|
||||||
prettier --write "${JS_FILES[@]}"
|
|
||||||
else
|
|
||||||
__msg "Listing (: unprettiered :) files:" 1
|
|
||||||
prettier --list-different "${JS_FILES[@]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
@ -1,31 +1,54 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
source ${INCLUDES_PATH}/formatters/prettier.shinc
|
|
||||||
source ${INCLUDES_PATH}/formatters/csscomb.shinc
|
__csscomb() {
|
||||||
source ${INCLUDES_PATH}/formatters/php-cs-fixer.shinc
|
if [[ ${DRY_RUN} -eq 0 ]]; then
|
||||||
|
csscomb "$@"
|
||||||
|
else
|
||||||
|
csscomb --lint "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__prettier() {
|
||||||
|
if [[ ${DRY_RUN} -eq 0 ]]; then
|
||||||
|
prettier --write "$@"
|
||||||
|
else
|
||||||
|
prettier --list-different "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
__phpFixer() {
|
||||||
|
# Cannot chain php files without specifying a config CS file :(
|
||||||
|
if [[ ${DRY_RUN} -eq 0 ]]; then
|
||||||
|
for file in "${PHP_FILES[@]}"; do
|
||||||
|
php-cs-fixer fix "${file}"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for file in "${PHP_FILES[@]}"; do
|
||||||
|
php-cs-fixer fix --dry-run "${file}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
local failed=0
|
|
||||||
|
|
||||||
# Run css comb
|
# Run css comb
|
||||||
if [[ ${#CSS_FILES[@]} -ne 0 ]]; then
|
if [[ ${#CSS_FILES[@]} -ne 0 ]]; then
|
||||||
__csscomb
|
__csscomb "${CSS_FILES[@]}"
|
||||||
[[ $? -ne 0 ]] && failed=1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run JS prettier
|
# Run JS prettier
|
||||||
if [[ ${#JS_FILES[@]} -ne 0 ]]; then
|
if [[ ${#JS_FILES[@]} -ne 0 ]]; then
|
||||||
__prettier
|
__prettier --write "${JS_FILES[@]}"
|
||||||
[[ $? -ne 0 ]] && failed=1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run PHP cs fixer
|
# Run PHP cs fixer
|
||||||
if [[ ${#PHP_FILES[@]} -ne 0 ]]; then
|
if [[ ${#PHP_FILES[@]} -ne 0 ]]; then
|
||||||
__phpFixer
|
__phpFixer ${PHP_FILES[@]}
|
||||||
[[ $? -ne 0 ]] && failed=1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return ${failed}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,25 +25,25 @@ __initVariables() {
|
|||||||
__path_exists "${1}"
|
__path_exists "${1}"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
__err "Specified path does not exist: ${1}"
|
__err "Specified path does not exist: ${1}"
|
||||||
else
|
continue
|
||||||
CSS_FILES+=("${1}")
|
|
||||||
fi
|
fi
|
||||||
|
CSS_FILES+=(${1})
|
||||||
;;
|
;;
|
||||||
*.js|*.jsx)
|
*.js|*.jsx)
|
||||||
__path_exists "${1}"
|
__path_exists "${1}"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
__err "Specified path does not exist: ${1}"
|
__err "Specified path does not exist: ${1}"
|
||||||
else
|
continue
|
||||||
JS_FILES+=("${1}")
|
|
||||||
fi
|
fi
|
||||||
|
JS_FILES+=(${1})
|
||||||
;;
|
;;
|
||||||
*.php|*.phtml)
|
*.php|*.phtml)
|
||||||
__path_exists "${1}"
|
__path_exists "${1}"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
__err "Specified path does not exist: ${1}"
|
__err "Specified path does not exist: ${1}"
|
||||||
else
|
continue
|
||||||
PHP_FILES+=("${1}")
|
|
||||||
fi
|
fi
|
||||||
|
PHP_FILES+=(${1})
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift 1
|
shift 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user