Suitecrm: We should have a Makefile

Created on 12 Dec 2018  路  11Comments  路  Source: salesagility/SuiteCRM



Issue

When developing it is very useful a Makefile to run common tasks like compiling css styles, deleting cache, rebuilding extensions, rebuilding relationships, etc, etc.

Actual Behavior


We do not have a Makefile

Possible Fix

Add a Makefile in SuiteCRM root directory. like this:

Example 1:

A task for cleaning SuiteCRM cache would be

clean_cache cc:
    rm -rf cache/xml/*
    rm -rf cache/import/*
    rm -rf cache/dashlets/*
    rm -rf cache/modules/*
    rm -rf cache/smarty/*
    rm -rf cache/jsLanguage/*
    rm -rf cache/themes/*
    rm -rf cache/Relationships/*
    rm -rf cache/include/javascript/*

And you can clean the SuiteCRM cache running:

$ make cc

Example 2:

A task for re-compiling CSS styles would be like this:

compile_styles:
    rm themes/SuiteP/css/Dawn/style.css
    rm themes/SuiteP/css/Day/style.css
    rm themes/SuiteP/css/Dusk/style.css
    rm themes/SuiteP/css/Night/style.css
        ./vendor/bin/pscss -f compressed themes/SuiteP/css/Dawn/style.scss > themes/SuiteP/css/Dawn/style.css
        ./vendor/bin/pscss -f compressed themes/SuiteP/css/Day/style.scss > themes/SuiteP/css/Day/style.css
        ./vendor/bin/pscss -f compressed themes/SuiteP/css/Dusk/style.scss > themes/SuiteP/css/Dusk/style.css
        ./vendor/bin/pscss -f compressed themes/SuiteP/css/Night/style.scss > themes/SuiteP/css/Night/style.css

And you can re-compile the SuiteCRM styles running:

$ make compile_styles

Context


A Makefile would be very useful for people that works customizing and developing SuiteCRM.

Your Environment

  • SuiteCRM Version used: Any
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Any
  • Environment name and version (e.g. MySQL, PHP 7): Any
  • Operating System and version (e.g Ubuntu 16.04): Unix like SO
Suggestion

All 11 comments

Nice!

A couple of things I would love to have:

  • a Quick Repair and Rebuild from the command-line
  • clear AOD Index

I wonder if these things could be done from Robo, instead of from a Makefile? I know almost nothing about Robo, but I think it fits this purpose and is a more modern approach, and we are already using it.

Yes Robo already does some nice things:

Available commands:
  help               Displays help for a command
  list               Lists commands
 build
  build:suitep       Build SuiteP theme
 code
  code:coverage      Runs code coverage for travis ci
 configure
  configure:tests    Configure environment for testing
 driver
  driver:run-chrome  Download and run the chrome web driver
 fake
  fake:travis        Configures local environment to look like travis

Some (minimal) Documentation here:
https://docs.suitecrm.com/developer/automatedtasks/

Our Robo commands are defined here:
https://github.com/salesagility/SuiteCRM/tree/master/lib/Robo/Plugin/Commands

We can add more, and it's in PHP, which makes many things easier than if we had to use Bash.

We've used this script to do CLI repair/rebuild with minimal issues: https://gist.github.com/chicks/6084088

Nice!

A couple of things I would love to have:

* a Quick Repair and Rebuild from the command-line

* clear AOD Index

I wonder if these things could be done from Robo, instead of from a Makefile? I know almost nothing about Robo, but I think it fits this purpose and is a more modern approach, and we are already using it.

Hi @pgorod !

We can use Robo instead Makefile. We use Makefile because we are old-school guys ;-)

In a SugarCRM CE 6.5.25 instance we have a Makefile with this:

rebuild_extensions:
    printf "INICIANDO RECONSTRUCCION DE EXTENSIONES...\n"
    php tools/batch/rebuild_extensions.php

And the file tools/batch/rebuild_extensions.php is

<?php

set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path());

define('sugarEntry', 1);

require_once 'include/entryPoint.php';
require_once 'include/modules.php';
require_once 'include/language/es_ES.lang.php';
require_once 'modules/Administration/QuickRepairAndRebuild.php';
require_once 'modules/Administration/language/es_ES.lang.php';

global $current_user;

$_REQUEST['silent'] = false;

$current_user->is_admin = '1';

$tool = new RepairAndClear();
$tool->show_output = True;
$tool->rebuildExtensions();

echo "\n";

We can do something similar but instead of executing rebuildExtensions() we should execute repairAndClearAll().

Any way we use Makefile or Robo, I think this is very useful.

What do you think @samus-aran ?

Ideally we would have a separate command for each of the separate items in Admin / Repair, and it would just call into the existing code for those repairs, instead of having to rewrite each function. That's the logic in your rebuild_extensions script, and I suppose it can be done for all the others without much effort.

See that #6186 [WIP Feature/robo coding standards] robo will maybe soon part of SuiteCRM

See that #6186 [WIP Feature/robo coding standards] robo will maybe soon part of SuiteCRM

Great!

@Dillon-Brown do you think we can work together in order to have Robo as a Task Runner for SuiteCRM with some useful common task like those you wrote in #6186 and those i describe in this issue?

It already supports custom Robo commands it鈥檚 just not documented.

Yeah, it's already in the product. The list of commands I included above is coming from a 7.10.11. I also linked the code on the master branch and even some Documentation! :-)

So it's up to us (everybody) to add useful commands to that.

As we discuss it is better to have tasks for RoboFile.php.

I close this issue and open #6648

Hi @Abuelodelanada, just taking a look through my mentions backlog :). I'd love to work together adding in more Robo commands, lots of good ideas here. I've left a comment in #6649 and i'll take a look at updating #6186 when I get a chance.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daschenbrener picture daschenbrener  路  3Comments

likhobory picture likhobory  路  3Comments

ajprouty87 picture ajprouty87  路  3Comments

darouca picture darouca  路  3Comments

Mausino picture Mausino  路  3Comments