gpupo/pipe2

该软件包已被弃用且不再维护。未建议替代软件包。

将Google购物XML格式转换为XMLPipe2格式

v1.1.1 2017-10-24 13:13 UTC

This package is auto-updated.

Last update: 2020-02-11 18:09:45 UTC


README

Build Status Scrutinizer Code Quality

Pipe2

XML命令行工具

安装

Pipe2是一个小的PHP应用程序,只需在您的电脑上安装一次。

在Linux和Mac OS X上安装

sudo curl -LsS https://github.com/gpupo/pipe2/releases/download/1.1/pipe2.phar -o /usr/local/bin/pipe2;
sudo chmod a+x /usr/local/bin/pipe2;

在Windows上安装

c:\> php -r "readfile('https://github.com/gpupo/pipe2/releases/download/1.1/pipe2.phar');" > pipe2

然后,只需运行pipe2

用法

将XML文件转换为XMLPipe2格式;

pipe2 convert data/acme.googleshopping.xml

此示例使用输入样本文件data/acme.googleshopping.xml

合并具有相似结构且第二个文档包含属性的XML文档

pipe2 merge-attributes data/acme.googleshopping.xml data/merge/attributes/secondDocument.xml --idField="g:id" --pretty=true

此示例使用输入样本文件data/acme.googleshopping.xmldata/merge/attributes/secondDocument.xml,并创建输出样本文件data/merge/attributes/output.xml

从PhpUnit XML生成Markdown文档

phpdoc -d ./src/ -t ./build/ --template="xml" --cache-folder=/tmp;
pipe2 documentor build/structure.xml Api.md;

高级

带频道名称

pipe2 convert --channel=amazon data/acme.googleshopping.xml

生成带有良好格式和缩进的空白文档

pipe2 generate --pretty=true

可用命令

命令 描述
convert 将XML文件转换为XMLPipe2格式
merge-attributes 合并具有相似结构且第二个文档包含属性的XML文档
generate 生成空白XMLPipe2格式文档
list 列出命令
help 显示命令的帮助信息

帮助

显示命令的帮助信息

pipe2 help convert;
pipe2 help generate;

示例

此示例使用输入样本文件data/acme.googleshopping.xml并创建输出样本文件data/acme.xmlpipe2.xml

pipe2 convert --channel=acme data/acme.googleshopping.xml > data/acme.xmlpipe2.xml

Sphinx搜索索引示例

source acmeSource
{
    type = xmlpipe
    xmlpipe_command = /usr/local/bin/pipe2 convert --channel=acme /tmp/data/acme.googleshopping.xml
}

index acmeIndex
{
  source = acmeSource
  path = /var/sphinx/acmeIndex
  charset_type = utf-8
  mlock           = 0
  morphology      = none
  enable_star     = 1
  min_prefix_len  = 2
  expand_keywords = 1
  min_word_len    = 2
}

有关Sphinx搜索配置文件示例,请参阅data/sphinx.sample.conf

要求

  • PHP版本至少为PHP 5.4,并需要PHP XML库
  • 推荐PHP内存至少为2GB或更多;

待办事项

  • 转换远程文件
  • 处理gz压缩
  • merge-elements:合并具有相似结构且第二个文档包含附加元素的XML文档

许可证

麻省理工学院(MIT),参见 许可协议