From 90eefd288b26b536b393c36b356527fbb7587bf5 Mon Sep 17 00:00:00 2001 From: Rajab Natshah <rajabn@gmail.com> Date: Tue, 6 Mar 2018 20:53:47 +0200 Subject: [PATCH] Issue #2949970: Varbase 8.4.16: Updated the Varbase Scripts to generate new Vartheme Sub theme, or Vartheme Material sub theme. --- scripts/README.md | 45 ++++++++++++------- scripts/create-new-vartheme.sh | 55 ++++------------------- scripts/create-new-vartheme_material.sh | 59 +++++-------------------- tests/README.md | 22 ++++----- 4 files changed, 60 insertions(+), 121 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 8da5aeae..1994d503 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -5,44 +5,57 @@ Default settings could be changed in scripts.settings.yml -## Create new Vartheme sub theme for a project. -By Composer: -``` -cd PROJECT_DIR_NAME/docroot/profiles/varbase -composer create-new-vartheme "THEME_NAME" "ltr" "sites/default/themes/custom" -``` +# Create new Vartheme sub theme for a project. By Bash: ``` cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -bash ./create-new-vartheme.sh "THEME_NAME" "ltr" "sites/default/themes/custom" +bash ./create-new-vartheme.sh "THEME_NAME" "ltr" ``` -------------------------------------------------------------------------------- ## For right to left themes. -By Composer: + +By Bash: ``` -cd PROJECT_DIR_NAME/docroot/profiles/varbase -composer create-new-vartheme "THEME_NAME" "rtl" "sites/default/themes/custom" +cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts +bash ./create-new-vartheme.sh "THEME_NAME" "rtl" ``` +-------------------------------------------------------------------------------- + +## To create a new theme in the PROJECT_DIR_NAME/docroot/themes/custom By Bash: ``` cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -bash ./create-new-vartheme.sh "THEME_NAME" "rtl" "sites/default/themes/custom" +bash ./create-new-vartheme.sh "THEME_NAME" ``` -------------------------------------------------------------------------------- -## To create a new theme in the themes/custom -By Composer: + +# Create new Vartheme Material sub theme for a project. + +By Bash: ``` -cd PROJECT_DIR_NAME/docroot/profiles/varbase -composer create-new-vartheme "THEME_NAME" "ltr" +cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts +bash ./create-new-vartheme_material.sh "THEME_NAME" "ltr" ``` +-------------------------------------------------------------------------------- + +## For right to left themes. By Bash: ``` cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -bash ./create-new-vartheme.sh "THEME_NAME" "ltr" +bash ./create-new-vartheme_material.sh "THEME_NAME" "rtl" ``` -------------------------------------------------------------------------------- + +## To create a new theme in the PROJECT_DIR_NAME/docroot/themes/custom + +By Bash: +``` +cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts +bash ./create-new-vartheme_material.sh "THEME_NAME" +``` +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/scripts/create-new-vartheme.sh b/scripts/create-new-vartheme.sh index bbcc804e..5673920e 100644 --- a/scripts/create-new-vartheme.sh +++ b/scripts/create-new-vartheme.sh @@ -6,39 +6,24 @@ ## Quick tip on how to use this script command file. ## ## Create new Vartheme sub theme for a project. -## By Composer: -## ----------------------------------------------------------------------------- -## cd PROJECT_DIR_NAME/docroot/profiles/varbase -## composer create-new-vartheme "THEME_NAME" "ltr" "sites/default/themes/custom" -## ----------------------------------------------------------------------------- ## By Bash: ## ----------------------------------------------------------------------------- ## cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -## bash ./create-new-vartheme.sh "THEME_NAME" "ltr" "sites/default/themes/custom" +## bash ./create-new-vartheme.sh "THEME_NAME" "ltr" ##------------------------------------------------------------------------------ ## ## For right to left themes. -## By Composer: -## ----------------------------------------------------------------------------- -## cd PROJECT_DIR_NAME/docroot/profiles/varbase -## composer create-new-vartheme "THEME_NAME" "rtl" "sites/default/themes/custom" -## ----------------------------------------------------------------------------- ## By Bash: ## ----------------------------------------------------------------------------- ## cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -## bash ./create-new-vartheme.sh "THEME_NAME" "rtl" "sites/default/themes/custom" +## bash ./create-new-vartheme.sh "THEME_NAME" "rtl" ## ----------------------------------------------------------------------------- ## -## To create a new theme in the themes/custom -## By Composer: -## ----------------------------------------------------------------------------- -## cd PROJECT_DIR_NAME/docroot/profiles/varbase -## composer create-new-vartheme "THEME_NAME" "ltr" -## ----------------------------------------------------------------------------- +## To create a new theme in the PROJECT_DIR_NAME/docroot/themes/custom ## By Bash: ## ----------------------------------------------------------------------------- ## cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -## bash ./create-new-vartheme.sh "THEME_NAME" "ltr" +## bash ./create-new-vartheme.sh "THEME_NAME" ## ----------------------------------------------------------------------------- ## ################################################################################ @@ -131,37 +116,15 @@ fi # Default themes creation path. theme_path=$drupal_root/$default_themes_creation_path; - -# Grape the theme path argument. only if we have arg #3. -if [ ! -z "$3" ]; then - arg3=$3; - if [[ $arg3 =~ ^[A-Za-z][A-Za-z0-9_-/]*$ ]]; then - if [[ "${arg3: -1}" == "/" ]]; then - arg3="${arg3::-1}"; - fi - - if [[ ! -d "$arg3" ]]; then - theme_path=$arg3; - mkdir -p $theme_path; - fi - else - echo "---------------------------------------------------------------------------"; - echo " Theme path must be in the right format! "; - echo "---------------------------------------------------------------------------"; - exit 1; - fi -else - if [[ ! -d "$theme_path" ]]; then - mkdir -p $theme_path; - fi -fi +mkdir -p ${theme_path}; +cp ${current_path}/README.md ${theme_path}/README.md # Create the new Vartheme subtheme if we do not have a folder with that name yet. if [[ ! -d "$theme_path/$theme_name" ]]; then # 1. Copy the VARTHEME_SUBTHEME folder to your custom theme location. - cp -r ${drupal_root}/profiles/varbase/themes/vartheme/VARTHEME_SUBTHEME ${theme_path}/${theme_name}; + cp -r ${drupal_root}/themes/contrib/vartheme/VARTHEME_SUBTHEME ${theme_path}/${theme_name}; # 2. Rename VARTHEME_SUBTHEME.starterkit.yml your_subtheme_name.info.yml mv ${theme_path}/${theme_name}/VARTHEME_SUBTHEME.starterkit.yml ${theme_path}/${theme_name}/VARTHEME_SUBTHEME.info.yml ; @@ -191,14 +154,14 @@ if [[ ! -d "$theme_path/$theme_name" ]]; then mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_SUBTHEME_main_menu.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_main_menu.yml mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_SUBTHEME_messages.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_messages.yml mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_SUBTHEME_page_title.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_page_title.yml + mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_SUBTHEME_socialauthlogin.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_socialauthlogin.yml + mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_SUBTHEME_views_block__varbase_heroslider_media_varbase_heroslider_media.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_views_block__varbase_heroslider_media_varbase_heroslider_media.yml # 8. Rename VARTHEME_SUBTHEME.base.css files. mv ${theme_path}/${theme_name}/css/base/VARTHEME_SUBTHEME.base.css ${theme_path}/${theme_name}/css/base/${theme_name}.base.css - mv ${theme_path}/${theme_name}/css/base/VARTHEME_SUBTHEME.base.css.map ${theme_path}/${theme_name}/css/base/${theme_name}.base.css.map # 9. Rename VARTHEME_SUBTHEME-rtl.base.css files. mv ${theme_path}/${theme_name}/css/rtl/base/VARTHEME_SUBTHEME-rtl.base.css ${theme_path}/${theme_name}/css/rtl/base/${theme_name}-rtl.base.css - mv ${theme_path}/${theme_name}/css/rtl/base/VARTHEME_SUBTHEME-rtl.base.css.map ${theme_path}/${theme_name}/css/rtl/base/${theme_name}-rtl.base.css.map # 10. Rename VARTHEME_SUBTHEME.base.less file. mv ${theme_path}/${theme_name}/less/base/VARTHEME_SUBTHEME.base.less ${theme_path}/${theme_name}/less/base/${theme_name}.base.less diff --git a/scripts/create-new-vartheme_material.sh b/scripts/create-new-vartheme_material.sh index 4cf87367..0e2e41cb 100644 --- a/scripts/create-new-vartheme_material.sh +++ b/scripts/create-new-vartheme_material.sh @@ -6,39 +6,24 @@ ## Quick tip on how to use this script command file. ## ## Create new Vartheme Material sub theme for a project. -## By Composer: -## ----------------------------------------------------------------------------- -## cd PROJECT_DIR_NAME/docroot/profiles/varbase -## composer create-new-vartheme_material "THEME_NAME" "ltr" "sites/default/themes/custom" -## ----------------------------------------------------------------------------- ## By Bash: ## ----------------------------------------------------------------------------- ## cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -## bash ./create-new-vartheme_material.sh "THEME_NAME" "ltr" "sites/default/themes/custom" +## bash ./create-new-vartheme_material.sh "THEME_NAME" "ltr" ##------------------------------------------------------------------------------ ## ## For right to left themes. -## By Composer: -## ----------------------------------------------------------------------------- -## cd PROJECT_DIR_NAME/docroot/profiles/varbase -## composer create-new-vartheme_material "THEME_NAME" "rtl" "sites/default/themes/custom" -## ----------------------------------------------------------------------------- ## By Bash: ## ----------------------------------------------------------------------------- ## cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -## bash ./create-new-vartheme_material.sh "THEME_NAME" "rtl" "sites/default/themes/custom" +## bash ./create-new-vartheme_material.sh "THEME_NAME" "rtl" ## ----------------------------------------------------------------------------- ## -## To create a new theme in the themes/custom -## By Composer: -## ----------------------------------------------------------------------------- -## cd PROJECT_DIR_NAME/docroot/profiles/varbase -## composer create-new-vartheme_material "THEME_NAME" "ltr" -## ----------------------------------------------------------------------------- +## To create a new theme in the PROJECT_DIR_NAME/docroot/themes/custom ## By Bash: ## ----------------------------------------------------------------------------- ## cd PROJECT_DIR_NAME/docroot/profiles/varbase/scripts -## bash ./create-new-vartheme_material.sh "THEME_NAME" "ltr" +## bash ./create-new-vartheme_material.sh "THEME_NAME" ## ----------------------------------------------------------------------------- ## ################################################################################ @@ -131,30 +116,8 @@ fi # Default themes creation path. theme_path=$drupal_root/$default_themes_creation_path; - -# Grape the theme path argument. only if we have arg #3. -if [ ! -z "$3" ]; then - arg3=$3; - if [[ $arg3 =~ ^[A-Za-z][A-Za-z0-9_-/]*$ ]]; then - if [[ "${arg3: -1}" == "/" ]]; then - arg3="${arg3::-1}"; - fi - - if [[ ! -d "$arg3" ]]; then - theme_path=$arg3; - mkdir -p $theme_path; - fi - else - echo "---------------------------------------------------------------------------"; - echo " Theme path must be in the right format! "; - echo "---------------------------------------------------------------------------"; - exit 1; - fi -else - if [[ ! -d "$theme_path" ]]; then - mkdir -p $theme_path; - fi -fi +mkdir -p ${theme_path}; +cp ${current_path}/README.md ${theme_path}/README.md # Create the new Vartheme material subtheme if we do not have a folder with that name yet. @@ -164,7 +127,7 @@ if [[ ! -d "$theme_path/$theme_name" ]]; then cp -r ${drupal_root}/themes/contrib/vartheme_material/VARTHEME_MATERIAL_SUBTHEME ${theme_path}/${theme_name}; # 2. Rename VARTHEME_MATERIAL_SUBTHEME.starterkit.yml your_subtheme_name.info.yml - mv ${theme_path}/${theme_name}/VARTHEME_MATERIAL_SUBTHEME.starterkit.yml ${theme_path}/${theme_name}/VARTHEME_SUBTHEME.info.yml ; + mv ${theme_path}/${theme_name}/VARTHEME_MATERIAL_SUBTHEME.starterkit.yml ${theme_path}/${theme_name}/VARTHEME_MATERIAL_SUBTHEME.info.yml ; mv ${theme_path}/${theme_name}/VARTHEME_MATERIAL_SUBTHEME.info.yml ${theme_path}/${theme_name}/${theme_name}.info.yml ; # 3. Rename VARTHEME_MATERIAL_SUBTHEME.libraries.yml your_subtheme_name.libraries.yml @@ -191,17 +154,17 @@ if [[ ! -d "$theme_path/$theme_name" ]]; then mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_MATERIAL_SUBTHEME_main_menu.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_main_menu.yml mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_MATERIAL_SUBTHEME_messages.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_messages.yml mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_MATERIAL_SUBTHEME_page_title.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_page_title.yml + mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_MATERIAL_SUBTHEME_socialauthlogin.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_socialauthlogin.yml + mv ${theme_path}/${theme_name}/config/optional/block.block.VARTHEME_MATERIAL_SUBTHEME_views_block__varbase_heroslider_media_varbase_heroslider_media.yml ${theme_path}/${theme_name}/config/optional/block.block.${theme_name}_views_block__varbase_heroslider_media_varbase_heroslider_media.yml # 8. Rename VARTHEME_MATERIAL_SUBTHEME.base.css files. - mv ${theme_path}/${theme_name}/css/base/VARTHEME_SUBTHEME.base.css ${theme_path}/${theme_name}/css/base/${theme_name}.base.css - mv ${theme_path}/${theme_name}/css/base/VARTHEME_SUBTHEME.base.css.map ${theme_path}/${theme_name}/css/base/${theme_name}.base.css.map + mv ${theme_path}/${theme_name}/css/base/VARTHEME_MATERIAL_SUBTHEME.base.css ${theme_path}/${theme_name}/css/base/${theme_name}.base.css # 9. Rename VARTHEME_MATERIAL_SUBTHEME-rtl.base.css files. mv ${theme_path}/${theme_name}/css/rtl/base/VARTHEME_SUBTHEME-rtl.base.css ${theme_path}/${theme_name}/css/rtl/base/${theme_name}-rtl.base.css - mv ${theme_path}/${theme_name}/css/rtl/base/VARTHEME_SUBTHEME-rtl.base.css.map ${theme_path}/${theme_name}/css/rtl/base/${theme_name}-rtl.base.css.map # 10. Rename VARTHEME_MATERIAL_SUBTHEME.base.less file. - mv ${theme_path}/${theme_name}/less/base/VARTHEME_SUBTHEME.base.less ${theme_path}/${theme_name}/less/base/${theme_name}.base.less + mv ${theme_path}/${theme_name}/less/base/VARTHEME_MATERIAL_SUBTHEME.base.less ${theme_path}/${theme_name}/less/base/${theme_name}.base.less # 11. Rename VARTHEME_MATERIAL_SUBTHEME-rtl.base.less file. mv ${theme_path}/${theme_name}/less/rtl/base/VARTHEME_SUBTHEME-rtl.base.less ${theme_path}/${theme_name}/less/rtl/base/${theme_name}-rtl.base.less diff --git a/tests/README.md b/tests/README.md index 0c650f1f..1e198532 100644 --- a/tests/README.md +++ b/tests/README.md @@ -14,7 +14,7 @@ the composer. ## Create a Varbase project with [Composer](https://getcomposer.org/download/): ``` -composer create-project vardot/varbase-project:8.4.x-dev PROJECT_DIR_NAME --stability dev --no-interaction +composer create-project vardot/varbase:8.4.x-dev PROJECT_DIR_NAME --stability dev --no-interaction ``` -------------------------------------------------------------------------------- @@ -76,7 +76,7 @@ terminal then you could run the following command: ``` $ ../../../bin/behat tests/features/varbase ``` -4. Run the behat command at PROJECT_DIR_NAME/docroot/profiles/varbase/testes +4. Run the behat command at PROJECT_DIR_NAME/docroot/profiles/varbase/tests $ ../../../bin/behat tests/features/varbase/step2-apply-tests/01-website-base-requirements/01-01-user-registration_only-admins-login.feature @@ -119,8 +119,8 @@ So that I will need a site admin or super admin to add me to the website -------------------------------------------------------------------------------- 5. Run this command with the .feature file to run the Gherkin Script in it to the installed site. -$ ../../../bin/behat features/varbase/your-gherkin-feature.feature -$ ../../../bin/behat features/project-name/your-gherkin-feature.feature +$ ../../../bin/behat tests/features/varbase/your-gherkin-feature.feature +$ ../../../bin/behat tests/features/project-name/your-gherkin-feature.feature -------------------------------------------------------------------------------- 8. Run this command to print all available step definitions @@ -160,19 +160,19 @@ $ ../../../bin/behat -di Example: ================================================================================ ``` - $ ../../../bin/behat --tags '@development' features/varbase/ + $ ../../../bin/behat --tags '@development' tests/features/varbase/ ``` Which it will run Scenarios which has got the @development tag. ================================================================================ ``` - $ ../../../bin/behat --tags '@staging' features/varbase/ + $ ../../../bin/behat --tags '@staging' ftests/eatures/varbase/ Which it will run Scenarios which has got the @staging tag. ``` ================================================================================ - $ ../../../bin/behat --tags '@production' features/varbase/ + $ ../../../bin/behat --tags '@production' tests/features/varbase/ Which it will run Scenarios which has got the @production tag. @@ -200,7 +200,7 @@ $ ../../../bin/behat -di # You can run the following command: # -------------------------------------------------------------------------- ``` - $ ../../../bin/behat features/varbase/ --format pretty --out std --format html --out reports/report-$( date '+%Y-%m-%d_%H-%M-%S' ) + $ ../../../bin/behat tests/features/varbase/ --format pretty --out std --format html --out reports/report-$( date '+%Y-%m-%d_%H-%M-%S' ) ``` After that you can see the report in the PROJECT_DIR_NAME/docroot/profiles/varbase/tests/reports folder. @@ -208,9 +208,9 @@ $ ../../../bin/behat -di initialization and cleaning up after the test. ``` - $ ../../../bin/behat features/varbase/step1-init-tests - $ ../../../bin/behat features/varbase/step2-apply-tests - $ ../../../bin/behat features/varbase/step3-cleanup-tests + $ ../../../bin/behat tests/features/varbase/step1-init-tests + $ ../../../bin/behat tests/features/varbase/step2-apply-tests + $ ../../../bin/behat tests/features/varbase/step3-cleanup-tests ``` 8. If you want to test the installation process, you will need to use the -- GitLab