vagrant-ttl 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +32 -0
- data/Rakefile +4 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/vagrant-ttl.rb +16 -0
- data/lib/vagrant-ttl/command/ttl.rb +64 -0
- data/lib/vagrant-ttl/version.rb +3 -0
- data/vagrant-ttl.gemspec +25 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ed1f778be7e89886c819868f829bea0ee679f9c805f698dd87db4f97eeaa19f9
|
4
|
+
data.tar.gz: 730a21a088fc18e5b37dcb04be583191ea6eb6ac52924b3550e472bcfa530420
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1da604c7d02bd4ceebf40d2facb6b389b6658c8e45368c46771673a3bdd142fbd08e17621d1a9a5cacea22bc24caec0071f2e4a2e904790066f756ea9b72c819
|
7
|
+
data.tar.gz: 1f62bd7dfb3113e51221ddd415b3b18bdbb9c88fed9fa3e6ea0fee2232fee95617407f720a93292819f8efb9d3a810f9e58ef57ab4a92b5ff6f18681438e8848
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 encry1024
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Vagrant TTL(TeraTermLanguage)
|
2
|
+
|
3
|
+
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE.txt)
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
```
|
8
|
+
$ git clone https://github.com/owlinux1000/vagrant-ttl
|
9
|
+
$ cd vagrant-ttl
|
10
|
+
$ bundle install
|
11
|
+
$ rake build
|
12
|
+
$ vagrant plugin install pkg/vagrant-ttl-X.X.X.gem
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
You can only use this command in ```VAGRANT_CWD``` and while the virtual machine is running up.
|
18
|
+
After you executed ```vagrant ttl```, can find the file named as *.ttl.
|
19
|
+
|
20
|
+
```
|
21
|
+
$ vagrant status
|
22
|
+
Current machine states:
|
23
|
+
|
24
|
+
default running (virtualbox)
|
25
|
+
|
26
|
+
The VM is running. To stop this VM, you can run `vagrant halt` to
|
27
|
+
shut it down forcefully, or you can run `vagrant suspend` to simply
|
28
|
+
suspend the virtual machine. In either case, to restart it again,
|
29
|
+
simply run `vagrant up`.
|
30
|
+
$ vagrant ttl
|
31
|
+
[ INFO ] Generating default.ttl
|
32
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vagrant-ttl"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/vagrant-ttl.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantTtl
|
4
|
+
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
|
7
|
+
name "vagrant-ttl"
|
8
|
+
description %q{Generate a TeraTerm macro from vagrant `ssh-config`}
|
9
|
+
|
10
|
+
command("ttl") do
|
11
|
+
require File.expand_path("../vagrant-ttl/command/ttl", __FILE__)
|
12
|
+
Command::CommandTtl
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
module VagrantTtl
|
5
|
+
|
6
|
+
module Command
|
7
|
+
|
8
|
+
class CommandTtl < Vagrant.plugin("2", :command)
|
9
|
+
|
10
|
+
def self.synopsis
|
11
|
+
%q{Generate a TeraTerm macro from `vagrant ssh-config`}
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
|
16
|
+
opts = OptionParser.new do |o|
|
17
|
+
o.banner = "Usage: vagrant ttl [machine-name]"
|
18
|
+
end
|
19
|
+
|
20
|
+
argv = parse_options(opts)
|
21
|
+
argv = ["default"] if !argv
|
22
|
+
|
23
|
+
ssh_info = nil
|
24
|
+
|
25
|
+
with_target_vms(argv) do |machine|
|
26
|
+
|
27
|
+
if machine.state.id == :poweroff
|
28
|
+
@env.ui.info("[ \e[31mError\e[0m ] #{machine.name} is poweroff. Please execute `vagrant up`")
|
29
|
+
next
|
30
|
+
end
|
31
|
+
|
32
|
+
ssh_info = machine.ssh_info
|
33
|
+
|
34
|
+
macro = <<"EOS"
|
35
|
+
username = '#{ssh_info[:username]}'
|
36
|
+
keyfile = '#{ssh_info[:private_key_path][0]}'
|
37
|
+
hostname = '#{ssh_info[:host]}'
|
38
|
+
msg = hostname
|
39
|
+
strconcat msg ':#{ssh_info[:port]} /ssh2 /auth=publickey /user='
|
40
|
+
strconcat msg username
|
41
|
+
strconcat msg ' /keyfile='
|
42
|
+
strconcat msg keyfile
|
43
|
+
connect msg
|
44
|
+
EOS
|
45
|
+
begin
|
46
|
+
File.open("#{machine.name}.ttl", "wb") do |fout|
|
47
|
+
fout.write(macro)
|
48
|
+
end
|
49
|
+
@env.ui.info("[ \e[32mINFO\e[0m ] Generating #{machine.name}.ttl")
|
50
|
+
rescue
|
51
|
+
@env.ui.info("[ \e[31mError \e[0m ] Generating #{machine.name}.ttl")
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
0
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/vagrant-ttl.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path("../lib/vagrant-ttl/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "vagrant-ttl"
|
6
|
+
s.version = VagrantTtl::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["chihiro hasegawa"]
|
9
|
+
s.email = ["mail@alicemcas.com"]
|
10
|
+
s.homepage = "http://github.com/owlinux1000/vagrant-ttl/"
|
11
|
+
s.summary = %q{Generate a TeraTerm macro from `vagrant ssh-config`}
|
12
|
+
s.description = %q{Generate a TeraTerm macro from `vagrant ssh-config`}
|
13
|
+
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
s.rubyforge_project = "vagrant-ttl"
|
16
|
+
|
17
|
+
# s.add_dependency "popen4", "~> 0.1.2"
|
18
|
+
# s.add_dependency "thor", "> 0.14"
|
19
|
+
|
20
|
+
s.add_development_dependency "bundler", ">= 1.0.0"
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
24
|
+
s.require_path = 'lib'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-ttl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- chihiro hasegawa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-29 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.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
description: Generate a TeraTerm macro from `vagrant ssh-config`
|
28
|
+
email:
|
29
|
+
- mail@alicemcas.com
|
30
|
+
executables:
|
31
|
+
- console
|
32
|
+
- setup
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- Gemfile
|
38
|
+
- Gemfile.lock
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- bin/console
|
43
|
+
- bin/setup
|
44
|
+
- lib/vagrant-ttl.rb
|
45
|
+
- lib/vagrant-ttl/command/ttl.rb
|
46
|
+
- lib/vagrant-ttl/version.rb
|
47
|
+
- vagrant-ttl.gemspec
|
48
|
+
homepage: http://github.com/owlinux1000/vagrant-ttl/
|
49
|
+
licenses: []
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.3.6
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project: vagrant-ttl
|
67
|
+
rubygems_version: 2.7.3
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Generate a TeraTerm macro from `vagrant ssh-config`
|
71
|
+
test_files: []
|