-
Notifications
You must be signed in to change notification settings - Fork 5k
Feature: expose repo as composer package. #2507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Indeed, sounds like a good use case of #2438. BTW, how does composer package of PHP work? Never used PHP... sorry. |
Heh, no need to be sorry :) Basically every, project kan be a composer package. It just need to have {
"repositories": [
{
"type": "composer",
"url": "http://try.gogs.io"
}
],
"require": {
"monolog/monolog": "~1.17.0"
}
} To install the above dependency, you'll type {
"packages": {
"monolog/monolog": {
"v1.17.0": {
"name": "monolog/monolog",
"version": "v1.17.0",
"version_normalized": "1.17.0.0",
"source": {
"type": "git",
"url": "http://try.gogs.io/monolog/monolog",
"reference": "d7c2fa6f5aa9ac73724c234c62f7f2d83035a7bd"
},
"dist": {
"type": "tar",
"url": "http://try.gogs.io/monolog/monolog/archive/v1.17.0.tar.gz"
},
"time": "2015-02-10 19:36:36",
"type": "library"
}
}
}
} Actually at this point, I'm kinda uncertain how this file is generated, because the official repo, Packagist, has a What I've found so far, is that if you for instance search for monolog {
"results": [
{
"name": "monolog/monolog",
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"url": "https://packagist.org/packages/monolog/monolog",
"repository": "https://github.com/Seldaek/monolog",
"downloads": 22744596,
"favers": 4443
}
]
} This result set, contains a key Further reading for the packages.json can be found here |
This would indeed be a valid use-case for plugins. The |
I think I figured out what it's used for, when executing
But when requiring the actual package it does not use the search method
You'll see that it downloads all those references it can find in the packages.json, and probably parsing them until it finds a match. |
Thanks for the great details! So... what exactly is missing from Gogs side? |
ping @jeppech |
Well, I think this should be implemented as a plugin. So this might, should be put on hold, until the plugin module for Gogs is ready? |
@jeppech yes. But hmm, from my zero knowledge of PHP, what is missing from Gogs side right now? |
Oh, like that. Well, you don't have to know any PHP at all, this is just a package manager for PHP. I don't see Gogs missing anything, when speaking of the composer integration, besides the plugin system of course. As of now, I'm not very familiar with the composer internal system, so I'll have to read up on that. I'm unsure whether the composer system should be accessible to Gogs, in order to make the 'package.json', or if we can generate that our self. So, for now, nothing further is needed in Gogs, besides the plugin module. |
I'm getting more confused.... |
Uhm well, didn't we agree on that this was a good use case, for a plugin earlier? |
Yeah.... will look back again when we have plugin... 0.0 |
Yeah, sorry for confusing you! |
I like the idea of having composer support in gogs which would allow to use gogs as a private/public composer repository similar to packagist. I have tested the composer wip implementation for gitlab, jeppech mentioned (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1921) which works well for me. Basically, all gogs has to do, is parsing the root of each repository, read the contents of composer.json, and merge it into a global packages.json (don't forget the to handle all the versions). If a repository was updated and the version / composer.json has changed, the package.json needs to be updated too to include the new version. Better method of implementing this, is using the documented provider-include-method which works better for large repositories like gogs. The packages.json and provider-include-format is well documented at https://getcomposer.org/doc/05-repositories.md#packages and https://getcomposer.org/doc/05-repositories.md#includes. You can see on packagist.org how it was implemented: In gogs there should be a repository based setting, to allow the inclusion of the repository in the global packages.json, because maybe someone don't want to expose his repository in the global packages.json. |
@X-Coder thanks for the details! |
Like webhook, The api is
when the packagist is processed it will be returned:
it's mean packagist update package complete, then https://packagist.org/packages/fengqi/compsoertest will be up to date: |
I've seen over at GitLab that someone is in the making of Composer Service, that makes it possible to expose a repository, as a Composer package for PHP.
That would be a pretty cool feature, if you'd like to host your own private packages. Atm, it's possible to have a static package repo, by using the static repository generator Satis.
Furthermore, support for npm packages or ruby gems, could also be possible.
Actually when I'm thinking about it, these features might not belong to the Gogs core, but maybe as some sort of plugins/add-ons, as mentioned in #2438
The text was updated successfully, but these errors were encountered: