| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | YELLOW="\e[93m" | 
					
						
							| 
									
										
										
										
											2022-07-18 20:08:13 -04:00
										 |  |  | GREEN="\e[32m" | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | RED="\e[31m" | 
					
						
							|  |  |  | ENDCOLOR="\e[0m" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage() { | 
					
						
							|  |  |  |    printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | printSuccess() { | 
					
						
							|  |  |  |    printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | printError() { | 
					
						
							|  |  |  |    printf "${RED}AppFlowy : $1${ENDCOLOR}\n" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | # Install Rust | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "The Rust programming language is required to compile AppFlowy." | 
					
						
							|  |  |  | printMessage "We can install it now if you don't already have it on your system." | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-23 21:59:32 -07:00
										 |  |  | read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-23 21:59:32 -07:00
										 |  |  | if [[ "${installrust:-N}" == [Yy] ]]; then | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  |    printMessage "Installing Rust." | 
					
						
							|  |  |  |    brew install rustup-init | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  |    rustup-init -y --default-toolchain=stable | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-02 14:06:07 +08:00
										 |  |  |    source "$HOME/.cargo/env" | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  |    printMessage "Skipping Rust installation." | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install sqllite | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "Installing sqlLite3." | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | brew install sqlite3 | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "Setting up Flutter" | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | # Get the current Flutter version | 
					
						
							|  |  |  | FLUTTER_VERSION=$(flutter --version | grep -oE 'Flutter [^ ]+' | grep -oE '[^ ]+$') | 
					
						
							| 
									
										
										
										
											2023-05-28 05:09:39 +01:00
										 |  |  | # Check if the current version is 3.10.1 | 
					
						
							|  |  |  | if [ "$FLUTTER_VERSION" = "3.10.1" ]; then | 
					
						
							|  |  |  |    echo "Flutter version is already 3.10.1" | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | else | 
					
						
							|  |  |  |    # Get the path to the Flutter SDK | 
					
						
							|  |  |  |    FLUTTER_PATH=$(which flutter) | 
					
						
							|  |  |  |    FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    current_dir=$(pwd) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    cd $FLUTTER_PATH | 
					
						
							| 
									
										
										
										
											2023-05-28 05:09:39 +01:00
										 |  |  |    # Use git to checkout version 3.10.1 of Flutter | 
					
						
							|  |  |  |    git checkout 3.10.1 | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  |    # Get back to current working directory | 
					
						
							|  |  |  |    cd "$current_dir" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 05:09:39 +01:00
										 |  |  |    echo "Switched to Flutter version 3.10.1" | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Enable linux desktop | 
					
						
							| 
									
										
										
										
											2022-07-18 21:44:11 -04:00
										 |  |  | flutter config --enable-macos-desktop | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Fix any problems reported by flutter doctor | 
					
						
							|  |  |  | flutter doctor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Add the githooks directory to your git configuration | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "Setting up githooks." | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | git config core.hooksPath .githooks | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | # Install go-gitlint | 
					
						
							| 
									
										
										
										
											2022-07-25 12:02:33 -04:00
										 |  |  | printMessage "Installing go-gitlint." | 
					
						
							|  |  |  | GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz" | 
					
						
							| 
									
										
										
										
											2022-07-31 20:09:41 +08:00
										 |  |  | curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME} | 
					
						
							| 
									
										
										
										
											2023-03-16 07:11:14 +05:30
										 |  |  | tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint | 
					
						
							| 
									
										
										
										
											2022-07-25 12:02:33 -04:00
										 |  |  | rm ${GOLINT_FILENAME} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | # Change to the frontend directory | 
					
						
							| 
									
										
										
										
											2022-09-23 21:59:32 -07:00
										 |  |  | cd frontend || exit 1 | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Install cargo make | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "Installing cargo-make." | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | cargo install --force cargo-make | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install duckscript | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "Installing duckscript." | 
					
						
							| 
									
										
										
										
											2022-07-18 15:24:25 -04:00
										 |  |  | cargo install --force duckscript_cli | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Check prerequisites | 
					
						
							| 
									
										
										
										
											2022-07-19 13:07:25 -04:00
										 |  |  | printMessage "Checking prerequisites." | 
					
						
							| 
									
										
										
										
											2023-01-17 16:27:17 +08:00
										 |  |  | cargo make appflowy-flutter-deps-tools |