vagrant-phpstorm-tunnel 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vagrant-phpstorm-tunnel.iml +27 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +9 -0
- data/README.md +4 -0
- data/Rakefile +2 -0
- data/Vagrantfile +6 -0
- data/data/php +70 -0
- data/lib/vagrant-phpstorm-tunnel.rb +15 -0
- data/lib/vagrant-phpstorm-tunnel/configurator.rb +27 -0
- data/lib/vagrant-phpstorm-tunnel/version.rb +5 -0
- data/vagrant-phpstorm-tunnel.gemspec +17 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 12b90f7d5d324117f7ae398e5500ca82019bb7ce
|
4
|
+
data.tar.gz: 8df3b412b493ed3bbd6fd0445a4c6759e22cd71a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 132bf45528bae8f0cc7790b8089d587739d4f4678be0c21595af365f06221ef1b46a1706162e149a9103fef54674c36dccf6d83efa804a93d00c3d023720e733
|
7
|
+
data.tar.gz: 23d365163b375eba18abb270624ff2814b7f7beb9de4a2ea2e9cb0c9b6ee04312ebd957859ec7bce1609dbf793e590a1a96cfe9602d6089a3df31b9d6facc76b
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/vagrant-phpstorm-tunnel.iml" filepath="$PROJECT_DIR$/.idea/vagrant-phpstorm-tunnel.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager">
|
13
|
+
<content url="file://$MODULE_DIR$" />
|
14
|
+
<orderEntry type="inheritedJdk" />
|
15
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.3, ruby-2.0.0-p247) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="childprocess (v0.3.9, ruby-2.0.0-p247) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, ruby-2.0.0-p247) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.3, ruby-2.0.0-p247) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.9, ruby-2.0.0-p247) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="log4r (v1.1.10, ruby-2.0.0-p247) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="net-scp (v1.1.2, ruby-2.0.0-p247) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="net-ssh (v2.7.0, ruby-2.0.0-p247) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="vagrant (v1.4.3@4f0eb9, ruby-2.0.0-p247) [gem]" level="application" />
|
25
|
+
</component>
|
26
|
+
</module>
|
27
|
+
|
data/.idea/vcs.xml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gemspec
|
3
|
+
|
4
|
+
group :development do
|
5
|
+
# We depend on Vagrant for development, but we don't add it as a
|
6
|
+
# gem dependency because we expect to be installed within the
|
7
|
+
# Vagrant environment itself using `vagrant plugin`.
|
8
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :ref => "v1.4.3"
|
9
|
+
end
|
data/README.md
ADDED
data/Rakefile
ADDED
data/Vagrantfile
ADDED
data/data/php
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env php
|
2
|
+
<?php
|
3
|
+
|
4
|
+
$scriptDir = __DIR__;
|
5
|
+
|
6
|
+
$projectDir = '';
|
7
|
+
$projectTmpDir = '/tmp';
|
8
|
+
|
9
|
+
$vagrantDir = '/vagrant';
|
10
|
+
$vagrantIp = '10.10.10.1';
|
11
|
+
|
12
|
+
$pathCrumbs = explode('/', $scriptDir);
|
13
|
+
while(count($pathCrumbs)) {
|
14
|
+
$_path = implode('/', $pathCrumbs);
|
15
|
+
if(is_dir($_path . '/.idea')) {
|
16
|
+
$projectDir = $_path;
|
17
|
+
break;
|
18
|
+
}
|
19
|
+
array_pop($pathCrumbs);
|
20
|
+
}
|
21
|
+
|
22
|
+
if (empty($projectDir)) {
|
23
|
+
echo "Cannot detect project dir!";
|
24
|
+
exit;
|
25
|
+
}
|
26
|
+
|
27
|
+
$args = $_SERVER['argv'];
|
28
|
+
foreach ($args as $index => &$arg) {
|
29
|
+
|
30
|
+
// IP mapping
|
31
|
+
$arg = str_replace(array('127.0.0.1', 'localhost'), $vagrantIp, $arg);
|
32
|
+
|
33
|
+
// Paths mapping
|
34
|
+
$filePath = $arg;
|
35
|
+
if (file_exists($filePath)) {
|
36
|
+
if (strpos($filePath, $projectDir) !== false) {
|
37
|
+
// Mapping project paths to remote paths
|
38
|
+
$args[$index] = str_replace($projectDir, $vagrantDir, $filePath);
|
39
|
+
} else {
|
40
|
+
if (strpos($filePath, $projectDir) === false) {
|
41
|
+
// Mapping any other local system paths to remote paths, upload files
|
42
|
+
$basename = basename($filePath);
|
43
|
+
copy($filePath, $projectDir . $projectTmpDir . '/tunnel.' . $basename);
|
44
|
+
$args[$index] = $vagrantDir . $projectTmpDir . '/tunnel.' . $basename;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
$arg = escapeshellarg($arg);
|
50
|
+
}
|
51
|
+
array_shift($args);
|
52
|
+
|
53
|
+
// Get XDEBUG environment variable
|
54
|
+
$env = '';
|
55
|
+
if (isset($_SERVER['XDEBUG_CONFIG'])) {
|
56
|
+
$env = "XDEBUG_CONFIG='" . $_SERVER['XDEBUG_CONFIG'] . "'";
|
57
|
+
}
|
58
|
+
|
59
|
+
// Tunnel
|
60
|
+
$pipe = 'vagrant ssh -c ';
|
61
|
+
|
62
|
+
// Remote command
|
63
|
+
$commandRemote = $env . ' php ' . implode(' ', $args);
|
64
|
+
|
65
|
+
// Local command
|
66
|
+
$commandLocal = 'cd ' . $projectDir . ' && ' . $pipe . '"' . $commandRemote . '"';
|
67
|
+
passthru($commandLocal);
|
68
|
+
|
69
|
+
exit;
|
70
|
+
?>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'vagrant-phpstorm-tunnel/configurator'
|
2
|
+
|
3
|
+
module VagrantPhpStormTunnel
|
4
|
+
class Plugin < Vagrant.plugin("2")
|
5
|
+
|
6
|
+
name "vagrant-phpstorm-tunnel"
|
7
|
+
|
8
|
+
%w{up provision}.each do |action|
|
9
|
+
action_hook(:restart_host_dns, "machine_action_#{action}".to_sym) do |hook|
|
10
|
+
hook.append VagrantPhpStormTunnel::Configurator
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module VagrantPhpStormTunnel
|
4
|
+
class Configurator
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
@env = env
|
8
|
+
end
|
9
|
+
|
10
|
+
def link_php_to_phpstorm
|
11
|
+
destination_path = Dir.getwd + '/scripts/vagrant/php'
|
12
|
+
source_path = File.expand_path('../../../data/php', __FILE__)
|
13
|
+
|
14
|
+
if !File.exist? destination_path
|
15
|
+
FileUtils.mkdir_p(File.dirname(destination_path))
|
16
|
+
File.link(source_path, destination_path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def call(env)
|
21
|
+
@env = env
|
22
|
+
@app.call(env)
|
23
|
+
|
24
|
+
link_php_to_phpstorm
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../lib/vagrant-phpstorm-tunnel/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ['kris-lab for Cargomedia AG']
|
5
|
+
gem.email = 'hello@cargomedia.ch'
|
6
|
+
gem.description = 'Creates tunnel between PhpStorm and Vagrant machine to allow execute PHP via SSH'
|
7
|
+
gem.summary = 'PhpStorm-Vagrant tunnel'
|
8
|
+
gem.homepage = 'https://github.com/kris-lab/vagrant-phpstorm-tunnel'
|
9
|
+
|
10
|
+
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = 'vagrant-phpstorm-tunnel'
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = Vagrant::VagrantPhpStormTunnel::VERSION
|
16
|
+
gem.license = 'MIT'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-phpstorm-tunnel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kris-lab for Cargomedia AG
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Creates tunnel between PhpStorm and Vagrant machine to allow execute
|
14
|
+
PHP via SSH
|
15
|
+
email: hello@cargomedia.ch
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .idea/encodings.xml
|
21
|
+
- .idea/misc.xml
|
22
|
+
- .idea/modules.xml
|
23
|
+
- .idea/scopes/scope_settings.xml
|
24
|
+
- .idea/vagrant-phpstorm-tunnel.iml
|
25
|
+
- .idea/vcs.xml
|
26
|
+
- Gemfile
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- Vagrantfile
|
30
|
+
- data/php
|
31
|
+
- lib/vagrant-phpstorm-tunnel.rb
|
32
|
+
- lib/vagrant-phpstorm-tunnel/configurator.rb
|
33
|
+
- lib/vagrant-phpstorm-tunnel/version.rb
|
34
|
+
- vagrant-phpstorm-tunnel.gemspec
|
35
|
+
homepage: https://github.com/kris-lab/vagrant-phpstorm-tunnel
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.0.3
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: PhpStorm-Vagrant tunnel
|
59
|
+
test_files: []
|