wp-cli: 1.2.1 -> 1.3.0

This commit is contained in:
Peter Hoeg 2017-08-16 08:39:22 +08:00
parent ed0f2641cb
commit d32bf457ef

View File

@ -1,51 +1,49 @@
{ stdenv, lib, fetchurl, php }: { stdenv, lib, fetchurl, writeScript, writeText, php }:
let let
version = "1.2.1"; name = "wp-cli-${version}";
version = "1.3.0";
bin = "bin/wp"; src = fetchurl {
ini = "etc/php/wp-cli.ini"; url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
phar = "share/wp-cli/wp-cli.phar"; sha256 = "0q5d32jq7a6rba77sr1yyj6ib6x838hw14mm186ah1xxgnn7rnry";
};
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";
}; };
in stdenv.mkDerivation rec { bin = writeScript "wp" ''
name = "wp-cli-${version}"; #! ${stdenv.shell}
src = fetchurl { set -euo pipefail
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
sha256 = "1ds9nhm0akajwykblg0s131vki02k3rpf72a851r3wjw2qv116wz";
};
buildCommand = '' exec ${lib.getBin php}/bin/php \
mkdir -p $out/bin $out/etc/php -c ${ini} \
-f ${src} -- "$@"
'';
cat <<_EOF > $out/${bin} ini = writeText "wp-cli.ini" ''
#! ${stdenv.shell} -eu
exec ${lib.getBin php}/bin/php \\
-c $out/${ini} \\
-f $out/${phar} "\$@"
_EOF
chmod 755 $out/${bin}
cat <<_EOF > $out/${ini}
[Phar] [Phar]
phar.readonly = Off phar.readonly = Off
_EOF '';
chmod 644 $out/${ini}
install -Dm644 ${src} $out/${phar} in stdenv.mkDerivation rec {
inherit name version;
buildCommand = ''
mkdir -p $out/{bin,share/bash-completion/completions}
ln -s ${bin} $out/bin/wp
install -Dm644 ${completion} $out/share/bash-completion/completions/wp install -Dm644 ${completion} $out/share/bash-completion/completions/wp
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A command line interface for WordPress"; description = "A command line interface for WordPress";
homepage = https://wp-cli.org;
license = licenses.mit;
maintainers = with maintainers; [ peterhoeg ]; maintainers = with maintainers; [ peterhoeg ];
platforms = platforms.all; platforms = platforms.all;
homepage = https://wp-cli.org;
license = licenses.mit;
}; };
} }