Skip to content

Commit 6fa5030

Browse files
committed
docs(setup): add how to instructions
1 parent f7aac86 commit 6fa5030

File tree

2 files changed

+47
-21
lines changed

2 files changed

+47
-21
lines changed

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
# Setup Flutter
22

3-
Automated script to install and setup Flutter development environment with Homebrew and FVM. Compatible with macOS and Linux.
3+
This script automates the installation of all required tools to set up a new machine to start developing with Flutter.
44

5-
## Install
5+
## Prerequisites
66

7-
```sh
7+
* The machine should be running macOS or Linux (Ubuntu/Debian).
8+
* The machine should have an active internet connection.
9+
* curl should be installed.
10+
11+
## Steps to Run the Script
12+
13+
1. Open the terminal.
14+
2. Run the following command:
15+
```sh
816
curl -fsSl https://raw.githubusercontent.com/shan-shaji/setup-flutter/main/setup-flutter | /bin/bash
917
```
1018

11-
This script will perform the following steps:
19+
3. Wait for the script to complete. It may take some time depending on the speed of your internet connection.
20+
21+
## Support
22+
23+
If you encounter any issues while running the script, please create an issue on the [GitHub repository](https://github.com/shan-shaji/setup-flutter/issues).
24+
25+
## Failure and Success Cases
26+
27+
* If any of the prerequisites are not met, the script will exit with an appropriate error message.
28+
* If any of the installations fail, the script will exit with an appropriate error message.
29+
* If the script completes successfully, all required tools will be installed and the machine will be ready for Flutter development.
30+
31+
**Note:** This script will perform the following steps:
1232

1333
- Install Home Brew
1434
- Install Snap - Linux
@@ -18,7 +38,8 @@ This script will perform the following steps:
1838
- Install FVM
1939
- Install Flutter default version
2040

21-
## Supports
41+
**Note**: The script does not install Xcode, JDK, or any other Android-related tools. You must have Xcode and JDK installed on macOS, and you need to configure Android Studio manually on both macOS and Linux.
42+
43+
**Note:** This script installs the stable version of Flutter. If you want to install a different version, you can do so using `fvm`. For more information on `fvm`, please refer to the [GitHub repository](https://github.com/leoafarias/fvm).
2244

23-
- ✅ Mac OS
24-
- ✅ Ubuntu
45+
**Note:** This script sets up `fvm` and adds it to the PATH. You can use `fvm` to manage different versions of Flutter on the same machine.

setup-flutter

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
#!/bin/bash
22

3-
# Install Homebrew if it's not already installed
4-
which brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3+
# Check if Homebrew is installed, and install it if necessary
4+
if ! command -v brew &> /dev/null; then
5+
echo "Installing Homebrew..."
6+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
7+
fi
58

69
# Add Homebrew to the PATH if it's not already there
710
if [ "$(uname)" == "Darwin" ]; then
8-
# macOS
11+
912
if [ ! -f ~/.zshrc ]; then
1013
touch ~/.zshrc
1114
fi
15+
1216
if ! grep -q 'eval "$(/opt/homebrew/bin/brew shellenv)"' ~/.zshrc; then
1317
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zshrc
1418
eval "$(/opt/homebrew/bin/brew shellenv)"
1519
fi
20+
21+
# Check if brew command is available
22+
if ! command brew -v &> /dev/null; then
23+
echo "Homebrew not found. Please check the Homebrew installation and PATH setup."
24+
exit 1
25+
fi
26+
1627
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
28+
1729
# Add homebrew to path if it's not already added
1830
if ! grep -q 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' ~/.bashrc && ! grep -q 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' ~/.zshrc; then
1931
if [ -n "$ZSH_VERSION" ]; then
@@ -23,7 +35,10 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
2335
fi
2436
fi
2537

26-
# Install snap if not installed
38+
# Since --cask option is not supported in linux using snap
39+
# to install applications.
40+
#
41+
# Install snap package.
2742
if ! command -v snap &> /dev/null; then
2843
sudo apt-get update
2944
sudo apt-get install -y snapd
@@ -37,16 +52,6 @@ elif [ -n "$BASH_VERSION" ]; then
3752
source ~/.bashrc
3853
fi
3954

40-
# Check if brew command is available
41-
# &> /dev/null: This is a redirection that redirects both
42-
# the standard output and standard error streams of the command to the null device, 4
43-
# discarding any output that the command may produce.
44-
# This is done to make the command run silently, without producing any output on the screen.
45-
if ! command brew -v &> /dev/null; then
46-
echo "Homebrew not found. Please check the Homebrew installation and PATH setup."
47-
exit 1
48-
fi
49-
x
5055

5156
if [ "$(uname)" == "Darwin" ]; then
5257
# Install Java if it's not already installed

0 commit comments

Comments
 (0)