GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1bca6a...c7b116 )
by Stefano
02:33
created

activeConnection.then   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 7
rs 9.4285
1
var path = require('path');
2
var fs = require('fs');
3
var JSZip = require("jszip");
4
var node_ssh = require('node-ssh');
5
var ssh = new node_ssh();
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like node_ssh should be capitalized.
Loading history...
6
var zip = new JSZip();
7
8
zip.file("Hello.txt", "Hello World\n");
9
10
//var img = zip.folder("images");
11
//img.file("smile.gif", imgData, {base64: true});
12
13
zip.generateNodeStream({type:'nodebuffer',streamFiles:true})
14
    .pipe(fs.createWriteStream('example.zip'))
15
    .on('finish', function () {
16
        // JSZip generates a readable stream with a "end" event,
17
        // but is piped here in a writable stream which emits a "finish" event.
18
        console.log("example.zip written.");
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
19
    });
20
21
var activeConnection = ssh.connect({
22
  host: 'www.d1b0.local',
23
  username: 'developer',
24
  privateKey: '../../server/play/ssh/developer.key'
25
});
26
27
activeConnection.then(function() {
28
29
  // Array<Shape('local' => string, 'remote' => string)>
30
  ssh.putFiles([
31
      { local: '../../applications/workspace/composer.json', remote: '/var/www/workspace.local/composer.json' }
32
    ]).then(function() {
33
    console.log("The File thing is done");
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
34
  }, function(error) {
35
    console.log("Something's wrong");
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
36
    console.log(error);
37
  });
38
39
  // Putting entire directories
40
  var failed = [];
41
  var successful = [];
42
  ssh.putDirectory('../../applications/workspace/src/', '/var/www/workspace.local/src/', {
43
    recursive: true,
44
    validate: function(itemPath) {
45
      var baseName = path.basename(itemPath);
46
      return baseName.substr(0, 1) !== '.' && baseName !== 'node_modules' && baseName !== 'vendor';
47
    },
48
    tick: function(localPath, remotePath, error) {
49
      if (error) {
50
        failed.push(localPath);
51
      } else {
52
        successful.push(localPath);
53
      }
54
    }
55
  }).then(function(successful) {
56
    console.log('the directory transfer was', successful ? 'successful' : 'unsuccessful');
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
57
    console.log('failed transfers', failed.join(', '));
58
    console.log('successful transfers', successful.join(', '));
59
  });
60
61
  // Command with escaped params
62
  ssh.exec('composer', ['install', '--no-dev', '--optimize-autoloader', '--no-interaction', '--no-progress', '--no-scripts'], { cwd: '/var/www/workspace.local/' }).then(function(result) {
63
    console.log('STDOUT: ' + result);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
64
  });
65
66
});
67