পৃষ্ঠাসমূহ

.

Search Your Article

Total Pageviews

Monday, February 20, 2017

Grav - CLI

The CLI stands for command line interface stored in bin/grav. It performs some tasks such as clearing cache, creating backup copy etc.
Accessing CLI is different on different platforms. On Windows you can access through cmd, on Mac you can access through Terminal and on Linux you can use shell. In windows, you can't use UNIX style commands.
To use these just install the msysgit package which provides GIT and GIT BASH and provides UNIX style commands on Windows.
You can list out the available commands in the Grav by using below command:
$ bin/grav list
You can see the available commands as shown in the screen below:
Grav CLI

New Project Creation

Creating new project with Grav is very simple. You can create with a Grav instance.
  • Open your terminal or console and navigate to your Grav folder.
     $ cd ../ProjectFolder/grav
     
  • Your Grav will be installed in the root of your web server. If you want to create folder called contact inside the root folder of your Grav, then use command as:
     $ bin/grav  project-name  ../webroot/ contact
     
It will download all the required dependencies and create new Grav instance.

Installing Grav Dependencies

While installing dependencies, Grav automatically installs plugins namely error plugin, problems plugin and antimatter theme. You can install these by using below command in your terminal or console:
$ cd ../webroot/myproject
$ bin/grav install
Now you will see the downloaded plugins in their respective folders as:
  • ../webroot/ myproject/user/plugins/error
  • ../webroot/ myproject/user/plugins/problems
  • ../webroot/ myproject/user/themes/antimatter

Clearing Grav Cache

You can delete files and folders to clear the cache which are stored in the cache/ folder. To clear cache, you can use below command:
$ cd ../webroot/myproject
$ bin/grav clear-cache

Create Backup

In Grav, you can backup your project stored under root folder. As it won't use database so there is no difficulty to take a backup. If you want to create the backup of your project called myproject (../webroot/myproject), then use the following command:
$ cd ../webroot/myproject
$ bin/grav backup
Next you will see a zip file of backup created under backup/ folder.

Updating Composer

You can update the Grav composer which was installed via Github and installed manually using composer based vendor packages. The command is:
$ bin/grav composer

No comments:

Post a Comment