crowdstar / svn-agent-host
一个本地消息主机,用于处理从特定Chrome扩展接收到的SVN命令。
1.0.15
2019-07-13 00:04 UTC
Requires
- php: >=7.0
- arvenil/ninja-mutex: ~0.6
- bugsnag/bugsnag: ~3.13
- deminy/shellwrap: dev-master
- monolog/monolog: ~1.11
- vlucas/phpdotenv: ~2.2
Requires (Dev)
- overtrue/phplint: ~1.1.0
- phpunit/phpunit: ~6.0
- squizlabs/php_codesniffer: >=2.0
README
一个本地消息主机,用于处理从特定Chrome扩展接收到的SVN命令。
主机程序是为Mac和Linux构建的。对于Windows用户,您可能可以通过Windows Subsystem for Linux在Ubuntu或其他Linux发行版中安装主机程序。
此存储库是Glu Mobile内部项目的一部分。Glu Mobile。我们将整个项目的一部分开源,以分享我们在
- PHP中编写本地消息主机的经验。
- 在不使用Subversion扩展的情况下将Subversion操作包装在PHP中。
运行测试
我们使用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; } );