From ae78fd6af886ccb94cb0f9dc6f3c66186344c3dd Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Thu, 14 Apr 2022 09:08:47 +0530 Subject: [PATCH 1/6] Written praxis_development flavour script --- scripts/praxis_development.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/praxis_development.sh diff --git a/scripts/praxis_development.sh b/scripts/praxis_development.sh new file mode 100644 index 0000000..8f9ec2d --- /dev/null +++ b/scripts/praxis_development.sh @@ -0,0 +1,35 @@ +# Go to root dir from the current scripts dir +echo "<---Going to root directory--->" +cd .. + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the presentation layer +echo "<---Generating config files for the presentation layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +# Go to data layer (package) +echo "<---Going to data layer--->" +cd praxis_data || return + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the data layer +echo "<---Generating config files for the data layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +#Go back to root dir +echo "<---Going back to root dir--->" +cd .. + +# Generate translation files +echo "<---Generating translation files--->" +flutter gen-l10n --template-arb-file=arb/app_en.arb + +# Build development flavor and run it +echo "<---Building development flavor and running it--->" +flutter run --flavor development --target lib/main_development.dart +echo "<---Press any key to exit--->" +read -r \ No newline at end of file From 421356e33aca024afc2da26af92f7e2d48cd6df6 Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Thu, 14 Apr 2022 09:21:35 +0530 Subject: [PATCH 2/6] Written staging and production scripts --- scripts/praxis_development.sh | 4 +++- scripts/praxis_production.sh | 37 +++++++++++++++++++++++++++++++++++ scripts/praxis_staging.sh | 37 +++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 scripts/praxis_production.sh create mode 100644 scripts/praxis_staging.sh diff --git a/scripts/praxis_development.sh b/scripts/praxis_development.sh index 8f9ec2d..68cc177 100644 --- a/scripts/praxis_development.sh +++ b/scripts/praxis_development.sh @@ -1,3 +1,5 @@ +# Please make sure that you have your device selected in the Flutter Device Section before running this script + # Go to root dir from the current scripts dir echo "<---Going to root directory--->" cd .. @@ -32,4 +34,4 @@ flutter gen-l10n --template-arb-file=arb/app_en.arb echo "<---Building development flavor and running it--->" flutter run --flavor development --target lib/main_development.dart echo "<---Press any key to exit--->" -read -r \ No newline at end of file +read -r diff --git a/scripts/praxis_production.sh b/scripts/praxis_production.sh new file mode 100644 index 0000000..b0a2105 --- /dev/null +++ b/scripts/praxis_production.sh @@ -0,0 +1,37 @@ +# Please make sure that you have your device selected in the Flutter Device Section before running this script + +# Go to root dir from the current scripts dir +echo "<---Going to root directory--->" +cd .. + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the presentation layer +echo "<---Generating config files for the presentation layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +# Go to data layer (package) +echo "<---Going to data layer--->" +cd praxis_data || return + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the data layer +echo "<---Generating config files for the data layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +#Go back to root dir +echo "<---Going back to root dir--->" +cd .. + +# Generate translation files +echo "<---Generating translation files--->" +flutter gen-l10n --template-arb-file=arb/app_en.arb + +# Build production flavor and run it +echo "<---Building production flavor and running it--->" +flutter run --flavor production --target lib/main_production.dart +echo "<---Press any key to exit--->" +read -r \ No newline at end of file diff --git a/scripts/praxis_staging.sh b/scripts/praxis_staging.sh new file mode 100644 index 0000000..9caabb3 --- /dev/null +++ b/scripts/praxis_staging.sh @@ -0,0 +1,37 @@ +# Please make sure that you have your device selected in the Flutter Device Section before running this script + +# Go to root dir from the current scripts dir +echo "<---Going to root directory--->" +cd .. + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the presentation layer +echo "<---Generating config files for the presentation layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +# Go to data layer (package) +echo "<---Going to data layer--->" +cd praxis_data || return + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the data layer +echo "<---Generating config files for the data layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +#Go back to root dir +echo "<---Going back to root dir--->" +cd .. + +# Generate translation files +echo "<---Generating translation files--->" +flutter gen-l10n --template-arb-file=arb/app_en.arb + +# Build staging flavor and run it +echo "<---Building staging flavor and running it--->" +flutter run --flavor staging --target lib/main_staging.dart +echo "<---Press any key to exit--->" +read -r \ No newline at end of file From 69f908ae97cce5350c1a7672e51b6399dd9c00ed Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Thu, 14 Apr 2022 10:36:55 +0530 Subject: [PATCH 3/6] Updated README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index e5b27e1..88889e1 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,20 @@ This project contains 3 flavors: - staging - production +For your convenience, the following scripts have been written inside the 'scripts' package: +1. praxis_development.sh +2. praxis_staging.sh +3. praxis_production.sh + +To run these, simply use the following 2 commands (taking the example of praxis_development.sh here): +1. `cd scripts` +2. On Windows: +`praxis_development.sh` +On Mac/Linux: +`bash praxis_development.sh` +and Press Enter/Return + +Also, please make sure that you have your device selected in the Flutter Device Section before running the script(s). ```sh To generate code for injectable From 6dcabb00fb9bc12eb365b9559588a45164f4be38 Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Thu, 14 Apr 2022 10:39:17 +0530 Subject: [PATCH 4/6] Fixed some typos --- README.md | 2 +- scripts/praxis_development.sh | 2 +- scripts/praxis_production.sh | 2 +- scripts/praxis_staging.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 88889e1..92ec83c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ On Mac/Linux: `bash praxis_development.sh` and Press Enter/Return -Also, please make sure that you have your device selected in the Flutter Device Section before running the script(s). +Also, please make sure that you have your device selected in the Flutter Device Selection window before running the script(s). ```sh To generate code for injectable diff --git a/scripts/praxis_development.sh b/scripts/praxis_development.sh index 68cc177..c1802fb 100644 --- a/scripts/praxis_development.sh +++ b/scripts/praxis_development.sh @@ -1,4 +1,4 @@ -# Please make sure that you have your device selected in the Flutter Device Section before running this script +# Please make sure that you have your device selected in the Flutter Device Selection window before running this script # Go to root dir from the current scripts dir echo "<---Going to root directory--->" diff --git a/scripts/praxis_production.sh b/scripts/praxis_production.sh index b0a2105..87e5c7a 100644 --- a/scripts/praxis_production.sh +++ b/scripts/praxis_production.sh @@ -1,4 +1,4 @@ -# Please make sure that you have your device selected in the Flutter Device Section before running this script +# Please make sure that you have your device selected in the Flutter Device Selection window before running this script # Go to root dir from the current scripts dir echo "<---Going to root directory--->" diff --git a/scripts/praxis_staging.sh b/scripts/praxis_staging.sh index 9caabb3..56d7366 100644 --- a/scripts/praxis_staging.sh +++ b/scripts/praxis_staging.sh @@ -1,4 +1,4 @@ -# Please make sure that you have your device selected in the Flutter Device Section before running this script +# Please make sure that you have your device selected in the Flutter Device Selection window before running this script # Go to root dir from the current scripts dir echo "<---Going to root directory--->" From 07387a21bd47b579287bdd7429da57450467b92e Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Thu, 14 Apr 2022 11:47:32 +0530 Subject: [PATCH 5/6] Extracted all common scripts inside core.sh and code generation for praxis_data is being done before root layer now --- scripts/core.sh | 33 +++++++++++++++++++++++++++++++++ scripts/praxis_development.sh | 31 ++----------------------------- scripts/praxis_production.sh | 31 ++----------------------------- scripts/praxis_staging.sh | 31 ++----------------------------- 4 files changed, 39 insertions(+), 87 deletions(-) create mode 100644 scripts/core.sh diff --git a/scripts/core.sh b/scripts/core.sh new file mode 100644 index 0000000..f8f29d4 --- /dev/null +++ b/scripts/core.sh @@ -0,0 +1,33 @@ +# Do NOT run this script manually. It is only supposed to be a helper script for praxis_*.sh scripts. + +function runCoreCommands() { + # Go to root dir from the current scripts dir + echo "<---Going to root directory--->" + cd .. + + # Go to data layer (package) + echo "<---Going to data layer--->" + cd praxis_data || return + + # Use pub get to fix pubspec.lock error + flutter pub get + + # Generate config files for the data layer + echo "<---Generating config files for the data layer--->" + flutter packages pub run build_runner build --delete-conflicting-outputs + + #Go back to root dir + echo "<---Going back to root dir--->" + cd .. + + # Use pub get to fix pubspec.lock error + flutter pub get + + # Generate config files for the presentation layer + echo "<---Generating config files for the presentation layer--->" + flutter packages pub run build_runner build --delete-conflicting-outputs + + # Generate translation files + echo "<---Generating translation files--->" + flutter gen-l10n --template-arb-file=arb/app_en.arb +} diff --git a/scripts/praxis_development.sh b/scripts/praxis_development.sh index c1802fb..cde0b09 100644 --- a/scripts/praxis_development.sh +++ b/scripts/praxis_development.sh @@ -1,34 +1,7 @@ # Please make sure that you have your device selected in the Flutter Device Selection window before running this script -# Go to root dir from the current scripts dir -echo "<---Going to root directory--->" -cd .. - -# Use pub get to fix pubspec.lock error -flutter pub get - -# Generate config files for the presentation layer -echo "<---Generating config files for the presentation layer--->" -flutter packages pub run build_runner build --delete-conflicting-outputs - -# Go to data layer (package) -echo "<---Going to data layer--->" -cd praxis_data || return - -# Use pub get to fix pubspec.lock error -flutter pub get - -# Generate config files for the data layer -echo "<---Generating config files for the data layer--->" -flutter packages pub run build_runner build --delete-conflicting-outputs - -#Go back to root dir -echo "<---Going back to root dir--->" -cd .. - -# Generate translation files -echo "<---Generating translation files--->" -flutter gen-l10n --template-arb-file=arb/app_en.arb +source ./core.sh +runCoreCommands # Build development flavor and run it echo "<---Building development flavor and running it--->" diff --git a/scripts/praxis_production.sh b/scripts/praxis_production.sh index 87e5c7a..24cd858 100644 --- a/scripts/praxis_production.sh +++ b/scripts/praxis_production.sh @@ -1,34 +1,7 @@ # Please make sure that you have your device selected in the Flutter Device Selection window before running this script -# Go to root dir from the current scripts dir -echo "<---Going to root directory--->" -cd .. - -# Use pub get to fix pubspec.lock error -flutter pub get - -# Generate config files for the presentation layer -echo "<---Generating config files for the presentation layer--->" -flutter packages pub run build_runner build --delete-conflicting-outputs - -# Go to data layer (package) -echo "<---Going to data layer--->" -cd praxis_data || return - -# Use pub get to fix pubspec.lock error -flutter pub get - -# Generate config files for the data layer -echo "<---Generating config files for the data layer--->" -flutter packages pub run build_runner build --delete-conflicting-outputs - -#Go back to root dir -echo "<---Going back to root dir--->" -cd .. - -# Generate translation files -echo "<---Generating translation files--->" -flutter gen-l10n --template-arb-file=arb/app_en.arb +source ./core.sh +runCoreCommands # Build production flavor and run it echo "<---Building production flavor and running it--->" diff --git a/scripts/praxis_staging.sh b/scripts/praxis_staging.sh index 56d7366..fc8c660 100644 --- a/scripts/praxis_staging.sh +++ b/scripts/praxis_staging.sh @@ -1,34 +1,7 @@ # Please make sure that you have your device selected in the Flutter Device Selection window before running this script -# Go to root dir from the current scripts dir -echo "<---Going to root directory--->" -cd .. - -# Use pub get to fix pubspec.lock error -flutter pub get - -# Generate config files for the presentation layer -echo "<---Generating config files for the presentation layer--->" -flutter packages pub run build_runner build --delete-conflicting-outputs - -# Go to data layer (package) -echo "<---Going to data layer--->" -cd praxis_data || return - -# Use pub get to fix pubspec.lock error -flutter pub get - -# Generate config files for the data layer -echo "<---Generating config files for the data layer--->" -flutter packages pub run build_runner build --delete-conflicting-outputs - -#Go back to root dir -echo "<---Going back to root dir--->" -cd .. - -# Generate translation files -echo "<---Generating translation files--->" -flutter gen-l10n --template-arb-file=arb/app_en.arb +source ./core.sh +runCoreCommands # Build staging flavor and run it echo "<---Building staging flavor and running it--->" From 764026c210629d78ec3e0104f01e134b7311a7c1 Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Fri, 15 Apr 2022 12:37:52 +0530 Subject: [PATCH 6/6] Combined all scripts into one and now asking the user to select the flavour at script runtime --- README.md | 11 +++----- scripts/buildPraxisFlutter.sh | 52 +++++++++++++++++++++++++++++++++++ scripts/core.sh | 33 ---------------------- scripts/praxis_development.sh | 10 ------- scripts/praxis_production.sh | 10 ------- scripts/praxis_staging.sh | 10 ------- 6 files changed, 56 insertions(+), 70 deletions(-) create mode 100644 scripts/buildPraxisFlutter.sh delete mode 100644 scripts/core.sh delete mode 100644 scripts/praxis_development.sh delete mode 100644 scripts/praxis_production.sh delete mode 100644 scripts/praxis_staging.sh diff --git a/README.md b/README.md index 92ec83c..3781e1b 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,14 @@ This project contains 3 flavors: - staging - production -For your convenience, the following scripts have been written inside the 'scripts' package: -1. praxis_development.sh -2. praxis_staging.sh -3. praxis_production.sh +For your convenience, a single script has been written inside the 'scripts' package (buildPraxisFlutter.sh). -To run these, simply use the following 2 commands (taking the example of praxis_development.sh here): +To run it, simply use the following 2 commands : 1. `cd scripts` 2. On Windows: -`praxis_development.sh` +`buildPraxisFlutter.sh` On Mac/Linux: -`bash praxis_development.sh` +`bash buildPraxisFlutter.sh` and Press Enter/Return Also, please make sure that you have your device selected in the Flutter Device Selection window before running the script(s). diff --git a/scripts/buildPraxisFlutter.sh b/scripts/buildPraxisFlutter.sh new file mode 100644 index 0000000..2ee89d9 --- /dev/null +++ b/scripts/buildPraxisFlutter.sh @@ -0,0 +1,52 @@ +# Create an array of all the available flavours +declare -a praxisFlavours=(development staging production) + +# Size of array +praxisFlavoursLength=${#praxisFlavours[@]} + +# Ask the user to select a flavour first +echo "Select one of the flavours to build 🔥:" +select flavour in "${praxisFlavours[@]}"; do + if [ "$REPLY" -gt "$praxisFlavoursLength" ] || [ "$REPLY" -lt 1 ]; then + echo "<---Please select a valid option (1-$praxisFlavoursLength)--->" + else + echo "<---'$flavour' flavour selected for building PraxisFlutter ✅--->" + break + fi +done + +# Go to root dir from the current scripts dir +echo "<---Going to root directory--->" +cd .. + +# Go to data layer (package) +echo "<---Going to data layer--->" +cd praxis_data || return + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the data layer +echo "<---Generating config files for the data layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +#Go back to root dir +echo "<---Going back to root dir--->" +cd .. + +# Use pub get to fix pubspec.lock error +flutter pub get + +# Generate config files for the presentation layer +echo "<---Generating config files for the presentation layer--->" +flutter packages pub run build_runner build --delete-conflicting-outputs + +# Generate translation files +echo "<---Generating translation files--->" +flutter gen-l10n --template-arb-file=arb/app_en.arb + +# Build user-selected flavor and run it +echo "<---Building $flavour flavor and running it--->" +flutter run --flavor "$flavour" --target lib/main_"$flavour".dart +echo "<---Press any key to exit--->" +read -r diff --git a/scripts/core.sh b/scripts/core.sh deleted file mode 100644 index f8f29d4..0000000 --- a/scripts/core.sh +++ /dev/null @@ -1,33 +0,0 @@ -# Do NOT run this script manually. It is only supposed to be a helper script for praxis_*.sh scripts. - -function runCoreCommands() { - # Go to root dir from the current scripts dir - echo "<---Going to root directory--->" - cd .. - - # Go to data layer (package) - echo "<---Going to data layer--->" - cd praxis_data || return - - # Use pub get to fix pubspec.lock error - flutter pub get - - # Generate config files for the data layer - echo "<---Generating config files for the data layer--->" - flutter packages pub run build_runner build --delete-conflicting-outputs - - #Go back to root dir - echo "<---Going back to root dir--->" - cd .. - - # Use pub get to fix pubspec.lock error - flutter pub get - - # Generate config files for the presentation layer - echo "<---Generating config files for the presentation layer--->" - flutter packages pub run build_runner build --delete-conflicting-outputs - - # Generate translation files - echo "<---Generating translation files--->" - flutter gen-l10n --template-arb-file=arb/app_en.arb -} diff --git a/scripts/praxis_development.sh b/scripts/praxis_development.sh deleted file mode 100644 index cde0b09..0000000 --- a/scripts/praxis_development.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Please make sure that you have your device selected in the Flutter Device Selection window before running this script - -source ./core.sh -runCoreCommands - -# Build development flavor and run it -echo "<---Building development flavor and running it--->" -flutter run --flavor development --target lib/main_development.dart -echo "<---Press any key to exit--->" -read -r diff --git a/scripts/praxis_production.sh b/scripts/praxis_production.sh deleted file mode 100644 index 24cd858..0000000 --- a/scripts/praxis_production.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Please make sure that you have your device selected in the Flutter Device Selection window before running this script - -source ./core.sh -runCoreCommands - -# Build production flavor and run it -echo "<---Building production flavor and running it--->" -flutter run --flavor production --target lib/main_production.dart -echo "<---Press any key to exit--->" -read -r \ No newline at end of file diff --git a/scripts/praxis_staging.sh b/scripts/praxis_staging.sh deleted file mode 100644 index fc8c660..0000000 --- a/scripts/praxis_staging.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Please make sure that you have your device selected in the Flutter Device Selection window before running this script - -source ./core.sh -runCoreCommands - -# Build staging flavor and run it -echo "<---Building staging flavor and running it--->" -flutter run --flavor staging --target lib/main_staging.dart -echo "<---Press any key to exit--->" -read -r \ No newline at end of file