Skip to content

Commit

Permalink
Merge pull request #337 from timur-harin/fix_brew_install_macos
Browse files Browse the repository at this point in the history
Add brew for main packages install from macos
  • Loading branch information
yegor256 committed May 24, 2024
2 parents e2f4f3a + a977ad5 commit 4dbde38
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
30 changes: 30 additions & 0 deletions help/is-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -e
set -o pipefail

if [[ "$OSTYPE" == "darwin"* ]]; then
exit 0
else
exit 1
fi
15 changes: 15 additions & 0 deletions steps/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ function install_package() {
if ! eval "$PACKAGE" --version >/dev/null 2>&1; then
if "${LOCAL}/help/is-linux.sh"; then
"${LOCAL}/help/sudo.sh" apt-get install -y "$PACKAGE"
elif "${LOCAL}/help/is-macos.sh"; then
if brew -v; then
brew install "$PACKAGE"
else
echo "If you install Homebrew, all necessary packages will be installed automatically by running 'make install'. Visit the Homebrew installation documentation at: https://docs.brew.sh/Installation"
exit 1
fi
else
"${LOCAL}/help/assert-tool.sh" "${PACKAGE}" --version
fi
Expand All @@ -51,9 +58,15 @@ install_package aspell
install_package xmlstarlet
install_package gawk

if "${LOCAL}/help/is-macos.sh"; then
brew install coreutils
fi

if ! pdftotext -v >/dev/null 2>&1; then
if "${LOCAL}/help/is-linux.sh"; then
"${LOCAL}/help/sudo.sh" apt-get install -y xpdf
elif "${LOCAL}/help/is-macos.sh"; then
brew install poppler
else
"${LOCAL}/help/assert-tool.sh" pdftotext -v
fi
Expand All @@ -64,6 +77,8 @@ if ! inkscape --version >/dev/null 2>&1; then
"${LOCAL}/help/sudo.sh" add-apt-repository -y ppa:inkscape.dev/stable && \
"${LOCAL}/help/sudo.sh" apt-get update -y --fix-missing && \
"${LOCAL}/help/sudo.sh" apt-get install -y inkscape
elif "${LOCAL}/help/is-macos.sh"; then
brew install --cask inkscape
else
"${LOCAL}/help/assert-tool.sh" inkscape --version
fi
Expand Down

0 comments on commit 4dbde38

Please sign in to comment.