vagrant-teraterm 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +14 -0
- data/lib/vagrant-teraterm.rb +6 -0
- data/lib/vagrant-teraterm/command.rb +99 -0
- data/lib/vagrant-teraterm/config.rb +44 -0
- data/lib/vagrant-teraterm/plugin.rb +20 -0
- data/lib/vagrant-teraterm/version.rb +3 -0
- data/vagrant-teraterm.gemspec +23 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd73f11724bbdd4f0aedb70abd39dc208c51af22
|
4
|
+
data.tar.gz: e06c6a9fa54b0eab48f6bbe11156895b162dd3a1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 06cfc50f255ede920800fa9a4ccea248e46134eab192c3c9338515885496848833910d89773bef6a485d1781d50043d5a83bae9f0ddd7780e19a68e42e17f53f
|
7
|
+
data.tar.gz: 842073cec11faab4b16dfc64a8bd8b6dcf57e85f110fda99166964670a333183e8fc77db8f21688ba83f1f20c01fdaa5c22ca406c37b54811b31ab57d76eb0ef
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 IIBUN Toshiyuki
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Vagrant TeraTerm Plugin
|
2
|
+
|
3
|
+
This is a Vagrant plugin that enables to ssh into vm with TeraTerm.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
vagrant plugin install vagrant-teraterm
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```
|
14
|
+
vagrant teraterm
|
15
|
+
```
|
16
|
+
|
17
|
+
## Configuration
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
Vagrant.configure(2) do |config|
|
21
|
+
# ...
|
22
|
+
config.teraterm.exe_path = 'C:\Program Files (x86)\teraterm\ttermpro.exe'
|
23
|
+
config.teraterm.ini_path = "teraterm.ini"
|
24
|
+
config.teraterm.log_path = "teraterm.log"
|
25
|
+
config.teraterm.extra_args = "/ssh-v"
|
26
|
+
# ...
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
* ```exe_path``` A ttermpro.exe file path. We will find real path
|
31
|
+
* If set and executable, use it.
|
32
|
+
* If set and not executable, search in PATH.
|
33
|
+
* If not set, search "ttermpro.exe" in PATH.
|
34
|
+
* If not found in PATH, use 'C:\Program Files (x86)\teraterm\ttermpro.exe'
|
35
|
+
or 'C:\Program Files\teraterm\ttermpro.exe'
|
36
|
+
* ```ini_path``` TERATERM.INI file absolute path or relative path from current dir.
|
37
|
+
* ```log_path``` Log file absolute path or relative path from current dir.
|
38
|
+
* ```extra_args``` Extra arguments.
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
1. Fork it ( https://github.com/tiibun/vagrant-term/fork )
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create a new Pull Request
|
50
|
+
|
51
|
+
## Thanks
|
52
|
+
|
53
|
+
Vagrant ( https://github.com/https://github.com/mitchellh/vagrant )
|
54
|
+
vagrant-multi-putty ( https://github.com/nickryand/vagrant-multi-putty )
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
# Immediately sync all stdout so that tools like buildbot can
|
5
|
+
# immediately load in the output.
|
6
|
+
$stdout.sync = true
|
7
|
+
$stderr.sync = true
|
8
|
+
|
9
|
+
# Change to the directory of this file.
|
10
|
+
Dir.chdir(File.expand_path("../", __FILE__))
|
11
|
+
|
12
|
+
# This installs the tasks that help with gem creation and
|
13
|
+
# publishing.
|
14
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require('optparse')
|
2
|
+
require('pathname')
|
3
|
+
|
4
|
+
module VagrantTeraTerm
|
5
|
+
class Command < Vagrant.plugin(2, :command)
|
6
|
+
def self.synopsis
|
7
|
+
"connects to machine via SSH using TeraTerm"
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute
|
11
|
+
opts = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: vagrant teraterm [vm-name...]"
|
13
|
+
|
14
|
+
opts.separator ""
|
15
|
+
end
|
16
|
+
|
17
|
+
argv = parse_options(opts)
|
18
|
+
return -1 if !argv
|
19
|
+
|
20
|
+
with_target_vms(argv, single_target: true) do |vm|
|
21
|
+
@config = vm.config.teraterm
|
22
|
+
@logger.debug("config is #@config")
|
23
|
+
|
24
|
+
ssh_info = vm.ssh_info
|
25
|
+
@logger.debug("ssh_info is #{ssh_info}")
|
26
|
+
# If ssh_info is nil, the machine is not ready for ssh.
|
27
|
+
raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
|
28
|
+
|
29
|
+
exe_path = find_exe_path(@config.exe_path)
|
30
|
+
return -1 if !exe_path
|
31
|
+
|
32
|
+
commands = [
|
33
|
+
"\"#{exe_path}\"",
|
34
|
+
"#{ssh_info[:host]}",
|
35
|
+
"#{ssh_info[:port]}",
|
36
|
+
"/ssh",
|
37
|
+
"/2",
|
38
|
+
"/user=#{ssh_info[:username]}"
|
39
|
+
]
|
40
|
+
|
41
|
+
|
42
|
+
if ssh_info.include?(:password)
|
43
|
+
commands << "/passwd=#{ssh_info[:password]}"
|
44
|
+
commands << "/auth=password"
|
45
|
+
elsif ssh_info.include?(:private_key_path)
|
46
|
+
Array(ssh_info[:private_key_path]).each do |p|
|
47
|
+
commands << "/keyfile=#{File.expand_path(p)}"
|
48
|
+
end
|
49
|
+
commands << "/auth=publickey"
|
50
|
+
end
|
51
|
+
|
52
|
+
commands << "/ssh-A" if ssh_info[:forward_agent]
|
53
|
+
commands << "/ssh-X" if ssh_info[:forward_x11]
|
54
|
+
commands << "/f=#{absolute_winpath(@config.ini_path)}" if not @config.ini_path.nil?
|
55
|
+
commands << "/L=#{absolute_winpath(@config.log_path)}" if not @config.log_path.nil?
|
56
|
+
commands << @config.extra_args if not @config.extra_args.nil?
|
57
|
+
|
58
|
+
@logger.debug(commands)
|
59
|
+
do_process(commands)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def find_exe_path(path)
|
64
|
+
if not path.nil?
|
65
|
+
return path if File.executable?(path)
|
66
|
+
|
67
|
+
# search in PATH
|
68
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |p|
|
69
|
+
_p = Pathname(p) + path
|
70
|
+
return _p.to_s if _p.executable?
|
71
|
+
end
|
72
|
+
else
|
73
|
+
# search in PATH
|
74
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |p|
|
75
|
+
_p = Pathname(p) + 'ttermpro.exe'
|
76
|
+
return _p.to_s if _p.executable?
|
77
|
+
end
|
78
|
+
|
79
|
+
# Program Files
|
80
|
+
['C:\Program Files (x86)\teraterm\ttermpro.exe',
|
81
|
+
'C:\Program Files\teraterm\ttermpro.exe'].each do |p|
|
82
|
+
return p if File.executable?(p)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
@env.ui.error("File is not found or executable. => #{path}")
|
87
|
+
nil
|
88
|
+
end
|
89
|
+
|
90
|
+
def absolute_winpath(path)
|
91
|
+
File.expand_path(path).gsub(/\//, "\\")
|
92
|
+
end
|
93
|
+
|
94
|
+
def do_process(commands)
|
95
|
+
pid = spawn(commands.join(" "))
|
96
|
+
Process.detach(pid)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module VagrantTeraTerm
|
2
|
+
class Config < Vagrant.plugin(2, :config)
|
3
|
+
# Program file absolute path or command name if found in PATH.
|
4
|
+
# If value is undefined, search
|
5
|
+
# ttermpro.exe
|
6
|
+
# C:\Program Files (x86)\teraterm\ttermpro.exe
|
7
|
+
# C:\Program Files\teraterm\ttermpro.exe
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
attr_accessor :exe_path
|
11
|
+
|
12
|
+
# TERATERM.INI file absolute path or relative path.
|
13
|
+
# Default is nil
|
14
|
+
#
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :ini_path
|
17
|
+
|
18
|
+
# Log file absolute path or relative path.
|
19
|
+
# Default is nil
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :log_path
|
23
|
+
|
24
|
+
# Extra arguments.
|
25
|
+
# Default is nil.
|
26
|
+
#
|
27
|
+
# @return [String]
|
28
|
+
attr_accessor :extra_args
|
29
|
+
|
30
|
+
def initialize
|
31
|
+
@exe_path = UNSET_VALUE
|
32
|
+
@ini_path = UNSET_VALUE
|
33
|
+
@log_path = UNSET_VALUE
|
34
|
+
@extra_args = UNSET_VALUE
|
35
|
+
end
|
36
|
+
|
37
|
+
def finalize!
|
38
|
+
@exe_path = nil if @exe_path == UNSET_VALUE
|
39
|
+
@ini_path = nil if @ini_path == UNSET_VALUE
|
40
|
+
@log_path = nil if @log_path == UNSET_VALUE
|
41
|
+
@extra_args = nil if @extra_args == UNSET_VALUE
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantTeraTerm
|
4
|
+
class Plugin < Vagrant.plugin("2")
|
5
|
+
name "TeraTerm Plugin"
|
6
|
+
description <<-DESC
|
7
|
+
This plugin enables to ssh into vm using TeraTerm.
|
8
|
+
DESC
|
9
|
+
|
10
|
+
command "teraterm" do
|
11
|
+
require_relative "command"
|
12
|
+
Command
|
13
|
+
end
|
14
|
+
|
15
|
+
config "teraterm" do
|
16
|
+
require_relative "config"
|
17
|
+
Config
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -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-teraterm/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-teraterm"
|
8
|
+
spec.version = VagrantTeraTerm::VERSION
|
9
|
+
spec.authors = ["IIBUN Toshiyuki"]
|
10
|
+
spec.email = ["toshiyuki.iibun@gmail.com"]
|
11
|
+
spec.summary = "This plugin enables to ssh into vm using TeraTerm."
|
12
|
+
spec.description = "This plugin enables to ssh into vm using TeraTerm."
|
13
|
+
spec.homepage = ""
|
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.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-teraterm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- IIBUN Toshiyuki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-05 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: This plugin enables to ssh into vm using TeraTerm.
|
42
|
+
email:
|
43
|
+
- toshiyuki.iibun@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/vagrant-teraterm.rb
|
54
|
+
- lib/vagrant-teraterm/command.rb
|
55
|
+
- lib/vagrant-teraterm/config.rb
|
56
|
+
- lib/vagrant-teraterm/plugin.rb
|
57
|
+
- lib/vagrant-teraterm/version.rb
|
58
|
+
- vagrant-teraterm.gemspec
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.4.6
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: This plugin enables to ssh into vm using TeraTerm.
|
83
|
+
test_files: []
|