david-gutierrez-mesa / liferay-zsh

Oh my zsh plugins for Liferay development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

liferay-zsh

Description

Oh my zsh plugin with scripts for Liferay development

Preconditions

Git

https://github.com/git-guides/install-git

Java 1.8

Download and install https://www.java.com/es/download/ Note: liferay-zsh.plugin.zsh is forcing change to java 1.8

Ant

In Mac
brew install ant
In Linux https://snapcraft.io/install/ant/ubuntu
sudo apt update && sudo apt install snapd && sudo snap install ant --classic

Oh-My-ZSH

https://github.com/ohmyzsh/ohmyzsh

GitHub CLI

https://cli.github.com/

GNU-sed

In Mac
brew install gnu-sed
In Linux Not needed in Linux

Node

In Mac https://nodejs.org/en/download/package-manager#macos
brew install node
In Linux https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
sudo apt update && sudo apt install nodejs && sudo apt install npm

Liferay projects

Download in $PATH_TO_LIFERAY_MAIN

Set upstream and brianchandotcom for liferay-portal

For that just enter in liferay-portal folder and run:

git remote add upstream https://github.com/liferay/liferay-portal.git
git remote add brianchandotcom https://github.com/brianchandotcom/liferay-portal.git

Set upstream and brianchandotcom for liferay-portal-ee

For that just enter in liferay-portal-ee folder and run:

git remote add upstream https://github.com/liferay/liferay-portal-ee.git
git remote add brianchandotcom https://github.com/brianchandotcom/liferay-portal-ee.git

Dependencies for python scripts

Install python (if you don't have it)

In Mac
brew install python
In Linux
sudo apt update && sudo apt install python3

Install pip

In Mac

Homebrew installs pip pointing to the Homebrew’d Python 3 for you.

In Linux
sudo apt install python3-pip

jira-cli

This is necessary if you want to update Jira from commands like gitSendTo

Install it with

sudo npm install -g jira-cli 

Configure it with

sudo jira config

More info at https://www.npmjs.com/package/jira-cli

MySQL

In Mac

Install it from here https://dev.mysql.com/downloads/file/?id=503070

Set same user and password you have in your .liferay-zsh.config file

In Linux

Install mySQL

sudo apt update && sudo apt upgrade && sudo apt install mysql-server

Configure mySQL

sudo mysql

Set same user and password you have in your .liferay-zsh.config file:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Exit mysql

exit

Coreutils

In Mac
brew install coreutils
In Linux
sudo apt-get update -y && sudo apt-get install -y coreutils

liferay-zsh installation

In this section, we describe how to install liferay-zsh plugin for oh-my-zsh

Create installation path and clone repo

As with any zsh plugin we need to create a specific structure to place our liferay-zsh plugin.

These are the steps we should follow:

  1. Create a custom folder to place your ZSH customizations. You can create this directory wherever you want and call it as you prefer. For instance MyCustomFolder inside user home
  2. Then create a directory called 'plugins' inside your custom directory.
  3. Enter into the plugins directory and do
gh repo clone david-gutierrez-mesa/liferay-zsh

Your file tree should look like this:

MyCustomFolder
      └── plugins
            └── liferay-zsh
                  └── liferay-zsh.plugin.zsh

Let Oh My ZSH know that we have a new plugin

Now we need to let oh-my-zsh know we have a new plugin. In order to fo that we should tell him where we placed our plugin and reference it.

For that we need to:

  1. Edit file ~/.zshrc
  2. Search for ZSH_CUSTOM
  3. Uncomment line that has ZSH_CUSTOM
  4. To change default value for your path. In our example this line is going to be:

ZSH_CUSTOM=/Users/dgutierrez/MyCustomFolder

  1. In the same file (~/.zshrc) we must search for plugins=
  2. Add liferay-zsh into the line that starts with plugins= .Example

plugins=(git bundler liferay-zsh)

  1. Save

Customize our plugin

You will find in the project a template file call .liferay-zsh.conf that you can copy in order to let liferay-zsh plugin know your users and paths.

Steps to follow:

  1. Move $ZSH_CUSTOM/plugins/liferay-zsh/.liferay-zsh.conf file to /Users/{youruser}/ folder
  2. Edit /Users/{youruser}/.liferay-zsh.conf and fill al the variables there.

Note: To generate a git hub token see https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token

Install Python dependencies

From Liferay ZSH root directory ($ZSH_CUSTOM/plugins/liferay-zsh/) type:

pip install -r python-scripts/requirements.txt

Reload zsh

Now that all the configuration is done you just need to reload zsh

  1. Reload zsh by typing 'zsh' in your terminal.

Now you are ready to use liferay-zsh plugin

How to use it

The Liferay ZSH plugin is a set of functions you can call from your Oh My ZSH terminal that are helping you with your daily work inside Liferay.

In order to see all the available functions check functions folder.

To know how to use a function, use the -h parameter. Example:

gitSendTo -h

References

https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#adding-a-new-plugin

https://github.com/ohmyzsh/ohmyzsh

http://nodegh.io/

License

MIT

About

Oh my zsh plugins for Liferay development

License:MIT License


Languages

Language:Python 59.5%Language:Shell 40.5%