consular-iterm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/consular-iterm.gemspec +2 -1
- data/lib/consular/iterm.rb +25 -26
- data/spec/iterm_spec.rb +10 -3
- data/spec/spec_helper.rb +1 -0
- metadata +19 -8
data/consular-iterm.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "consular-iterm"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.2"
|
7
7
|
s.authors = ["Arthur Chiu"]
|
8
8
|
s.email = ["mr.arthur.chiu@gmail.com"]
|
9
9
|
s.homepage = "http://www.github.com/achiu/consular-iterm"
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'consular'
|
21
21
|
s.add_dependency 'rb-appscript'
|
22
22
|
s.add_development_dependency 'minitest'
|
23
|
+
s.add_development_dependency 'mocha'
|
23
24
|
|
24
25
|
# specify any dependencies here; for example:
|
25
26
|
# s.add_development_dependency "rspec"
|
data/lib/consular/iterm.rb
CHANGED
@@ -13,7 +13,7 @@ module Consular
|
|
13
13
|
|
14
14
|
class << self
|
15
15
|
|
16
|
-
# Checks to see if the current system is darwin and
|
16
|
+
# Checks to see if the current system is darwin and
|
17
17
|
# if $TERM_PROGRAM is iTerm.app
|
18
18
|
#
|
19
19
|
# @api public
|
@@ -80,15 +80,14 @@ module Consular
|
|
80
80
|
|
81
81
|
# Prepend a title setting command prior to the other commands.
|
82
82
|
#
|
83
|
-
# @param [String]
|
84
|
-
# The title
|
85
|
-
# @param [
|
86
|
-
# The
|
83
|
+
# @param [String]
|
84
|
+
# The tab title.
|
85
|
+
# @param [Appscript::Reference]
|
86
|
+
# The tab instance resulting from #open_tab.
|
87
87
|
#
|
88
88
|
# @api public
|
89
|
-
def set_title(title,
|
90
|
-
|
91
|
-
title ? commands.insert(0, cmd) : commands
|
89
|
+
def set_title(title, tab)
|
90
|
+
tab.name.set(title) if title
|
92
91
|
end
|
93
92
|
|
94
93
|
# Executes the commands for each designated window.
|
@@ -117,31 +116,31 @@ module Consular
|
|
117
116
|
# @api public
|
118
117
|
def execute_window(content, options = {})
|
119
118
|
window_options = content[:options]
|
120
|
-
|
121
|
-
|
119
|
+
tab_contents = content[:tabs]
|
120
|
+
first_run = true
|
122
121
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
122
|
+
tab_contents.keys.sort.each do |key|
|
123
|
+
tab_content = tab_contents[key]
|
124
|
+
tab_options = tab_content[:options] || {}
|
125
|
+
tab_name = tab_options[:name]
|
127
126
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
127
|
+
tab =
|
128
|
+
if first_run && !options[:default]
|
129
|
+
open_window options.merge(window_options)
|
130
|
+
else
|
131
|
+
key == 'default' ? active_tab : open_tab(tab_options) && active_tab
|
132
|
+
end
|
133
|
+
set_title tab_name, tab
|
134
134
|
|
135
|
-
|
136
|
-
commands = prepend_befores
|
137
|
-
commands = set_title _name, commands
|
135
|
+
first_run = false
|
136
|
+
commands = prepend_befores tab_content[:commands], content[:before]
|
138
137
|
|
139
138
|
if content.key? :panes
|
140
|
-
commands.each { |cmd| execute_command cmd, :in =>
|
139
|
+
commands.each { |cmd| execute_command cmd, :in => tab }
|
141
140
|
execute_panes content
|
142
141
|
content.delete :panes
|
143
142
|
else
|
144
|
-
commands.each { |cmd| execute_command cmd, :in =>
|
143
|
+
commands.each { |cmd| execute_command cmd, :in => tab }
|
145
144
|
end
|
146
145
|
end
|
147
146
|
end
|
@@ -233,7 +232,7 @@ module Consular
|
|
233
232
|
|
234
233
|
# to select panes; iTerm's Appscript select method does not work
|
235
234
|
# as expected, we have to select via menu instead
|
236
|
-
#
|
235
|
+
#
|
237
236
|
# @param [String] direction
|
238
237
|
# Direction to split the pane. The valid directions are:
|
239
238
|
# 'Above', 'Below', 'Left', 'Right'
|
data/spec/iterm_spec.rb
CHANGED
@@ -23,9 +23,16 @@ describe Consular::ITerm do
|
|
23
23
|
assert_equal ['ls'], @core.prepend_befores(['ls'])
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should set
|
27
|
-
|
28
|
-
|
26
|
+
it "should set the title of the tab if one given" do
|
27
|
+
(name = Object.new).expects(:set)
|
28
|
+
(tab = Object.new).stubs(:name).returns(name)
|
29
|
+
@core.set_title('the title', tab)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should not bother setting the tab title if not one given" do
|
33
|
+
(name = Object.new).expects(:set).never
|
34
|
+
(tab = Object.new).stubs(:name).returns(name)
|
35
|
+
@core.set_title(nil, tab)
|
29
36
|
end
|
30
37
|
|
31
38
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consular-iterm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: consular
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152532600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152532600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rb-appscript
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152532160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152532160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitest
|
38
|
-
requirement: &
|
38
|
+
requirement: &2152531740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,18 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152531740
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: &2152485220 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2152485220
|
47
58
|
description: Terminal Automation for ITerm via Consular
|
48
59
|
email:
|
49
60
|
- mr.arthur.chiu@gmail.com
|