terminitor 0.4.1 → 0.5.0
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.
- data/Gemfile.lock +2 -4
- data/LICENSE +20 -0
- data/README.md +31 -4
- data/lib/terminitor.rb +12 -1
- data/lib/terminitor/abstract_core.rb +17 -6
- data/lib/terminitor/capture/cmd_capture.rb +7 -0
- data/lib/terminitor/capture/terminator_capture.rb +9 -0
- data/lib/terminitor/cli.rb +13 -2
- data/lib/terminitor/cores/cmd_core/cmd_core.rb +35 -0
- data/lib/terminitor/cores/cmd_core/input.rb +273 -0
- data/lib/terminitor/cores/cmd_core/windows_console.rb +83 -0
- data/lib/terminitor/cores/terminator_core.rb +117 -0
- data/lib/terminitor/dsl.rb +29 -12
- data/lib/terminitor/runner.rb +48 -14
- data/lib/terminitor/version.rb +1 -1
- data/lib/terminitor/yaml.rb +2 -0
- data/terminitor.gemspec +21 -10
- data/test.watchr +9 -5
- data/test/capture/mac_capture_test.rb +2 -6
- data/test/cli_test.rb +54 -22
- data/test/cores/cmd_core_test.rb +51 -0
- data/test/cores/iterm_core_test.rb +2 -5
- data/test/cores/konsole_core_test.rb +1 -1
- data/test/cores/mac_core_test.rb +12 -11
- data/test/cores/terminator_core_test.rb +39 -0
- data/test/dsl_test.rb +79 -25
- data/test/runner_test.rb +47 -24
- data/test/teststrap.rb +15 -7
- metadata +31 -87
- data/templates/example.yml.tt +0 -16
data/terminitor.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ['Arthur Chiu', 'Nathan Esquenazi']
|
9
9
|
s.email = ['mr.arthur.chiu@gmail.com','nesquena@gmail.com']
|
10
10
|
s.homepage = "http://rubygems.org/gems/terminitor"
|
11
|
-
s.summary = "
|
11
|
+
s.summary = "Automate your development workflow"
|
12
12
|
s.description = "Automate your development workflow"
|
13
13
|
|
14
14
|
s.required_rubygems_version = ">= 1.3.6"
|
@@ -17,24 +17,35 @@ Gem::Specification.new do |s|
|
|
17
17
|
# Platform Specific Dependencies
|
18
18
|
case RUBY_PLATFORM.downcase
|
19
19
|
when %r{darwin}
|
20
|
-
s.add_dependency "rb-appscript"
|
20
|
+
s.add_dependency "rb-appscript", "~>0.6.1"
|
21
|
+
when %r{linux}
|
22
|
+
s.add_dependency "ruby-dbus"
|
23
|
+
when %r{mswin|mingw}
|
24
|
+
s.add_dependency "windows-api", "= 0.4.0"
|
25
|
+
s.add_dependency "windows-pr", "= 1.1.2"
|
26
|
+
s.add_dependency "win32-process", "= 0.6.4"
|
21
27
|
else
|
22
28
|
end
|
23
29
|
|
24
|
-
s.add_dependency "text-hyphen", "1.0.0"
|
25
|
-
s.add_dependency "text-format", "1.0.0"
|
26
30
|
s.add_dependency "thor", "~>0.14.0"
|
27
|
-
s.add_dependency "github", "~>0.6.
|
31
|
+
s.add_dependency "github", "~>0.6.2"
|
28
32
|
s.add_development_dependency "bundler", "~>1.0.0"
|
29
|
-
s.add_development_dependency "riot", "~>0.12.
|
33
|
+
s.add_development_dependency "riot", "~>0.12.3"
|
30
34
|
s.add_development_dependency "rr", "~>1.0.0"
|
31
35
|
s.add_development_dependency "fakefs"
|
32
36
|
s.post_install_message = %q{********************************************************************************
|
33
37
|
|
34
|
-
Terminitor is installed!
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
Terminitor is installed! Please run:
|
39
|
+
|
40
|
+
terminitor init
|
41
|
+
|
42
|
+
This will create a directory at ~/.config/terminitor which will hold all your global scripts.
|
43
|
+
|
44
|
+
For those updating from a previous version of Terminitor(<=0.4.1) please run
|
45
|
+
|
46
|
+
terminitor update
|
47
|
+
|
48
|
+
This will copy over your terminitor files from the old path to the newer .config/terminitor location.
|
38
49
|
|
39
50
|
********************************************************************************
|
40
51
|
}
|
data/test.watchr
CHANGED
@@ -3,10 +3,14 @@ system 'clear'
|
|
3
3
|
|
4
4
|
def growl(message)
|
5
5
|
growlnotify = `which growlnotify`.chomp
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
if not growlnotify.empty?
|
7
|
+
title = "Watchr Test Results"
|
8
|
+
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
|
9
|
+
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
|
10
|
+
system %(#{growlnotify} #{options} &)
|
11
|
+
else
|
12
|
+
puts message
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
def run(cmd)
|
@@ -67,4 +71,4 @@ Signal.trap 'INT' do
|
|
67
71
|
# raise Interrupt, nil # let the run loop catch it
|
68
72
|
run_suite
|
69
73
|
end
|
70
|
-
end
|
74
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path('../../teststrap',__FILE__)
|
2
2
|
|
3
|
-
|
3
|
+
on_platform "darwin" do
|
4
4
|
context "MacCapture" do
|
5
5
|
# Stub out the initialization
|
6
6
|
setup do
|
@@ -35,8 +35,4 @@ if platform?("darwin") # Only run test if it's darwin
|
|
35
35
|
asserts_topic.equals { {:bounds => [10,20,30,40]} }
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
context "MacCore" do
|
40
|
-
puts "Nothing to do, you are not on OSX"
|
41
|
-
end
|
42
|
-
end
|
38
|
+
end
|
data/test/cli_test.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
require File.expand_path('../teststrap', __FILE__)
|
2
2
|
|
3
3
|
context "Terminitor" do
|
4
|
+
|
5
|
+
helper(:terminitor_root) { |file| File.join(ENV['HOME'],'.config','terminitor',file) }
|
6
|
+
|
4
7
|
setup do
|
5
|
-
@yaml
|
8
|
+
@yaml = File.read(File.expand_path('../fixtures/foo.yml', __FILE__))
|
6
9
|
@template = File.read(File.expand_path('../../lib/templates/example.yml.tt', __FILE__))
|
7
10
|
FakeFS.activate!
|
8
|
-
FileUtils.mkdir_p(File.join(ENV["HOME"],'.terminitor'))
|
11
|
+
FileUtils.mkdir_p(File.join(ENV["HOME"],'.config','terminitor'))
|
9
12
|
end
|
13
|
+
|
10
14
|
teardown { FakeFS.deactivate! }
|
11
15
|
|
12
16
|
context "help" do
|
@@ -18,9 +22,8 @@ context "Terminitor" do
|
|
18
22
|
|
19
23
|
context "list" do
|
20
24
|
setup do
|
21
|
-
@
|
22
|
-
File.open(
|
23
|
-
File.open(File.join(@path,'bar.yml'),"w") { |f| f.puts @template }
|
25
|
+
File.open(terminitor_root('foo.yml'),"w") { |f| f.puts @template }
|
26
|
+
File.open(terminitor_root('bar.yml'),"w") { |f| f.puts @template }
|
24
27
|
capture(:stdout) { Terminitor::Cli.start(['list']) }
|
25
28
|
end
|
26
29
|
asserts_topic.matches %r{foo\.yml - COMMENT OF SCRIPT HERE}
|
@@ -29,20 +32,20 @@ context "Terminitor" do
|
|
29
32
|
|
30
33
|
asserts "#init creates .terminitor" do
|
31
34
|
capture(:stdout) { Terminitor::Cli.start(['init']) }
|
32
|
-
File.exists?("#{ENV['HOME']}/.terminitor")
|
35
|
+
File.exists?("#{ENV['HOME']}/.config/terminitor")
|
33
36
|
end
|
34
37
|
|
35
38
|
context "edit" do
|
36
39
|
setup do
|
37
40
|
FakeFS.deactivate!
|
38
|
-
`rm -rf #{
|
39
|
-
`rm -rf #{
|
41
|
+
`rm -rf #{terminitor_root('test_foo_bar2.yml')}`
|
42
|
+
`rm -rf #{terminitor_root('test_foo_bar2.term')}`
|
40
43
|
end
|
41
44
|
|
42
45
|
teardown do
|
43
46
|
`rm -rf /tmp/sample_project`
|
44
|
-
`rm -rf #{
|
45
|
-
`rm -rf #{
|
47
|
+
`rm -rf #{terminitor_root('test_foo_bar2.yml')}`
|
48
|
+
`rm -rf #{terminitor_root('test_foo_bar2.term')}`
|
46
49
|
end
|
47
50
|
|
48
51
|
context "for project" do
|
@@ -50,39 +53,41 @@ context "Terminitor" do
|
|
50
53
|
context "for yaml" do
|
51
54
|
setup do
|
52
55
|
capture(:stdout) do
|
53
|
-
mock.instance_of(Terminitor::Cli).open_in_editor(
|
56
|
+
mock.instance_of(Terminitor::Cli).open_in_editor(terminitor_root('test_foo_bar2.yml'),nil) { true }.once
|
54
57
|
Terminitor::Cli.start(['edit','test_foo_bar2', '-s=yml'])
|
55
58
|
end
|
56
59
|
end
|
57
60
|
asserts_topic.matches %r{create}
|
58
61
|
asserts_topic.matches %r{test_foo_bar2.yml}
|
59
|
-
asserts("has yml template") { File.read(
|
62
|
+
asserts("has yml template") { File.read terminitor_root('test_foo_bar2.yml') }.matches %r{- tab1}
|
60
63
|
end
|
61
64
|
|
62
65
|
context "for term" do
|
63
66
|
setup do
|
64
67
|
capture(:stdout) do
|
65
|
-
mock.instance_of(Terminitor::Cli).open_in_editor(
|
68
|
+
mock.instance_of(Terminitor::Cli).open_in_editor(terminitor_root('test_foo_bar2.term'),nil) { true }.once
|
66
69
|
Terminitor::Cli.start(['edit','test_foo_bar2', '-s=term'])
|
67
70
|
end
|
68
71
|
end
|
69
72
|
asserts_topic.matches %r{create}
|
70
73
|
asserts_topic.matches %r{test_foo_bar2.term}
|
71
|
-
asserts("has term template") { File.read(
|
74
|
+
asserts("has term template") { File.read terminitor_root('test_foo_bar2.term') }.matches %r{setup}
|
72
75
|
end
|
73
76
|
|
74
77
|
end
|
75
78
|
|
76
79
|
context "for Termfile" do
|
80
|
+
|
81
|
+
helper(:termfile) { '/tmp/sample_project/Termfile' }
|
77
82
|
setup do
|
78
83
|
capture(:stdout) do
|
79
|
-
mock.instance_of(Terminitor::Cli).open_in_editor(
|
84
|
+
mock.instance_of(Terminitor::Cli).open_in_editor(termfile,nil) { true }.once
|
80
85
|
Terminitor::Cli.start ['edit','-s=yml','-r=/tmp/sample_project']
|
81
86
|
end
|
82
87
|
end
|
83
88
|
asserts_topic.matches %r{create}
|
84
89
|
asserts_topic.matches %r{Termfile}
|
85
|
-
asserts("has term template") { File.read
|
90
|
+
asserts("has term template") { File.read termfile }.matches %r{setup}
|
86
91
|
end
|
87
92
|
|
88
93
|
should "accept editor flag" do
|
@@ -104,7 +109,7 @@ context "Terminitor" do
|
|
104
109
|
asserts "with no core returns a message that" do
|
105
110
|
capture(:stdout) do
|
106
111
|
mock.instance_of(Terminitor::Cli).capture_core(anything) { nil }
|
107
|
-
FileUtils.touch(
|
112
|
+
FileUtils.touch terminitor_root('delete_this.term')
|
108
113
|
Terminitor::Cli.start(['edit', 'test_foo_bar2', '--capture'])
|
109
114
|
end
|
110
115
|
end.matches %r{No suitable core found!}
|
@@ -112,7 +117,7 @@ context "Terminitor" do
|
|
112
117
|
|
113
118
|
asserts "with core that it executes" do
|
114
119
|
mock.instance_of(Terminitor::Cli).capture_core(anything) { mock!.new.mock!.capture_settings { "settings"} }
|
115
|
-
mock.instance_of(Terminitor::Cli).open_in_editor(
|
120
|
+
mock.instance_of(Terminitor::Cli).open_in_editor(terminitor_root('test_foo_bar2.term'),nil) { true }
|
116
121
|
Terminitor::Cli.start(['edit','test_foo_bar2', '--capture'])
|
117
122
|
end
|
118
123
|
|
@@ -144,15 +149,15 @@ context "Terminitor" do
|
|
144
149
|
end
|
145
150
|
|
146
151
|
denies "yaml exists" do
|
147
|
-
FileUtils.touch
|
152
|
+
FileUtils.touch terminitor_root('delete_this.yml')
|
148
153
|
capture(:stdout) { Terminitor::Cli.start(['delete','delete_this', '-s=yml']) }
|
149
|
-
File.exists?
|
154
|
+
File.exists? terminitor_root('delete_this.yml')
|
150
155
|
end
|
151
156
|
|
152
157
|
denies "term exists" do
|
153
|
-
FileUtils.touch
|
158
|
+
FileUtils.touch terminitor_root('delete_this.term')
|
154
159
|
capture(:stdout) { Terminitor::Cli.start(['delete','delete_this']) }
|
155
|
-
File.exists?
|
160
|
+
File.exists? terminitor_root('delete_this.term')
|
156
161
|
end
|
157
162
|
end
|
158
163
|
|
@@ -177,4 +182,31 @@ context "Terminitor" do
|
|
177
182
|
Terminitor::Cli.start ['fetch','achiu','terminitor']
|
178
183
|
end
|
179
184
|
end
|
185
|
+
|
186
|
+
context "#update" do
|
187
|
+
|
188
|
+
context "with old global path" do
|
189
|
+
helper(:test_yml) { File.join(ENV["HOME"], '.terminitor', 'test.yml') }
|
190
|
+
|
191
|
+
setup do
|
192
|
+
FileUtils.mkdir_p File.join(ENV['HOME'], '.terminitor')
|
193
|
+
FileUtils.touch test_yml
|
194
|
+
end
|
195
|
+
|
196
|
+
asserts "that it will move the old global folder over to the new one" do
|
197
|
+
capture(:stdout) do
|
198
|
+
Terminitor::Cli.start(['update'])
|
199
|
+
end
|
200
|
+
end.matches %r{Terminitor has updated your global folder}
|
201
|
+
|
202
|
+
denies "that their exists the old folder" do
|
203
|
+
File.exists? test_yml
|
204
|
+
end
|
205
|
+
|
206
|
+
asserts "that the new folder exists" do
|
207
|
+
File.exists? File.join(ENV['HOME'],'.config','terminitor', 'test.yml')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
180
212
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../../teststrap', __FILE__)
|
2
|
+
|
3
|
+
on_platform 'mingw32', 'mswin32' do
|
4
|
+
|
5
|
+
context "CmdCore" do
|
6
|
+
setup do
|
7
|
+
any_instance_of(Terminitor::CmdCore) do |core|
|
8
|
+
stub(core).load_termfile('/path/to') { true }
|
9
|
+
stub(core).window_id { "1" }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
setup { Terminitor::CmdCore.new('/path/to') }
|
13
|
+
|
14
|
+
context "open_window" do
|
15
|
+
setup{ topic.open_window } #topic is switched from cmdcore to windowsconsole.
|
16
|
+
asserts_topic.kind_of(Terminitor::WindowsConsole)
|
17
|
+
denies("that window id is nil"){ topic.pid.nil? }
|
18
|
+
asserts("that killed window returns id"){topic.kill!}
|
19
|
+
end
|
20
|
+
|
21
|
+
#currently same thing, we emulate tab as window.
|
22
|
+
context "open_tab" do
|
23
|
+
setup{ topic.open_tab }
|
24
|
+
asserts_topic.kind_of(Terminitor::WindowsConsole)
|
25
|
+
denies("that window id is nil"){ topic.pid.nil? }
|
26
|
+
asserts("that killed window returns id"){topic.kill!}
|
27
|
+
end
|
28
|
+
|
29
|
+
context "execute with window" do
|
30
|
+
hookup { @window = topic.open_window }
|
31
|
+
hookup { mock(@window).send_command("hello\n") { true }}
|
32
|
+
asserts("that it can execute") { topic.execute_command "hello", :in => @window }
|
33
|
+
teardown { @window.kill! }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "execute without window" do
|
37
|
+
hookup { @window = topic.open_window }
|
38
|
+
hookup { mock(@window).send_command("hello\n") { true }}
|
39
|
+
hookup { mock(topic).current_window { @window }}
|
40
|
+
asserts("that it executes in injected current window") { topic.execute_command "hello" }
|
41
|
+
teardown { @window.kill! }
|
42
|
+
end
|
43
|
+
|
44
|
+
context "translate commands" do
|
45
|
+
hookup { @window = topic.open_window }
|
46
|
+
hookup { mock(@window).send_command("cls\n") { true }}
|
47
|
+
asserts("that it executes in injected current window") { topic.execute_command "clear", :in => @window }
|
48
|
+
teardown { @window.kill! }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require File.expand_path('../../teststrap',__FILE__)
|
2
2
|
|
3
|
-
|
3
|
+
on_platform "darwin" do
|
4
|
+
|
4
5
|
context "ItermCore" do
|
5
6
|
setup do
|
6
7
|
any_instance_of(Terminitor::ItermCore) do |core|
|
@@ -59,9 +60,5 @@ if platform?("darwin") # Only run test if it's darwin
|
|
59
60
|
end
|
60
61
|
|
61
62
|
end
|
62
|
-
else
|
63
|
-
context "itermCore" do
|
64
|
-
puts "Nothing to do, you are not on OSX"
|
65
|
-
end
|
66
63
|
end
|
67
64
|
|
data/test/cores/mac_core_test.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require File.expand_path('../../teststrap',__FILE__)
|
2
2
|
|
3
|
-
|
3
|
+
on_platform "darwin" do
|
4
|
+
|
4
5
|
context "MacCore" do
|
5
6
|
setup do
|
6
7
|
any_instance_of(Terminitor::MacCore) do |core|
|
7
8
|
stub(core).app('Terminal') { mock!.windows { true } }
|
8
9
|
stub(core).load_termfile('/path/to') { true }
|
9
10
|
end
|
10
|
-
|
11
|
+
Terminitor::MacCore.new('/path/to')
|
11
12
|
end
|
12
13
|
|
13
14
|
asserts "#terminal_process calls System Events" do
|
@@ -98,9 +99,12 @@ if platform?("darwin") # Only run test if it's darwin
|
|
98
99
|
context "invalid settings" do
|
99
100
|
should "return a error message that" do
|
100
101
|
stub(@terminal).settings_sets {{:invalid_settings => true}}
|
101
|
-
stub(
|
102
|
-
|
103
|
-
|
102
|
+
stub(@object).current_settings.stub!.set(anything) do
|
103
|
+
raise Appscript::CommandError.new("code","error","object","reference", "command")
|
104
|
+
end
|
105
|
+
capture(:stdout) do
|
106
|
+
Terminitor::MacCore.new('/path/to').set_options(@object, :settings => :invalid_settings)
|
107
|
+
end
|
104
108
|
end.matches %r{Error: invalid settings}
|
105
109
|
end
|
106
110
|
|
@@ -124,8 +128,9 @@ if platform?("darwin") # Only run test if it's darwin
|
|
124
128
|
context "unknown option" do
|
125
129
|
|
126
130
|
should "return a message" do
|
127
|
-
stub(
|
128
|
-
|
131
|
+
stub(@object).unknown_option.stub!.set(anything) do
|
132
|
+
raise Appscript::CommandError.new("code","error","object","reference", "command")
|
133
|
+
end
|
129
134
|
capture(:stdout) { Terminitor::MacCore.new('/path/to').set_options(@object, :unknown_option => true)}
|
130
135
|
end.matches %r{Error}
|
131
136
|
|
@@ -152,8 +157,4 @@ if platform?("darwin") # Only run test if it's darwin
|
|
152
157
|
end
|
153
158
|
|
154
159
|
end
|
155
|
-
else
|
156
|
-
context "MacCore" do
|
157
|
-
puts "Nothing to do, you are not on OSX"
|
158
|
-
end
|
159
160
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path('../../teststrap', __FILE__)
|
2
|
+
|
3
|
+
on_platform 'linux' do
|
4
|
+
context "TerminatorCore" do
|
5
|
+
helper(:fake_exec_success) { IO.popen("true").read }
|
6
|
+
setup do
|
7
|
+
@xdotool = `which xdotool`.chomp
|
8
|
+
# stub xdotool invocations and termfile loading
|
9
|
+
any_instance_of(Terminitor::TerminatorCore) do |core|
|
10
|
+
stub(core).load_termfile('/path/to') { true }
|
11
|
+
stub(core).window_id { "1" }
|
12
|
+
stub(core).execute { |cmd| puts "Would run \"#{cmd}\"" }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
setup { @core = Terminitor::TerminatorCore.new('/path/to') }
|
17
|
+
|
18
|
+
context "open_tab" do
|
19
|
+
setup do
|
20
|
+
mock(@core).execute("#{@xdotool} key --window 1 ctrl+shift+t") { fake_exec_success }
|
21
|
+
end
|
22
|
+
asserts("opens a new tab") { @core.open_tab }
|
23
|
+
end
|
24
|
+
|
25
|
+
context "open_window" do
|
26
|
+
setup do
|
27
|
+
mock(@core).execute("#{@xdotool} key --window 1 ctrl+shift+i") { fake_exec_success }
|
28
|
+
end
|
29
|
+
asserts("opens a new window") { @core.open_window }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "execute_command" do
|
33
|
+
setup do
|
34
|
+
mock(@core).execute("#{@xdotool} type --window 1 \"hasta\n\"") { fake_exec_success }
|
35
|
+
end
|
36
|
+
asserts("executes command") { @core.execute_command('hasta') }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/test/dsl_test.rb
CHANGED
@@ -1,35 +1,89 @@
|
|
1
1
|
require File.expand_path('../teststrap', __FILE__)
|
2
2
|
|
3
3
|
context "Dsl" do
|
4
|
-
setup {
|
5
|
-
setup { @yaml = Terminitor::Dsl.new(@path) }
|
4
|
+
setup { Terminitor::Dsl.new File.expand_path('../fixtures/bar.term', __FILE__) }
|
6
5
|
asserts_topic.assigns :setup
|
7
6
|
asserts_topic.assigns :windows
|
8
7
|
asserts_topic.assigns :_context
|
9
8
|
|
10
9
|
context "to_hash" do
|
11
|
-
setup {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
10
|
+
setup { topic.to_hash }
|
11
|
+
asserts([:[],:setup]).equals ["echo \"setup\""]
|
12
|
+
context ":windows" do
|
13
|
+
setup { topic[:windows] }
|
14
|
+
|
15
|
+
context "with 'window1' key" do
|
16
|
+
setup { topic['window1'] }
|
17
|
+
|
18
|
+
asserts([:[],:before]).equals ['cd /path']
|
19
|
+
asserts([:[],:options]).equals({ :size => [70,30]})
|
20
|
+
|
21
|
+
context "with :tabs" do
|
22
|
+
setup { topic[:tabs] }
|
23
|
+
|
24
|
+
asserts([:[], 'tab2']).equivalent_to({
|
25
|
+
:commands=>["(echo 'named tab')", "(ls)"],
|
26
|
+
:options => {
|
27
|
+
:name => "named tab",
|
28
|
+
:settings=>"Grass"
|
29
|
+
}
|
30
|
+
})
|
31
|
+
|
32
|
+
asserts([:[], 'tab1']).equivalent_to({
|
33
|
+
:commands=>["echo 'first tab'", "echo 'of window'", "echo 'than now'"]
|
34
|
+
})
|
35
|
+
|
36
|
+
asserts([:[],'tab3']).equivalent_to({
|
37
|
+
:commands=>["(top)"],
|
38
|
+
:options =>{
|
39
|
+
:name => "a tab",
|
40
|
+
:settings => "Pro"
|
41
|
+
}
|
42
|
+
})
|
43
|
+
|
44
|
+
asserts([:[],'tab4']).equivalent_to({
|
45
|
+
:commands=>["(ls)"],
|
46
|
+
:options =>{
|
47
|
+
:name => "another named tab",
|
48
|
+
:settings => "Grass"
|
49
|
+
}
|
50
|
+
})
|
51
|
+
|
52
|
+
asserts([:[],'default']).equivalent_to({
|
53
|
+
:commands=>['(whoami) && (who) && (ls)']
|
54
|
+
})
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
34
58
|
|
59
|
+
context "with 'window2' key" do
|
60
|
+
setup { topic['window2'] }
|
61
|
+
|
62
|
+
asserts([:[],:before]).equals ['(whoami)']
|
63
|
+
|
64
|
+
context "with :tabs" do
|
65
|
+
setup { topic[:tabs] }
|
66
|
+
|
67
|
+
asserts([:[], 'tab1']).equals({ :commands => ["uptime"]})
|
68
|
+
asserts([:[], 'default']).equals({ :commands => []})
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "with 'default' key" do
|
73
|
+
setup { topic['default'] }
|
74
|
+
|
75
|
+
context "with :tags key" do
|
76
|
+
setup { topic[:tabs] }
|
77
|
+
|
78
|
+
asserts([:[],'tab1']).equals({
|
79
|
+
:commands=>["echo 'default'", "echo 'default tab'", "ok", "for real"]
|
80
|
+
})
|
81
|
+
|
82
|
+
asserts([:[],'default']).equals({
|
83
|
+
:commands => []
|
84
|
+
})
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
35
89
|
end
|