terminitor 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/test/runner_test.rb
CHANGED
@@ -18,6 +18,9 @@ class TestItem
|
|
18
18
|
end
|
19
19
|
|
20
20
|
context "Runner" do
|
21
|
+
|
22
|
+
helper(:terminitor_root) { |file| File.join(ENV['HOME'],'.config','terminitor', file) }
|
23
|
+
|
21
24
|
setup do
|
22
25
|
@yaml = File.read(File.expand_path('../fixtures/foo.yml', __FILE__))
|
23
26
|
@template = File.read(File.expand_path('../../lib/templates/example.yml.tt', __FILE__))
|
@@ -28,22 +31,36 @@ context "Runner" do
|
|
28
31
|
|
29
32
|
|
30
33
|
context "#find_core" do
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
|
35
|
+
helper(:find_core) { |core| @test_runner.find_core core }
|
36
|
+
|
37
|
+
on_platform 'darwin' do
|
38
|
+
if ENV['TERM_PROGRAM'] == 'iTerm.app'
|
39
|
+
should("have iTerm") { find_core('darwin') }.equals Terminitor::ItermCore
|
40
|
+
else
|
41
|
+
should("have Terminal") { find_core('darwin') }.equals Terminitor::MacCore
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
|
-
|
38
|
-
|
45
|
+
on_platform 'linux' do # TODO Gotta be a better way.
|
46
|
+
if `which terminator`.chomp.empty?
|
47
|
+
should("have KDE") { find_core('linux') }.equals Terminitor::KonsoleCore
|
48
|
+
else
|
49
|
+
should("have terminator") { find_core('linux') }.equals Terminitor::TerminatorCore
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
42
54
|
context "#capture_core" do
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
|
56
|
+
helper(:capture_core) { |core| @test_runner.capture_core core }
|
57
|
+
|
58
|
+
on_platform 'darwin' do
|
59
|
+
if ENV['TERM_PROGRAM'] == 'iTerm.app'
|
60
|
+
should("have iTerm") { capture_core('darwin') }.equals Terminitor::ItermCapture
|
61
|
+
else
|
62
|
+
should("have Terminal") { capture_core('darwin') }.equals Terminitor::MacCapture
|
63
|
+
end
|
47
64
|
end
|
48
65
|
end
|
49
66
|
|
@@ -79,23 +96,23 @@ context "Runner" do
|
|
79
96
|
end
|
80
97
|
|
81
98
|
context "#resolve_path" do
|
82
|
-
setup { FileUtils.mkdir_p(File.join(ENV['HOME'],'.terminitor')) }
|
99
|
+
setup { FileUtils.mkdir_p(File.join(ENV['HOME'],'.config','terminitor')) }
|
83
100
|
|
84
101
|
should "return yaml" do
|
85
|
-
FileUtils.touch(
|
86
|
-
@test_runner.resolve_path('test')
|
87
|
-
end
|
102
|
+
FileUtils.touch terminitor_root('test.yml')
|
103
|
+
@test_runner.resolve_path('test') == terminitor_root('test.yml')
|
104
|
+
end
|
88
105
|
|
89
106
|
should "return term" do
|
90
|
-
FileUtils.touch(
|
91
|
-
FileUtils.rm(
|
92
|
-
@test_runner.resolve_path('test')
|
93
|
-
end
|
107
|
+
FileUtils.touch terminitor_root('test.term')
|
108
|
+
FileUtils.rm terminitor_root('test.yml')
|
109
|
+
@test_runner.resolve_path('test') == terminitor_root('test.term')
|
110
|
+
end
|
94
111
|
|
95
112
|
|
96
113
|
should "return Termfile" do
|
97
|
-
FileUtils.rm(
|
98
|
-
FileUtils.rm(
|
114
|
+
FileUtils.rm terminitor_root('test.yml')
|
115
|
+
FileUtils.rm terminitor_root('test.term')
|
99
116
|
FileUtils.touch("Termfile")
|
100
117
|
mock(@test_runner).options { {:root => '.'} }
|
101
118
|
@test_runner.resolve_path("")
|
@@ -104,8 +121,8 @@ context "Runner" do
|
|
104
121
|
|
105
122
|
context "with nothing" do
|
106
123
|
setup do
|
107
|
-
FileUtils.rm(
|
108
|
-
FileUtils.rm(
|
124
|
+
FileUtils.rm terminitor_root('test.term')
|
125
|
+
FileUtils.rm terminitor_root('test.yml')
|
109
126
|
FileUtils.rm("Termfile")
|
110
127
|
end
|
111
128
|
|
@@ -121,8 +138,14 @@ context "Runner" do
|
|
121
138
|
end
|
122
139
|
|
123
140
|
context "config_path" do
|
124
|
-
|
125
|
-
should("have
|
141
|
+
|
142
|
+
should("have yaml") do
|
143
|
+
@test_runner.config_path('test',:yml) == terminitor_root('test.yml')
|
144
|
+
end
|
145
|
+
|
146
|
+
should("have term") do
|
147
|
+
@test_runner.config_path('test', :term) == terminitor_root('test.term')
|
148
|
+
end
|
126
149
|
|
127
150
|
should "have Termfile" do
|
128
151
|
mock(@test_runner).options { {:root => '/tmp'} }
|
data/test/teststrap.rb
CHANGED
@@ -2,18 +2,26 @@ require 'rubygems'
|
|
2
2
|
require 'riot'
|
3
3
|
require 'riot/rr'
|
4
4
|
require File.expand_path('../../lib/terminitor',__FILE__)
|
5
|
-
require 'fakefs/safe'
|
6
|
-
Riot.reporter = Riot::DotMatrixReporter
|
7
5
|
|
8
|
-
|
6
|
+
|
7
|
+
# Yield the block if the platform matches current platform
|
8
|
+
# example:
|
9
|
+
# on_platform('linux') { puts 'hi' }
|
10
|
+
def on_platform(*platform)
|
11
|
+
platform = [platform] unless platform.respond_to? :each
|
12
|
+
platform.each { |p| yield && break if RUBY_PLATFORM.downcase.include?(p) }
|
9
13
|
end
|
10
14
|
|
11
|
-
|
15
|
+
on_platform('linux', 'darwin') do
|
16
|
+
require 'fakefs/safe'
|
17
|
+
end
|
18
|
+
|
19
|
+
Riot.pretty_dots
|
20
|
+
|
21
|
+
class Riot::Situation
|
12
22
|
end
|
13
23
|
|
14
|
-
|
15
|
-
def platform?(platform)
|
16
|
-
RUBY_PLATFORM.downcase.include?(platform)
|
24
|
+
class Riot::Context
|
17
25
|
end
|
18
26
|
|
19
27
|
module Kernel
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 1
|
9
|
-
version: 0.4.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.5.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Arthur Chiu
|
@@ -15,7 +11,7 @@ autorequire:
|
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
13
|
|
18
|
-
date: 2011-
|
14
|
+
date: 2011-04-03 00:00:00 -07:00
|
19
15
|
default_executable:
|
20
16
|
dependencies:
|
21
17
|
- !ruby/object:Gem::Dependency
|
@@ -24,131 +20,77 @@ dependencies:
|
|
24
20
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
21
|
none: false
|
26
22
|
requirements:
|
27
|
-
- -
|
23
|
+
- - ~>
|
28
24
|
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
- 0
|
31
|
-
version: "0"
|
25
|
+
version: 0.6.1
|
32
26
|
type: :runtime
|
33
27
|
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: text-hyphen
|
36
|
-
prerelease: false
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
40
|
-
- - "="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 1
|
44
|
-
- 0
|
45
|
-
- 0
|
46
|
-
version: 1.0.0
|
47
|
-
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: text-format
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - "="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 1
|
59
|
-
- 0
|
60
|
-
- 0
|
61
|
-
version: 1.0.0
|
62
|
-
type: :runtime
|
63
|
-
version_requirements: *id003
|
64
28
|
- !ruby/object:Gem::Dependency
|
65
29
|
name: thor
|
66
30
|
prerelease: false
|
67
|
-
requirement: &
|
31
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
68
32
|
none: false
|
69
33
|
requirements:
|
70
34
|
- - ~>
|
71
35
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
- 14
|
75
|
-
- 0
|
76
36
|
version: 0.14.0
|
77
37
|
type: :runtime
|
78
|
-
version_requirements: *
|
38
|
+
version_requirements: *id002
|
79
39
|
- !ruby/object:Gem::Dependency
|
80
40
|
name: github
|
81
41
|
prerelease: false
|
82
|
-
requirement: &
|
42
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
83
43
|
none: false
|
84
44
|
requirements:
|
85
45
|
- - ~>
|
86
46
|
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
- 0
|
89
|
-
- 6
|
90
|
-
- 0
|
91
|
-
version: 0.6.0
|
47
|
+
version: 0.6.2
|
92
48
|
type: :runtime
|
93
|
-
version_requirements: *
|
49
|
+
version_requirements: *id003
|
94
50
|
- !ruby/object:Gem::Dependency
|
95
51
|
name: bundler
|
96
52
|
prerelease: false
|
97
|
-
requirement: &
|
53
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
98
54
|
none: false
|
99
55
|
requirements:
|
100
56
|
- - ~>
|
101
57
|
- !ruby/object:Gem::Version
|
102
|
-
segments:
|
103
|
-
- 1
|
104
|
-
- 0
|
105
|
-
- 0
|
106
58
|
version: 1.0.0
|
107
59
|
type: :development
|
108
|
-
version_requirements: *
|
60
|
+
version_requirements: *id004
|
109
61
|
- !ruby/object:Gem::Dependency
|
110
62
|
name: riot
|
111
63
|
prerelease: false
|
112
|
-
requirement: &
|
64
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
113
65
|
none: false
|
114
66
|
requirements:
|
115
67
|
- - ~>
|
116
68
|
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
- 0
|
119
|
-
- 12
|
120
|
-
- 0
|
121
|
-
version: 0.12.0
|
69
|
+
version: 0.12.3
|
122
70
|
type: :development
|
123
|
-
version_requirements: *
|
71
|
+
version_requirements: *id005
|
124
72
|
- !ruby/object:Gem::Dependency
|
125
73
|
name: rr
|
126
74
|
prerelease: false
|
127
|
-
requirement: &
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
128
76
|
none: false
|
129
77
|
requirements:
|
130
78
|
- - ~>
|
131
79
|
- !ruby/object:Gem::Version
|
132
|
-
segments:
|
133
|
-
- 1
|
134
|
-
- 0
|
135
|
-
- 0
|
136
80
|
version: 1.0.0
|
137
81
|
type: :development
|
138
|
-
version_requirements: *
|
82
|
+
version_requirements: *id006
|
139
83
|
- !ruby/object:Gem::Dependency
|
140
84
|
name: fakefs
|
141
85
|
prerelease: false
|
142
|
-
requirement: &
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
143
87
|
none: false
|
144
88
|
requirements:
|
145
89
|
- - ">="
|
146
90
|
- !ruby/object:Gem::Version
|
147
|
-
segments:
|
148
|
-
- 0
|
149
91
|
version: "0"
|
150
92
|
type: :development
|
151
|
-
version_requirements: *
|
93
|
+
version_requirements: *id007
|
152
94
|
description: Automate your development workflow
|
153
95
|
email:
|
154
96
|
- mr.arthur.chiu@gmail.com
|
@@ -163,6 +105,7 @@ files:
|
|
163
105
|
- .gitignore
|
164
106
|
- Gemfile
|
165
107
|
- Gemfile.lock
|
108
|
+
- LICENSE
|
166
109
|
- README.md
|
167
110
|
- Rakefile
|
168
111
|
- Termfile
|
@@ -172,27 +115,34 @@ files:
|
|
172
115
|
- lib/terminitor.rb
|
173
116
|
- lib/terminitor/abstract_capture.rb
|
174
117
|
- lib/terminitor/abstract_core.rb
|
118
|
+
- lib/terminitor/capture/cmd_capture.rb
|
175
119
|
- lib/terminitor/capture/iterm_capture.rb
|
176
120
|
- lib/terminitor/capture/konsole_capture.rb
|
177
121
|
- lib/terminitor/capture/mac_capture.rb
|
122
|
+
- lib/terminitor/capture/terminator_capture.rb
|
178
123
|
- lib/terminitor/cli.rb
|
124
|
+
- lib/terminitor/cores/cmd_core/cmd_core.rb
|
125
|
+
- lib/terminitor/cores/cmd_core/input.rb
|
126
|
+
- lib/terminitor/cores/cmd_core/windows_console.rb
|
179
127
|
- lib/terminitor/cores/iterm_core.rb
|
180
128
|
- lib/terminitor/cores/konsole_core.rb
|
181
129
|
- lib/terminitor/cores/mac_core.rb
|
130
|
+
- lib/terminitor/cores/terminator_core.rb
|
182
131
|
- lib/terminitor/dsl.rb
|
183
132
|
- lib/terminitor/runner.rb
|
184
133
|
- lib/terminitor/version.rb
|
185
134
|
- lib/terminitor/yaml.rb
|
186
|
-
- templates/example.yml.tt
|
187
135
|
- terminitor.gemspec
|
188
136
|
- test.watchr
|
189
137
|
- test/abstract_capture_test.rb
|
190
138
|
- test/abstract_core_test.rb
|
191
139
|
- test/capture/mac_capture_test.rb
|
192
140
|
- test/cli_test.rb
|
141
|
+
- test/cores/cmd_core_test.rb
|
193
142
|
- test/cores/iterm_core_test.rb
|
194
143
|
- test/cores/konsole_core_test.rb
|
195
144
|
- test/cores/mac_core_test.rb
|
145
|
+
- test/cores/terminator_core_test.rb
|
196
146
|
- test/dsl_test.rb
|
197
147
|
- test/fixtures/bar.term
|
198
148
|
- test/fixtures/foo.term
|
@@ -204,7 +154,7 @@ has_rdoc: true
|
|
204
154
|
homepage: http://rubygems.org/gems/terminitor
|
205
155
|
licenses: []
|
206
156
|
|
207
|
-
post_install_message: "********************************************************************************\n\n Terminitor is installed! \n
|
157
|
+
post_install_message: "********************************************************************************\n\n Terminitor is installed! Please run:\n \n terminitor init\n\n This will create a directory at ~/.config/terminitor which will hold all your global scripts.\n\n For those updating from a previous version of Terminitor(<=0.4.1) please run\n\n terminitor update\n\n This will copy over your terminitor files from the old path to the newer .config/terminitor location.\n\n\
|
208
158
|
********************************************************************************\n "
|
209
159
|
rdoc_options: []
|
210
160
|
|
@@ -215,25 +165,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
165
|
requirements:
|
216
166
|
- - ">="
|
217
167
|
- !ruby/object:Gem::Version
|
218
|
-
segments:
|
219
|
-
- 0
|
220
168
|
version: "0"
|
221
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
170
|
none: false
|
223
171
|
requirements:
|
224
172
|
- - ">="
|
225
173
|
- !ruby/object:Gem::Version
|
226
|
-
segments:
|
227
|
-
- 1
|
228
|
-
- 3
|
229
|
-
- 6
|
230
174
|
version: 1.3.6
|
231
175
|
requirements: []
|
232
176
|
|
233
177
|
rubyforge_project: terminitor
|
234
|
-
rubygems_version: 1.
|
178
|
+
rubygems_version: 1.6.1
|
235
179
|
signing_key:
|
236
180
|
specification_version: 3
|
237
|
-
summary:
|
181
|
+
summary: Automate your development workflow
|
238
182
|
test_files: []
|
239
183
|
|
data/templates/example.yml.tt
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# COMMENT OF SCRIPT HERE
|
2
|
-
# you can make as many tabs as you wish...
|
3
|
-
# tab names are actually arbitrary at this point too.
|
4
|
-
---
|
5
|
-
- tab1:
|
6
|
-
- cd ~/foo/bar
|
7
|
-
- gitx
|
8
|
-
- tab2:
|
9
|
-
- mysql -u root
|
10
|
-
- use test;
|
11
|
-
- show tables;
|
12
|
-
- tab3: echo "hello world"
|
13
|
-
- tab4: cd ~/baz/ && git pull
|
14
|
-
- tab5:
|
15
|
-
- cd ~/foo/project
|
16
|
-
- autotest
|