Skip to content

Instantly share code, notes, and snippets.

@dgrigg
Created January 30, 2018 17:42
Show Gist options
  • Save dgrigg/7f312f5566c30228fc3aa96deb1ece91 to your computer and use it in GitHub Desktop.
Save dgrigg/7f312f5566c30228fc3aa96deb1ece91 to your computer and use it in GitHub Desktop.
Setting up a CraftCMS website and plugins with Composer
{
"name": "idcorp/silverado",
"type": "project",
"authors": [
{
"name": "Derrick Grigg",
"email": "derrick@dgrigg.com"
}
],
"minimum-stability": "dev",
"repositories": [
{
"type": "package",
"package": {
"name": "craftcms/cms",
"version": "master",
"dist": {
"type": "zip",
"url": "https://craftcms.com/latest.zip?accept_license=yes"
}
}
},
{
"url": "https://github.com/Firstborn/Craft-CMS-Migration-Manager.git",
"type": "git"
},
{
"type": "package",
"package" : {
"name" : "verbb/super-table",
"version" : "master",
"dist": {
"type": "zip",
"url": "https://github.com/verbb/super-table/archive/craft-2.zip"
}
}
},
{
"type": "package",
"package" : {
"name" : "fruitstudios/linkit",
"version" : "master",
"dist": {
"type": "zip",
"url": "https://github.com/fruitstudios/LinkIt/archive/master.zip"
}
}
},
{
"type": "package",
"package" : {
"name" : "fromtheoutfit/navee",
"version" : "master",
"dist": {
"type": "zip",
"url": "https://github.com/fromtheoutfit/navee/archive/master.zip"
}
}
},
{
"type": "package",
"package" : {
"name" : "joshuabaker/craft-sitemap",
"version" : "master",
"dist": {
"type": "zip",
"url": "https://github.com/joshuabaker/craft-sitemap/archive/master.zip"
}
}
},
{
"type": "package",
"package" : {
"name" : "aelvan/imager-craft",
"version" : "master",
"dist": {
"type": "zip",
"url": "https://github.com/aelvan/Imager-Craft/archive/master.zip"
}
}
},
{
"url": "https://github.com/dgrigg/knockknock.git",
"type": "git"
}
],
"require": {
"craftcms/cms" : "dev-master",
"verbb/super-table" : "dev-master",
"firstborn/craft-cms-migration-manager": "dev-master",
"nystudio107/seomatic": "dev-master",
"ryanshrum/hacksaw": "dev-master",
"fruitstudios/linkit": "dev-master",
"fromtheoutfit/navee": "dev-master",
"joshuabaker/craft-sitemap": "dev-master",
"aelvan/imager-craft": "dev-master",
"dgrigg/knockknock": "dev-master"
},
"scripts": {
"post-install-cmd": [
"@php post-install.php"
],
"post-update-cmd": [
"@php post-install.php"
]
}
}
<?php
/****************************************************************************************************************************
Setup each folder for craft, this is done folder by folder to prevent overwriting changed files during installation.
Craft core files (ie app) should only be installed once, any updates to core files should only happen via the Craft updater
******************************************************************************************************************************/
$craft = [
[
'source' => 'vendor/craftcms/cms/craft/app/',
'destination' => 'craft/app'
],
[
'source' => 'vendor/craftcms/cms/craft/config/',
'destination' => 'craft/config'
],
[
'source' => 'vendor/craftcms/cms/craft/plugins/',
'destination' => 'craft/plugins'
],
[
'source' => 'vendor/craftcms/cms/craft/storage/',
'destination' => 'craft/storage'
],
[
'source' => 'vendor/craftcms/cms/craft/templates/',
'destination' => 'craft/templates'
],
[
'source' => 'vendor/craftcms/cms/public/',
'destination' => 'public'
]
];
$plugins = [
[
'source' => 'vendor/firstborn/craft-cms-migration-manager/migrationmanager/',
'destination' => 'craft/plugins/migrationmanager'
],
[
'source' => 'vendor/verbb/super-table/supertable/',
'destination' => 'craft/plugins/supertable'
],
[
'source' => 'vendor/fruitstudios/linkit/fruitlinkit/',
'destination' => 'craft/plugins/fruitlinkit'
],
[
'source' => 'vendor/fromtheoutfit/navee/',
'destination' => 'craft/plugins/navee'
],
[
'source' => 'vendor/aelvan/imager-craft/imager/',
'destination' => 'craft/plugins/imager'
]
];
echo 'Install craft' . PHP_EOL;
foreach($craft as $folder) {
echo 'Installing Craft: ' . $folder['destination'] . PHP_EOL;
if (is_dir($folder['destination']))
{
echo 'Whoops ... ' . $folder['destination'] . ' already exists!' . PHP_EOL;
} else {
shell_exec(strtr('rsync -az source destination', $folder));
}
}
echo 'Install plugins' . PHP_EOL;
foreach($plugins as $plugin) {
echo 'Installing plugins: ' . $plugin['destination'] . PHP_EOL;
shell_exec(strtr('rsync -az source destination', $plugin));
}
shell_exec('find craft/plugins | grep .git | xargs rm -rf');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment