Kirby CLI Installer

Because I am lazy and don’t want to git clone the repo all the with the fitting project name but also didn’t want to download the zip file and unzip it by hand.

So I decided to create something! :heartbeat:

First, download the Kirby installer using Composer:

composer global require "cilice/kirby-installer=~1.0"

Make sure to place the ~/.composer/vendor/bin directory in your PATH so the kirby executable can be located by your system.

Once installed, the simple kirby new command will create a fresh Kirby CMS installation in the directory you specify. For instance, kirby new datingsite will create a directory named datingsite containing a fresh Kirby CMS installation. This method of installation is faster than installing via git, as it downloads the provided zip file.

10 Likes

Oh, actually, it could be extended by further functionality. Feel free to leave some ideas. Having a one liner update script “kirby upgrade” would be fun. :heart:

1 Like

That’s brilliant, but for some reason I can’t get it installed because the Guzzle dependency throws a lot of errors.

 Problem 1
    - Installation request for cilice/kirby-installer ~1.0 -> satisfiable by cilice/kirby-installer[1.0.0].
    - cilice/kirby-installer 1.0.0 requires guzzlehttp/guzzle ~5.0 -> satisfiable by guzzlehttp/guzzle[5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.1.0, 5.2.0, 5.3.0].
    - guzzlehttp/guzzle 5.0.0 requires guzzlehttp/ringphp ~1.0 -> satisfiable by guzzlehttp/ringphp[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0].
    - guzzlehttp/guzzle 5.0.1 requires guzzlehttp/ringphp ~1.0 -> satisfiable by guzzlehttp/ringphp[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0].
    - guzzlehttp/guzzle 5.0.2 requires guzzlehttp/ringphp ~1.0 -> satisfiable by guzzlehttp/ringphp[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0].
    - guzzlehttp/guzzle 5.0.3 requires guzzlehttp/ringphp ~1.0 -> satisfiable by guzzlehttp/ringphp[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0].
    - guzzlehttp/guzzle 5.1.0 requires guzzlehttp/ringphp ~1.0 -> satisfiable by guzzlehttp/ringphp[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0].
    - guzzlehttp/guzzle 5.2.0 requires guzzlehttp/ringphp ~1.0 -> satisfiable by guzzlehttp/ringphp[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0].
    - guzzlehttp/guzzle 5.3.0 requires guzzlehttp/ringphp ^1.1 -> satisfiable by guzzlehttp/ringphp[1.1.0].
    - guzzlehttp/ringphp 1.0.0 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.1 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.2 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.3 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.4 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.5 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.6 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.0.7 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - guzzlehttp/ringphp 1.1.0 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0].
    - Conclusion: don't install guzzlehttp/streams 3.0.0

Any idea?

Could you tell me the php version you are using? But I got an idea for a fix. :smile:

it’s the built in version on yosemite: 5.5.19

I just deleted my ~/.composer/ folder and switched to system php.

$ which php

/usr/bin/php

$ rm -rf ~/.composer 

$ composer global require "cilice/kirby-installer=~1.0"

Changed current directory to /Users/cilice/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/process (v2.7.0)
    Downloading: 100%         

  - Installing symfony/console (v2.7.0)
    Downloading: 100%         

  - Installing react/promise (v2.2.0)
    Downloading: 100%         

  - Installing guzzlehttp/streams (3.0.0)
    Downloading: 100%         

  - Installing guzzlehttp/ringphp (1.1.0)
    Downloading: 100%         

  - Installing guzzlehttp/guzzle (5.3.0)
    Downloading: 100%         

  - Installing cilice/kirby-installer (1.0.1)
    Downloading: 100%         

symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files

Maybe its a weird github/composer issue, it just has worked for me.

After removing the composer folder, it now works — and it rocks big time!!! It would be so awesome to extend this further. The upgrade option would indeed be brilliant. Selecting a different kit would be ace. Something like

kirby new mysite --kit=langkit

or

kirby new mysite --kit=plainkit

or maybe even shorter

kirby plainkit
kirby plainkit mysite

The icing on the cake would be a plugin installer:

kirby plugin cdn

3 Likes

Oh yes, +1 for more options like plainkit etc.

Are there special zips for plainkit Kirby installations? Otherwise I could build you a release script that would submit zip files to github releases tab. :sunny:

Or I could just do the git magic within the script, it would work as well.

Being able to use our own “kit” would be nice. So if we have a favorite custom boilerplate we could install it with your script.

Regarding plugins, some are easy to install, some are just files than we have to copy or symlink manually in the right place. I wonder how that would play with an install/update script?

1 Like

I doubt there are that many people who create their own kit - and if they do, it could be their business to create a script to bootstrap it. This installer should be more fitting for all people rather than be so flexible to suit it all.

So I’ll rather try to adjust it to all the official kits Bastian provides. So far I’ve found starterkit, langkit and plainkit.

Im thinking about making a select question on kirby new site which would then ask the user to pick a kit. It could be provided via cli with e.g. kirby new site --kit=plainkit without the question.

Any opinions on this?

Landed now in 1.1.0.

Preview:

I’m also thinking to adjust the syntax to rather have kirby plugin install cdn, so I could also implement kirby plugin uninstall cdn which would delete site/plugins/cdn folder.

2 Likes

And this is a preview of the kit support.

Yay/nay? :blush:

6 Likes

Dude… YAY, totally :smile:

My two cents…
by default kirby plugin cdn could install the plugin and kirby plugin uninstall cdn would well… do its thing. Or maybe both ways… not sure how hard it is.

Thanks a lot.

My favorite thread since hooks released. Keep up the great work.

I’m using composer the first time, so a noob question: if there is a new version of the kirby tool, how to update?

ad +100 for your work :smile:

So awesome, man!!! <3

You can just call the command again, it should update the script to 1.1.0

I’ll probably work on the new command tonight. An idea I had is also:

kirby clear cache

if html cache is enabled

composer global update is the command I was searching for.

2 Likes