ckeditor/ckeditor4-releases

Can't install alternate distribution releases with composer

Closed this issue · 11 comments

Following the docs at http://ckeditor.com/blog/CKEditor-Supports-Bower-and-Composer, I tried the following code:

"require": {
    "ckeditor/ckeditor": "full/4.3.3",
}

Unfortunately composer fails with the following message:

[UnexpectedValueException]                                                            
Could not parse version constraint full/4.3.3: Invalid version string "full/4.3.3"  

On the other hand branches seem to work OK. Unfortunately, I work with a very picky project manager that wants all dependencies to be pinned versions.

Is there any workarounds?

That does not work in general with composer libraries. You simply do not see the versions unless you're on stability dev.

This is what worked for us: "ckeditor/ckeditor": "~4.7.0+full"

This is what worked: "ckeditor/ckeditor": "dev-full/4.7.x as 4.7.0" (full/4.7.0 does NOT work for some reason)

@oleq @Reinmar @mlewand To my understanding, using a / in the version tag is not covered by semver. Build metadata should be annotated with a + sign, see http://semver.org/#spec-item-10

Thanks @schmunk42 for your insights.
Your latest suggestion pins the release but not the specific version.
I worked around it by adding the tag.
It's not very legible but does the trick for now.

The documentation still needs updating though…

It looks that Comopser is simply not handling tags that way, since branches are working correctly. You can see Fetching a Particular Build Preset section in our docs to find pretty much what @schmunk42 has suggested, so the docs are fine here.

As for workaround, since Composer doesn't play well with tags that contain backslash, you could simply pin the requirement to a given hash.

To my understanding, using a / in the version tag is not covered by semver. Build metadata should be annotated with a + sign, see http://semver.org/#spec-item-10

Yes, these branches do not follow SemVer - we simply added them to allow devs to fetch a particular build.

@mlewand Thanks for your comment.
The docs are indeed fine but the blog I linked in my first message is not.
Unfortunately it's the first Google result for "ckeditor composer" hence my mixup.
Sorry for the confusion.

I haven't really tested it, but would you consider an additional tag like 4.7.0+full if it would work fine?

The problem with composer and multiple distributions is, because of the fact that ckeditor is often included as a dependency, that you can not specify a version constraint like ^4.2.1.

If you wanna include a full version, you have to "patch" your root composer.json pointing to a specific branch or version, which makes package management with dependency resolution useless in this setup.

Would be really nice, if you could provide a solution for this.

And how would Composer resolve anything like ^4.7.0+full? I'm afraid that it will simply skip meta info, and will just use any other preset. That's a no-go for us if it would replace 4.x.x+basic with a 4.x.x+full or the other way around during the update.

Tried it with a fork and it does not work :(

See my issue in composer/composer...

Any chance to make this happen?

It should be released as 3 different packages. E.g. ckeditor/ckeditor (standard), ckeditor/ckeditor-basic, ckeditor/ckeditor-full

composer/composer#6489 (comment)

[edit]
Maybe additional three repos automatically splitted?

It is a possibility, I created #69 for this, however it's not a hi priority for us ATM as it will require a bit of work to make it happen (and maintain backward compat).