Requirements:
1 There is one set of code on svn locally (editor UltraEdit) and one set on the development machine (centos). The local code needs to be modified and then uploaded to the development machine
2 Do not modify and use it directly on the development machine. The reason is that multiple people use the same development machine. In order to keep a local backup
Idea:
1 Write a script as a plug-in for UltraEdit, so that after modifying the code, pressing the specified button can directly save the code locally and upload it to centos
2 The local is windows, the remote is linux, and the file upload tool can be used pscp.exe, the scripting language uses PHP or Python
3 PHP must be installed locally, there is no need to install database and apache
4 Create a process in PHP to call pscp.exe, parse path and other logic Place it in php
Steps:
1 Set the script in the tool configuration in UltaEdit
php "C:UsersnickyjfDesktopmeshToolssyncFilesync142.php" %p%n%e
The %p%n%e after it is the absolute path of the currently edited file, which is passed into synv142.php as a parameter
2 sync142.php code
Copy code The code is as follows:
//Plug-in, synchronize windwos files to linux
//php "rsync142.php" %p%n%e
//valid argv
//testCode
/*
$argv = array(
"rsync142.php",
"E:\SVN\test\www\include\ggg\test\DTest.php",
) ;
*/
if(count($argv) == 2)
{
$sFilePath = $argv[1];
$sServerName = "192.168.10.142";
$sServerUserName = "name";
$sServerPassword = "password";
$sServerPath = sGetServerPath($sFilePath);
$realPath = sprintf("%s@%s:/%s", $sServerUserName, $sServerName, $sServerPath);
try
{
$cmd = sprintf("pscp.exe -pw %s %s %s", $sServerPassword, $sFilePath, $realPath);
echo $cmd."n";
system($cmd);
}
catch(Exception $e)
{
print_r($e);exit;
}
}
function sGetServerPath($sWindowsPath)
{
$ret = "";
$paths = explode("\", $sWindowsPath);
if($ startKey = array_search("www", $paths))
{
$ret = "test/";
for($i=$startKey+1; $i{
$ret .= $paths[$i] . "/";
}
$ret = trim($ret, "/");
}
return $ret;
}
?>
3 Place pscp.exe in the same directory as sync142
4 Map the keys Ctrl + 1 to this script
So when writing a program, just press Ctrl + 1 to replace the current script with the remote script
http://www.bkjia.com/PHPjc/324841.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324841.htmlTechArticleRequirements: 1. There is a set of code on svn locally (editor UltraEdit) and on the development machine (centos) There is a set, which requires local code modification and uploading to the development machine 2. Do not open it directly...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn