termup 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/termup/base.rb +27 -14
- data/lib/termup/cli.rb +5 -3
- data/termup.gemspec +4 -3
- metadata +27 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/termup/base.rb
CHANGED
@@ -3,6 +3,9 @@ require 'yaml'
|
|
3
3
|
|
4
4
|
module Termup
|
5
5
|
class Base
|
6
|
+
ITERM1 = /^0\.10/
|
7
|
+
ITERM2 = /^0\.20/
|
8
|
+
|
6
9
|
include Appscript
|
7
10
|
|
8
11
|
def initialize(project)
|
@@ -10,22 +13,21 @@ module Termup
|
|
10
13
|
@frontmost = @apps.get.select{|i| i.frontmost.get }.map{|i| i.name.get }.first
|
11
14
|
return unless ["Terminal", "iTerm"].include?(@frontmost)
|
12
15
|
@terminal = app(@frontmost)
|
13
|
-
|
16
|
+
|
14
17
|
@project = YAML.load(File.read("#{TERMUP_DIR}/#{project}.yml"))
|
15
|
-
|
16
|
-
# Split panes for iTerm
|
17
|
-
split_panes if
|
18
|
-
|
18
|
+
|
19
|
+
# Split panes for iTerm 2
|
20
|
+
split_panes if iterm2? and @project['options']['iterm']
|
21
|
+
|
19
22
|
@project['tabs'].each do |hash|
|
20
23
|
tabname = hash.keys.first
|
21
24
|
cmds = hash.values.first
|
22
25
|
cmds = [cmds].flatten
|
23
26
|
tab = new_tab
|
24
27
|
cmds.each do |cmd|
|
25
|
-
|
26
|
-
when "Terminal"
|
28
|
+
if terminal?
|
27
29
|
@terminal.do_script(cmd, :in => tab)
|
28
|
-
|
30
|
+
else
|
29
31
|
@terminal.current_terminal.current_session.write(:text => "#{cmd}")
|
30
32
|
end
|
31
33
|
end
|
@@ -34,18 +36,17 @@ module Termup
|
|
34
36
|
|
35
37
|
def new_tab
|
36
38
|
if @got_first_tab_already
|
37
|
-
|
38
|
-
when "Terminal"
|
39
|
-
@apps[@frontmost].keystroke("t", :using => :command_down)
|
40
|
-
when "iTerm"
|
39
|
+
if iterm2?
|
41
40
|
@apps[@frontmost].keystroke("]", :using => :command_down)
|
41
|
+
else
|
42
|
+
@apps[@frontmost].keystroke("t", :using => :command_down)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
@got_first_tab_already = true
|
45
46
|
sleep 0.01 # Allow some time to complete opening a new tab
|
46
|
-
@terminal.windows[1].tabs.last.get if
|
47
|
+
@terminal.windows[1].tabs.last.get if terminal?
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def split_panes
|
50
51
|
# Virtical splits
|
51
52
|
(@project['options']['iterm']['width'] - 1).times do |i|
|
@@ -62,5 +63,17 @@ module Termup
|
|
62
63
|
@apps[@frontmost].keystroke("]", :using => :command_down)
|
63
64
|
end
|
64
65
|
end
|
66
|
+
|
67
|
+
def terminal?
|
68
|
+
@frontmost == "Terminal"
|
69
|
+
end
|
70
|
+
|
71
|
+
def iterm1?
|
72
|
+
@frontmost == "iTerm" and @terminal.version.get =~ ITERM1
|
73
|
+
end
|
74
|
+
|
75
|
+
def iterm2?
|
76
|
+
@frontmost == "iTerm" and @terminal.version.get =~ ITERM2
|
77
|
+
end
|
65
78
|
end
|
66
79
|
end
|
data/lib/termup/cli.rb
CHANGED
@@ -29,19 +29,21 @@ module Termup
|
|
29
29
|
say "please set $EDITOR in your .bash_profile." and return unless editor = ENV['EDITOR']
|
30
30
|
system("#{editor} #{path(project)}")
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
desc "list", "List termup projects (Shortcut: l)"
|
34
34
|
def list
|
35
35
|
projects = Dir["#{TERMUP_DIR}/*.yml"].map{|file| File.basename(file,'.yml') }
|
36
36
|
say "Your projects: #{projects.join(', ')}"
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
desc "start PROJECT", "Start termup project (Shortcut: s)"
|
40
40
|
def start(project)
|
41
|
+
say "project \"#{project}\" doesn't exist!" and return unless File.exists?(path(project))
|
41
42
|
Termup::Base.new(project)
|
42
43
|
end
|
44
|
+
|
45
|
+
protected
|
43
46
|
|
44
|
-
protected
|
45
47
|
def path(project)
|
46
48
|
"#{TERMUP_DIR}/#{project}.yml"
|
47
49
|
end
|
data/termup.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{termup}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kenn Ejima"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-17}
|
13
13
|
s.default_executable = %q{termup}
|
14
14
|
s.description = %q{Initialize terminal tabs with preset commands}
|
15
15
|
s.email = %q{kenn.ejima@gmail.com}
|
@@ -41,10 +41,11 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.homepage = %q{http://github.com/kenn/termup}
|
42
42
|
s.licenses = ["MIT"]
|
43
43
|
s.require_paths = ["lib"]
|
44
|
-
s.rubygems_version = %q{1.
|
44
|
+
s.rubygems_version = %q{1.3.7}
|
45
45
|
s.summary = %q{Initialize terminal tabs with preset commands}
|
46
46
|
|
47
47
|
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
49
|
s.specification_version = 3
|
49
50
|
|
50
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: termup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Kenn Ejima
|
@@ -10,7 +14,7 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-05-
|
17
|
+
date: 2011-05-17 00:00:00 -07:00
|
14
18
|
default_executable: termup
|
15
19
|
dependencies:
|
16
20
|
- !ruby/object:Gem::Dependency
|
@@ -20,6 +24,10 @@ dependencies:
|
|
20
24
|
requirements:
|
21
25
|
- - ~>
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 6
|
30
|
+
- 1
|
23
31
|
version: 0.6.1
|
24
32
|
type: :runtime
|
25
33
|
prerelease: false
|
@@ -31,6 +39,10 @@ dependencies:
|
|
31
39
|
requirements:
|
32
40
|
- - ~>
|
33
41
|
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 2
|
44
|
+
- 6
|
45
|
+
- 0
|
34
46
|
version: 2.6.0
|
35
47
|
type: :development
|
36
48
|
prerelease: false
|
@@ -42,6 +54,10 @@ dependencies:
|
|
42
54
|
requirements:
|
43
55
|
- - ~>
|
44
56
|
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 1
|
59
|
+
- 0
|
60
|
+
- 13
|
45
61
|
version: 1.0.13
|
46
62
|
type: :development
|
47
63
|
prerelease: false
|
@@ -53,6 +69,10 @@ dependencies:
|
|
53
69
|
requirements:
|
54
70
|
- - ~>
|
55
71
|
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 1
|
74
|
+
- 6
|
75
|
+
- 0
|
56
76
|
version: 1.6.0
|
57
77
|
type: :development
|
58
78
|
prerelease: false
|
@@ -99,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
119
|
requirements:
|
100
120
|
- - ">="
|
101
121
|
- !ruby/object:Gem::Version
|
102
|
-
hash:
|
122
|
+
hash: -2202960048524737384
|
103
123
|
segments:
|
104
124
|
- 0
|
105
125
|
version: "0"
|
@@ -108,11 +128,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
128
|
requirements:
|
109
129
|
- - ">="
|
110
130
|
- !ruby/object:Gem::Version
|
131
|
+
segments:
|
132
|
+
- 0
|
111
133
|
version: "0"
|
112
134
|
requirements: []
|
113
135
|
|
114
136
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
137
|
+
rubygems_version: 1.3.7
|
116
138
|
signing_key:
|
117
139
|
specification_version: 3
|
118
140
|
summary: Initialize terminal tabs with preset commands
|