crowdstar/svn-agent-host

一个本地消息主机,用于处理从特定Chrome扩展接收到的SVN命令。

1.0.15 2019-07-13 00:04 UTC

This package is auto-updated.

Last update: 2024-09-04 21:05:27 UTC


README

Build Status AppVeyor Build Status Latest Stable Version Latest Unstable Version License

一个本地消息主机,用于处理从特定Chrome扩展接收到的SVN命令。

主机程序是为Mac和Linux构建的。对于Windows用户,您可能可以通过Windows Subsystem for Linux在Ubuntu或其他Linux发行版中安装主机程序。

此存储库是Glu Mobile内部项目的一部分。Glu Mobile。我们将整个项目的一部分开源,以分享我们在

运行测试

我们使用Docker来设置测试环境。您可以使用以下命令在PHP和Subversion的不同版本安装(使用Docker准备)上运行单元测试、编码风格检查和其他测试:

PHP_VERSION=7.0    SVN_VERSION=1.8.19 ./bin/ci-on-linux.sh
PHP_VERSION=7.1    SVN_VERSION=1.9.9  ./bin/ci-on-linux.sh
PHP_VERSION=7.2    SVN_VERSION=1.10.3 ./bin/ci-on-linux.sh
PHP_VERSION=7.3    SVN_VERSION=1.11.0 ./bin/ci-on-linux.sh
PHP_VERSION=7.4    SVN_VERSION=1.13.0 ./bin/ci-on-linux.sh
# or, more specifically:
PHP_VERSION=7.1.19 SVN_VERSION=1.10.0 ./bin/ci-on-linux.sh

要在您的机器上使用当前PHP和Subversion安装运行单元测试,只需直接执行以下命令:

./bin/ci-on-osx.sh

演示代码

以下演示代码展示了如何从Chrome扩展与本地消息主机通信。

// content.js: a Content Script file.
window.addEventListener(
    "message",
    function (event) {
        chrome.runtime.sendMessage(
            event.data,
            function (response) {
                console.log('response from the background script', response);
            }
        );
    },
    false
);
window.postMessage({action: "create", data: {"path": "path/1"}}, "*");

// background.js: a Background Script file.
chrome.runtime.onMessage.addListener(
    function (request, sender, sendResponse) {
        chrome.runtime.sendNativeMessage(
            'com.glu.crowdstar.svnagent', // name of the native messaging host.
            request,
            function (response) {
                console.log("response from the native messaging host: ", response);
                // sendResponse(response);
            }
        );

        return true;
    }
);