ttss
July 30, 2014, 1:06pm
10
Hi all, I have a question regarding Satis, composer and private plugins.
I have a plugin called x-shortcodes
from vendor themeco
, I’ve put the entire code of the plugin in our private git repo: ssh://git@code.ttss.ch:2222/diffusion/SATIS/satis.git
The plugin PHP code is in the themeco/x-shortcodes/
folder inside the git repo.
Inside satis.json
I’ve put:
{
"name": "TTSS",
"homepage": "http://satis.ttss.ch",
"repositories": [
{ "type": "vcs", "url": "ssh://git@code.ttss.ch:2222/diffusion/SATIS/satis.git" },
{
"type": "package",
"package": {
"name": "themeco/x-shortcodes",
"version": "2.3.3",
"source": {
"url": "ssh://git@code.ttss.ch:2222/diffusion/SATIS/satis.git:/themeco/x-shortcodes/",
"type": "git",
"reference": "origin/master"
},
"autoload": {
"psr-4": { "themeco\\x-shortcodes\\": "themeco/x-shortcodes/" }
}
}
}
],
"require-all": true
}
when I execute composer update
x-shortcodes get’s installed fine (fetches it from git as it should do) but places everything in the folder vendor/themeco/x-shortcodes/themeco/
which is wrong, I neet to specify which folder to get from git, he actually pulls all the git root.
To make things short I would place all my private plugins into one repo, under <vendor>/<plugin-name>
and serve them that way. Suggestions? Thanks.
ttss
July 30, 2014, 3:38pm
11
think I resolved it using zip files:
{
"name": "TTSS",
"homepage": "http://satis.ttss.ch",
"repositories": [
{
"type": "package",
"package": {
"name": "themeco/x-shortcodes",
"description": "Includes all shortcode functionality for X",
"keywords": ["themeco","x-shortcodes"],
"license": "LGPL-3.0+",
"authors": [
{
"name":"Themeco",
"homepage":"http://theme.co"
}
],
"version": "2.3.3",
"dist": {
"url": "http://satis.ttss.ch/files/x-shortcodes.zip",
"type": "zip"
},
"type": "wordpress-plugin",
"require": {
"php": ">=5.3.2",
"composer/installers": "*"
}
}
}
],
"require-all": true
}
1 Like
Yeah, Composer won’t pull from a subdirectory within a Git repo. In fact it’s not even possible using git clone
. See http://stackoverflow.com/questions/600079/is-there-any-way-to-clone-a-git-repositorys-sub-directory-only
1 Like
ttss
July 31, 2014, 7:07am
13
Perfect, thanks @swalkinshaw everything works this way, now I’ll just protect the package repo with some basic auth and it should be fine.
ttss
August 1, 2014, 12:45pm
14
1 Like
rolle
January 15, 2015, 10:14am
15
I think this is the best way.
2 Likes
wdeer
March 24, 2016, 6:46pm
16
After a quick search I was unable to find any references to managing plugins with composer from https://github.com/wp-premium
Soo, I felt like this thread would be a good place to bring it up…
So, I got the following to work with no issue:
{
"type": "package",
"package": {
"name": "wp-premium/gravityforms",
"type": "wordpress-plugin",
"version": "1.9.17.5",
"dist": {
"url": "https://github.com/wp-premium/gravityforms/archive/master.zip",
"type": "zip"
}
}
}
and then simply ran $ composer require "wp-premium/gravityforms"
While the above worked, is it the correct approach? or should i be doing something different? (note: i’d really rather not maintain a multitude of private repos, but would if its the correct approach)
note: i also tried the same format above but with “git” as the type and changing the url to:
git@github.com:wp-premium/gravityforms.git
…along with some other variations but had no luck with any
Thanks in advance!
2 Likes
vdrnn
March 26, 2016, 11:02pm
17
There’s a new project by the creator of Composer called Toran Proxy.
This might solve most of the issues here.
https://toranproxy.com/
2 Likes
@wdeer that’s awesome.
Any idea who maintains the wp-premium repo?
@vdrnn that looks really cool too.
But correct me if I’m wrong guys– with toranproxy you’d need to manually update the proxy repo every time the plugin updates, and with wp-premium the repo owner updates it?
If that’s the idea of wp-premium does, that seems incredibly useful. But then you’ll probably still need to update the .json manually (to update version #s )? Or is there an automated process for this?
Edit: -“gist” +“idea”, gist is probably a bad word to use now that it’s a proper noun.
1 Like
Yep, you would
Composer packages work off Git tags, so you could just tag each release as the version number.
1 Like
@kalenjohnson very true! That’s awesome.
Which leads me to my next point:
@wdeer , your problem with using the remote git repo is that your .json syntax is wrong. Try something like this :
{
"type": "vcs",
"url": "git@github.com:wp-premium/gravityforms.git"
},
@kalenjohnson , that ^^ should work right?
zip is probably faster, but yeah using Git is better IMO as you just need to update the version number rather than the file URL each time.
With a .zip can you do it like this?
{
"type": "vcs",
"url": "git@github.com:wp-premium/gravityforms.zip"
},
Or do you have to do it like this?
{
"type": "package",
"package": {
"name": "wp-premium/gravityforms",
"type": "wordpress-plugin",
"version": "1.9.17.5",
"dist": {
"url": "https://github.com/wp-premium/gravityforms/archive/master.zip",
"type": "zip"
}
}
}
1 Like
RiFi2k
March 30, 2016, 5:17pm
23
For a long time I added
{
"type": "git",
"url": "git@bitbucket.org:your-name/advanced-custom-fields-pro.git"
},
etc, etc, and just tagged my commits with the new version number.
Now I use Toran Proxy because you can set it up with a cron and it will mirror all your git repos and also packagist too if you want at whatever rate you decide to set the cron job for. So you really only need to push new versions to your private repos and Toran automatically stays in sync.
If you want a super ez way to do zip files check out
https://getcomposer.org/doc/05-repositories.md#artifact
2 Likes
marco
April 12, 2016, 1:48pm
24
Hi there, if you are fed up of writing / modifying composer.json for your premium or own packages, release-belt from Rarst is a nice solution.
Serve release-belt through a web server of your choice (can be the php embedded one)
Drop your plugins and themes zips in release/wordpress-{plugin,theme}/company/
that’s all
Relase-belt will create a composer.json automatically.
I’m just starting using it on a server on the wild with basic http auth and it works great.
4 Likes
I’m running into problems with this approach when deploying, as I’m not sure how to pass the --prefer-source
flag to the deploy script.
Ideally, I’d like to avoid using the --prefer-source
flag, but on composer update
and deploy, I get the error message:
[LogicException] Downloader “Composer\Downloader\GitDownloader” is a source type downloader
and can not be used to download dist
And I really don’t understand what’s going on and how to get around it (how do you set the private plugin to be “source” rather than “dist”?).
Bedrock composer.json repository code:
{
"type": "vcs",
"url": "git@bitbucket.org:growdigital/advanced-custom-fields-pro.git"
}
Plugin composer.json:
{
"name": "growdigital/advanced-custom-fields-pro",
"type": "wordpress-plugin",
"source": {
"type": "git",
"url": "git!@bitbucket.org:growdigital/advanced-custom-fields-pro.git"
}
}
And it feels like I’ve tried every variation inbetween!!
I’ve managed to run composer with private repos locally but unfortunately I’m having the same issue when I try do deploy.yml
Loading composer repositories with package information
Installing dependencies from lock file
[LogicException]
Downloader "Composer\Downloader\GitDownloader" is a source type downloader
and can not be used to download dist
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev]
[--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress]
[--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a
|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
fatal: [production_host]: FAILED! => {"changed": true, "cmd": ["composer", "inst
all", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-
autoloader", "--no-scripts"], "delta": "0:00:00.141280", "end": "2016-11-29 05:4
9:38.212958", "failed": true, "rc": 1, "start": "2016-11-29 05:49:38.071678", "s
tderr": "Loading composer repositories with package information\nInstalling depe
ndencies from lock file\n\n
\n [LogicExceptio
n]
\n Downloader \"Composer\\Downloader\\GitDownloader\" is a s
ource type downloader and can not be used to download dist \n
\n\ninstall [--prefer-source] [--prefer-dist] [--dry-run] [--de
v] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-pr
ogress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--cl
assmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...", "stdout":
"", "stdout_lines": [], "warnings": []}
to retry, use: --limit @/vagrant/deploy.retry
1 Like
Got to working!
For reference, I simply removed these lines from the repo’s composer.json
"source": {
"url": "git@bitbucket.org:gabrielgiordan/my-plugin.git",
"type": "git"
}
And keep it like this.
{
"name": "gabrielgiordan/my-plugin",
"description": "My Plugin",
"type": "wordpress-plugin",
"license": "proprietary",
"authors": [
{
"name": "Gabriel Giordano"
}
],
"require": {
"composer/installers": "^1.0.6"
}
}
Deploy worked fine!
3 Likes
$60/m is a little steep for most freelancers. Might be a good idea for an agency though.
1 Like