wp-cli: 2.0.1 -> 2.2.0
This commit is contained in:
parent
cf3948fbe0
commit
a91c1dc167
@ -1,53 +1,49 @@
|
|||||||
{ stdenv, lib, fetchurl, php, runtimeShell }:
|
{ stdenv, lib, fetchurl, writeText, php, makeWrapper }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "2.0.1";
|
version = "2.2.0";
|
||||||
|
|
||||||
completion = fetchurl {
|
completion = fetchurl {
|
||||||
url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash";
|
url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash";
|
||||||
sha256 = "15d330x6d3fizrm6ckzmdknqg6wjlx5fr87bmkbd5s6a1ihs0g24";
|
sha256 = "15d330x6d3fizrm6ckzmdknqg6wjlx5fr87bmkbd5s6a1ihs0g24";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ini = writeText "php.ini" ''
|
||||||
|
[PHP]
|
||||||
|
memory_limit = -1 ; no limit as composer uses a lot of memory
|
||||||
|
|
||||||
|
[Phar]
|
||||||
|
phar.readonly = Off
|
||||||
|
'';
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
name = "wp-cli-${version}";
|
pname = "wp-cli";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
|
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${pname}-${version}.phar";
|
||||||
sha256 = "05lbay4c0477465vv4h8d2j94pk3haz1a7f0ncb127fvxz3a2pcg";
|
sha256 = "0s03jbsjwvkcbyss6rvpgw867hiwvk5p4n1qznkghyzi94j8mvki";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
dir=$out/share/wp-cli
|
dir=$out/share/wp-cli
|
||||||
mkdir -p $out/bin $dir
|
mkdir -p $out/bin $dir
|
||||||
|
|
||||||
cat <<_EOF > $out/bin/wp
|
install -Dm444 ${src} $dir/wp-cli
|
||||||
#!${runtimeShell}
|
install -Dm444 ${ini} $dir/php.ini
|
||||||
|
install -Dm444 ${completion} $out/share/bash-completion/completions/wp
|
||||||
|
|
||||||
set -euo pipefail
|
makeWrapper ${lib.getBin php}/bin/php $out/bin/wp \
|
||||||
|
--add-flags "-c $dir/php.ini" \
|
||||||
exec ${lib.getBin php}/bin/php \\
|
--add-flags "-f $dir/wp-cli"
|
||||||
-c $dir/php.ini \\
|
|
||||||
-f $dir/wp-cli -- "\$@"
|
|
||||||
_EOF
|
|
||||||
chmod 0755 $out/bin/wp
|
|
||||||
|
|
||||||
cat <<_EOF > $dir/php.ini
|
|
||||||
[PHP]
|
|
||||||
memory_limit = -1 ; no limit as composer uses a lot of memory
|
|
||||||
|
|
||||||
[Phar]
|
|
||||||
phar.readonly = Off
|
|
||||||
_EOF
|
|
||||||
|
|
||||||
install -Dm644 ${src} $dir/wp-cli
|
|
||||||
install -Dm644 ${completion} $out/share/bash-completion/completions/wp
|
|
||||||
|
|
||||||
# this is a very basic run test
|
# this is a very basic run test
|
||||||
$out/bin/wp --info
|
$out/bin/wp --info >/dev/null
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with lib; {
|
||||||
description = "A command line interface for WordPress";
|
description = "A command line interface for WordPress";
|
||||||
homepage = https://wp-cli.org;
|
homepage = https://wp-cli.org;
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
|
Loading…
Reference in New Issue
Block a user