Changes

Jump to navigation Jump to search
2,557 bytes added ,  01:27, 8 December 2016
m
typo
<li> [[mw:Composer/For extensions]] on using Composer to manage extensions
<li> [[mw:Manual:composer.json best practices]] for how to add Composer support to your extensions (including extension.json and skin.json)
<li> Jeroen DeDauw wrote [https://www.entropywins.wtf/blog/2013/11/24/introduction-to-composer-for-mediawiki-developers/ this blog post in 2014] that is probably still not only relevant, but also contains wisdom not addressed in other places (e.g. Extension developers should specify <code>"type": "mediawiki-extension"</code> in their extension's composer.json so that Composer installs your package into the 'extensions' folder instead of the typical 'vendor' folder that is Composer's default.)
</ol>
 
=== Use git checkouts ===
Say you installed Semantic Mediawiki with <code>composer require</code> and then when you went to your 'extensions' directory you were <i class="fa fa-frown-o"></i> because it wasn't a git checkout. You can rectify that by redoing the command, but with the <code>--prefer-source</code> option. nb. You first have to move the existing directory out of the way: <code>mv SemanticMediaWiki unused/</code> <code>cd ../ composer require --update-no-dev --sort-packages --optimize-autoloader -vvv mediawiki/semantic-media-wiki "~2.4" --prefer-source</code> But, it's still a bit different than you might expect, because Composer leaves you with a detached head owing to the specific version that it checks out (see composer.lock).
<pre>
Dependency resolution completed in 0.002 seconds
- Installing mediawiki/semantic-media-wiki (2.4.3)
Executing command (CWD): git --version
Cloning 6661acdd8c8420a7e07c178aad47590d086c83d6
Executing command (CWD): git clone --no-checkout 'https://github.com/SemanticMediaWiki/SemanticMediaWiki.git' 'extensions/SemanticMediaWiki/' && cd 'extensions/SemanticMediaWiki/' && git remote add composer 'https://github.com/SemanticMediaWiki/SemanticMediaWiki.git' && git fetch composer
Executing command (extensions/SemanticMediaWiki/): git remote set-url --push origin 'git@github.com:SemanticMediaWiki/SemanticMediaWiki.git'
Executing command (extensions/SemanticMediaWiki/): git branch -r
Executing command (extensions/SemanticMediaWiki/): git checkout '2.4.3' --
Executing command (extensions/SemanticMediaWiki/): git reset --hard '6661acdd8c8420a7e07c178aad47590d086c83d6' --
 
REASON: Required by the root package: Install command rule (install mediawiki/semantic-media-wiki 2.4.3|install mediawiki/semantic-media-wiki 2.4.0|install mediawiki/semantic-media-wiki 2.4.1|install mediawiki/semantic-media-wiki 2.4.2|install mediawiki/semantic-media-wiki 2.4.3)
 
$ git branch
* (detached from 2.4.3)
master
$ git status
HEAD detached at 2.4.3
nothing to commit, working directory clean
</pre>
== Installation ==
4,558

edits

Navigation menu