Closed youknowriad closed 8 years ago
hi,
the only possible way I can think of are composer scripts: https://getcomposer.org/doc/articles/scripts.md
Hi,
I think if cockpit is intended to be for developers, it should be easy to install and update with developers tools (composer pour PHP). I think your point (am I wrong) is to make easy to use, juste copy/paste and launch a webserver, but for many developpers like, we want to be able to add the cockpit code to .gitignore and we want it to be outside the public path, update it easily with composer and custom some paths (cache, storage).
I've tried some things, override some consts and symlink assets, but I've not the required knowledge of how the CSM is organised to make this work. May be you should consider having two install methods ? one with composer with the ability to custom paths and one copy/paste method.
Thanks
I agree with @youknowriad , you should provide way to customize paths for cockpit out of the box.
For example currently I see one problem: you define bootstrap.php
in your composer.json and this makes it impossible to change any constants in this file after composer load.
Maybe you should exclude this file from autoloading, or at least maybe create separate repository that can be used for composer dependecies, and another repository for installing cockpit as standalone application
I've got idea. Maybe it would be possible trough Composer Installers.
_If there would a package type publicFolder with destination of public subfolder (public
, web
or public_html
)_,
and Cockpit's composer.json would look like:
"name": "aheinze/cockpit",
"type": "publicFolder",
"extra": {
"installer-name": "cockpit"
}
then using composer it should get installed to public/cockpit
folder.
@piotr-cz Not a bad idea
Maybe cleaner way is to register cockpit installer type for composer. Additionally it would open possibility to install modules using composer:
Cockpit application
destination: ./public/cockpit
{
"name": "aheinze/cockpit",
"type": "cockpit-core",
"extra": {
"installer-name": "cockpit"
}
}
Example module
destination: ./public/cockpit/modules/addons
{
"name": "verdorName/FooBar",
"type": "cockpit-module",
"extra": {
"installer-name": "FooBar"
}
}
Downside is that the public folder should be pre-set (hardcoded) in the installer type. Maybe it's possible overwrite it with a CLI parameter, but haven't investigated further.
If you are wondering, why there is an extra.installer-name
key, it makes the target install directly into such subfolder instead of default composer scheme vendor/productName. But it may not be necessary (See JoomlaInstaller.php)
@piotr-cz awesome
I vote for public
name as it seems most explicit to me. By inspecting Base installer.php file
maybe it's possible to change it in root composer.json file with handling something like extra.publicPath
.
do I need to change anything in cockpits composer.json?
composer.json
schemaI'm not sure I understood correctly the purpose of installer-name
but IMHO it doesn't make sense to play with it without above steps anyway.
BTW: All of this is theory, I haven't tried it out.
Another option would be to create an installer similar to Laravel installer (GitHub repo, Docs) or Lumen installer (GitHub repo, Docs).
This would be idea for us, since we build our websites with Laravel, we just want to use the helper methods collection
or region
etc within our existing code. We handle routing etc, but want to use the helpers only.
One more and maybe most easiest option is to treat Cockpit like a frontend component (jQuery/ Bootstrap) using Component Installer for Composer
So in projects composer.json
file we'd define
{
"require": {
"components/cockpit": "~0.13"
}
}
Any updates on this one? Maybe an idea to do it like Bedrock does for Wordpress? See:
Relevant to this issue: https://github.com/mnsami/composer-custom-directory-installer/issues/11
I've added support for Cockpit modules as composer installers. New version that includes aforementioned commit It's not released yet
See https://github.com/composer/installers/pull/284 for details.
So, what is the process for installing Cockpit as a Composer dependency? For example I want to use Cockpit as a CMS for Laravel, since it is a 3rd party package it should be installed to the vendor folder, and not manually copied to the public folder. The Cockpit storage folder can/should exist in the public folder however.
What is the correct way of doing this?
Hi, Is there a way yo install cockpit as a composer dependency and have the custom config outside the vendor folder.
Thanks a lot