Demand:
1 The code on SVN has a set of local (editor UltraEdit), a set on the development machine (CentOS), need local code modification to upload to the development machine
2 is not modified and used directly on the development machine because many people use the same development machine, in order to keep local backups
ideas:
1 Write a script as UltraEdit plug-in, so that the code can be modified and press the key to be able to directly save the code locally after uploading to the CentOS
2 Local is Windows, remote is Linux, File Upload tool can use Pscp.exe, scripting language using PHP or Python
3 PHP must be installed locally, no database installation and Apache required
4 in PHP, a process call Pscp.exe, parsing path and other logic put in PHP
steps:
1 Ultaedit Set the script in the tool configuration .
PHP "C:\Users\nickyjf\Desktop\mesh\Tools\syncFile\sync142.php"%p%n%e
The%p%n%e is the absolute path to the currently edited file, which is passed into the synv142.php as a parameter
2 sync142.php Code
Copy CodeThe code is as follows:
Plug-ins to sync 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", $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 the Pscp.exe in the sync142 sibling
4 to map the key CTRL + 1 to this script so in the writing process When you press CTRL + 1 to replace the current script with the remote script
http://www.bkjia.com/phpjc/ 324841.html www.bkjia.com true http://www.bkjia.com/phpjc/324841.html techarticle requirements: 1 SVN code on the local (editor UltraEdit) a set, on the development Machine (CentOS) has a set of local code needs to be modified after uploading to the development machine 2 is not directly on the open ...