vagrant-ttl 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem "rake"
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vagrant-ttl (0.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ rake (12.3.1)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (>= 1.0.0)
16
+ rake
17
+ vagrant-ttl!
18
+
19
+ BUNDLED WITH
20
+ 1.16.1
@@ -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.
@@ -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
+ ```
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ require 'bundler/setup'
4
+ Bundler::GemHelper.install_tasks
@@ -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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -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
@@ -0,0 +1,3 @@
1
+ module VagrantTtl
2
+ VERSION = "0.1.0"
3
+ end
@@ -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: []