ttlauto 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7415deb117b96d2e9e83420ad5e0a8fe86d8016
4
+ data.tar.gz: c6dad5995da82d71e0936a7d5679cd786dcc3dcc
5
+ SHA512:
6
+ metadata.gz: ecb5ce27626a9164a03a2a86d25023cbc296da59947356687b529d230c6c0ed7727b937246b0738a08d9fd539d72673d849d6618949316c2d1c6db80fd0f99c1
7
+ data.tar.gz: 3663c29c1af0cd41fea1f90b5224eb88f0980fd4e47f332a68ae1770ca54092a62af314bed06b7d39f536b5dbe12465c223d1981b809f35f0a722273ba9cf435
data/.gitignore ADDED
@@ -0,0 +1,52 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ =======
16
+ *.gem
17
+ *.rbc
18
+ /.config
19
+ /coverage/
20
+ /InstalledFiles
21
+ /pkg/
22
+ /spec/reports/
23
+ /test/tmp/
24
+ /test/version_tmp/
25
+ /tmp/
26
+
27
+ ## Specific to RubyMotion:
28
+ .dat*
29
+ .repl_history
30
+ build/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalisation:
39
+ /.bundle/
40
+ /lib/bundler/man/
41
+
42
+ # for a library or gem, you might want to ignore these files since the code is
43
+ # intended to run in multiple environments; otherwise, check them in:
44
+ # Gemfile.lock
45
+ # .ruby-version
46
+ # .ruby-gemset
47
+
48
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
49
+ .rvmrc
50
+
51
+ *~
52
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ttl_auto.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 hilolih
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 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,
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 THE
21
+ SOFTWARE.
22
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 hiroshi shimoda
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,74 @@
1
+ # ttlauto
2
+ make teraterm macro automatically with configuration file(yaml).
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'ttlauto'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install ttlauto
19
+
20
+ ## Usage
21
+
22
+ you write server definitions into yaml file.
23
+
24
+ ```yaml
25
+ - name: server_name
26
+ category: servers_genre/sub_genre
27
+ description: this server is ...
28
+ define:
29
+ - method: new
30
+ server: 192.168.1.12
31
+ user: username
32
+ pass: password
33
+ encoding: UTF-8
34
+ protocol: telnet
35
+ prompt: '>'
36
+ command:
37
+ - bash
38
+ - alias ls='#39'ls --colors -F'#39'
39
+ - call_templates: for_solaris
40
+ - cd /opt
41
+ ```
42
+
43
+ Also, you write command macros into yaml file if you need.
44
+ ```yaml
45
+ - name: for_solaris
46
+ type: command_macro
47
+ commands:
48
+ - export HISTCONTROL=ignoreboth
49
+ - set -o vi
50
+ - alias vi='#39'vi -u NONE -N "+set incsearch" "+set hlsearch" "+syntax on"'#39'
51
+ - alias grep=ggrep
52
+ - alias tail=gtail
53
+ ```
54
+
55
+ And then, build teraterm macro files.
56
+
57
+ ```ruby
58
+ gem "ttl_auto"
59
+
60
+ TtlAuto::Exe.new(open("servers.yml"), open("macros.yml")).run
61
+
62
+ # output teraterm macro named by
63
+ # out/servers_genre/sub_genre/server_name.ttl in case of yaml file
64
+
65
+ servers.out!
66
+
67
+ ```
68
+ ## Contributing
69
+
70
+ 1. Fork it ( https://github.com/hilolih/ttl_auto/fork )
71
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
72
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
73
+ 4. Push to the branch (`git push origin my-new-feature`)
74
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
data/lib/ttlauto.rb ADDED
@@ -0,0 +1,13 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'optparse'
3
+ module TtlAuto
4
+ end
5
+ require 'ttlauto/log'
6
+ require 'ttlauto/constant.rb'
7
+ require 'ttlauto/record.rb'
8
+ require 'ttlauto/exe.rb'
9
+ require 'ttlauto/ttl.rb'
10
+ require 'ttlauto/csvread'
11
+ require 'ttlauto/yamlread'
12
+ require 'ttlauto/ping'
13
+
@@ -0,0 +1,8 @@
1
+ module TtlAuto
2
+ module Constant
3
+ dir = File.dirname( File.dirname( File.dirname(__FILE__) ) )
4
+ OUT = "./out"
5
+ PEM = "lib/pem"
6
+ TEMPLATE = "#{dir}/templates/utf8/template.ttl"
7
+ end
8
+ end
@@ -0,0 +1,33 @@
1
+ require 'csv'
2
+ module TtlAuto
3
+ class Csv
4
+ attr_reader :servers, :categories
5
+ def read file
6
+ @servers = []
7
+ CSV.open( file, "r" ){ |csv|
8
+ csv.each do |row|
9
+ ttl = TtlAuto::TTL.new
10
+ ttl.filename = "#{row[0].strip}.ttl"
11
+ ttl.dataname = "#{row[0].strip}.dat"
12
+ ttl.server = row[1].strip
13
+ ttl.user = row[2].strip
14
+ ttl.pass = row[3].strip
15
+ ttl.encoding = row[4].strip
16
+ ttl.protocol = row[5].strip
17
+ ttl.category = row[6].strip
18
+ ttl.rootpass = row[7] ? row[7].strip : ""
19
+
20
+ @servers << ttl
21
+ end
22
+ }
23
+ end
24
+
25
+ def set_categories
26
+ @categories = {}
27
+ @servers.each do |srv|
28
+ @categories[srv.category] ||= []
29
+ @categories[srv.category] << srv
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,66 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module TtlAuto
3
+ class Exe
4
+ include Constant
5
+ include TtlAuto::Log
6
+ attr_reader :yaml, :command_templates
7
+ def initialize file, templates=nil
8
+ @yaml = TtlAuto::Yaml.new
9
+ @yaml.read file
10
+ @yaml.set_categories
11
+ unless templates.nil?
12
+ yml = TtlAuto::Yaml.new
13
+ @command_templates = yml.read templates
14
+ end
15
+ end
16
+
17
+ def run
18
+ @yaml.records.each do |record|
19
+ run_each_parents record
20
+ end
21
+ end
22
+
23
+ def ping
24
+ return_code = 0
25
+ server_list.each do |server|
26
+ tcp = TtlAuto::Ping.new( server )
27
+ if tcp.scan?
28
+ log_info "#{server[:server]}:#{server[:port]} is enable to connect"
29
+ else
30
+ log_error "!!! #{server[:server]}:#{server[:port]} is NOT enable to connect !!!"
31
+ return_code = 1
32
+ end
33
+ end
34
+ return_code
35
+ end
36
+
37
+ private
38
+
39
+ def server_list
40
+ list = []
41
+ @yaml.records.each do |record|
42
+ list << record['define'].map{|hash| {server: hash['server'],
43
+ port: hash['protocol'],
44
+ ping: (hash['ping'].nil? ? true : hash['ping'])
45
+ } }
46
+ end
47
+ list.flatten!.uniq!
48
+ list.select{|item| item[:ping] }
49
+ end
50
+
51
+ def run_each_parents record
52
+ @command_templates ||= {}
53
+ parents( record['category'] ).each do |v|
54
+ Ttl.new( record, v, @command_templates ).bind
55
+ end
56
+ end
57
+
58
+ def parents obj
59
+ if obj.class == Array
60
+ obj
61
+ else
62
+ [ obj ]
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'logger'
3
+ module TtlAuto::Log
4
+ LOG = Logger.new(STDOUT)
5
+ LOG.level = Logger::INFO
6
+ def log_info(str)
7
+ LOG.info(str)
8
+ end
9
+ def log_error(str)
10
+ LOG.error(str)
11
+ end
12
+ def log_debug(str)
13
+ LOG.debug(str)
14
+ end
15
+ end
16
+
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'net/ping'
3
+ module TtlAuto
4
+ class Ping
5
+ include Constant
6
+
7
+ def initialize hash
8
+ @host = hash[:server]
9
+ @port = hash[:port]
10
+ end
11
+
12
+ def scan?
13
+ tcp = Net::Ping::TCP.new(@host, @port)
14
+ tcp.ping?
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,75 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module TtlAuto
3
+ class Record
4
+ include Constant
5
+ include TtlAuto::Log
6
+ attr_reader :body, :defines
7
+ def initialize record
8
+ @body = record
9
+ @defines = record['define']
10
+ end
11
+
12
+ def description
13
+ parse_description @body['description']
14
+ end
15
+
16
+ def replace_macro templates
17
+ templates.each do |tmpl|
18
+ if tmpl['type'] == "command_macro"
19
+ target = {"call_templates" => tmpl['name']}
20
+ @body = replace_iter @body, target, tmpl["commands"]
21
+ end
22
+ end
23
+ end
24
+
25
+ def keyfile?
26
+ @body['define'].any?{|d| d['publickey']}
27
+ end
28
+
29
+ def set_keyfile_path
30
+ @body['define'].each do |d|
31
+ if d['publickey']
32
+ pem = "#{PEM}/#{File.basename(d['publickey'])}"
33
+ d['publickey'] = depth.times.reduce(pem){|n| File.join('../', n)}
34
+ log_info d['publickey']
35
+ end
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def depth
42
+ @body['category'].count('/') + 1
43
+ end
44
+
45
+ def replace_iter obj, target, replace
46
+ if obj.class == Array
47
+ if obj.include?( target )
48
+ return obj.map{|el|
49
+ if el == target
50
+ replace
51
+ else
52
+ replace_iter el, target, replace
53
+ end
54
+ }.flatten
55
+ else
56
+ return obj.map{|el| replace_iter el, target, replace }
57
+ end
58
+ elsif obj.class == Hash
59
+ return Hash[obj.map{|k, v| [k, replace_iter(v , target, replace)] }]
60
+ else
61
+ return obj
62
+ end
63
+ end
64
+
65
+ def parse_description obj
66
+ if obj.class == Array
67
+ obj.join("\n; ")
68
+ else
69
+ obj
70
+ end
71
+ end
72
+
73
+ end
74
+ end
75
+
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'erb'
3
+ module TtlAuto
4
+ class Ttl
5
+ include Constant
6
+ include TtlAuto::Log
7
+ attr_reader :path, :record
8
+
9
+ def initialize record, category, cmd_templates={}
10
+ @path = "#{OUT}/#{category}"
11
+ @record = record
12
+ @cmd_templates = cmd_templates
13
+ end
14
+
15
+ def bind
16
+ rd = TtlAuto::Record.new(@record)
17
+ log_debug "#{@path}/#{record['name']}.ttl"
18
+ unless @cmd_templates.empty?
19
+ rd.replace_macro @cmd_templates
20
+ end
21
+ # set valid public keyfile path
22
+ if rd.keyfile?
23
+ rd.set_keyfile_path
24
+ end
25
+ record = rd.body
26
+ description = rd.description
27
+ FileUtils.mkdir_p @path unless File.exists?(@path)
28
+ open( "#{@path}/#{record['name']}.ttl", "w:windows-31j"){|f|
29
+ f.puts ERB.new(IO.read(TEMPLATE), nil, '-').result(binding)
30
+ }
31
+ end
32
+
33
+ private
34
+
35
+ def timestamp
36
+ Time.now.strftime('%Y/%m/%d %H:%M:%S')
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module TtlAuto
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ require 'psych'
2
+ module TtlAuto
3
+ class Yaml
4
+ attr_reader :records, :categories
5
+ def read file
6
+ str = file.read
7
+ ast = Psych.parse str
8
+ @records = ast.to_ruby
9
+ #@records = YAML.load(str)
10
+ end
11
+
12
+ def set_categories
13
+ @categories = {}
14
+ @records.each do | record |
15
+ @categories[record["category"]] ||= []
16
+ @categories[record["category"]] << record
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'ttl_auto'
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe TtlAuto do
4
+ it 'has a version number' do
5
+ expect(TtlAuto::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,172 @@
1
+ ; ----------------------------------------------------------------
2
+ ; teraterm マクロ by ttl_auto
3
+ ;
4
+ ; 作成日時 : <%=timestamp%>
5
+ ;
6
+ ; Hiroshi Shimoda
7
+ ;
8
+ ;
9
+ ; ※ このマクロは自動生成されています。
10
+ ;
11
+ ; name : <%=record['category']%>/<%=record['name']%>.ttl
12
+ ; memo : <%=description%>
13
+ ;
14
+ ;
15
+ ; ----------------------------------------------------------------
16
+ script_dir = ''
17
+ getdir script_dir
18
+ setdir script_dir
19
+ makepath _Ini script_dir 'macro_term.ini'
20
+ <%# yesno %>
21
+ <%- if record['yesno'] -%>
22
+ yesnobox '<%=record['yesno']['message']%>' '<%=record['yesno']['title']%>'
23
+ if result goto yes
24
+ end
25
+ :yes
26
+ <%- end -%>
27
+ <%# サーバごとの処理をまわす %>
28
+ <%- record['define'].each_with_index do |d,i| -%>
29
+ <%- if ( d['method'] == "new" and i.to_i > 0 )-%>
30
+ unlink
31
+ <%- end -%>
32
+ ; ----------------------------------------------
33
+ ; サーバ情報 no.<%=i+1%>
34
+ ;
35
+ ; server : <%=d['server']%>
36
+ ; user : <%=d['user']%>
37
+ ; pass : <%=d['pass']%>
38
+ ; encoding : <%=d['encoding']%>
39
+ ; protocol : <%=d['protocol']%>
40
+ ; memo : <%=d['memo']%>
41
+ ; command : <%=d['command'] && d["command"].join("\n; ")%>
42
+ ; method : <%=d['method'] %>
43
+ ;
44
+ ; ----------------------------------------------
45
+ _logprompt = ':'
46
+ <%# -----------------------------------------------------%>
47
+ <% if d['method'] == "new" -%>
48
+ _server = '<%=d['server']%>'
49
+ <%- case d['protocol']
50
+ when "telnet" then -%>
51
+ ; telnet接続
52
+ strconcat _server ':23 /nossh'
53
+ strconcat _server ' /KR='
54
+ strconcat _server '<%=d['encoding']%>'
55
+ strconcat _server ' /KT='
56
+ strconcat _server '<%=d['encoding']%>'
57
+ <%- if d['ini'] -%>
58
+ strconcat _server ' /F='
59
+ makepath _Ini script_dir '<%=d['ini']%>'
60
+ strconcat _server _Ini
61
+ <%- end -%>
62
+ ; サーバへ接続
63
+ connect _server
64
+ <%- if d['user'] -%>
65
+ wait _logprompt
66
+ sendln '<%=d["user"]%>'
67
+ <%- else -%>
68
+ ; --- ネットワーク機器等のため、ユーザーはありません ---
69
+ <%- end -%>
70
+ wait _logprompt
71
+ sendln '<%=d["pass"]%>'
72
+ <%- when "ssh" then -%>
73
+ ; ssh接続
74
+ strconcat _server ':22 /ssh'
75
+ <%- if d['publickey'] -%>
76
+ makepath _keyfile script_dir '<%=d['publickey']%>'
77
+ strconcat _server ' /auth=publickey'
78
+ strconcat _server ' /keyfile='
79
+ strconcat _server _keyfile
80
+ <%- else -%>
81
+ strconcat _server ' /auth=password'
82
+ strconcat _server ' /passwd='
83
+ strconcat _server '<%=d['pass']%>'
84
+ <%- end -%>
85
+ strconcat _server ' /user='
86
+ strconcat _server '<%=d['user']%>'
87
+ strconcat _server ' /KR='
88
+ strconcat _server '<%=d['encoding']%>'
89
+ strconcat _server ' /KT='
90
+ strconcat _server '<%=d['encoding']%>'
91
+ ; サーバへ接続
92
+ connect _server
93
+ <%- end -%>
94
+ <%# ----------------------------------------------------- %>
95
+ <%- else -%>
96
+ wait _prompt
97
+ sendln 'telnet <%=d['server']%>'
98
+ <%-if d['user']-%>
99
+ wait _logprompt
100
+ sendln '<%=d["user"]%>'
101
+ <%-else-%>
102
+ ; --- ネットワーク機器等のため、ユーザーはありません ---
103
+ <%-end-%>
104
+ wait _logprompt
105
+ sendln '<%=d["pass"]%>'
106
+ <%- end -%>
107
+ <%# ----------------------------------------------------- -%>
108
+ <%# プロンプト設定。rootpassがあればroot取得 %>
109
+ <%- if d['prompt'] -%>
110
+ _prompt = '<%=d['prompt']%>'
111
+ <%- else -%>
112
+ _prompt = '$'
113
+ <%- end -%>
114
+ <%- if d['rootpass'] -%>
115
+ wait _prompt
116
+ <%- if d['su'] -%>
117
+ sendln '<%= d['su'] -%>'
118
+ <%- else -%>
119
+ sendln 'su -'
120
+ <%- end -%>
121
+ wait _logprompt
122
+ sendln '<%= d['rootpass'] -%>'
123
+ <%- if d['rootprompt'] -%>
124
+ _prompt = '<%=d['rootprompt']%>'
125
+ <%- else -%>
126
+ _prompt = '#'
127
+ <%- end -%>
128
+ <%- end -%>
129
+ <%-# ----------------------------------------------------- -%>
130
+ <%-# 各サーバでのコマンド処理(プロトコルによらず共通)-%>
131
+ <%- if d['command'] -%>
132
+ <%- d['command'].each do |cmd| -%>
133
+ <%- if cmd.class == Hash -%>
134
+ <%-# ----------------------------------------------------- -%>
135
+ <%-# 繰り返し処理 -%>
136
+ <%- if cmd.has_key?("do") -%>
137
+
138
+ do
139
+ <%- cmd["do"].each do |do_cmd| -%>
140
+ <%- if do_cmd.class == Hash -%>
141
+ <%- do_cmd.each_pair do |k, v| -%>
142
+ <%= k %> <%= v %>
143
+ <%- end -%>
144
+ <%- else -%>
145
+ <%-# 通常コマンド -%>
146
+ wait _prompt
147
+ sendln ' <%=do_cmd%>'
148
+ <%- end -%>
149
+ <%- end -%>
150
+ loop
151
+ <%-# ----------------------------------------------------- -%>
152
+ <%-# プロンプトの変更 -%>
153
+ <%- elsif cmd.has_key?("prompt") -%>
154
+ _prompt = '<%=cmd['prompt']%>'
155
+ <%-# ----------------------------------------------------- -%>
156
+ <%- else -%>
157
+ <%- cmd.each_pair do |k, v| -%>
158
+ <%= k %> <%= v %>
159
+ <%- end -%>
160
+ <%- end -%>
161
+ <%- else -%>
162
+ <%# 通常コマンド %>
163
+ wait _prompt
164
+ sendln ' <%=cmd%>'
165
+ <%- end -%>
166
+ <%- end -%>
167
+ <%- end -%>
168
+ <%- end -%>
169
+ ; マクロとウィンドウを切り離す
170
+ unlink
171
+ end
172
+
data/ttl_auto.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ttlauto/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ttlauto"
8
+ spec.version = TtlAuto::VERSION
9
+ spec.authors = ["hiroshi shimoda"]
10
+ spec.email = ["hilolih@gmail.com"]
11
+ spec.summary = %q{automatically teraterm macros}
12
+ spec.description = %q{make teraterm macros automatically with configuration file(yaml).}
13
+ spec.homepage = "https://github.com/hilolih/ttlauto"
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_dependency "net-ping"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec"
26
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ttlauto
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - hiroshi shimoda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: net-ping
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: make teraterm macros automatically with configuration file(yaml).
70
+ email:
71
+ - hilolih@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - lib/ttlauto.rb
85
+ - lib/ttlauto/constant.rb
86
+ - lib/ttlauto/csvread.rb
87
+ - lib/ttlauto/exe.rb
88
+ - lib/ttlauto/log.rb
89
+ - lib/ttlauto/ping.rb
90
+ - lib/ttlauto/record.rb
91
+ - lib/ttlauto/ttl.rb
92
+ - lib/ttlauto/version.rb
93
+ - lib/ttlauto/yamlread.rb
94
+ - spec/spec_helper.rb
95
+ - spec/ttl_auto_spec.rb
96
+ - templates/utf8/template.ttl
97
+ - ttl_auto.gemspec
98
+ homepage: https://github.com/hilolih/ttlauto
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.0.14
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: automatically teraterm macros
122
+ test_files:
123
+ - spec/spec_helper.rb
124
+ - spec/ttl_auto_spec.rb
125
+ has_rdoc: