Composer: Difference between revisions

No edit summary
adds commentary about detached head
Line 17: Line 17:


=== Use git checkouts ===
=== 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>
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, but composer leaves you with a detached head owing to the specific version that it checks out.
<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 ==
== Installation ==