Article Image
read

Grav is one of those new open source, flat file CMS's that you see around the place these days, it's driven by PHP, it's articles/pages are written in Markdown, uses YAML, has Twig support… and it's recently passed it's official 1.0 release.

One of the really nice things is, that out-of-the-box it's runs on your Mac without any extras or changes to the system (apart from the standard Apache setup anyway — and you can use VirtualHost for that if you're not into that sort of stuff). No need for VirtualBox or Vagrant just a text editor and a local site and away you go.

So, to get you started here's some terminal tricks that might help you out.

Install it

Go to the getgrav.org website and download it… I recommend the version with the Admin Plugin so you don't have to edit it's configuration files directly like some cave dwelling neanderthal. Then unzip it to your websites root directory.

Follow their guide… it really is well written.

Make sure you create a new user if you do get the Admin Plugin version.

Updates/Upgrades

As always run these upgrades on your development copy first before doing it on your live site… you don't want a broken website.

Using terminal you can run a range of useful task from the root of your Grav website.

You can check the version of Grav using this from the site root:

: bin/gpm version

You can upgrade Grav with:

: bin/gpm self-upgrade

You can update plugins and themes with

: bin/gpm update

Watch out for template updates they can break the site, so do them on your dev site first and then check the results. (#Protip: Use git to find exact differences.)

Pushing out changes…

If you're like me you run a dev copy on your Mac laptop/desktop as described above you can rsync changes to the themes or pages directory to your live host very simply. _If you're not familiar with ssh, setting up the .config file for SSH or rsync you will probably want to skip this next bit.

Add your live site to your .config

Adding the host to your .config file makes the rsync commands short, simpler and less prone to errors… so read this if you don't know how. In the examples below you can see I've created thesumof.it config entry using the short name tsoi

Syncing

rsync -avr --delete ~/Sites/sitename/user/themes/ **tsoi**:public_html/user/themes/  

Where ~/Sites/sitename is the location of the development website you setup and tsoi is the short name for your public/live website host in your .config file for ssh

For your articles/content it's pretty similar:

rsync -avr --delete ~/Sites/sitename/user/pages/ tsoi:public_html/user/pages/  

Notes:

If your host uses a custom port for ssh connections you can set that in your rsync command using the -e option. For example, if your host is using port 8765 for ssh, you would add:

-e "ssh -p 8765"

So the pages sync example above would become:

rsync -avr --delete -e "ssh -p 8765" ~/Sites/sitename/user/pages/ tsoi:public_html/user/pages/  

Well I hope that helps you get a little more out of Grav :D

p.s. reading that back to myself I realise I really do love Grav from ease of use to feature set… nice work RocketTheme

Blog Logo

CPPL

The sum of it.


Published

Image

The Sum Of It

A place of for me to write things others may be interested in or find useful.

Back to Overview