terminitor 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +10 -11
- data/README.md +3 -2
- data/lib/terminitor/cli.rb +1 -1
- data/lib/terminitor/cores/cmd_core/cmd_core.rb +9 -6
- data/lib/terminitor/cores/cmd_core/input.rb +2 -2
- data/lib/terminitor/version.rb +1 -1
- data/test/cli_test.rb +5 -1
- data/test/cores/cmd_core_test.rb +23 -0
- data/test/dsl_test.rb +13 -13
- metadata +48 -2
data/Gemfile.lock
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
terminitor (0.
|
5
|
-
github (~> 0.6.
|
6
|
-
rb-appscript
|
7
|
-
text-format (= 1.0.0)
|
8
|
-
text-hyphen (= 1.0.0)
|
4
|
+
terminitor (0.5.2)
|
5
|
+
github (~> 0.6.2)
|
6
|
+
rb-appscript (~> 0.6.1)
|
9
7
|
thor (~> 0.14.0)
|
10
8
|
|
11
9
|
GEM
|
@@ -13,19 +11,20 @@ GEM
|
|
13
11
|
specs:
|
14
12
|
configuration (1.2.0)
|
15
13
|
fakefs (0.3.1)
|
16
|
-
github (0.6.
|
14
|
+
github (0.6.2)
|
17
15
|
highline (~> 1.5.1)
|
18
|
-
|
16
|
+
json_pure (~> 1.5.1)
|
19
17
|
launchy (~> 0.3.7)
|
20
18
|
text-format (= 1.0.0)
|
19
|
+
text-hyphen (= 1.0.0)
|
21
20
|
highline (1.5.2)
|
22
|
-
|
21
|
+
json_pure (1.5.1)
|
23
22
|
launchy (0.3.7)
|
24
23
|
configuration (>= 0.0.5)
|
25
24
|
rake (>= 0.8.1)
|
26
25
|
rake (0.8.7)
|
27
|
-
rb-appscript (0.6.
|
28
|
-
riot (0.12.
|
26
|
+
rb-appscript (0.6.1)
|
27
|
+
riot (0.12.3)
|
29
28
|
rr
|
30
29
|
rr (1.0.2)
|
31
30
|
text-format (1.0.0)
|
@@ -39,6 +38,6 @@ PLATFORMS
|
|
39
38
|
DEPENDENCIES
|
40
39
|
bundler (~> 1.0.0)
|
41
40
|
fakefs
|
42
|
-
riot (~> 0.12.
|
41
|
+
riot (~> 0.12.3)
|
43
42
|
rr (~> 1.0.0)
|
44
43
|
terminitor!
|
data/README.md
CHANGED
@@ -370,8 +370,9 @@ Thanks to the following people for their contributions so far:
|
|
370
370
|
* Dave Perrett ([recurser](https://github.com/recurser)) for adding basic iTerm support.
|
371
371
|
* Ilkka Laukkanen ([ilkka](https://github.com/achiu/terminitor/commits/master?author=ilkka)) for Terminator core and other fixes
|
372
372
|
* Elia Schito ([elia](https://github.com/achiu/terminitor/commits/master?author=elia)) for patch to allow usage of "&" for background operations
|
373
|
-
* Dotan J. Nahum ([
|
374
|
-
* Kyriacos Souroullas ([
|
373
|
+
* Dotan J. Nahum ([jondot](https://github.com/jondot)) for adding windows(cmd.exe) support
|
374
|
+
* Kyriacos Souroullas ([kyriacos](https://github.com/kyriacos) For removing params to support generic commands
|
375
|
+
* Jerry Cheung ([jch](https://github.com/jch)) For adding ignore for emac backups
|
375
376
|
|
376
377
|
Acknowledgements
|
377
378
|
-----------------
|
data/lib/terminitor/cli.rb
CHANGED
@@ -29,7 +29,7 @@ module Terminitor
|
|
29
29
|
desc "list", "lists all terminitor scripts"
|
30
30
|
def list
|
31
31
|
say "Global scripts: \n"
|
32
|
-
Dir.glob("#{TERM_PATH}/*").each do |file|
|
32
|
+
Dir.glob("#{TERM_PATH}/*[^~]").each do |file|
|
33
33
|
say " * #{File.basename(file, '.term')} #{grab_comment_for_file(file)}"
|
34
34
|
end
|
35
35
|
end
|
@@ -17,16 +17,19 @@ module Terminitor
|
|
17
17
|
(options[:in] || current_window).send_command(cmd)
|
18
18
|
end
|
19
19
|
|
20
|
-
def open_tab(options =
|
21
|
-
create_window
|
20
|
+
def open_tab(options = {})
|
21
|
+
create_window options
|
22
22
|
end
|
23
23
|
|
24
|
-
def open_window(options =
|
25
|
-
create_window
|
24
|
+
def open_window(options = {})
|
25
|
+
create_window options
|
26
26
|
end
|
27
27
|
|
28
|
-
def create_window
|
29
|
-
WindowsConsole.new :name=>'cmd'
|
28
|
+
def create_window(options = {})
|
29
|
+
c = WindowsConsole.new :name=>'cmd'
|
30
|
+
c.send_command "title #{options[:name]}\n" if options[:name]
|
31
|
+
c.send_command "mode con: cols=#{options[:bounds][0]} lines=#{options[:bounds][1]}\n" if options[:bounds]
|
32
|
+
c
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -194,11 +194,11 @@ module Terminitor
|
|
194
194
|
|
195
195
|
case char
|
196
196
|
when '0'..'9'
|
197
|
-
[code - ?0 + 0x30]
|
197
|
+
[code - ?0.ord + 0x30]
|
198
198
|
when 'A'..'Z'
|
199
199
|
[VK_SHIFT, code]
|
200
200
|
when 'a'..'z'
|
201
|
-
[code - ?a + ?A]
|
201
|
+
[code - ?a.ord + ?A.ord]
|
202
202
|
when ' '
|
203
203
|
[code]
|
204
204
|
when '+'
|
data/lib/terminitor/version.rb
CHANGED
data/test/cli_test.rb
CHANGED
@@ -24,10 +24,14 @@ context "Terminitor" do
|
|
24
24
|
setup do
|
25
25
|
File.open(terminitor_root('foo.yml'),"w") { |f| f.puts @template }
|
26
26
|
File.open(terminitor_root('bar.yml'),"w") { |f| f.puts @template }
|
27
|
+
File.open(terminitor_root('baz.term'),"w") { |f| f.puts @template }
|
28
|
+
File.open(terminitor_root('baz.term~'),"w") { |f| f.puts @template }
|
27
29
|
capture(:stdout) { Terminitor::Cli.start(['list']) }
|
28
30
|
end
|
29
31
|
asserts_topic.matches %r{foo\.yml - COMMENT OF SCRIPT HERE}
|
30
|
-
asserts_topic.matches %r{bar\.yml - COMMENT OF SCRIPT HERE}
|
32
|
+
asserts_topic.matches %r{bar\.yml - COMMENT OF SCRIPT HERE} # yaml style
|
33
|
+
asserts_topic.matches %r{baz - COMMENT OF SCRIPT HERE} # .term style
|
34
|
+
denies_topic.matches %r{baz\.term~ - COMMENT OF SCRIPT HERE} # backup files
|
31
35
|
end
|
32
36
|
|
33
37
|
asserts "#init creates .terminitor" do
|
data/test/cores/cmd_core_test.rb
CHANGED
@@ -47,5 +47,28 @@ on_platform 'mingw32', 'mswin32' do
|
|
47
47
|
asserts("that it executes in injected current window") { topic.execute_command "clear", :in => @window }
|
48
48
|
teardown { @window.kill! }
|
49
49
|
end
|
50
|
+
|
51
|
+
context "accepts name" do
|
52
|
+
hookup do
|
53
|
+
any_instance_of(Terminitor::WindowsConsole) do |console|
|
54
|
+
mock(console).send_command("title named\n")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
asserts("send_command was called"){ @window = topic.open_window :name=>'named' }
|
59
|
+
teardown { @window.kill! }
|
60
|
+
end
|
61
|
+
|
62
|
+
context "accepts bounds" do
|
63
|
+
hookup do
|
64
|
+
any_instance_of(Terminitor::WindowsConsole) do |console|
|
65
|
+
mock(console).send_command("mode con: cols=80 lines=90\n")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
asserts("send_command was called"){ @window = topic.open_window :bounds=>[80,90] }
|
70
|
+
teardown { @window.kill! }
|
71
|
+
end
|
72
|
+
|
50
73
|
end
|
51
74
|
end
|
data/test/dsl_test.rb
CHANGED
@@ -8,20 +8,20 @@ context "Dsl" do
|
|
8
8
|
|
9
9
|
context "to_hash" do
|
10
10
|
setup { topic.to_hash }
|
11
|
-
asserts(
|
11
|
+
asserts(:[],:setup).equals ["echo \"setup\""]
|
12
12
|
context ":windows" do
|
13
13
|
setup { topic[:windows] }
|
14
14
|
|
15
15
|
context "with 'window1' key" do
|
16
16
|
setup { topic['window1'] }
|
17
17
|
|
18
|
-
asserts(
|
19
|
-
asserts(
|
18
|
+
asserts(:[],:before).equals ['cd /path']
|
19
|
+
asserts(:[],:options).equals({ :size => [70,30]})
|
20
20
|
|
21
21
|
context "with :tabs" do
|
22
22
|
setup { topic[:tabs] }
|
23
23
|
|
24
|
-
asserts(
|
24
|
+
asserts(:[], 'tab2').equivalent_to({
|
25
25
|
:commands=>["echo 'named tab'", "ls"],
|
26
26
|
:options => {
|
27
27
|
:name => "named tab",
|
@@ -29,11 +29,11 @@ context "Dsl" do
|
|
29
29
|
}
|
30
30
|
})
|
31
31
|
|
32
|
-
asserts(
|
32
|
+
asserts(:[], 'tab1').equivalent_to({
|
33
33
|
:commands=>["echo 'first tab'", "motion &", "echo 'than now'"]
|
34
34
|
})
|
35
35
|
|
36
|
-
asserts(
|
36
|
+
asserts(:[],'tab3').equivalent_to({
|
37
37
|
:commands=>["top","(mate &) && (gitx &) && cd /this"],
|
38
38
|
:options =>{
|
39
39
|
:name => "a tab",
|
@@ -41,7 +41,7 @@ context "Dsl" do
|
|
41
41
|
}
|
42
42
|
})
|
43
43
|
|
44
|
-
asserts(
|
44
|
+
asserts(:[],'tab4').equivalent_to({
|
45
45
|
:commands=>["ls"],
|
46
46
|
:options =>{
|
47
47
|
:name => "another named tab",
|
@@ -49,7 +49,7 @@ context "Dsl" do
|
|
49
49
|
}
|
50
50
|
})
|
51
51
|
|
52
|
-
asserts(
|
52
|
+
asserts(:[],'default').equivalent_to({
|
53
53
|
:commands=>['whoami && who && ls']
|
54
54
|
})
|
55
55
|
end
|
@@ -59,13 +59,13 @@ context "Dsl" do
|
|
59
59
|
context "with 'window2' key" do
|
60
60
|
setup { topic['window2'] }
|
61
61
|
|
62
|
-
asserts(
|
62
|
+
asserts(:[],:before).equals ['whoami']
|
63
63
|
|
64
64
|
context "with :tabs" do
|
65
65
|
setup { topic[:tabs] }
|
66
66
|
|
67
|
-
asserts(
|
68
|
-
asserts(
|
67
|
+
asserts(:[], 'tab1').equals({ :commands => ["uptime"]})
|
68
|
+
asserts(:[], 'default').equals({ :commands => []})
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -75,11 +75,11 @@ context "Dsl" do
|
|
75
75
|
context "with :tags key" do
|
76
76
|
setup { topic[:tabs] }
|
77
77
|
|
78
|
-
asserts(
|
78
|
+
asserts(:[],'tab1').equals({
|
79
79
|
:commands=>["echo 'default'", "echo 'default tab'", "ok", "for real"]
|
80
80
|
})
|
81
81
|
|
82
|
-
asserts(
|
82
|
+
asserts(:[],'default').equals({
|
83
83
|
:commands => []
|
84
84
|
})
|
85
85
|
end
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Arthur Chiu
|
@@ -11,7 +16,7 @@ autorequire:
|
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-22 00:00:00 -07:00
|
15
20
|
default_executable:
|
16
21
|
dependencies:
|
17
22
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +27,11 @@ dependencies:
|
|
22
27
|
requirements:
|
23
28
|
- - ~>
|
24
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 5
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 6
|
34
|
+
- 1
|
25
35
|
version: 0.6.1
|
26
36
|
type: :runtime
|
27
37
|
version_requirements: *id001
|
@@ -33,6 +43,11 @@ dependencies:
|
|
33
43
|
requirements:
|
34
44
|
- - ~>
|
35
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 39
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
- 14
|
50
|
+
- 0
|
36
51
|
version: 0.14.0
|
37
52
|
type: :runtime
|
38
53
|
version_requirements: *id002
|
@@ -44,6 +59,11 @@ dependencies:
|
|
44
59
|
requirements:
|
45
60
|
- - ~>
|
46
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
- 6
|
66
|
+
- 2
|
47
67
|
version: 0.6.2
|
48
68
|
type: :runtime
|
49
69
|
version_requirements: *id003
|
@@ -55,6 +75,11 @@ dependencies:
|
|
55
75
|
requirements:
|
56
76
|
- - ~>
|
57
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 23
|
79
|
+
segments:
|
80
|
+
- 1
|
81
|
+
- 0
|
82
|
+
- 0
|
58
83
|
version: 1.0.0
|
59
84
|
type: :development
|
60
85
|
version_requirements: *id004
|
@@ -66,6 +91,11 @@ dependencies:
|
|
66
91
|
requirements:
|
67
92
|
- - ~>
|
68
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 41
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
- 12
|
98
|
+
- 3
|
69
99
|
version: 0.12.3
|
70
100
|
type: :development
|
71
101
|
version_requirements: *id005
|
@@ -77,6 +107,11 @@ dependencies:
|
|
77
107
|
requirements:
|
78
108
|
- - ~>
|
79
109
|
- !ruby/object:Gem::Version
|
110
|
+
hash: 23
|
111
|
+
segments:
|
112
|
+
- 1
|
113
|
+
- 0
|
114
|
+
- 0
|
80
115
|
version: 1.0.0
|
81
116
|
type: :development
|
82
117
|
version_requirements: *id006
|
@@ -88,6 +123,9 @@ dependencies:
|
|
88
123
|
requirements:
|
89
124
|
- - ">="
|
90
125
|
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
91
129
|
version: "0"
|
92
130
|
type: :development
|
93
131
|
version_requirements: *id007
|
@@ -165,12 +203,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
203
|
requirements:
|
166
204
|
- - ">="
|
167
205
|
- !ruby/object:Gem::Version
|
206
|
+
hash: 3
|
207
|
+
segments:
|
208
|
+
- 0
|
168
209
|
version: "0"
|
169
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
211
|
none: false
|
171
212
|
requirements:
|
172
213
|
- - ">="
|
173
214
|
- !ruby/object:Gem::Version
|
215
|
+
hash: 23
|
216
|
+
segments:
|
217
|
+
- 1
|
218
|
+
- 3
|
219
|
+
- 6
|
174
220
|
version: 1.3.6
|
175
221
|
requirements: []
|
176
222
|
|