vagrant-rdp 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +11 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/vagrant-rdp/command.rb +85 -0
- data/lib/vagrant-rdp/plugin.rb +20 -0
- data/lib/vagrant-rdp/version.rb +5 -0
- data/lib/vagrant-rdp.rb +3 -0
- data/vagrant-rdp.gemspec +23 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 28dd031fa9521bd50309671eb41e210560509eb4
|
4
|
+
data.tar.gz: 88915a79879607ad35686a3b0ec44ccafa4824d9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fe0c2178b4f2d6d6a9f0ce9c132d6cae35e11fa47f48bc6719089ee019df9eecd2ef44c76c4af07de57dea8666f049b31e4862488ab2198ce01c2bb54230345e
|
7
|
+
data.tar.gz: 025f31192ebbfa91c45a7ae1814ad762d6d0bdfd93ccadffd865e935e0e29ff11bb5024acbbb88466b932009ec3bbbda3ad09860a60982514579150a3e10b801
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in vagrant-rdp.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
# We depend on Vagrant for development, but we don't add it as a
|
8
|
+
# gem dependency because we expect to be installed within the
|
9
|
+
# Vagrant environment itself using `vagrant plugin`.
|
10
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
|
11
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Toru Nayuki
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Vagrant::Rdp
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'vagrant-rdp'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install vagrant-rdp
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/vagrant-rdp/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module RDP
|
6
|
+
class Command < Vagrant.plugin(2, :command)
|
7
|
+
def execute
|
8
|
+
opts = OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: vagrant rdp [vm-name...]"
|
10
|
+
|
11
|
+
opts.separator ""
|
12
|
+
end
|
13
|
+
|
14
|
+
argv = parse_options(opts)
|
15
|
+
return -1 if !argv
|
16
|
+
|
17
|
+
with_target_vms(argv) do |vm|
|
18
|
+
@logger.info("Launching remote desktop session to: #{vm.name}")
|
19
|
+
rdp_connect(vm)
|
20
|
+
end
|
21
|
+
|
22
|
+
return 0
|
23
|
+
end
|
24
|
+
|
25
|
+
def rdp_connect(vm)
|
26
|
+
rdpport = nil
|
27
|
+
vm.provider.driver.read_forwarded_ports.each do |_, _, hostport, guestport|
|
28
|
+
rdpport = hostport if guestport == 3389
|
29
|
+
end
|
30
|
+
|
31
|
+
Tempfile.open('vagrant-rdp-shell-') do |tf|
|
32
|
+
rdp_file = rdp_file(vm, rdpport)
|
33
|
+
|
34
|
+
tf.puts <<EOS
|
35
|
+
open -W -a "/Applications/Microsoft Remote Desktop.app/Contents/MacOS/Microsoft Remote Desktop" "#{rdp_file}"
|
36
|
+
sleep 5 #HACK
|
37
|
+
rm "#{rdp_file}"
|
38
|
+
EOS
|
39
|
+
tf.close
|
40
|
+
|
41
|
+
# Spawn remote desktop and detach it so we can move on.
|
42
|
+
pid = spawn("/bin/bash", tf.path)
|
43
|
+
Process.detach(pid)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def rdp_file(vm, rdpport)
|
48
|
+
path = nil
|
49
|
+
|
50
|
+
Tempfile.open([ "vagrant-rdp-", ".rdp" ], vm.data_dir) { |fp|
|
51
|
+
path = fp.path
|
52
|
+
fp.unlink
|
53
|
+
}
|
54
|
+
|
55
|
+
File.open(path, "w") { |io|
|
56
|
+
io.puts <<EOF
|
57
|
+
screen mode id:i:0
|
58
|
+
desktopwidth:i:1024
|
59
|
+
desktopheight:i:768
|
60
|
+
use multimon:i:1
|
61
|
+
session bpp:i:32
|
62
|
+
full address:s:localhost:#{rdpport}
|
63
|
+
audiomode:i:0
|
64
|
+
disable wallpaper:i:0
|
65
|
+
disable full window drag:i:0
|
66
|
+
disable menu anims:i:0
|
67
|
+
disable themes:i:0
|
68
|
+
alternate shell:s:
|
69
|
+
shell working directory:s:
|
70
|
+
authentication level:i:2
|
71
|
+
connect to console:i:0
|
72
|
+
gatewayusagemethod:i:0
|
73
|
+
disable cursor setting:i:0
|
74
|
+
allow font smoothing:i:1
|
75
|
+
allow desktop composition:i:1
|
76
|
+
bookmarktype:i:3
|
77
|
+
use redirection server name:i:0
|
78
|
+
EOF
|
79
|
+
}
|
80
|
+
|
81
|
+
path
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant AWS plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module RDP
|
9
|
+
class Plugin < Vagrant.plugin("2")
|
10
|
+
name "RDP"
|
11
|
+
description <<-DESC
|
12
|
+
With this plugin, you can connect to windows VM by remote desktop connection.
|
13
|
+
DESC
|
14
|
+
|
15
|
+
command "rdp" do
|
16
|
+
Command
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/vagrant-rdp.rb
ADDED
data/vagrant-rdp.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-rdp/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-rdp"
|
8
|
+
spec.version = VagrantPlugins::RDP::VERSION
|
9
|
+
spec.authors = ["Toru Nayuki"]
|
10
|
+
spec.email = ["tnayuki@icloud.com"]
|
11
|
+
spec.summary = %q{With this plugin, you can connect to windows VM by remote desktop connection.}
|
12
|
+
spec.description = %q{With this plugin, you can connect to windows VM by remote desktop connection.}
|
13
|
+
spec.homepage = "https://github.com/tnayuki/vagrant-rdp"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-rdp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Toru Nayuki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: With this plugin, you can connect to windows VM by remote desktop connection.
|
42
|
+
email:
|
43
|
+
- tnayuki@icloud.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/vagrant-rdp.rb
|
54
|
+
- lib/vagrant-rdp/command.rb
|
55
|
+
- lib/vagrant-rdp/plugin.rb
|
56
|
+
- lib/vagrant-rdp/version.rb
|
57
|
+
- vagrant-rdp.gemspec
|
58
|
+
homepage: https://github.com/tnayuki/vagrant-rdp
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.14
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: With this plugin, you can connect to windows VM by remote desktop connection.
|
82
|
+
test_files: []
|