Skip to content

Commit

Permalink
now it will work
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorgalvao committed Jan 6, 2017
1 parent 6a5961b commit f629c53
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ci/travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@

header 'Running script.sh...'

modified_casks=($(git diff --name-only --diff-filter=AM "${TRAVIS_COMMIT_RANGE}" -- Casks/*.rb))
ruby_files_added_outside_casks_dir=($(find . -maxdepth 1 -type f | git diff --name-only --diff-filter=A "${TRAVIS_COMMIT_RANGE}" -- *.rb))
modified_ruby_files=($(git diff --name-only --diff-filter=AM "${TRAVIS_COMMIT_RANGE}" -- *.rb))

if [[ ${#ruby_files_added_outside_casks_dir[@]} -gt 0 ]]; then
odie "Casks added outside Casks directory: ${ruby_files_added_outside_casks_dir[@]}"
for file in "${modified_ruby_files[@]}"; do
[[ "${file}" == 'Casks/'* ]] && modified_casks+=("${file}") || casks_wrong_dir+=("${file}")
done

if [[ ${#casks_wrong_dir[@]} -gt 0 ]]; then
odie "Casks added outside Casks directory: ${casks_wrong_dir[*]}"
elif [[ ${#modified_casks[@]} -gt 0 ]]; then
run brew cask _audit_modified_casks "${TRAVIS_COMMIT_RANGE}"
run brew cask style "${modified_casks[@]}"
Expand Down

0 comments on commit f629c53

Please sign in to comment.