Have a Question?
Cookbook de desenvolvimento do LigeroSmart
First steps
Install LightSmart
Create / opt / src folder. This is the place we will use for putting all the addons we want to develop or update
mkdir / opt / src
Preparing for working with GitHub private repositories (if needed)
Install git on the development system.
After that, please follow these steps for allowing your system to authenticate on github:
Preparing for working with GitHub private repositories (if needed)
Install git on the development system.
After that, please follow these steps for allowing your system to authenticate on github:
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
Preparing for updating an existing AddOn
Checkout the code / Clone the repository
First of all, you need to clone the addon to the / opt / src directory
Let's use our Forms AddOn in this example. Go to the github repository of the addon and get the link for clonning:
1 - Got to https://github.com/complemento
2 - Type forms
3 - Click at the repository's name
Now:
1 - Click on “Clone or download”
2 - Be sure that you're seeing “Clone with SSH”. If you are not seeing that, you should click on “Use SSH”.
3 - Copy the address that starts with “git @ github…”:
Now you can go back to your development environment and clone the repository:
cd / opt / src
git clone git@github.com: complement / otrs.Forms.git
If you are going to work with OTRS 6 addon
So, you may checkout rel-6_0 before linking the files.
cd /opt/src/otrs.Forms ← (or the folder of the AddOn you are working on)
git checkout -b rel-6_0
Migrate the XML file structure with the following command:
If your plan is to upgrade from an old ((otrs)) 5 addon:
su - otrs
/opt/otrs/bin/otrs.Console.pl Dev :: Tools :: Migrate :: ConfigXMLStructure --source-directory /opt/src/otrs.XXXXXXX/Kernel/Config/Files/
Now you can proceed with “Link the files” section
Link the files
Once you have cloned the repository, you may link the files that are under the AddOn directory to LigeroSmart directory. This can be easily achieved by using module-tools link.pl application:
/opt/src/module-tools/link.pl /opt/src/otrs.Forms/ / opt / otrs /
Once you have done that, you may also link manually the sopm of the file to the OTRS root. This is needed for we to be able to run the Installation of the Database and of the code on the next steps.
All the sopm of LigeroSmart AddOns are normally under Custom folder, since the files that are on otrs root folder may have permission issues in some systems when installing it. For this reason you will need to link it to the root:
ln -s /opt/src/otrs.Forms/Custom/Forms.sopm / opt / otrs /
Please note that you will need to change the command according to the addon.
Install the Database
The command below creates the database structure:
otrs.Console.pl Admin::Database::Migrations::Apply
If something is weird
Fixing file permissions usually fixes access issues on the system. The command below applies this fix:
docker-compose exec -u otrs web otrs.SetPermissions.pl
After that restart the web service
docker-compose restart web
Important for LigeroSmart 6 development
Everytime you create or edit a XML file under Config / Files / XML, or when you link the files the first time, you should run the following command in order to OTRS recognize the changes:
/opt/otrs/bin/otrs.Console.pl Maint :: Config :: Rebuild
Working with the code
Now you are ready to work.
If you create a new file
If you need to create a new file, remember to that on the AddOn folder and them execute the “Link the files” section
Also, you will need to add it to the Git repository. Go to the addon directory:
cd /opt/src/otrs.Forms
And add it to the git repository:
git add Kernel / Modules / MyAwesomeFile.pm
If you create a new file
If you need to create a new file, remember to that on the AddOn folder and them execute the “Link the files” section
Also, you will need to add it to the Git repository. Go to the addon directory:
cd /opt/src/otrs.Forms
And add it to the git repository:
git add Kernel / Modules / MyAwesomeFile.pm
After you finish your job or part of it
Once you have finish your work, you should commit it and also push it to our repository
For committing the job, run the following
git commit -a -m "comments about what You have done"
(Please note that you should use standard double quotes. Google Driver may transform the quotes above in strange quotes ”
Creating LigeroSmart 6 Packages
su - otrs
cd / opt / otrs
/opt/otrs/bin/otrs.Console.pl Dev :: Package :: Build /opt/src/otrs.XXXX/MyPackageName.sopm / tmp
Creating package using docker image
docker run --rm -v '$PWD': / pkg / -w / pkg / -u otrs -it dockerhub.complemento.net.br/otrs otrs.Console.pl Dev :: Package :: Build --module-directory /pkg/MyPackageName.sopm.
Inserting Random Data on LigeroSmart
Check the following command:
/opt/otrs/bin/otrs.Console.pl Dev :: Tools :: Database :: RandomDataInsert
Create a Dev Directory from an ((otrs)) or LigeroSmart Package
If for some reason the package does not have a git repository from where you can clone it, you can use the OTRS Package to recreate the development directory from it:
mkdir /opt/src/otrs.MyPackage
/opt/otrs/bin/otrs.Console.pl Admin :: Package :: Export --target-directory \
/opt/src/otrs.MyPackage/ / opt / src / MyPackage-Xxxopm --allow-root
This will export all the contents from MyPackage.opm to the target-directory
Then you can proceed by creating the git repository, adding the files to the repository, committing and pushing to the repository.