Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added swiftformat to install and bootstrap #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e

DEFAULT_CARTHAGE_VERSION="0.16.2"
DEFAULT_SWIFTLINT_VERSION="0.9.2"
DEFAULT_XCODE_VERSION="7.3"
DEFAULT_XCODE_VERSION="10.1"

generate_env_file ()
{
Expand Down Expand Up @@ -48,6 +48,10 @@ generate_env_file ()
echo ""
echo "What version of Xcode should we use? [$DEFAULT_XCODE_VERSION]"
read required_xcode_version
if [ -z "$required_xcode_version" ]
then
required_xcode_version="$DEFAULT_XCODE_VERSION"
fi

echo ""
echo "Do you want to install githooks when bootstrapping the project? [Y/n]"
Expand All @@ -62,8 +66,16 @@ generate_env_file ()
echo ""
echo "What version of swiftlint should we use? [$DEFAULT_SWIFTLINT_VERSION]"
read required_swiftlint_version
if [ -z "$required_swiftlint_version" ]
then
required_swiftlint_version="$DEFAULT_SWIFTLINT_VERSION"
fi
fi

echo ""
echo "Do you want to install SwiftFormat? [N/y]"
read use_swiftformat

if [ -f $1/Cartfile ] || [ -f $1/Cartfile.private ]
then
echo ""
Expand Down Expand Up @@ -128,7 +140,10 @@ XCODE_PROJECT=$xcode_project_file
IOS_DESTINATION_VERSION=\${IOS_DESTINATION_VERSION:-\"$ios_destination_version\"}
IOS_DESTINATION_SIMULATOR_NAME=\${IOS_DESTINATION_SIMULATOR_NAME:-\"$ios_destination_simulator_name\"}
OSX_DESTINATION_ARCH=\${OSX_DESTINATION_ARCH:-\"$osx_destination_arch\"}" > "$1/script/.env"

if [ "$use_swiftformat" == "y" ]
then
echo "USE_SWIFTFORMAT=true" >> "$1/script/.env"
fi
if [ "$use_ssh" == "y" ]
then
echo "USE_SSH=true" >> "$1/script/.env"
Expand Down
19 changes: 19 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ install_swiftlint ()
fi
}

install_swiftformat ()
{
source script/common/swiftformat

if type swiftformat > /dev/null
then
echo ""
echo " ✔ SwiftFormat already installed!"
echo ""
else
force_install_swiftformat
fi
}

install_tailor ()
{
source script/common/tailor
Expand Down Expand Up @@ -199,6 +213,11 @@ main ()
then
install_swiftlint
fi

if [ -n $USE_SWIFTFORMAT ]
then
install_swiftformat
fi

if [ -f .tailor.yml ]
then
Expand Down
11 changes: 11 additions & 0 deletions script/common/swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
force_install_swiftformat ()
{
echo ""
echo " → Installing and configuring SwiftFormat..."
echo ""
brew update && brew install swiftformat

echo ""
echo " SwiftFormat successfully installed"
echo ""
}