{"id":202728,"date":"2013-11-19T14:48:03","date_gmt":"2013-11-19T10:48:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=202728"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=202728","title":{"rendered":"<span class=\"post_title\">PhpStorm. \u041b\u0430\u0439\u0444\u0445\u0430\u043a: keep-alive automatic upload \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041c\u043d\u043e\u0433\u0438\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 Automatic Upload \u0432 PhpStorm (\u0441\u044e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e IDE \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439) \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u00ab\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439\u00bb \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043d\u0430\u0442\u044f\u0436\u043a\u043e\u0439, \u043d\u043e \u0442\u0435\u043c\u0430 <a href=\"http:\/\/youtrack.jetbrains.com\/issue\/WI-674\">\u0436\u0438\u0432\u0430<\/a>: PhpStorm \u043f\u0440\u0438 \u0437\u0430\u043b\u0438\u0432\u043a\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u0443 \u043c\u0435\u043d\u044f \u0443\u0436 \u0442\u043e\u0447\u043d\u043e: \u0445\u043e\u0441\u0442\u0438\u043d\u0433-\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 Hetzner), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0436\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043b\u044c\u044e\u0442\u0441\u044f.<\/p>\n<p>  \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442 keep-alive \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441 Automatic Upload \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0412 \u0442\u0435\u043a\u0441\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043c\u0430\u043b\u043e \u043a\u043e\u043c\u043c\u0435\u0442\u0430\u0440\u0438\u0435\u0432. \u0421\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u0441 \u0442\u0435\u043c \u0447\u0442\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043c \u0438 \u043d\u0435\u0447\u0435\u0433\u043e: \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 NodeJS \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0433\u0430\u0439\u0434\u044b \u0438 \u0441\u0442\u0430\u0442\u044c\u0438 (\u043d\u043e \u0432 \u044d\u0442\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 JavaScript), \u0430 \u0434\u043b\u044f \u0431\u044b\u0432\u0430\u043b\u044b\u0445 \u043a\u043e\u0434-\u0440\u0435\u0432\u044c\u044e \u0441\u043a\u0430\u0436\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u044f.<\/p>\n<p>  \u0421\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 NodeJS \u2014 \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0431\u043e\u0440 \u0431\u044b\u043b \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e SFTP. \u0418\u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/li>\n<li>Upload \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440<\/li>\n<\/ul>\n<p>  \u042f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0411\u0435\u0433\u043b\u044b\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u043e\u0432 \u043d\u0430\u0432\u0435\u043b \u043c\u0435\u043d\u044f \u043d\u0430 2 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/paulmillr\/chokidar\">chokidar<\/a> \u2014 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li><a href=\"https:\/\/github.com\/mscdex\/ssh2\">ssh2<\/a> \u2014 \u0441\u0441\u0448-\u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443<\/li>\n<\/ul>\n<p>  \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u0445 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 NodeJS \u043d\u0435 \u0431\u0443\u0434\u0443 \u2014 \u0433\u0430\u0439\u0434\u043e\u0432 \u043f\u043e\u043b\u043d\u043e \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0445\u0430\u0431\u0440\u0435.<\/p>\n<p>  \u0424\u0430\u0439\u043b\u0438\u043a \u044f \u043d\u0430\u0437\u0432\u0430\u043b \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u043e <b>deploy.js<\/b>. \u041f\u0435\u0440\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u0440\u043e\u0441\u0442\u043e: <\/p>\n<pre><code class=\"javascript\">var fs = require('fs'); var Connection = require('ssh2'); var \u0421hokidar = require('chokidar'); var c = new Connection(); <\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443:<\/p>\n<pre><code class=\"javascript\">c.connect({         host: 'habrahabr.ru',         port: 1500, \tusername: 'habr', \tpassword: 'habrapassword' }); <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0443 <b>ssh2 <\/b>\u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0412\u044b\u0432\u0435\u0434\u0435\u043c \u0438\u0445 \u0432 \u043b\u043e\u0433:<\/p>\n<pre><code class=\"javascript\">c.on('connect', function() { \tconsole.log('Connection :: connect'); }); c.on('error', function(err) { \tconsole.log('Connection :: error :: ' + err); }); c.on('end', function() { \tconsole.log('Connection :: end'); }); c.on('close', function(had_error) { \tconsole.log('Connection :: close'); }); <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0442\u043e \u0441 \u0447\u0435\u043c \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">c.on('ready', function() {         .... }) <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0444\u0438\u0447\u0430 \u2014 <b>sftp<\/b>: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">c.sftp(function(err,sftp){ \t\tif(!err){ \t\t\tconsole.log('sftp start'); \t\t}else{ \t\t\tconsole.log('sftp err',err); \t\t} \t}); <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u043e \u2014 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">\t\t\tvar watcher = chokidar.watch(local_path, \t\t\t\t{ignored: \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0430\u044f \u0437\u0430 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u044e\u0434\u0430 \u043f\u0443\u0442\u0438 \u043f\u0430\u043f\u043a\u0438 SVN \u0438 \u0441\u0430\u043c\u043e\u0433\u043e PhpStorm \t\t\t\t\tfunction(path){ \t\t\t\t\t\tif(path.indexOf(&quot;.idea&quot;) &gt;= 0 || path.indexOf(&quot;.svn&quot;) &gt;= 0 || path == (local_path+'\/dpl')){ \t\t\t\t\t\t\treturn true; \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\tignoreInitial:true \/\/ \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0442\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0415\u0441\u043b\u0438 false - \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0442\u044c\u0441\u044f \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \t\t\t\t}); <\/code><\/pre>\n<p>  \u0423 \u0432\u043e\u0442\u0447\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f <b>add<\/b>, <b>change<\/b>, <b>unlink <\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u0414\u0435\u043b\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043c\u0430\u043b\u044b\u043c: \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <b>ssh2 <\/b>\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e <b>sftp<\/b>:<\/p>\n<pre><code class=\"javascript\">\t\t\twatcher \t\t\t\t.on('add', function(path,meta) {  \t\t\t\t\tconsole.log('upload added',path.replace(local_path,deploy_path));  \t\t\t\t\tsftp.fastPut(path,path.replace(local_path,deploy_path),{},function(err){ \t\t\t\t\t\tif(err){ \t\t\t\t\t\t\tconsole.log('sftp upload err',err); \t\t\t\t\t\t} \t\t\t\t\t}); \t\t\t\t}) \t\t\t\t.on('change', function(path) {  \t\t\t\t\tconsole.log('upload changed',path.replace(local_path,deploy_path));  \t\t\t\t\tsftp.fastPut(path,path.replace(local_path,deploy_path),{},function(err){ \t\t\t\t\t\tif(err){ \t\t\t\t\t\t\tconsole.log('sftp change err',err); \t\t\t\t\t\t} \t\t\t\t\t}); \t\t\t\t}) \t\t\t\t.on('unlink', function(path) { \t\t\t\t\tconsole.log('remove file',path.replace(local_path,deploy_path));  \t\t\t\t\tsftp.unlink(path.replace(local_path,deploy_path),function(err){ \t\t\t\t\t\tif(err){ \t\t\t\t\t\t\tconsole.log('sftp remove err',err); \t\t\t\t\t\t} \t\t\t\t\t}); \t\t\t\t}) \t\t\t\t.on('error', function(error) {console.error('Error happened', error);}) <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e! \u0424\u0430\u0439\u043b\u044b \u0437\u0430\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u043c \u043c\u044b \u0442\u0430\u0431\u0430\u0435\u043c\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440! \u041f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u2014 \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u0443\u0448\u0430\u0435\u0442 \u0426\u041f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a\u0430\u043a \u0441\u043a\u0430\u0439\u043f (MacBook Air mid 2012), \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0442\u0435\u0440\u043f\u0438\u043c\u043e.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u0434\u0435\u043f\u043b\u043e\u0435\u0440\u0443 \u044f \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b \u043b\u0435\u0433\u043a\u0438\u0439 Bash \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0440\u043e\u0441\u0430\u044e \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u043d \u0443\u0436\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442. <\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  DEPLOY_PATH=&quot;\/deploy\/path&quot;  DEPLOYER_PATH=&quot;\/path\/to\/deploy.js&quot;  SOURCE=&quot;${BASH_SOURCE[0]}&quot; while [ -h &quot;$SOURCE&quot; ]; do    TARGET=&quot;$(readlink &quot;$SOURCE&quot;)&quot;   if [[ $SOURCE == \/* ]]; then     echo &quot;SOURCE '$SOURCE' is an absolute symlink to '$TARGET'&quot;     SOURCE=&quot;$TARGET&quot;   else     DIR=&quot;$( dirname &quot;$SOURCE&quot; )&quot;     echo &quot;SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')&quot;     SOURCE=&quot;$DIR\/$TARGET&quot;   fi done  RDIR=&quot;$( dirname &quot;$SOURCE&quot; )&quot; DIR=&quot;$( cd -P &quot;$( dirname &quot;$SOURCE&quot; )&quot; && pwd )&quot; if [ &quot;$DIR&quot; != &quot;$RDIR&quot; ]; then   echo &quot;local_path is '$DIR'&quot; fi  node $DEPLOYER_PATH local_path=$DIR deploy_path=$DEPLOY_PATH <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 <b>deploy.js<\/b><\/p>\n<pre><code class=\"javascript\">var local_path; var deploy_path;  process.argv.forEach(function (val, index, array) { \tvar item_arr = val.split('='); \tif(item_arr.length &gt; 1){ \t\tswitch(item_arr[0]){ \t\t\tcase 'local_path': \t\t\t\tlocal_path = item_arr[1]; \t\t\t\tbreak; \t\t\tcase 'deploy_path': \t\t\t\tdeploy_path = item_arr[1]; \t\t\t\tbreak; \t\t} \t} }); <\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u043e\u0441\u0442 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c NodeJS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043b\u0438\u0432\u043a\u0438 \u0444\u0430\u0439\u043b\u0430, \u0438\u043b\u0438 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0441 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u043e\u0431\u0449\u0438\u0439 dev \u0441\u0435\u0440\u0432\u0435\u0440. <\/p>\n<p>  \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e <a href=\"http:\/\/rangg.ru\/deploy.js\">\u0444\u0430\u0439\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/a>.<\/p>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0437\u0430 \u0447\u0430\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0435\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0433\u043b\u0443\u043f\u043e\u0441\u0442\u0438 \u0438 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0448\u0443 \u043d\u0435 \u0441\u0443\u0434\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e. \u0421\u043c\u044b\u0441\u043b \u043f\u043e\u0441\u0442\u0430 \u2014 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0430 \u043d\u0430\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 \u043c\u044b\u0441\u043b\u0438 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438. \u0414\u043e\u043b\u0433\u0438\u0435 \u0447\u0430\u0441\u044b \u044f \u0448\u0430\u0440\u0438\u043b\u0441\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430\u0445 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u0438\u043b\u0438 \u0445\u0430\u043a\u043e\u0432, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u0418\u0434\u0435\u044f \u043f\u0440\u0438\u0448\u043b\u0430 \u0441\u0430\u043c\u0430 \u0441\u043e\u0431\u043e\u0439, \u0441 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u043d\u043e\u0432\u043e\u0433\u043e PhpStorm, \u043a\u043e\u0433\u0434\u0430 \u0443\u0432\u0438\u0434\u0435\u043b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 IDE. <\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/rangg\/blog\/202728\/\"> http:\/\/habrahabr.ru\/company\/rangg\/blog\/202728\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041c\u043d\u043e\u0433\u0438\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 Automatic Upload \u0432 PhpStorm (\u0441\u044e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e IDE \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439) \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u00ab\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439\u00bb \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043d\u0430\u0442\u044f\u0436\u043a\u043e\u0439, \u043d\u043e \u0442\u0435\u043c\u0430 <a href=\"http:\/\/youtrack.jetbrains.com\/issue\/WI-674\">\u0436\u0438\u0432\u0430<\/a>: PhpStorm \u043f\u0440\u0438 \u0437\u0430\u043b\u0438\u0432\u043a\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u0443 \u043c\u0435\u043d\u044f \u0443\u0436 \u0442\u043e\u0447\u043d\u043e: \u0445\u043e\u0441\u0442\u0438\u043d\u0433-\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 Hetzner), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0436\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043b\u044c\u044e\u0442\u0441\u044f.<\/p>\n<p>  \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442 keep-alive \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441 Automatic Upload \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-202728","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/202728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202728"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/202728\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}