vagrant-phpstorm-tunnel 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/php +54 -45
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9903f4dc20f8395f96d1c3017f4ec0bc1e41dd10
|
4
|
+
data.tar.gz: 8f83694594116a771fdb66a438618216d5e25d8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce622ef060da5d40c1eaa3c86ecb4f59e6ae2aa9cdea2f15debe0cd55fa5594d0f98c4abe3c1dfeee85d9cccdc7bbfa0fdc7c1ac6aed8f5c71f5acc104f9ebb
|
7
|
+
data.tar.gz: 117a4345f00be04e7f4cbfba35692822a15be72454201079c6e2000c38f09f816d98f558c84e12210e3435a272aaa00905207029fb21a43bcb25bad521250658
|
data/data/php
CHANGED
@@ -12,25 +12,57 @@ chdir($projectDirHost);
|
|
12
12
|
// Detect Host IP
|
13
13
|
$hostIpFile = $homeDirHost . '/host_ip';
|
14
14
|
if (!file_exists($hostIpFile)) {
|
15
|
-
|
16
|
-
|
15
|
+
$ip = shell_exec('vagrant ssh -c "sudo ip route | awk \'/default/ { print \$3; exit; }\'"');
|
16
|
+
file_put_contents($hostIpFile, $ip);
|
17
17
|
}
|
18
18
|
$hostIp = trim(file_get_contents($hostIpFile));
|
19
19
|
if (!filter_var($hostIp, FILTER_VALIDATE_IP)) {
|
20
|
-
|
20
|
+
throw new Exception('Cannot detect host IP, got value `' . $hostIp . '`.');
|
21
21
|
}
|
22
22
|
|
23
23
|
// Detect Project Dir on Guest
|
24
24
|
$projectDirGuestFile = $homeDirHost . '/vm_project_dir';
|
25
25
|
if (file_exists($projectDirGuestFile)) {
|
26
|
-
|
26
|
+
$projectDirGuest = trim(file_get_contents($projectDirGuestFile));
|
27
27
|
}
|
28
28
|
$homeDirGuest = $projectDirGuest . '/.idea/vagrant';
|
29
29
|
|
30
|
+
$applyMapping = function ($argument) use ($projectDirHost, $projectDirGuest, $homeDirHost, $homeDirGuest, $hostIp) {
|
31
|
+
// IP mapping
|
32
|
+
$argument = str_replace(array('127.0.0.1', 'localhost'), $hostIp, $argument);
|
33
|
+
|
34
|
+
// Paths mapping
|
35
|
+
$filePath = $argument;
|
36
|
+
if (strrpos($filePath, '.coverage') == strlen($filePath) - 9) {
|
37
|
+
// Mapping output files to remote paths
|
38
|
+
if (!is_dir($homeDirHost . '/output/')) {
|
39
|
+
mkdir($homeDirHost . '/output/', 0777, true);
|
40
|
+
}
|
41
|
+
$argument = $homeDirGuest . '/output/' . basename($filePath);
|
42
|
+
$coverageFileList[$filePath] = $homeDirHost . '/output/' . basename($filePath);
|
43
|
+
} elseif (file_exists($filePath)) {
|
44
|
+
if (strpos($filePath, $projectDirHost) !== false) {
|
45
|
+
// Mapping project paths to remote paths
|
46
|
+
$argument = str_replace($projectDirHost, $projectDirGuest, $filePath);
|
47
|
+
} else {
|
48
|
+
// Mapping any other local system paths to remote paths, upload files
|
49
|
+
if (!is_dir($homeDirHost . '/scripts/')) {
|
50
|
+
mkdir($homeDirHost . '/scripts/', 0777, true);
|
51
|
+
}
|
52
|
+
if (is_file($filePath)) {
|
53
|
+
copy($filePath, $homeDirHost . '/scripts/' . basename($filePath));
|
54
|
+
}
|
55
|
+
$argument = $homeDirGuest . '/scripts/' . basename($filePath);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
return escapeshellarg($argument);
|
60
|
+
};
|
61
|
+
|
30
62
|
// Detect Command Prefix
|
31
63
|
$commandPrefixFile = $homeDirHost . '/vm_command_prefix';
|
32
64
|
if (file_exists($commandPrefixFile)) {
|
33
|
-
|
65
|
+
$commandPrefix = trim(file_get_contents($commandPrefixFile));
|
34
66
|
}
|
35
67
|
|
36
68
|
$coverageFileList = array();
|
@@ -38,53 +70,30 @@ $coverageFileList = array();
|
|
38
70
|
$arguments = $argv;
|
39
71
|
array_shift($arguments);
|
40
72
|
foreach ($arguments as $index => &$argument) {
|
41
|
-
|
42
|
-
$argument = str_replace(array('127.0.0.1', 'localhost'), $hostIp, $argument);
|
43
|
-
|
44
|
-
// Paths mapping
|
45
|
-
$filePath = $argument;
|
46
|
-
if (strrpos($filePath, '.coverage') == strlen($filePath) - 9) {
|
47
|
-
// Mapping output files to remote paths
|
48
|
-
if(!is_dir($homeDirHost . '/output/')) {
|
49
|
-
mkdir($homeDirHost . '/output/', 0777, true);
|
50
|
-
}
|
51
|
-
$argument = $homeDirGuest . '/output/' . basename($filePath);
|
52
|
-
$coverageFileList[$filePath] = $homeDirHost . '/output/' . basename($filePath);
|
53
|
-
} elseif (file_exists($filePath)) {
|
54
|
-
if (strpos($filePath, $projectDirHost) !== false) {
|
55
|
-
// Mapping project paths to remote paths
|
56
|
-
$argument = str_replace($projectDirHost, $projectDirGuest, $filePath);
|
57
|
-
} else {
|
58
|
-
// Mapping any other local system paths to remote paths, upload files
|
59
|
-
if(!is_dir($homeDirHost . '/scripts/')) {
|
60
|
-
mkdir($homeDirHost . '/scripts/', 0777, true);
|
61
|
-
}
|
62
|
-
copy($filePath, $homeDirHost . '/scripts/' . basename($filePath));
|
63
|
-
$argument = $homeDirGuest . '/scripts/' . basename($filePath);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
$argument = escapeshellarg($argument);
|
73
|
+
$argument = $applyMapping($argument);
|
68
74
|
}
|
69
75
|
|
70
|
-
// Get
|
71
|
-
$
|
72
|
-
|
73
|
-
|
76
|
+
// Get allowed environment variables
|
77
|
+
$allowedEnv = array('XDEBUG_CONFIG', 'IDE_PHPUNIT_CUSTOM_LOADER', 'IDE_PHPUNIT_PHPUNIT_PHAR', 'IDE_PHPUNIT_PHPUNIT_INCLUDE');
|
78
|
+
$env = array();
|
79
|
+
foreach ($_SERVER as $name => $value) {
|
80
|
+
if (in_array($name, $allowedEnv)) {
|
81
|
+
$env[] = $name . '=' . $applyMapping($value);
|
82
|
+
}
|
74
83
|
}
|
75
84
|
|
76
85
|
$includePaths = array('.', $projectDirGuest . '/vendor/phpunit/phpunit');
|
77
86
|
$arguments = array_merge(array('-d', 'include_path=' . implode(':', $includePaths)), $arguments);
|
78
87
|
|
79
|
-
passthru($pipe . escapeshellarg($commandPrefix. ' ' . $env . ' php ' . implode(' ', $arguments)));
|
88
|
+
passthru($pipe . escapeshellarg($commandPrefix. ' ' . implode(' ', $env) . ' php ' . implode(' ', $arguments)));
|
80
89
|
|
81
90
|
// Copy output files to their location, adapt paths
|
82
|
-
foreach($coverageFileList as $filePath => $hostPath) {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
91
|
+
foreach ($coverageFileList as $filePath => $hostPath) {
|
92
|
+
if (!file_exists($hostPath)) {
|
93
|
+
@unlink($filePath);
|
94
|
+
} else {
|
95
|
+
$contents = file_get_contents($hostPath);
|
96
|
+
$contents = str_replace($projectDirGuest, $projectDirHost, $contents);
|
97
|
+
file_put_contents($filePath, $contents);
|
98
|
+
}
|
90
99
|
}
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-phpstorm-tunnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cargo Media
|
8
8
|
- kris-lab
|
9
9
|
- njam
|
10
10
|
- fauvel
|
11
|
+
- alexispeter
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date: 2014-
|
15
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: rake
|
@@ -60,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
version: '0'
|
61
62
|
requirements: []
|
62
63
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
64
|
+
rubygems_version: 2.3.0
|
64
65
|
signing_key:
|
65
66
|
specification_version: 4
|
66
67
|
summary: Proxy php-calls from PhpStorm to Vagrant
|